From 84e0f04f9c3a156aa9292c6d6dedbbd94b13bd1a Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Wed, 11 Sep 2013 11:17:24 -0400 Subject: Use bash instead of sh --- corpus/tokenize-anything.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corpus/tokenize-anything.sh b/corpus/tokenize-anything.sh index a20a022f..fb038717 100755 --- a/corpus/tokenize-anything.sh +++ b/corpus/tokenize-anything.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash ROOTDIR=`dirname $0` SUPPORT=$ROOTDIR/support -- cgit v1.2.3 From 8b429e08566ffc640c2de0f0eca66c354c8377f9 Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Wed, 11 Sep 2013 16:20:36 -0400 Subject: Find pycdec --- realtime/rt/__init__.py | 15 +++++++++++++++ realtime/rt/aligner.py | 2 +- realtime/rt/decoder.py | 4 ++-- realtime/rt/rt.py | 8 +++----- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/realtime/rt/__init__.py b/realtime/rt/__init__.py index 738777f3..fbde8f4d 100644 --- a/realtime/rt/__init__.py +++ b/realtime/rt/__init__.py @@ -1,3 +1,18 @@ +# Add pycdec to the Python path if user hasn't +import os +import sys +try: + import cdec +except ImportError as ie: + try: + pycdec = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'python') + sys.path.append(pycdec) + import cdec + except: + sys.stderr.write('Error: cannot import pycdec. Please check the cdec/python is built.\n') + raise ie + +# Regular init imports from rt import * import aligner import decoder diff --git a/realtime/rt/aligner.py b/realtime/rt/aligner.py index 3c6ea144..80835412 100644 --- a/realtime/rt/aligner.py +++ b/realtime/rt/aligner.py @@ -9,7 +9,7 @@ class ForceAligner: def __init__(self, fwd_params, fwd_err, rev_params, rev_err): - cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) + cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) fast_align = os.path.join(cdec_root, 'word-aligner', 'fast_align') atools = os.path.join(cdec_root, 'utils', 'atools') diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py index 0a202fae..34b5d391 100644 --- a/realtime/rt/decoder.py +++ b/realtime/rt/decoder.py @@ -17,7 +17,7 @@ class Decoder: class CdecDecoder(Decoder): def __init__(self, config, weights): - cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) + cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) decoder = os.path.join(cdec_root, 'decoder', 'cdec') decoder_cmd = [decoder, '-c', config, '-w', weights] logging.info('Executing: {}'.format(' '.join(decoder_cmd))) @@ -26,7 +26,7 @@ class CdecDecoder(Decoder): class MIRADecoder(Decoder): def __init__(self, config, weights): - cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) + cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) mira = os.path.join(cdec_root, 'training', 'mira', 'kbest_cut_mira') # optimizer=2 step=0.001 best=500, k=500, uniq, stream mira_cmd = [mira, '-c', config, '-w', weights, '-o', '2', '-C', '0.001', '-b', '500', '-k', '500', '-u', '-t'] diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 892cc217..4dc2de09 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -10,9 +10,7 @@ import subprocess import tempfile import time -from cdec.configobj import ConfigObj -import cdec.sa - +import cdec import aligner import decoder import util @@ -21,7 +19,7 @@ class RealtimeDecoder: def __init__(self, configdir, tmpdir='/tmp', cache_size=5, norm=False): - cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) + cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # Temporary work dir self.tmp = tempfile.mkdtemp(dir=tmpdir, prefix='realtime.') @@ -41,7 +39,7 @@ class RealtimeDecoder: self.aligner = aligner.ForceAligner(fwd_params, fwd_err, rev_params, rev_err) # Grammar extractor - sa_config = ConfigObj(os.path.join(configdir, 'sa.ini'), unrepr=True) + sa_config = cdec.ConfigObj(os.path.join(configdir, 'sa.ini'), unrepr=True) sa_config.filename = os.path.join(self.tmp, 'sa.ini') util.sa_ini_for_realtime(sa_config, os.path.abspath(configdir)) sa_config.write() -- cgit v1.2.3 From e93efa83c2959c84b656a060f0cd07500effeee2 Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Wed, 11 Sep 2013 16:29:04 -0400 Subject: reorganization --- word-aligner/force_align.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/word-aligner/force_align.py b/word-aligner/force_align.py index 6721dacb..8b6ca224 100755 --- a/word-aligner/force_align.py +++ b/word-aligner/force_align.py @@ -16,7 +16,7 @@ def main(): # Hook into realtime sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'realtime')) - from rt import ForceAligner + from rt.aligner import ForceAligner aligner = ForceAligner(*sys.argv[1:]) -- cgit v1.2.3 From e9a72fc12b5c6cb7c02bfcf146f074ffd2f7a958 Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Wed, 11 Sep 2013 16:44:59 -0400 Subject: reorganization --- realtime/mkconfig.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/realtime/mkconfig.py b/realtime/mkconfig.py index 32388978..f193c57a 100755 --- a/realtime/mkconfig.py +++ b/realtime/mkconfig.py @@ -4,9 +4,11 @@ import os import shutil import sys +# Import first to make sure pycdec is on path +import rt + from cdec.configobj import ConfigObj -import rt def main(): -- cgit v1.2.3 From 2cfa58d956e6fa4b5e4c2ff0e283c50bd6bed799 Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Sat, 14 Sep 2013 13:42:17 -0400 Subject: Package name --- realtime/rt/rt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 4dc2de09..1b8ac58c 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -39,7 +39,7 @@ class RealtimeDecoder: self.aligner = aligner.ForceAligner(fwd_params, fwd_err, rev_params, rev_err) # Grammar extractor - sa_config = cdec.ConfigObj(os.path.join(configdir, 'sa.ini'), unrepr=True) + sa_config = cdec.configobj.ConfigObj(os.path.join(configdir, 'sa.ini'), unrepr=True) sa_config.filename = os.path.join(self.tmp, 'sa.ini') util.sa_ini_for_realtime(sa_config, os.path.abspath(configdir)) sa_config.write() -- cgit v1.2.3 From b67c9b33ca9e91fc0200a6687fc76f73c0a022f3 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Sun, 15 Sep 2013 12:01:44 -0700 Subject: Fixed pathes for mkconfig --- realtime/rt/util.py | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/realtime/rt/util.py b/realtime/rt/util.py index 10e94909..b823e12f 100644 --- a/realtime/rt/util.py +++ b/realtime/rt/util.py @@ -14,28 +14,31 @@ SA_INI_FILES = set(( )) def cdec_ini_for_config(config): - cdec_ini_handle(config, os.path.basename, hpyplm_rm_ref) + # This is a list of (k, v), not a ConfigObj or dict + for i in range(len(config)): + if config[i][0] == 'feature_function': + if config[i][1].startswith('KLanguageModel'): + f = config[i][1].split() + f[-1] = 'mono.klm' + config[i][1] = ' '.join(f) + elif config[i][1].startswith('External'): + config[i][1] = 'External libcdec_ff_hpyplm.so corpus.hpyplm' def cdec_ini_for_realtime(config, path, ref_fifo): - cdec_ini_handle(config, lambda x: os.path.join(path, x), lambda x: hpyplm_add_ref(x, ref_fifo)) - -def cdec_ini_handle(config, path_fn, hpyplm_fn): # This is a list of (k, v), not a ConfigObj or dict for i in range(len(config)): if config[i][0] == 'feature_function': if config[i][1].startswith('KLanguageModel'): f = config[i][1].split() - f[-1] = path_fn(f[-1]) + f[-1] = os.path.join(path, f[-1]) config[i][1] = ' '.join(f) elif config[i][1].startswith('External'): f = config[i][1].split() - if f[1].endswith('libcdec_ff_hpyplm.so'): - # Modify paths - for j in range(1, len(f)): - if not f[j].startswith('-'): - f[j] = path_fn(f[j]) - # Modify hpyplm args - hpyplm_fn(f) + f[1] = os.path.join(path, f[1]) + f[2] = os.path.join(path, f[2]) + f.append('-r') + f.append(ref) + f.append('-t') config[i][1] = ' '.join(f) def consume_stream(stream): @@ -44,18 +47,6 @@ def consume_stream(stream): pass threading.Thread(target=consume, args=(stream,)).start() -def hpyplm_add_ref(f, ref): - f.append('-r') - f.append(ref) - f.append('-t') - -def hpyplm_rm_ref(f): - for i in range(1, len(f)): - if f[i] == '-r': - f.pop(i) - f.pop(i) - return - def popen_io(cmd): p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) consume_stream(p.stderr) -- cgit v1.2.3 From 58763340c02ddafa056d0a00a061cecfb33c9c0c Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Sun, 15 Sep 2013 19:51:08 -0700 Subject: Typo fix --- realtime/rt/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/realtime/rt/util.py b/realtime/rt/util.py index b823e12f..6e07f116 100644 --- a/realtime/rt/util.py +++ b/realtime/rt/util.py @@ -37,7 +37,7 @@ def cdec_ini_for_realtime(config, path, ref_fifo): f[1] = os.path.join(path, f[1]) f[2] = os.path.join(path, f[2]) f.append('-r') - f.append(ref) + f.append(ref_fifo) f.append('-t') config[i][1] = ' '.join(f) -- cgit v1.2.3 From 895dfd64ea5599ab16981cbfb538ec5f4073c8c1 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Sun, 15 Sep 2013 20:32:59 -0700 Subject: Move to using named commands --- realtime/mkinput.py | 17 +++++++++++++++++ realtime/realtime.py | 4 ++-- realtime/rt/decoder.py | 2 +- realtime/rt/rt.py | 8 ++++++++ training/mira/kbest_cut_mira.cc | 15 ++++++++++++--- 5 files changed, 40 insertions(+), 6 deletions(-) create mode 100755 realtime/mkinput.py diff --git a/realtime/mkinput.py b/realtime/mkinput.py new file mode 100755 index 00000000..897b44fd --- /dev/null +++ b/realtime/mkinput.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +import itertools +import sys + +def main(): + + if len(sys.argv[1:]) != 2: + sys.stderr.write('usage: {} test.src test.ref >test.input\n'.format(sys.argv[0])) + sys.exit(2) + + for (src, ref) in itertools.izip(open(sys.argv[1]), open(sys.argv[2])): + sys.stdout.write('{}'.format(src)) + sys.stdout.write('LEARN ||| {} ||| {}'.format(src.strip(), ref)) + +if __name__ == '__main__': + main() diff --git a/realtime/realtime.py b/realtime/realtime.py index dff7e90c..554c52ca 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -38,8 +38,8 @@ def main(): hyp = rtd.decode(input[0]) sys.stdout.write('{}\n'.format(hyp)) sys.stdout.flush() - elif len(input) == 2: - rtd.learn(*input) + else: + rtd.command(input) # Clean exit on ctrl+c except KeyboardInterrupt: diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py index 34b5d391..57739d93 100644 --- a/realtime/rt/decoder.py +++ b/realtime/rt/decoder.py @@ -34,6 +34,6 @@ class MIRADecoder(Decoder): self.decoder = util.popen_io(mira_cmd) def update(self, sentence, grammar, reference): - input = '{s} ||| {r}\n'.format(s=sentence, g=grammar, r=reference) + input = 'LEARN ||| {s} ||| {r}\n'.format(s=sentence, g=grammar, r=reference) self.decoder.stdin.write(input) return self.decoder.stdout.readline().strip() diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 1b8ac58c..0ce05a56 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -19,6 +19,8 @@ class RealtimeDecoder: def __init__(self, configdir, tmpdir='/tmp', cache_size=5, norm=False): + self.commands = {'LEARN': self.learn} + cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # Temporary work dir @@ -126,6 +128,12 @@ class RealtimeDecoder: self.detokenizer.stdin.write('{}\n'.format(line)) return self.detokenizer.stdout.readline().strip() + def command(self, args): + try: + self.commands[args[0]](*args[1:]) + except: + logging.info('Command error: {}'.format(' ||| '.join(args))) + def learn(self, source, target): if '' in (source.strip(), target.strip()): logging.info('Error empty source or target: {} ||| {}'.format(source, target)) diff --git a/training/mira/kbest_cut_mira.cc b/training/mira/kbest_cut_mira.cc index e4435abb..a9a4aeb6 100644 --- a/training/mira/kbest_cut_mira.cc +++ b/training/mira/kbest_cut_mira.cc @@ -734,10 +734,19 @@ int main(int argc, char** argv) { ViterbiESentence(bobs.hypergraph[0], &trans); cout << TD::GetString(trans) << endl; continue; - // Translate and update (normal MIRA) + // Special command: + // CMD ||| arg1 ||| arg2 ... } else { - ds->update(buf.substr(delim + 5)); - buf = buf.substr(0, delim); + string cmd = buf.substr(0, delim); + buf = buf.substr(delim + 5); + // Translate and update (normal MIRA) + // LEARN ||| source ||| reference + if (cmd == "LEARN") { + delim = buf.find(" ||| "); + ds->update(buf.substr(delim + 5)); + buf = buf.substr(0, delim); + } + // TODO: additional commands } } //TODO: allow batch updating -- cgit v1.2.3 From 769dfa1e69c22d4aea37840a955db7fd2cf3a4d7 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Tue, 17 Sep 2013 12:46:02 -0700 Subject: Save/load weights in stream mira --- training/mira/kbest_cut_mira.cc | 15 ++++++++++++++- utils/weights.cc | 26 ++++++++++++++++++++++++++ utils/weights.h | 5 +++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/training/mira/kbest_cut_mira.cc b/training/mira/kbest_cut_mira.cc index a9a4aeb6..59fa860a 100644 --- a/training/mira/kbest_cut_mira.cc +++ b/training/mira/kbest_cut_mira.cc @@ -745,10 +745,23 @@ int main(int argc, char** argv) { delim = buf.find(" ||| "); ds->update(buf.substr(delim + 5)); buf = buf.substr(0, delim); + } else if (cmd == "WEIGHTS") { + // WEIGHTS ||| WRITE + if (buf == "WRITE") { + cout << Weights::GetString(dense_weights) << endl; + // WEIGHTS ||| f1=w1 f2=w2 ... + } else { + Weights::UpdateFromString(buf, dense_weights); + } + continue; + } else { + cerr << "Error: cannot parse command, skipping line:" << endl; + cerr << cmd << " ||| " << buf << endl; + continue; } - // TODO: additional commands } } + // Regular mode or LEARN line from stream mode //TODO: allow batch updating lambdas.init_vector(&dense_weights); dense_w_local = dense_weights; diff --git a/utils/weights.cc b/utils/weights.cc index 575877b6..1284f686 100644 --- a/utils/weights.cc +++ b/utils/weights.cc @@ -4,6 +4,7 @@ #include "fdict.h" #include "filelib.h" +#include "stringlib.h" #include "verbose.h" using namespace std; @@ -156,4 +157,29 @@ void Weights::ShowLargestFeatures(const vector& w) { cerr << endl; } +string Weights::GetString(const vector& w, + bool hide_zero_value_features) { + ostringstream os; + os.precision(17); + int nf = FD::NumFeats(); + for (unsigned i = 1; i < nf; i++) { + if (hide_zero_value_features && w[i] == 0.0) { + continue; + } + os << FD::Convert(i) << '=' << w[i]; + if (i < nf - 1) { + os << ' '; + } + } + return os.str(); +} +void Weights::UpdateFromString(string& w_string, + vector& w) { + vector tok = SplitOnWhitespace(w_string); + for (vector::iterator i = tok.begin(); i != tok.end(); i++) { + int delim = i->find('='); + int fid = FD::Convert(i->substr(0, delim)); + w[fid] = strtod(i->substr(delim + 1).c_str(), NULL); + } +} diff --git a/utils/weights.h b/utils/weights.h index 30f71db0..920fdd75 100644 --- a/utils/weights.h +++ b/utils/weights.h @@ -23,6 +23,11 @@ class Weights { static void SanityCheck(const std::vector& w); // write weights with largest magnitude to cerr static void ShowLargestFeatures(const std::vector& w); + static std::string GetString(const std::vector& w, + bool hide_zero_value_features = true); + // Assumes weights are already initialized for now + static void UpdateFromString(std::string& w_string, + std::vector& w); private: Weights(); }; -- cgit v1.2.3 From f96397d3a34fd5279c92a21f66cfa7538f60cb52 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Tue, 17 Sep 2013 22:05:32 -0700 Subject: Save/load state in realtime --- realtime/realtime.py | 48 +++++++++++++++++----------------- realtime/rt/__init__.py | 2 +- realtime/rt/decoder.py | 11 ++++++-- realtime/rt/rt.py | 68 ++++++++++++++++++++++++++++++++++++++++++++----- utils/weights.cc | 10 +++----- 5 files changed, 101 insertions(+), 38 deletions(-) diff --git a/realtime/realtime.py b/realtime/realtime.py index 554c52ca..a6ed1511 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -15,8 +15,9 @@ class Parser(argparse.ArgumentParser): def main(): - parser = Parser(description='Real-time adaptive translation with cdec.') - parser.add_argument('-c', '--config', required=True, help='Config directory (see README.md)') + parser = Parser(description='Real-time adaptive translation with cdec. (See README.md)') + parser.add_argument('-c', '--config', required=True, help='Config directory') + parser.add_argument('-s', '--state', help='Load state file (saved incremental data)') parser.add_argument('-n', '--normalize', help='Normalize text (tokenize, translate, detokenize)', action='store_true') parser.add_argument('-T', '--temp', help='Temp directory (default /tmp)', default='/tmp') parser.add_argument('-a', '--cache', help='Grammar cache size (default 5)', default='5') @@ -26,27 +27,28 @@ def main(): if args.verbose: logging.basicConfig(level=logging.INFO) - rtd = rt.RealtimeDecoder(args.config, tmpdir=args.temp, cache_size=int(args.cache), norm=args.normalize) - - try: - while True: - line = sys.stdin.readline() - if not line: - break - input = [f.strip() for f in line.split('|||')] - if len(input) == 1: - hyp = rtd.decode(input[0]) - sys.stdout.write('{}\n'.format(hyp)) - sys.stdout.flush() - else: - rtd.command(input) - - # Clean exit on ctrl+c - except KeyboardInterrupt: - logging.info('Caught KeyboardInterrupt, exiting') - - # Cleanup - rtd.close() + with rt.RealtimeDecoder(args.config, tmpdir=args.temp, cache_size=int(args.cache), norm=args.normalize) as rtd: + + try: + # Load state if given + if args.state: + rtd.load_state(args.state) + # Read lines and commands + while True: + line = sys.stdin.readline() + if not line: + break + line = line.strip() + if '|||' in line: + rtd.command_line(line) + else: + hyp = rtd.decode(line) + sys.stdout.write('{}\n'.format(hyp)) + sys.stdout.flush() + + # Clean exit on ctrl+c + except KeyboardInterrupt: + logging.info('Caught KeyboardInterrupt, exiting') if __name__ == '__main__': main() diff --git a/realtime/rt/__init__.py b/realtime/rt/__init__.py index fbde8f4d..c76acc4d 100644 --- a/realtime/rt/__init__.py +++ b/realtime/rt/__init__.py @@ -9,7 +9,7 @@ except ImportError as ie: sys.path.append(pycdec) import cdec except: - sys.stderr.write('Error: cannot import pycdec. Please check the cdec/python is built.\n') + sys.stderr.write('Error: cannot import pycdec. Please check that cdec/python is built.\n') raise ie # Regular init imports diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py index 57739d93..aa6db64d 100644 --- a/realtime/rt/decoder.py +++ b/realtime/rt/decoder.py @@ -9,8 +9,8 @@ class Decoder: def close(self): self.decoder.stdin.close() - def decode(self, sentence, grammar): - input = '{s}\n'.format(s=sentence, g=grammar) + def decode(self, sentence, grammar=None): + input = '{s}\n'.format(s=sentence, g=grammar) if grammar else '{}\n'.format(sentence) self.decoder.stdin.write(input) return self.decoder.stdout.readline().strip() @@ -33,6 +33,13 @@ class MIRADecoder(Decoder): logging.info('Executing: {}'.format(' '.join(mira_cmd))) self.decoder = util.popen_io(mira_cmd) + def get_weights(self): + self.decoder.stdin.write('WEIGHTS ||| WRITE\n') + return self.decoder.stdout.readline().strip() + + def set_weights(self, w_line): + self.decoder.stdin.write('WEIGHTS ||| {}\n'.format(w_line)) + def update(self, sentence, grammar, reference): input = 'LEARN ||| {s} ||| {r}\n'.format(s=sentence, g=grammar, r=reference) self.decoder.stdin.write(input) diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 0ce05a56..fedc1fcf 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -15,14 +15,18 @@ import aligner import decoder import util +LIKELY_OOV = '("OOV")' + class RealtimeDecoder: - def __init__(self, configdir, tmpdir='/tmp', cache_size=5, norm=False): + def __init__(self, configdir, tmpdir='/tmp', cache_size=5, norm=False, state=None): - self.commands = {'LEARN': self.learn} + self.commands = {'LEARN': self.learn, 'SAVE': self.save_state, 'LOAD': self.load_state} cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + self.inc_data = [] # instances of (source, target) + # Temporary work dir self.tmp = tempfile.mkdtemp(dir=tmpdir, prefix='realtime.') logging.info('Using temp dir {}'.format(self.tmp)) @@ -68,6 +72,17 @@ class RealtimeDecoder: decoder_weights = os.path.join(configdir, 'weights.final') self.decoder = decoder.MIRADecoder(decoder_config_file, decoder_weights) + # Load state if given + if state: + with open(state) as input: + self.load_state(input) + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + self.close() + def close(self): logging.info('Closing processes') self.aligner.close() @@ -128,9 +143,13 @@ class RealtimeDecoder: self.detokenizer.stdin.write('{}\n'.format(line)) return self.detokenizer.stdout.readline().strip() - def command(self, args): + def command_line(self, line): + args = [f.strip() for f in line.split('|||')] try: - self.commands[args[0]](*args[1:]) + if len(args) == 2 and not args[1]: + self.commands[args[0]]() + else: + self.commands[args[0]](*args[1:]) except: logging.info('Command error: {}'.format(' ||| '.join(args))) @@ -145,9 +164,12 @@ class RealtimeDecoder: grammar_file = self.grammar(source) mira_log = self.decoder.update(source, grammar_file, target) logging.info('MIRA: {}'.format(mira_log)) - # Add aligned sentence pair to grammar extractor + # Align instance alignment = self.aligner.align(source, target) - logging.info('Adding instance: {} ||| {} ||| {}'.format(source, target, alignment)) + # Store incremental data for save/load + self.inc_data.append((source, target, alignment)) + # Add aligned sentence pair to grammar extractor + logging.info('Adding to bitext: {} ||| {} ||| {}'.format(source, target, alignment)) self.extractor.add_instance(source, target, alignment) # Clear (old) cached grammar rm_grammar = self.grammar_dict.pop(source) @@ -156,3 +178,37 @@ class RealtimeDecoder: logging.info('Adding to HPYPLM: {}'.format(target)) self.ref_fifo.write('{}\n'.format(target)) self.ref_fifo.flush() + + def save_state(self): + logging.info('Saving state with {} sentences'.format(len(self.inc_data))) + sys.stdout.write('{}\n'.format(self.decoder.get_weights())) + for (source, target, alignment) in self.inc_data: + sys.stdout.write('{} ||| {} ||| {}\n'.format(source, target, alignment)) + sys.stdout.write('EOF\n') + + def load_state(self, input=sys.stdin): + # Non-initial load error + if self.inc_data: + logging.info('Error: Incremental data has already been added to decoder.') + logging.info(' State can only be loaded by a freshly started decoder.') + return + # MIRA weights + line = input.readline().strip() + self.decoder.set_weights(line) + logging.info('Loading state...') + start_time = time.time() + # Lines source ||| target ||| alignment + while True: + line = input.readline().strip() + if line == 'EOF': + break + (source, target, alignment) = line.split(' ||| ') + self.inc_data.append((source, target, alignment)) + # Extractor + self.extractor.add_instance(source, target, alignment) + # HPYPLM + hyp = self.decoder.decode(LIKELY_OOV) + self.ref_fifo.write('{}\n'.format(target)) + self.ref_fifo.flush() + stop_time = time.time() + logging.info('Loaded state with {} sentences in {} seconds'.format(len(self.inc_data), stop_time - start_time)) diff --git a/utils/weights.cc b/utils/weights.cc index 1284f686..effdfc5e 100644 --- a/utils/weights.cc +++ b/utils/weights.cc @@ -163,15 +163,13 @@ string Weights::GetString(const vector& w, os.precision(17); int nf = FD::NumFeats(); for (unsigned i = 1; i < nf; i++) { - if (hide_zero_value_features && w[i] == 0.0) { + weight_t val = (i < w.size() ? w[i] : 0.0); + if (hide_zero_value_features && val == 0.0) { continue; } - os << FD::Convert(i) << '=' << w[i]; - if (i < nf - 1) { - os << ' '; - } + os << ' ' << FD::Convert(i) << '=' << val; } - return os.str(); + return os.str().substr(1); } void Weights::UpdateFromString(string& w_string, -- cgit v1.2.3 From afdd521ba4cbcec44b548288918d1517f30260f1 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Tue, 17 Sep 2013 22:23:39 -0700 Subject: Open stream to state file --- realtime/realtime.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/realtime/realtime.py b/realtime/realtime.py index a6ed1511..3c384fa2 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -32,7 +32,8 @@ def main(): try: # Load state if given if args.state: - rtd.load_state(args.state) + with open(args.state) as input: + rtd.load_state(input) # Read lines and commands while True: line = sys.stdin.readline() -- cgit v1.2.3 From f650759280f7ceb71e36be3ac834f3046112d037 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Wed, 18 Sep 2013 11:01:41 -0700 Subject: Support writing state to file --- realtime/rt/rt.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index fedc1fcf..b1cf19ef 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -179,12 +179,15 @@ class RealtimeDecoder: self.ref_fifo.write('{}\n'.format(target)) self.ref_fifo.flush() - def save_state(self): + def save_state(self, filename=None): + out = open(filename, 'w') if filename else sys.stdout logging.info('Saving state with {} sentences'.format(len(self.inc_data))) - sys.stdout.write('{}\n'.format(self.decoder.get_weights())) + out.write('{}\n'.format(self.decoder.get_weights())) for (source, target, alignment) in self.inc_data: - sys.stdout.write('{} ||| {} ||| {}\n'.format(source, target, alignment)) - sys.stdout.write('EOF\n') + out.write('{} ||| {} ||| {}\n'.format(source, target, alignment)) + out.write('EOF\n') + if filename: + out.close() def load_state(self, input=sys.stdin): # Non-initial load error -- cgit v1.2.3 From 60013ff62cee092db5f85eb5ecb2ea6119f2da6d Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Wed, 18 Sep 2013 12:16:27 -0700 Subject: README --- realtime/README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/realtime/README.md b/realtime/README.md index b37dddc8..584ee516 100644 --- a/realtime/README.md +++ b/realtime/README.md @@ -1 +1,17 @@ -More to come. +cdec-realtime +------------- + +Code by Michael Denkowski (http://www.cs.cmu.edu/~mdenkows/, mdenkows@cs.cmu.edu) + +``` +@misc{denkowski-proposal2013, + author = {Michael Denkowski}, + title = {Machine Translation for Human Translators}, + year = {2013}, + month = {May}, + day = {30}, + howpublished = {{Ph.D.} Thesis Proposal, Carnegie Mellon University} +} +``` + +For a full tutorial, see http://www.cs.cmu.edu/~mdenkows/cdec-realtime.html -- cgit v1.2.3 From 903339fdd7c294a72a8b2066550dbb5dd78f5384 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Sun, 22 Sep 2013 22:49:46 -0400 Subject: Don't leak open files. --- realtime/rt/rt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index b1cf19ef..033ed790 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -101,7 +101,8 @@ class RealtimeDecoder: logging.info('Grammar cache hit') return grammar_file # Extract and cache - grammar_file = tempfile.mkstemp(dir=self.tmp, prefix='grammar.')[1] + (fid, grammar_file) = tempfile.mkstemp(dir=self.tmp, prefix='grammar.') + os.close(fid) with open(grammar_file, 'w') as output: for rule in self.extractor.grammar(sentence): output.write('{}\n'.format(str(rule))) -- cgit v1.2.3 From ae3cfd5700d20d30a06f5c27ea1c5e39a458c783 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Mon, 23 Sep 2013 08:21:58 -0700 Subject: One extractor, multiple online contexts. --- python/cdec/_cdec.cpp | 10498 ++++++------ python/cdec/sa/_sa.c | 33689 ++++++++++++++++++++------------------- python/cdec/sa/extractor.py | 14 +- python/cdec/sa/rulefactory.pxi | 122 +- 4 files changed, 22162 insertions(+), 22161 deletions(-) diff --git a/python/cdec/_cdec.cpp b/python/cdec/_cdec.cpp index ae36b773..ca693bcd 100644 --- a/python/cdec/_cdec.cpp +++ b/python/cdec/_cdec.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sun Jun 2 14:47:49 2013 */ +/* Generated by Cython 0.19.1 on Mon Sep 23 08:04:01 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -306,8 +306,8 @@ static CYTHON_INLINE float __PYX_NAN() { #define _USE_MATH_DEFINES #endif #include -#define __PYX_HAVE___cdec -#define __PYX_HAVE_API___cdec +#define __PYX_HAVE__cdec___cdec +#define __PYX_HAVE_API__cdec___cdec #include "string.h" #include #include "ios" @@ -525,75 +525,75 @@ static const char *__pyx_f[] = { "hypergraph.pxi", "lattice.pxi", "mteval.pxi", - "cdec.sa._sa.pxd", + "_sa.pxd", }; /*--- Type declarations ---*/ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector; -struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__; -struct __pyx_obj_5_cdec_NTRef; -struct __pyx_obj_5_cdec_Scorer; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__; +struct __pyx_obj_4cdec_5_cdec_DenseVector; +struct __pyx_obj_4cdec_5_cdec_SufficientStats; +struct __pyx_obj_4cdec_5_cdec_TRule; +struct __pyx_obj_4cdec_5_cdec_MRule; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__; +struct __pyx_obj_4cdec_5_cdec_Metric; struct __pyx_obj_4cdec_2sa_3_sa_IntList; -struct __pyx_obj_4cdec_2sa_3_sa_Phrase; -struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__; -struct __pyx_obj_5_cdec_Grammar; -struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines; -struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees; -struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__; -struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase; -struct __pyx_obj_5_cdec_CandidateSet; -struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__; -struct __pyx_obj_5_cdec_TRule; +struct __pyx_obj_4cdec_5_cdec_SparseVector; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__; +struct __pyx_obj_4cdec_5_cdec_NT; +struct __pyx_obj_4cdec_5_cdec_Lattice; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config; +struct __pyx_obj_4cdec_5_cdec_HypergraphEdge; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__; struct __pyx_obj_4cdec_2sa_3_sa_Rule; -struct __pyx_obj_5_cdec_MRule; -struct __pyx_obj_5_cdec_SegmentEvaluator; -struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr; -struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot; -struct __pyx_obj_5_cdec_Candidate; -struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr; -struct __pyx_obj_5_cdec_NT; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines; +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_Grammar; +struct __pyx_obj_4cdec_5_cdec_Hypergraph; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__; +struct __pyx_obj_4cdec_5_cdec_CandidateSet; struct __pyx_obj_4cdec_2sa_3_sa_FloatList; -struct __pyx_obj_5_cdec_HypergraphEdge; -struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__; -struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__; -struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__; -struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__; -struct __pyx_obj_5_cdec_Decoder; -struct __pyx_obj_5_cdec_HypergraphNode; -struct __pyx_obj_5_cdec_SparseVector; -struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__; -struct __pyx_obj_5_cdec___pyx_scope_struct____iter__; -struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__; -struct __pyx_obj_5_cdec_DenseVector; -struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__; -struct __pyx_obj_5_cdec_Metric; -struct __pyx_obj_5_cdec_SufficientStats; -struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest; -struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features; -struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__; -struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__; -struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr; -struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees; -struct __pyx_obj_5_cdec_Hypergraph; -struct __pyx_obj_5_cdec_Lattice; -struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample; -struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config; -struct __pyx_obj_5_cdec_TextGrammar; -struct __pyx_opt_args_5_cdec_as_str; - -/* "_cdec.pyx":6 +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot; +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_25_genexpr; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__; +struct __pyx_obj_4cdec_2sa_3_sa_Phrase; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__; +struct __pyx_obj_4cdec_5_cdec_TextGrammar; +struct __pyx_obj_4cdec_5_cdec_Decoder; +struct __pyx_obj_4cdec_5_cdec_Candidate; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__; +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_sample_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_opt_args_4cdec_5_cdec_as_str; + +/* "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): */ -struct __pyx_opt_args_5_cdec_as_str { +struct __pyx_opt_args_4cdec_5_cdec_as_str { int __pyx_n; char *error_msg; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":25 +/* "cdec/sa/_sa.pxd":25 * cdef void read_handle(self, FILE* f) * * cdef class FeatureVector: # <<<<<<<<<<<<<< @@ -607,47 +607,106 @@ struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector { }; -/* "_cdec.pyx":47 - * cdef DenseVector weights +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":90 + * return candidate * - * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<< - * """Decoder('formalism = scfg') -> initialize from configuration string - * Decoder(formalism='scfg') -> initialize from named parameters + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * for i in range(len(self)): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ { PyObject_HEAD - PyObject *__pyx_v_config; + 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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":21 - * return '[%s]' % self.cat +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":3 + * from cython.operator cimport preincrement as pinc * - * cdef class NTRef: # <<<<<<<<<<<<<< - * cdef public unsigned ref - * def __init__(self, unsigned ref): + * cdef class DenseVector: # <<<<<<<<<<<<<< + * cdef vector[weight_t]* vector + * cdef bint owned # if True, do not manage memory */ -struct __pyx_obj_5_cdec_NTRef { +struct __pyx_obj_4cdec_5_cdec_DenseVector { PyObject_HEAD - unsigned int ref; + std::vector *vector; + int owned; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":121 - * return CandidateSet(self) +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":26 + * return fmap * - * cdef class Scorer: # <<<<<<<<<<<<<< - * cdef string* name + * cdef class SufficientStats: # <<<<<<<<<<<<<< + * cdef mteval.SufficientStats* stats * cdef mteval.EvaluationMetric* metric */ -struct __pyx_obj_5_cdec_Scorer { +struct __pyx_obj_4cdec_5_cdec_SufficientStats { PyObject_HEAD - std::string *name; + SufficientStats *stats; EvaluationMetric *metric; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":12 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":49 + * return TRule(lhs, f, e, scores, a) + * + * cdef class TRule: # <<<<<<<<<<<<<< + * cdef shared_ptr[grammar.TRule]* rule + * + */ +struct __pyx_obj_4cdec_5_cdec_TRule { + PyObject_HEAD + boost::shared_ptr *rule; +}; + + +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":177 + * _phrase(self.f), _phrase(self.e), scores) + * + * cdef class MRule(TRule): # <<<<<<<<<<<<<< + * def __init__(self, lhs, rhs, scores): + * """MRule(lhs, rhs, scores, a=None) -> Monolingual rule. + */ +struct __pyx_obj_4cdec_5_cdec_MRule { + struct __pyx_obj_4cdec_5_cdec_TRule __pyx_base; +}; + + +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":44 + * return self.stats.size() + * + * def __iter__(self): # <<<<<<<<<<<<<< + * for i in range(len(self)): + * yield self[i] + */ +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ { + 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 *); +}; + + +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":176 + * out.fields[i] = ss[i] + * + * cdef class Metric: # <<<<<<<<<<<<<< + * cdef Scorer scorer + * def __cinit__(self): + */ +struct __pyx_obj_4cdec_5_cdec_Metric { + PyObject_HEAD + struct __pyx_obj_4cdec_5_cdec_Scorer *scorer; +}; + + +/* "cdec/sa/_sa.pxd":12 * cdef void read_handle(self, FILE* f) * * cdef class IntList: # <<<<<<<<<<<<<< @@ -664,167 +723,131 @@ struct __pyx_obj_4cdec_2sa_3_sa_IntList { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":29 - * cdef FloatList values +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":48 + * return sparse + * + * cdef class SparseVector: # <<<<<<<<<<<<<< + * cdef FastSparseVector[weight_t]* vector * - * cdef class Phrase: # <<<<<<<<<<<<<< - * cdef int *syms - * cdef int n, *varpos, n_vars */ -struct __pyx_obj_4cdec_2sa_3_sa_Phrase { +struct __pyx_obj_4cdec_5_cdec_SparseVector { PyObject_HEAD - struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtab; - int *syms; - int n; - int *varpos; - int n_vars; + FastSparseVector *vector; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":90 - * return candidate +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":216 * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * for i in range(len(self)): + * property tail_nodes: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * for i in range(self.edge.tail_nodes_.size()): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ { PyObject_HEAD unsigned int __pyx_v_i; - struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self; - Py_ssize_t __pyx_t_0; + struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self; + unsigned int __pyx_t_0; unsigned int __pyx_t_1; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":193 - * super(MRule, self).__init__(lhs, rhs, e, scores, None) - * - * cdef class Grammar: # <<<<<<<<<<<<<< - * cdef shared_ptr[grammar.Grammar]* grammar +/* "/home/mdenkows/cdec/python/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_5_cdec_Grammar { +struct __pyx_obj_4cdec_5_cdec_NT { PyObject_HEAD - boost::shared_ptr *grammar; + PyObject *cat; + unsigned int ref; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63 - * def todot(self): - * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" - * def lines(): # <<<<<<<<<<<<<< - * yield 'digraph lattice {' - * yield 'rankdir = LR;' +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":3 + * cimport lattice + * + * cdef class Lattice: # <<<<<<<<<<<<<< + * cdef lattice.Lattice* lattice + * */ -struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines { +struct __pyx_obj_4cdec_5_cdec_Lattice { PyObject_HEAD - struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *__pyx_outer_scope; - PyObject *__pyx_v_delta; - PyObject *__pyx_v_i; - PyObject *__pyx_v_label; - PyObject *__pyx_v_weight; - Py_ssize_t __pyx_t_0; - PyObject *__pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); - PyObject *__pyx_t_3; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); + Lattice *lattice; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":108 - * del hypos +/* "cdec/_cdec.pyx":32 + * SetSilent(yn) * - * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<< - * """hg.sample_trees(n) -> Sample of n trees from the hypergraph.""" - * cdef vector[string]* trees = new vector[string]() + * def _make_config(config): # <<<<<<<<<<<<<< + * for key, value in config.items(): + * if isinstance(value, dict): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config { PyObject_HEAD - unsigned int __pyx_v_k; - unsigned int __pyx_v_n; - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self; - std::vector *__pyx_v_trees; - size_t __pyx_t_0; - unsigned int __pyx_t_1; + 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 *); }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":161 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":196 + * return vector * - * property edges: - * def __get__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * for i in range(self.hg.edges_.size()): + * cdef class HypergraphEdge: # <<<<<<<<<<<<<< + * cdef hypergraph.Hypergraph* hg + * cdef hypergraph.HypergraphEdge* edge */ -struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ { +struct __pyx_obj_4cdec_5_cdec_HypergraphEdge { PyObject_HEAD - unsigned int __pyx_v_i; - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self; - size_t __pyx_t_0; - unsigned int __pyx_t_1; + struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *__pyx_vtab; + Hypergraph *hg; + Hypergraph::Edge *edge; + struct __pyx_obj_4cdec_5_cdec_TRule *trule; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5 +/* "/home/mdenkows/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) * */ -struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase { PyObject_HEAD PyObject *__pyx_v_phrase; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":65 - * return result +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":161 * - * cdef class CandidateSet: # <<<<<<<<<<<<<< - * cdef shared_ptr[mteval.SegmentEvaluator]* scorer - * cdef mteval.EvaluationMetric* metric - */ -struct __pyx_obj_5_cdec_CandidateSet { - PyObject_HEAD - boost::shared_ptr *scorer; - EvaluationMetric *metric; - training::CandidateSet *cs; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":167 - * - * property nodes: + * property edges: * def __get__(self): # <<<<<<<<<<<<<< * cdef unsigned i - * for i in range(self.hg.nodes_.size()): + * for i in range(self.hg.edges_.size()): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ { PyObject_HEAD unsigned int __pyx_v_i; - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self; + struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self; size_t __pyx_t_0; unsigned int __pyx_t_1; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":49 - * return TRule(lhs, f, e, scores, a) - * - * cdef class TRule: # <<<<<<<<<<<<<< - * cdef shared_ptr[grammar.TRule]* rule - * - */ -struct __pyx_obj_5_cdec_TRule { - PyObject_HEAD - boost::shared_ptr *rule; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":35 +/* "cdec/sa/_sa.pxd":35 * cdef public int chunklen(self, int k) * * cdef class Rule: # <<<<<<<<<<<<<< @@ -842,108 +865,148 @@ struct __pyx_obj_4cdec_2sa_3_sa_Rule { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":177 - * _phrase(self.f), _phrase(self.e), scores) - * - * cdef class MRule(TRule): # <<<<<<<<<<<<<< - * def __init__(self, lhs, rhs, scores): - * """MRule(lhs, rhs, scores, a=None) -> Monolingual rule. +/* "/home/mdenkows/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;' */ -struct __pyx_obj_5_cdec_MRule { - struct __pyx_obj_5_cdec_TRule __pyx_base; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines { + PyObject_HEAD + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *__pyx_outer_scope; + PyObject *__pyx_v_delta; + PyObject *__pyx_v_i; + PyObject *__pyx_v_label; + PyObject *__pyx_v_weight; + Py_ssize_t __pyx_t_0; + PyObject *__pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); + PyObject *__pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); }; -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":100 - * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get()) +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":121 + * return CandidateSet(self) * - * cdef class SegmentEvaluator: # <<<<<<<<<<<<<< - * cdef shared_ptr[mteval.SegmentEvaluator]* scorer + * cdef class Scorer: # <<<<<<<<<<<<<< + * cdef string* name * cdef mteval.EvaluationMetric* metric */ -struct __pyx_obj_5_cdec_SegmentEvaluator { +struct __pyx_obj_4cdec_5_cdec_Scorer { PyObject_HEAD - boost::shared_ptr *scorer; + std::string *name; EvaluationMetric *metric; }; -/* "_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) +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":246 + * raise NotImplemented('comparison not implemented for HypergraphEdge') + * + * cdef class HypergraphNode: # <<<<<<<<<<<<<< + * cdef hypergraph.Hypergraph* hg + * cdef hypergraph.HypergraphNode* node */ -struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr { +struct __pyx_obj_4cdec_5_cdec_HypergraphNode { PyObject_HEAD - struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *__pyx_outer_scope; - PyObject *__pyx_v_kv; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); + struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtab; + Hypergraph *hg; + Hypergraph::Node *node; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":61 - * yield self[i] +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":81 + * del e_derivations * - * def todot(self): # <<<<<<<<<<<<<< - * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" - * def lines(): + * def kbest_features(self, size): # <<<<<<<<<<<<<< + * """hg.kbest_trees(size) -> List of k-best feature vectors in the hypergraph.""" + * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal](self.hg[0], size) */ -struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features { PyObject_HEAD - struct __pyx_obj_5_cdec_Lattice *__pyx_v_self; + KBest::KBestDerivations,FeatureVectorTraversal>::Derivation *__pyx_v_derivation; + KBest::KBestDerivations,FeatureVectorTraversal> *__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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":12 - * return stats +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":21 + * return '[%s]' % self.cat * - * cdef class Candidate: # <<<<<<<<<<<<<< - * cdef mteval.const_Candidate* candidate - * cdef public float score + * cdef class NTRef: # <<<<<<<<<<<<<< + * cdef public unsigned ref + * def __init__(self, unsigned ref): */ -struct __pyx_obj_5_cdec_Candidate { +struct __pyx_obj_4cdec_5_cdec_NTRef { PyObject_HEAD - const training::Candidate *candidate; - float score; + unsigned int ref; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":193 + * super(MRule, self).__init__(lhs, rhs, e, scores, None) + * + * cdef class Grammar: # <<<<<<<<<<<<<< + * cdef shared_ptr[grammar.Grammar]* grammar * - * def __str__(self): - * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< - * return '%s ||| %s ||| %s ||| %s' % (self.lhs, - * _phrase(self.f), _phrase(self.e), scores) */ -struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr { +struct __pyx_obj_4cdec_5_cdec_Grammar { PyObject_HEAD - struct __pyx_obj_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 *); + boost::shared_ptr *grammar; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":8 - * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":4 + * cimport kbest * - * cdef class NT: # <<<<<<<<<<<<<< - * cdef public bytes cat - * cdef public unsigned ref + * cdef class Hypergraph: # <<<<<<<<<<<<<< + * cdef hypergraph.Hypergraph* hg + * cdef MT19937* rng */ -struct __pyx_obj_5_cdec_NT { +struct __pyx_obj_4cdec_5_cdec_Hypergraph { PyObject_HEAD - PyObject *cat; - unsigned int ref; + struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtab; + Hypergraph *hg; + MT19937 *rng; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":3 +/* "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 + */ +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ { + PyObject_HEAD + PyObject *__pyx_v_config; +}; + + +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":65 + * return result + * + * cdef class CandidateSet: # <<<<<<<<<<<<<< + * cdef shared_ptr[mteval.SegmentEvaluator]* scorer + * cdef mteval.EvaluationMetric* metric + */ +struct __pyx_obj_4cdec_5_cdec_CandidateSet { + PyObject_HEAD + boost::shared_ptr *scorer; + EvaluationMetric *metric; + training::CandidateSet *cs; +}; + + +/* "cdec/sa/_sa.pxd":3 * from libc.stdio cimport FILE * * cdef class FloatList: # <<<<<<<<<<<<<< @@ -960,444 +1023,381 @@ struct __pyx_obj_4cdec_2sa_3_sa_FloatList { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":196 - * return vector +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":62 + * del derivations * - * cdef class HypergraphEdge: # <<<<<<<<<<<<<< - * cdef hypergraph.Hypergraph* hg - * cdef hypergraph.HypergraphEdge* edge + * def kbest_trees(self, size): # <<<<<<<<<<<<<< + * """hg.kbest_trees(size) -> List of k-best trees in the hypergraph.""" + * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size) */ -struct __pyx_obj_5_cdec_HypergraphEdge { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees { PyObject_HEAD - struct __pyx_vtabstruct_5_cdec_HypergraphEdge *__pyx_vtab; - Hypergraph *hg; - Hypergraph::Edge *edge; - struct __pyx_obj_5_cdec_TRule *trule; + KBest::KBestDerivations,ETreeTraversal>::Derivation *__pyx_v_e_derivation; + KBest::KBestDerivations,ETreeTraversal> *__pyx_v_e_derivations; + PyObject *__pyx_v_e_tree; + KBest::KBestDerivations,FTreeTraversal>::Derivation *__pyx_v_f_derivation; + KBest::KBestDerivations,FTreeTraversal> *__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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":72 - * self.vector.set_value(fid, value) +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":61 + * yield self[i] * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) - * cdef unsigned i + * def todot(self): # <<<<<<<<<<<<<< + * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" + * def lines(): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot { PyObject_HEAD - unsigned int __pyx_v_i; - FastSparseVector::const_iterator *__pyx_v_it; - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self; - size_t __pyx_t_0; - unsigned int __pyx_t_1; + struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":256 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":172 + * self.rule.get().lhs_ = -TDConvert(( lhs).cat) * - * property in_edges: - * def __get__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * for i in range(self.node.in_edges_.size()): + * def __str__(self): # <<<<<<<<<<<<<< + * scores = ' '.join('%s=%s' % feat for feat in self.scores) + * return '%s ||| %s ||| %s ||| %s' % (self.lhs, */ -struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ { PyObject_HEAD - unsigned int __pyx_v_i; - struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self; - size_t __pyx_t_0; - unsigned int __pyx_t_1; + struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":131 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":100 + * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get()) * - * property a: - * def __get__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ + * cdef class SegmentEvaluator: # <<<<<<<<<<<<<< + * cdef shared_ptr[mteval.SegmentEvaluator]* scorer + * cdef mteval.EvaluationMetric* metric */ -struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ { +struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator { PyObject_HEAD - std::vector *__pyx_v_a; - unsigned int __pyx_v_i; - struct __pyx_obj_5_cdec_TRule *__pyx_v_self; - size_t __pyx_t_0; - unsigned int __pyx_t_1; + boost::shared_ptr *scorer; + EvaluationMetric *metric; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":56 - * return unicode(str(self), 'utf8') +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":256 * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * for i in range(len(self)): + * property in_edges: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * for i in range(self.node.in_edges_.size()): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_16___get__ { PyObject_HEAD unsigned int __pyx_v_i; - struct __pyx_obj_5_cdec_Lattice *__pyx_v_self; - Py_ssize_t __pyx_t_0; + struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self; + size_t __pyx_t_0; unsigned int __pyx_t_1; }; -/* "_cdec.pyx":43 - * yield key, str(value) - * - * cdef class Decoder: # <<<<<<<<<<<<<< - * cdef decoder.Decoder* dec - * cdef DenseVector weights - */ -struct __pyx_obj_5_cdec_Decoder { - PyObject_HEAD - Decoder *dec; - struct __pyx_obj_5_cdec_DenseVector *weights; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":246 - * raise NotImplemented('comparison not implemented for HypergraphEdge') - * - * cdef class HypergraphNode: # <<<<<<<<<<<<<< - * cdef hypergraph.Hypergraph* hg - * cdef hypergraph.HypergraphNode* node +/* "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) */ -struct __pyx_obj_5_cdec_HypergraphNode { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr { PyObject_HEAD - struct __pyx_vtabstruct_5_cdec_HypergraphNode *__pyx_vtab; - Hypergraph *hg; - Hypergraph::Node *node; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *__pyx_outer_scope; + PyObject *__pyx_v_kv; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); }; -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":48 - * return sparse +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":6 * - * cdef class SparseVector: # <<<<<<<<<<<<<< - * cdef FastSparseVector[weight_t]* vector + * 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_5_cdec_SparseVector { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr { PyObject_HEAD - FastSparseVector *vector; + 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 *); }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":262 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":97 + * del derivations * - * property out_edges: - * def __get__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * for i in range(self.node.out_edges_.size()): + * 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_5_cdec___pyx_scope_struct_17___get__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample { PyObject_HEAD - unsigned int __pyx_v_i; - struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self; + std::vector *__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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":32 - * self.vector[0][fid] = value +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":49 + * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef unsigned fid - * for fid in range(1, self.vector.size()): + * def kbest(self, size): # <<<<<<<<<<<<<< + * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph.""" + * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal](self.hg[0], size) */ -struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest { PyObject_HEAD - unsigned int __pyx_v_fid; - struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self; - size_t __pyx_t_0; - unsigned int __pyx_t_1; + KBest::KBestDerivations,ESentenceTraversal>::Derivation *__pyx_v_derivation; + KBest::KBestDerivations,ESentenceTraversal> *__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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44 - * return self.stats.size() +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":167 * - * def __iter__(self): # <<<<<<<<<<<<<< - * for i in range(len(self)): - * yield self[i] + * property nodes: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * for i in range(self.hg.nodes_.size()): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ { PyObject_HEAD - PyObject *__pyx_v_i; - struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self; - Py_ssize_t __pyx_t_0; - PyObject *__pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); + 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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":3 - * from cython.operator cimport preincrement as pinc +/* "cdec/sa/_sa.pxd":29 + * cdef FloatList values * - * cdef class DenseVector: # <<<<<<<<<<<<<< - * cdef vector[weight_t]* vector - * cdef bint owned # if True, do not manage memory + * cdef class Phrase: # <<<<<<<<<<<<<< + * cdef int *syms + * cdef int n, *varpos, n_vars */ -struct __pyx_obj_5_cdec_DenseVector { +struct __pyx_obj_4cdec_2sa_3_sa_Phrase { PyObject_HEAD - std::vector *vector; - int owned; + struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtab; + int *syms; + int n; + int *varpos; + int n_vars; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":199 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":199 * del self.grammar * * def __iter__(self): # <<<<<<<<<<<<<< * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() * cdef grammar.const_RuleBin* rbin = root.GetRules() */ -struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ { PyObject_HEAD unsigned int __pyx_v_i; const RuleBin *__pyx_v_rbin; const GrammarIter *__pyx_v_root; - struct __pyx_obj_5_cdec_Grammar *__pyx_v_self; - struct __pyx_obj_5_cdec_TRule *__pyx_v_trule; + 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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":176 - * out.fields[i] = ss[i] +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":217 + * self.grammar.get().SetGrammarName(name) * - * cdef class Metric: # <<<<<<<<<<<<<< - * cdef Scorer scorer - * def __cinit__(self): + * cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<< + * def __init__(self, rules): + * """TextGrammar(rules) -> SCFG Grammar containing the rules.""" */ -struct __pyx_obj_5_cdec_Metric { - PyObject_HEAD - struct __pyx_obj_5_cdec_Scorer *scorer; +struct __pyx_obj_4cdec_5_cdec_TextGrammar { + struct __pyx_obj_4cdec_5_cdec_Grammar __pyx_base; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":26 - * return fmap +/* "cdec/_cdec.pyx":43 + * yield key, str(value) * - * cdef class SufficientStats: # <<<<<<<<<<<<<< - * cdef mteval.SufficientStats* stats - * cdef mteval.EvaluationMetric* metric + * cdef class Decoder: # <<<<<<<<<<<<<< + * cdef decoder.Decoder* dec + * cdef DenseVector weights */ -struct __pyx_obj_5_cdec_SufficientStats { +struct __pyx_obj_4cdec_5_cdec_Decoder { PyObject_HEAD - SufficientStats *stats; - EvaluationMetric *metric; + Decoder *dec; + struct __pyx_obj_4cdec_5_cdec_DenseVector *weights; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":49 - * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":12 + * return stats * - * def kbest(self, size): # <<<<<<<<<<<<<< - * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph.""" - * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal](self.hg[0], size) + * cdef class Candidate: # <<<<<<<<<<<<<< + * cdef mteval.const_Candidate* candidate + * cdef public float score */ -struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest { +struct __pyx_obj_4cdec_5_cdec_Candidate { PyObject_HEAD - KBest::KBestDerivations,ESentenceTraversal>::Derivation *__pyx_v_derivation; - KBest::KBestDerivations,ESentenceTraversal> *__pyx_v_derivations; - unsigned int __pyx_v_k; - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self; - PyObject *__pyx_v_size; - unsigned int __pyx_t_0; - long __pyx_t_1; + const training::Candidate *candidate; + float score; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":81 - * del e_derivations +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":262 * - * def kbest_features(self, size): # <<<<<<<<<<<<<< - * """hg.kbest_trees(size) -> List of k-best feature vectors in the hypergraph.""" - * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal](self.hg[0], size) + * property out_edges: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * for i in range(self.node.out_edges_.size()): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ { PyObject_HEAD - KBest::KBestDerivations,FeatureVectorTraversal>::Derivation *__pyx_v_derivation; - KBest::KBestDerivations,FeatureVectorTraversal> *__pyx_v_derivations; - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_fmap; - unsigned int __pyx_v_k; - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self; - PyObject *__pyx_v_size; - unsigned int __pyx_t_0; - long __pyx_t_1; + 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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":56 + * return unicode(str(self), 'utf8') * - * property tail_nodes: - * def __get__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * for i in range(self.edge.tail_nodes_.size()): + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * for i in range(len(self)): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ { PyObject_HEAD unsigned int __pyx_v_i; - struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self; - unsigned int __pyx_t_0; + struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self; + Py_ssize_t __pyx_t_0; unsigned int __pyx_t_1; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":172 - * self.rule.get().lhs_ = -TDConvert(( lhs).cat) +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":32 + * self.vector[0][fid] = value * - * def __str__(self): # <<<<<<<<<<<<<< - * scores = ' '.join('%s=%s' % feat for feat in self.scores) - * return '%s ||| %s ||| %s ||| %s' % (self.lhs, + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef unsigned fid + * for fid in range(1, self.vector.size()): */ -struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ { PyObject_HEAD - struct __pyx_obj_5_cdec_TRule *__pyx_v_self; + 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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6 - * - * def _phrase(phrase): - * return ' '.join(w.encode('utf8') if isinstance(w, unicode) else str(w) for w in phrase) # <<<<<<<<<<<<<< +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":173 * - * cdef class NT: + * def __str__(self): + * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< + * return '%s ||| %s ||| %s ||| %s' % (self.lhs, + * _phrase(self.f), _phrase(self.e), scores) */ -struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr { PyObject_HEAD - struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *__pyx_outer_scope; - PyObject *__pyx_v_w; + 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 *); }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":62 - * del derivations - * - * def kbest_trees(self, size): # <<<<<<<<<<<<<< - * """hg.kbest_trees(size) -> List of k-best trees in the hypergraph.""" - * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size) - */ -struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees { - PyObject_HEAD - KBest::KBestDerivations,ETreeTraversal>::Derivation *__pyx_v_e_derivation; - KBest::KBestDerivations,ETreeTraversal> *__pyx_v_e_derivations; - PyObject *__pyx_v_e_tree; - KBest::KBestDerivations,FTreeTraversal>::Derivation *__pyx_v_f_derivation; - KBest::KBestDerivations,FTreeTraversal> *__pyx_v_f_derivations; - PyObject *__pyx_v_f_tree; - unsigned int __pyx_v_k; - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self; - PyObject *__pyx_v_size; - unsigned int __pyx_t_0; - long __pyx_t_1; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":4 - * cimport kbest - * - * cdef class Hypergraph: # <<<<<<<<<<<<<< - * cdef hypergraph.Hypergraph* hg - * cdef MT19937* rng - */ -struct __pyx_obj_5_cdec_Hypergraph { - PyObject_HEAD - struct __pyx_vtabstruct_5_cdec_Hypergraph *__pyx_vtab; - Hypergraph *hg; - MT19937 *rng; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":3 - * cimport lattice - * - * cdef class Lattice: # <<<<<<<<<<<<<< - * cdef lattice.Lattice* lattice - * - */ -struct __pyx_obj_5_cdec_Lattice { - PyObject_HEAD - Lattice *lattice; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":97 - * del derivations +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":108 + * del hypos * - * def sample(self, unsigned n): # <<<<<<<<<<<<<< - * """hg.sample(n) -> Sample of n hypotheses from the hypergraph.""" - * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() + * 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_5_cdec___pyx_scope_struct_11_sample { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees { PyObject_HEAD - std::vector *__pyx_v_hypos; unsigned int __pyx_v_k; unsigned int __pyx_v_n; - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self; + struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self; + std::vector *__pyx_v_trees; size_t __pyx_t_0; unsigned int __pyx_t_1; }; -/* "_cdec.pyx":32 - * SetSilent(yn) +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":131 * - * def _make_config(config): # <<<<<<<<<<<<<< - * for key, value in config.items(): - * if isinstance(value, dict): + * property a: + * def __get__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ */ -struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config { +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ { 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 *); + std::vector *__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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":217 - * self.grammar.get().SetGrammarName(name) +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":72 + * self.vector.set_value(fid, value) * - * cdef class TextGrammar(Grammar): # <<<<<<<<<<<<<< - * def __init__(self, rules): - * """TextGrammar(rules) -> SCFG Grammar containing the rules.""" + * 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_5_cdec_TextGrammar { - struct __pyx_obj_5_cdec_Grammar __pyx_base; +struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ { + PyObject_HEAD + unsigned int __pyx_v_i; + FastSparseVector::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; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":4 - * cimport kbest +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":246 + * raise NotImplemented('comparison not implemented for HypergraphEdge') * - * cdef class Hypergraph: # <<<<<<<<<<<<<< + * cdef class HypergraphNode: # <<<<<<<<<<<<<< * cdef hypergraph.Hypergraph* hg - * cdef MT19937* rng + * cdef hypergraph.HypergraphNode* node */ -struct __pyx_vtabstruct_5_cdec_Hypergraph { - MT19937 *(*_rng)(struct __pyx_obj_5_cdec_Hypergraph *); +struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode { + PyObject *(*init)(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *, Hypergraph *, unsigned int); }; -static struct __pyx_vtabstruct_5_cdec_Hypergraph *__pyx_vtabptr_5_cdec_Hypergraph; +static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode *__pyx_vtabptr_4cdec_5_cdec_HypergraphNode; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":196 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":196 * return vector * * cdef class HypergraphEdge: # <<<<<<<<<<<<<< @@ -1405,13 +1405,13 @@ static struct __pyx_vtabstruct_5_cdec_Hypergraph *__pyx_vtabptr_5_cdec_Hypergrap * cdef hypergraph.HypergraphEdge* edge */ -struct __pyx_vtabstruct_5_cdec_HypergraphEdge { - PyObject *(*init)(struct __pyx_obj_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int); +struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge { + PyObject *(*init)(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int); }; -static struct __pyx_vtabstruct_5_cdec_HypergraphEdge *__pyx_vtabptr_5_cdec_HypergraphEdge; +static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *__pyx_vtabptr_4cdec_5_cdec_HypergraphEdge; -/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":12 +/* "cdec/sa/_sa.pxd":12 * cdef void read_handle(self, FILE* f) * * cdef class IntList: # <<<<<<<<<<<<<< @@ -1431,7 +1431,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; -/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":3 +/* "cdec/sa/_sa.pxd":3 * from libc.stdio cimport FILE * * cdef class FloatList: # <<<<<<<<<<<<<< @@ -1447,7 +1447,7 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList { static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtabptr_4cdec_2sa_3_sa_FloatList; -/* "/Users/vchahun/Sandbox/cdec/python/src/cdec.sa._sa.pxd":29 +/* "cdec/sa/_sa.pxd":29 * cdef FloatList values * * cdef class Phrase: # <<<<<<<<<<<<<< @@ -1462,18 +1462,18 @@ struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase { static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *__pyx_vtabptr_4cdec_2sa_3_sa_Phrase; -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":246 - * raise NotImplemented('comparison not implemented for HypergraphEdge') +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":4 + * cimport kbest * - * cdef class HypergraphNode: # <<<<<<<<<<<<<< + * cdef class Hypergraph: # <<<<<<<<<<<<<< * cdef hypergraph.Hypergraph* hg - * cdef hypergraph.HypergraphNode* node + * cdef MT19937* rng */ -struct __pyx_vtabstruct_5_cdec_HypergraphNode { - PyObject *(*init)(struct __pyx_obj_5_cdec_HypergraphNode *, Hypergraph *, unsigned int); +struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph { + MT19937 *(*_rng)(struct __pyx_obj_4cdec_5_cdec_Hypergraph *); }; -static struct __pyx_vtabstruct_5_cdec_HypergraphNode *__pyx_vtabptr_5_cdec_HypergraphNode; +static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph *__pyx_vtabptr_4cdec_5_cdec_Hypergraph; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -1895,15 +1895,15 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'libcpp.pair' */ -/* Module declarations from 'utils' */ +/* Module declarations from 'cdec.utils' */ -/* Module declarations from 'grammar' */ +/* Module declarations from 'cdec.grammar' */ -/* Module declarations from 'lattice' */ +/* Module declarations from 'cdec.lattice' */ -/* Module declarations from 'hypergraph' */ +/* Module declarations from 'cdec.hypergraph' */ -/* Module declarations from 'decoder' */ +/* Module declarations from 'cdec.decoder' */ /* Module declarations from 'libc.stdio' */ @@ -1918,66 +1918,66 @@ static char *(*__pyx_f_4cdec_2sa_3_sa_sym_tocat)(int); /*proto*/ static int (*__pyx_f_4cdec_2sa_3_sa_sym_isvar)(int); /*proto*/ static int (*__pyx_f_4cdec_2sa_3_sa_sym_getindex)(int); /*proto*/ -/* Module declarations from 'kbest' */ - -/* Module declarations from 'mteval' */ - -/* Module declarations from '_cdec' */ -static PyTypeObject *__pyx_ptype_5_cdec_Scorer = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_24___init__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec_NTRef = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_22___iter__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec_Grammar = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_20_lines = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_13___get__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_2__phrase = 0; -static PyTypeObject *__pyx_ptype_5_cdec_CandidateSet = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_14___get__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec_TRule = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_3_genexpr = 0; -static PyTypeObject *__pyx_ptype_5_cdec_MRule = 0; -static PyTypeObject *__pyx_ptype_5_cdec_SegmentEvaluator = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_19_todot = 0; -static PyTypeObject *__pyx_ptype_5_cdec_Candidate = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr = 0; -static PyTypeObject *__pyx_ptype_5_cdec_NT = 0; -static PyTypeObject *__pyx_ptype_5_cdec_HypergraphEdge = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_1___iter__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_16___get__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_4___get__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec_Decoder = 0; -static PyTypeObject *__pyx_ptype_5_cdec_HypergraphNode = 0; -static PyTypeObject *__pyx_ptype_5_cdec_SparseVector = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_17___get__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct____iter__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec_DenseVector = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_7___iter__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec_Metric = 0; -static PyTypeObject *__pyx_ptype_5_cdec_SufficientStats = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_8_kbest = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_10_kbest_features = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_15___get__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_5___str__ = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees = 0; -static PyTypeObject *__pyx_ptype_5_cdec_Hypergraph = 0; -static PyTypeObject *__pyx_ptype_5_cdec_Lattice = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_11_sample = 0; -static PyTypeObject *__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config = 0; -static PyTypeObject *__pyx_ptype_5_cdec_TextGrammar = 0; -static PyObject *__pyx_f_5_cdec_as_str(PyObject *, struct __pyx_opt_args_5_cdec_as_str *__pyx_optional_args); /*proto*/ -static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_obj_4cdec_2sa_3_sa_Rule *); /*proto*/ -static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject *, PyObject *); /*proto*/ -static float __pyx_f_5_cdec__compute_score(void *, SufficientStats *); /*proto*/ -static void __pyx_f_5_cdec__compute_sufficient_stats(void *, std::string *, std::vector *, SufficientStats *); /*proto*/ +/* Module declarations from 'cdec.kbest' */ + +/* Module declarations from 'cdec.mteval' */ + +/* Module declarations from 'cdec._cdec' */ +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___pyx_scope_struct_22___iter__ = 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_21___iter__ = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Metric = 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_15___get__ = 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_23__make_config = 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___pyx_scope_struct_13___get__ = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20_lines = 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_Grammar = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec_Hypergraph = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24___init__ = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec_CandidateSet = 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_19_todot = 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_25_genexpr = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_3_genexpr = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_11_sample = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_8_kbest = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14___get__ = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_7___iter__ = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec_TextGrammar = 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_17___get__ = 0; +static PyTypeObject *__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___iter__ = 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_sample_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 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 *, SufficientStats *); /*proto*/ static std::string __pyx_convert_string_from_py_(PyObject *); /*proto*/ -#define __Pyx_MODULE_NAME "_cdec" -int __pyx_module_is_main__cdec = 0; +#define __Pyx_MODULE_NAME "cdec._cdec" +int __pyx_module_is_main_cdec___cdec = 0; -/* Implementation of '_cdec' */ +/* Implementation of 'cdec._cdec' */ static PyObject *__pyx_builtin_Exception; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_KeyError; @@ -1989,204 +1989,204 @@ static PyObject *__pyx_builtin_eval; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_IndexError; static PyObject *__pyx_builtin_open; -static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self); /* proto */ -static void __pyx_pf_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_pf_5_cdec_11DenseVector_4__len__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname); /* proto */ -static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value); /* proto */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_10__iter__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_13dot(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_12SparseVector___init__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static void __pyx_pf_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_4copy(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname); /* proto */ -static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_10__iter__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_y, int __pyx_v_op); /* proto */ -static Py_ssize_t __pyx_pf_5_cdec_12SparseVector_17__len__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar); /* proto */ +static int __pyx_pf_4cdec_5_cdec_11DenseVector___init__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self); /* proto */ +static void __pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_4cdec_5_cdec_11DenseVector_4__len__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_11DenseVector_10__iter__(struct __pyx_obj_4cdec_5_cdec_DenseVector *__pyx_v_self); /* proto */ +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 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 */ +static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_10__iter__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_13dot(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +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); /* proto */ +static Py_ssize_t __pyx_pf_4cdec_5_cdec_12SparseVector_17__len__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self); /* proto */ +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); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar); /* proto */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar); /* proto */ #endif -static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_y); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_y); /* proto */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */ +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); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */ #endif -static PyObject *__pyx_pf_5_cdec_7_phrase_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_phrase); /* proto */ -static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_cat, unsigned int __pyx_v_ref); /* proto */ -static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_2NT_3cat___get__(struct __pyx_obj_5_cdec_NT *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_2NT_3cat_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_5_cdec_2NT_3cat_4__del__(struct __pyx_obj_5_cdec_NT *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_2NT_3ref___get__(struct __pyx_obj_5_cdec_NT *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_5_cdec_5NTRef___init__(struct __pyx_obj_5_cdec_NTRef *__pyx_v_self, unsigned int __pyx_v_ref); /* proto */ -static PyObject *__pyx_pf_5_cdec_5NTRef_2__str__(struct __pyx_obj_5_cdec_NTRef *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_5_cdec_NTRef *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_5_cdec_NTRef *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_a); /* proto */ -static void __pyx_pf_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_f); /* proto */ -static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_e); /* proto */ -static PyObject *__pyx_pf_5_cdec_5TRule_1a___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_a); /* proto */ -static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_scores); /* proto */ -static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_lhs); /* proto */ -static PyObject *__pyx_pf_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_rhs, PyObject *__pyx_v_scores); /* proto */ -static void __pyx_pf_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Grammar *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Grammar_2__iter__(struct __pyx_obj_5_cdec_Grammar *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Grammar_4name___get__(struct __pyx_obj_5_cdec_Grammar *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Grammar *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ -static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGrammar *__pyx_v_self, PyObject *__pyx_v_rules); /* proto */ -static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_10viterbi_joshua(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_18kbest_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_21sample(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_24sample_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_33plf(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_8src_span___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_x, struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_y, int __pyx_v_op); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_5trule___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_x, struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_y, int __pyx_v_op); /* proto */ -static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */ -static void __pyx_pf_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index); /* proto */ -static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs); /* proto */ -static Py_ssize_t __pyx_pf_5_cdec_7Lattice_10__len__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Lattice_12__str__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Lattice_16__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_9Candidate_5score___get__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static void __pyx_pf_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_5score___get__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_pf_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self, int __pyx_v_index); /* proto */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self, struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */ -static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_evaluator); /* proto */ -static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_pf_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self, int __pyx_v_k); /* proto */ -static PyObject *__pyx_pf_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_hypergraph, unsigned int __pyx_v_k); /* proto */ -static void __pyx_pf_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_self, PyObject *__pyx_v_sentence); /* proto */ -static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ -static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Scorer *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_refs); /* proto */ -static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_6Metric_2__call__(struct __pyx_obj_5_cdec_Metric *__pyx_v_self, PyObject *__pyx_v_refs); /* proto */ -static PyObject *__pyx_pf_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx_obj_5_cdec_Metric *__pyx_v_stats); /* proto */ -static PyObject *__pyx_pf_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_obj_5_cdec_Metric *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_hyp, CYTHON_UNUSED PyObject *__pyx_v_refs); /* proto */ -static PyObject *__pyx_pf_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_yn); /* proto */ -static PyObject *__pyx_pf_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Decoder_8__init___genexpr(PyObject *__pyx_self); /* proto */ -static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_config_str, PyObject *__pyx_v_config); /* proto */ -static void __pyx_pf_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Decoder *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self); /* proto */ -static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights); /* proto */ -static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_sentence, PyObject *__pyx_v_grammar); /* proto */ -static PyObject *__pyx_tp_new_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_24___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_NTRef(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_Grammar(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_20_lines(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_TRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_MRule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_SegmentEvaluator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_todot(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_Candidate(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_NT(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_HypergraphEdge(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_Decoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_HypergraphNode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_SparseVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_DenseVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_Metric(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_SufficientStats(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_Hypergraph(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_Lattice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_23__make_config(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_pf_4cdec_5_cdec_7_phrase_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_phrase); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_2NT_2__str__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_2NT_3cat___get__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self); /* proto */ +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); /* proto */ +static int __pyx_pf_4cdec_5_cdec_2NT_3cat_4__del__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_2NT_3ref___get__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_5_cdec_5NTRef___init__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self, unsigned int __pyx_v_ref); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_5NTRef_2__str__(struct __pyx_obj_4cdec_5_cdec_NTRef *__pyx_v_self); /* proto */ +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); /* 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 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 */ +static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1a___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self); /* proto */ +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); /* proto */ +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 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 */ +static int __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(struct __pyx_obj_4cdec_5_cdec_TextGrammar *__pyx_v_self, PyObject *__pyx_v_rules); /* proto */ +static void __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_18kbest_features(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_21sample(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_24sample_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_27intersect(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_inp); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_29prune(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_31lattice(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_33plf(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_35reweight(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_37inside_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 */ +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_9out_edges___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_4cdec_5_cdec_HypergraphNode *__pyx_v_self); /* proto */ +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 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 */ +static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_12__str__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_16__iter__(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_19todot(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(struct __pyx_obj_4cdec_5_cdec_Candidate *__pyx_v_self); /* proto */ +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 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 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 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 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 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 */ +static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_2__call__(struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_self, PyObject *__pyx_v_refs); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_stats); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_yn); /* proto */ +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 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_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_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___pyx_scope_struct_22___iter__(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_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_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_15___get__(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_23__make_config(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___pyx_scope_struct_13___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20_lines(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_Grammar(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___pyx_scope_struct_24___init__(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_9_kbest_trees(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_19_todot(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_25_genexpr(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_11_sample(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_14___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_TextGrammar(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_17___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___iter__(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_sample_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"; @@ -2212,21 +2212,22 @@ static char __pyx_k_26[] = "digraph lattice {"; static char __pyx_k_31[] = "\\\""; static char __pyx_k_33[] = "%d [shape=doublecircle]"; static char __pyx_k_34[] = "}"; -static char __pyx_k_37[] = "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi"; +static char __pyx_k_37[] = "/home/mdenkows/cdec/python/cdec/lattice.pxi"; static char __pyx_k_38[] = "Lattice.todot..lines"; -static char __pyx_k_39[] = "\n"; -static char __pyx_k_41[] = "sufficient stats vector index out of range"; -static char __pyx_k_43[] = "candidate set index out of range"; -static char __pyx_k_45[] = "%s %s"; -static char __pyx_k_46[] = "%s = %s"; -static char __pyx_k_47[] = "formalism \"%s\" unknown"; -static char __pyx_k_48[] = "cannot initialize weights with %s"; -static char __pyx_k_49[] = "#"; -static char __pyx_k_52[] = "Cannot translate input type %s"; -static char __pyx_k_53[] = "cdec.sa._sa"; -static char __pyx_k_54[] = "*"; -static char __pyx_k_57[] = "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi"; -static char __pyx_k_65[] = "/Users/vchahun/Sandbox/cdec/python/src/_cdec.pyx"; +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[] = "/home/mdenkows/cdec/python/cdec/grammar.pxi"; +static char __pyx_k_66[] = "/home/mdenkows/cdec/python/cdec/_cdec.pyx"; static char __pyx_k__a[] = "a"; static char __pyx_k__e[] = "e"; static char __pyx_k__f[] = "f"; @@ -2263,7 +2264,6 @@ static char __pyx_k__self[] = "self"; static char __pyx_k__send[] = "send"; static char __pyx_k__span[] = "span"; static char __pyx_k__utf8[] = "utf8"; -static char __pyx_k___cdec[] = "_cdec"; static char __pyx_k__close[] = "close"; static char __pyx_k__delta[] = "delta"; static char __pyx_k__items[] = "items"; @@ -2352,20 +2352,21 @@ 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_kp_s_39; +static PyObject *__pyx_n_s_39; static PyObject *__pyx_kp_s_4; -static PyObject *__pyx_kp_s_41; -static PyObject *__pyx_kp_s_43; -static PyObject *__pyx_kp_s_45; +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_52; -static PyObject *__pyx_n_s_53; +static PyObject *__pyx_kp_s_50; +static PyObject *__pyx_kp_s_53; static PyObject *__pyx_n_s_54; -static PyObject *__pyx_kp_s_57; -static PyObject *__pyx_kp_s_65; +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; @@ -2397,7 +2398,6 @@ 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___cdec; static PyObject *__pyx_n_s___make_config; static PyObject *__pyx_n_s___phrase; static PyObject *__pyx_n_s___sa; @@ -2484,25 +2484,25 @@ 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_40; -static PyObject *__pyx_k_tuple_42; -static PyObject *__pyx_k_tuple_44; -static PyObject *__pyx_k_tuple_50; +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_55; -static PyObject *__pyx_k_tuple_58; +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_66; +static PyObject *__pyx_k_tuple_64; +static PyObject *__pyx_k_tuple_67; static PyObject *__pyx_k_codeobj_36; -static PyObject *__pyx_k_codeobj_56; -static PyObject *__pyx_k_codeobj_64; -static PyObject *__pyx_k_codeobj_67; +static PyObject *__pyx_k_codeobj_57; +static PyObject *__pyx_k_codeobj_65; +static PyObject *__pyx_k_codeobj_68; -/* "_cdec.pyx":6 +/* "cdec/_cdec.pyx":6 * cimport decoder * * cdef bytes as_str(data, char* error_msg='Cannot convert type %s to str'): # <<<<<<<<<<<<<< @@ -2510,7 +2510,7 @@ static PyObject *__pyx_k_codeobj_67; * if isinstance(data, unicode): */ -static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_args_5_cdec_as_str *__pyx_optional_args) { +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); PyObject *__pyx_v_ret = 0; PyObject *__pyx_r = NULL; @@ -2530,7 +2530,7 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ } } - /* "_cdec.pyx":8 + /* "cdec/_cdec.pyx":8 * cdef bytes as_str(data, char* error_msg='Cannot convert type %s to str'): * cdef bytes ret * if isinstance(data, unicode): # <<<<<<<<<<<<<< @@ -2541,7 +2541,7 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "_cdec.pyx":9 + /* "cdec/_cdec.pyx":9 * cdef bytes ret * if isinstance(data, unicode): * ret = data.encode('utf8') # <<<<<<<<<<<<<< @@ -2559,7 +2559,7 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ goto __pyx_L3; } - /* "_cdec.pyx":10 + /* "cdec/_cdec.pyx":10 * if isinstance(data, unicode): * ret = data.encode('utf8') * elif isinstance(data, str): # <<<<<<<<<<<<<< @@ -2570,7 +2570,7 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "_cdec.pyx":11 + /* "cdec/_cdec.pyx":11 * ret = data.encode('utf8') * elif isinstance(data, str): * ret = data # <<<<<<<<<<<<<< @@ -2584,7 +2584,7 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ } /*else*/ { - /* "_cdec.pyx":13 + /* "cdec/_cdec.pyx":13 * ret = data * else: * raise TypeError(error_msg.format(type(data))) # <<<<<<<<<<<<<< @@ -2619,7 +2619,7 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ } __pyx_L3:; - /* "_cdec.pyx":14 + /* "cdec/_cdec.pyx":14 * else: * raise TypeError(error_msg.format(type(data))) * return ret # <<<<<<<<<<<<<< @@ -2637,7 +2637,7 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec.as_str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.as_str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ret); @@ -2647,24 +2647,24 @@ static PyObject *__pyx_f_5_cdec_as_str(PyObject *__pyx_v_data, struct __pyx_opt_ } /* Python wrapper */ -static int __pyx_pw_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5_cdec_11DenseVector___init__[] = "DenseVector() -> Dense weight/feature vector."; +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."; #if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5_cdec_11DenseVector___init__; +struct wrapperbase __pyx_wrapperbase_4cdec_5_cdec_11DenseVector___init__; #endif -static int __pyx_pw_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __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_5_cdec_11DenseVector___init__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector___init__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":7 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":7 * cdef bint owned # if True, do not manage memory * * def __init__(self): # <<<<<<<<<<<<<< @@ -2672,7 +2672,7 @@ static int __pyx_pw_5_cdec_11DenseVector_1__init__(PyObject *__pyx_v_self, PyObj * self.vector = new vector[weight_t]() */ -static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self) { +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 *__pyx_t_1; @@ -2681,7 +2681,7 @@ static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseV int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":9 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":9 * def __init__(self): * """DenseVector() -> Dense weight/feature vector.""" * self.vector = new vector[weight_t]() # <<<<<<<<<<<<<< @@ -2696,7 +2696,7 @@ static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseV } __pyx_v_self->vector = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":10 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":10 * """DenseVector() -> Dense weight/feature vector.""" * self.vector = new vector[weight_t]() * self.owned = False # <<<<<<<<<<<<<< @@ -2708,7 +2708,7 @@ static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseV __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.DenseVector.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.DenseVector.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -2716,15 +2716,15 @@ static int __pyx_pf_5_cdec_11DenseVector___init__(struct __pyx_obj_5_cdec_DenseV } /* Python wrapper */ -static void __pyx_pw_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_self) { +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_5_cdec_11DenseVector_2__dealloc__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_11DenseVector_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":12 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":12 * self.owned = False * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2732,12 +2732,12 @@ static void __pyx_pw_5_cdec_11DenseVector_3__dealloc__(PyObject *__pyx_v_self) { * del self.vector */ -static void __pyx_pf_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":13 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":13 * * def __dealloc__(self): * if not self.owned: # <<<<<<<<<<<<<< @@ -2747,7 +2747,7 @@ static void __pyx_pf_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_5_cdec_D __pyx_t_1 = ((!(__pyx_v_self->owned != 0)) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":14 * def __dealloc__(self): * if not self.owned: * del self.vector # <<<<<<<<<<<<<< @@ -2763,17 +2763,17 @@ static void __pyx_pf_5_cdec_11DenseVector_2__dealloc__(struct __pyx_obj_5_cdec_D } /* Python wrapper */ -static Py_ssize_t __pyx_pw_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_11DenseVector_4__len__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_4__len__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":16 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":16 * del self.vector * * def __len__(self): # <<<<<<<<<<<<<< @@ -2781,12 +2781,12 @@ static Py_ssize_t __pyx_pw_5_cdec_11DenseVector_5__len__(PyObject *__pyx_v_self) * */ -static Py_ssize_t __pyx_pf_5_cdec_11DenseVector_4__len__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":17 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":17 * * def __len__(self): * return self.vector.size() # <<<<<<<<<<<<<< @@ -2803,8 +2803,8 @@ static Py_ssize_t __pyx_pf_5_cdec_11DenseVector_4__len__(struct __pyx_obj_5_cdec } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/ -static PyObject *__pyx_pw_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) { +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) { char *__pyx_v_fname; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -2817,16 +2817,16 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_se } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.DenseVector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.DenseVector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_11DenseVector_6__getitem__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); + __pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":19 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":19 * return self.vector.size() * * def __getitem__(self, char* fname): # <<<<<<<<<<<<<< @@ -2834,7 +2834,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_7__getitem__(PyObject *__pyx_v_se * if 0 <= fid < self.vector.size(): */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname) { +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; __Pyx_RefNannyDeclarations @@ -2847,7 +2847,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":20 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":20 * * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -2856,7 +2856,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":21 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":21 * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) * if 0 <= fid < self.vector.size(): # <<<<<<<<<<<<<< @@ -2870,7 +2870,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":22 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":22 * cdef int fid = FDConvert(fname) * if 0 <= fid < self.vector.size(): * return self.vector[0][fid] # <<<<<<<<<<<<<< @@ -2887,7 +2887,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":23 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":23 * if 0 <= fid < self.vector.size(): * return self.vector[0][fid] * raise KeyError(fname) # <<<<<<<<<<<<<< @@ -2913,7 +2913,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.DenseVector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.DenseVector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2922,8 +2922,8 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_6__getitem__(struct __pyx_obj_5_c } /* Python wrapper */ -static int __pyx_pw_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value); /*proto*/ -static int __pyx_pw_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value) { +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) { char *__pyx_v_fname; float __pyx_v_value; int __pyx_lineno = 0; @@ -2940,16 +2940,16 @@ static int __pyx_pw_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, Py } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.DenseVector.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.DenseVector.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_11DenseVector_8__setitem__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self), ((char *)__pyx_v_fname), ((float)__pyx_v_value)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":25 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":25 * raise KeyError(fname) * * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<< @@ -2957,7 +2957,7 @@ static int __pyx_pw_5_cdec_11DenseVector_9__setitem__(PyObject *__pyx_v_self, Py * if fid < 0: raise KeyError(fname) */ -static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value) { +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; __Pyx_RefNannyDeclarations @@ -2969,7 +2969,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":26 * * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -2978,7 +2978,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":27 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":27 * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -3004,7 +3004,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":28 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":28 * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) * if self.vector.size() <= fid: # <<<<<<<<<<<<<< @@ -3014,7 +3014,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De __pyx_t_1 = ((__pyx_v_self->vector->size() <= __pyx_v_fid) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":29 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":29 * if fid < 0: raise KeyError(fname) * if self.vector.size() <= fid: * self.vector.resize(fid + 1) # <<<<<<<<<<<<<< @@ -3026,7 +3026,7 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":30 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":30 * if self.vector.size() <= fid: * self.vector.resize(fid + 1) * self.vector[0][fid] = value # <<<<<<<<<<<<<< @@ -3040,26 +3040,26 @@ static int __pyx_pf_5_cdec_11DenseVector_8__setitem__(struct __pyx_obj_5_cdec_De __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.DenseVector.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.DenseVector.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_11DenseVector_10__iter__(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_10__iter__(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":32 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":32 * self.vector[0][fid] = value * * def __iter__(self): # <<<<<<<<<<<<<< @@ -3067,15 +3067,15 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_11__iter__(PyObject *__pyx_v_self * for fid in range(1, self.vector.size()): */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_10__iter__(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *__pyx_cur_scope; +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; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(__pyx_ptype_5_cdec___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -3085,7 +3085,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_10__iter__(struct __pyx_obj_5_cde __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_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); 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; @@ -3094,7 +3094,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_10__iter__(struct __pyx_obj_5_cde __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.DenseVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.DenseVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -3103,9 +3103,9 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_10__iter__(struct __pyx_obj_5_cde return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; size_t __pyx_t_1; unsigned int __pyx_t_2; @@ -3127,7 +3127,7 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":34 * def __iter__(self): * cdef unsigned fid * for fid in range(1, self.vector.size()): # <<<<<<<<<<<<<< @@ -3138,7 +3138,7 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject for (__pyx_t_2 = 1; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_fid = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":35 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":35 * cdef unsigned fid * for fid in range(1, self.vector.size()): * yield str(FDConvert(fid).c_str()), self.vector[0][fid] # <<<<<<<<<<<<<< @@ -3195,17 +3195,17 @@ static PyObject *__pyx_gb_5_cdec_11DenseVector_12generator(__pyx_GeneratorObject } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static char __pyx_doc_5_cdec_11DenseVector_13dot[] = "vector.dot(SparseVector other) -> Dot product of the two vectors."; -static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_14dot(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("dot (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_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_5_cdec_11DenseVector_13dot(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self), ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_other)); + 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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3214,7 +3214,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":37 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":37 * yield str(FDConvert(fid).c_str()), self.vector[0][fid] * * def dot(self, SparseVector other): # <<<<<<<<<<<<<< @@ -3222,7 +3222,7 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_14dot(PyObject *__pyx_v_self, PyO * return other.dot(self) */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_13dot(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_other) { +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; @@ -3233,7 +3233,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_13dot(struct __pyx_obj_5_cdec_Den int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dot", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":39 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":39 * def dot(self, SparseVector other): * """vector.dot(SparseVector other) -> Dot product of the two vectors.""" * return other.dot(self) # <<<<<<<<<<<<<< @@ -3262,7 +3262,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_13dot(struct __pyx_obj_5_cdec_Den __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.DenseVector.dot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.DenseVector.dot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3271,18 +3271,18 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_13dot(struct __pyx_obj_5_cdec_Den } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_11DenseVector_15tosparse[] = "vector.tosparse() -> Equivalent SparseVector."; -static PyObject *__pyx_pw_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("tosparse (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_11DenseVector_15tosparse(((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_11DenseVector_15tosparse(((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":41 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":41 * return other.dot(self) * * def tosparse(self): # <<<<<<<<<<<<<< @@ -3290,8 +3290,8 @@ static PyObject *__pyx_pw_5_cdec_11DenseVector_16tosparse(PyObject *__pyx_v_self * cdef SparseVector sparse = SparseVector.__new__(SparseVector) */ -static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cdec_DenseVector *__pyx_v_self) { - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_sparse = 0; +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; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3300,20 +3300,20 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("tosparse", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":43 + /* "/home/mdenkows/cdec/python/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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_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)), ((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_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_sparse = ((struct __pyx_obj_5_cdec_SparseVector *)__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":44 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":44 * """vector.tosparse() -> Equivalent SparseVector.""" * cdef SparseVector sparse = SparseVector.__new__(SparseVector) * sparse.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<< @@ -3322,7 +3322,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde */ __pyx_v_sparse->vector = new FastSparseVector(); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":45 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":45 * cdef SparseVector sparse = SparseVector.__new__(SparseVector) * sparse.vector = new FastSparseVector[weight_t]() * InitSparseVector(self.vector[0], sparse.vector) # <<<<<<<<<<<<<< @@ -3331,7 +3331,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde */ Weights::InitSparseVector((__pyx_v_self->vector[0]), __pyx_v_sparse->vector); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":46 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":46 * sparse.vector = new FastSparseVector[weight_t]() * InitSparseVector(self.vector[0], sparse.vector) * return sparse # <<<<<<<<<<<<<< @@ -3347,7 +3347,7 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.DenseVector.tosparse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.DenseVector.tosparse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_sparse); @@ -3357,24 +3357,24 @@ static PyObject *__pyx_pf_5_cdec_11DenseVector_15tosparse(struct __pyx_obj_5_cde } /* Python wrapper */ -static int __pyx_pw_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5_cdec_12SparseVector___init__[] = "SparseVector() -> Sparse feature/weight vector."; +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."; #if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5_cdec_12SparseVector___init__; +struct wrapperbase __pyx_wrapperbase_4cdec_5_cdec_12SparseVector___init__; #endif -static int __pyx_pw_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __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_5_cdec_12SparseVector___init__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector___init__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":51 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":51 * cdef FastSparseVector[weight_t]* vector * * def __init__(self): # <<<<<<<<<<<<<< @@ -3382,12 +3382,12 @@ static int __pyx_pw_5_cdec_12SparseVector_1__init__(PyObject *__pyx_v_self, PyOb * self.vector = new FastSparseVector[weight_t]() */ -static int __pyx_pf_5_cdec_12SparseVector___init__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":53 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":53 * def __init__(self): * """SparseVector() -> Sparse feature/weight vector.""" * self.vector = new FastSparseVector[weight_t]() # <<<<<<<<<<<<<< @@ -3402,15 +3402,15 @@ static int __pyx_pf_5_cdec_12SparseVector___init__(struct __pyx_obj_5_cdec_Spars } /* Python wrapper */ -static void __pyx_pw_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_self) { +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_5_cdec_12SparseVector_2__dealloc__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":55 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":55 * self.vector = new FastSparseVector[weight_t]() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3418,11 +3418,11 @@ static void __pyx_pw_5_cdec_12SparseVector_3__dealloc__(PyObject *__pyx_v_self) * */ -static void __pyx_pf_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { +static void __pyx_pf_4cdec_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":56 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":56 * * def __dealloc__(self): * del self.vector # <<<<<<<<<<<<<< @@ -3435,18 +3435,18 @@ static void __pyx_pf_5_cdec_12SparseVector_2__dealloc__(CYTHON_UNUSED struct __p } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_12SparseVector_4copy[] = "vector.copy() -> SparseVector copy."; -static PyObject *__pyx_pw_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_4copy(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_4copy(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":58 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":58 * del self.vector * * def copy(self): # <<<<<<<<<<<<<< @@ -3454,7 +3454,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_5copy(PyObject *__pyx_v_self, CY * return self * 1 */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_4copy(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -3463,7 +3463,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4copy(struct __pyx_obj_5_cdec_Sp int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":60 * def copy(self): * """vector.copy() -> SparseVector copy.""" * return self * 1 # <<<<<<<<<<<<<< @@ -3481,7 +3481,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4copy(struct __pyx_obj_5_cdec_Sp goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.SparseVector.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3490,8 +3490,8 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_4copy(struct __pyx_obj_5_cdec_Sp } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) { +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) { char *__pyx_v_fname; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -3504,16 +3504,16 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_s } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.SparseVector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12SparseVector_6__getitem__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":62 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":62 * return self * 1 * * def __getitem__(self, char* fname): # <<<<<<<<<<<<<< @@ -3521,7 +3521,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_7__getitem__(PyObject *__pyx_v_s * if fid < 0: raise KeyError(fname) */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_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; __Pyx_RefNannyDeclarations @@ -3533,7 +3533,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":63 * * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -3542,7 +3542,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_ */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":64 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":64 * def __getitem__(self, char* fname): * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -3568,7 +3568,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":65 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":65 * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) * return self.vector.value(fid) # <<<<<<<<<<<<<< @@ -3587,7 +3587,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.SparseVector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3596,8 +3596,8 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_6__getitem__(struct __pyx_obj_5_ } /* Python wrapper */ -static int __pyx_pw_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value); /*proto*/ -static int __pyx_pw_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname, PyObject *__pyx_arg_value) { +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) { char *__pyx_v_fname; float __pyx_v_value; int __pyx_lineno = 0; @@ -3614,16 +3614,16 @@ static int __pyx_pw_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.SparseVector.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12SparseVector_8__setitem__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname), ((float)__pyx_v_value)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":67 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":67 * return self.vector.value(fid) * * def __setitem__(self, char* fname, float value): # <<<<<<<<<<<<<< @@ -3631,7 +3631,7 @@ static int __pyx_pw_5_cdec_12SparseVector_9__setitem__(PyObject *__pyx_v_self, P * if fid < 0: raise KeyError(fname) */ -static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_fname, float __pyx_v_value) { +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; __Pyx_RefNannyDeclarations @@ -3643,7 +3643,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":68 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":68 * * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) # <<<<<<<<<<<<<< @@ -3652,7 +3652,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S */ __pyx_v_fid = FD::Convert(__pyx_v_fname); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":69 * def __setitem__(self, char* fname, float value): * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -3678,7 +3678,7 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":70 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":70 * cdef int fid = FDConvert(fname) * if fid < 0: raise KeyError(fname) * self.vector.set_value(fid, value) # <<<<<<<<<<<<<< @@ -3692,26 +3692,26 @@ static int __pyx_pf_5_cdec_12SparseVector_8__setitem__(struct __pyx_obj_5_cdec_S __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.SparseVector.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_11__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_11__iter__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_10__iter__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_10__iter__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":72 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":72 * self.vector.set_value(fid, value) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -3719,15 +3719,15 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_11__iter__(PyObject *__pyx_v_sel * cdef unsigned i */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_10__iter__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *__pyx_cur_scope; +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; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_1___iter__(__pyx_ptype_5_cdec___pyx_scope_struct_1___iter__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_1___iter__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_1___iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -3737,7 +3737,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_10__iter__(struct __pyx_obj_5_cd __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_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); 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; @@ -3746,7 +3746,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_10__iter__(struct __pyx_obj_5_cd __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.SparseVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -3755,9 +3755,9 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_10__iter__(struct __pyx_obj_5_cd return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; size_t __pyx_t_1; unsigned int __pyx_t_2; @@ -3779,7 +3779,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":73 * * def __iter__(self): * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) # <<<<<<<<<<<<<< @@ -3788,7 +3788,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje */ __pyx_cur_scope->__pyx_v_it = new FastSparseVector::const_iterator((__pyx_cur_scope->__pyx_v_self->vector[0]), 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":75 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":75 * cdef FastSparseVector[weight_t].const_iterator* it = new FastSparseVector[weight_t].const_iterator(self.vector[0], False) * cdef unsigned i * try: # <<<<<<<<<<<<<< @@ -3797,7 +3797,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje */ /*try:*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":76 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":76 * cdef unsigned i * try: * for i in range(self.vector.size()): # <<<<<<<<<<<<<< @@ -3808,7 +3808,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":77 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":77 * try: * for i in range(self.vector.size()): * yield (str(FDConvert(it[0].ptr().first).c_str()), it[0].ptr().second) # <<<<<<<<<<<<<< @@ -3849,7 +3849,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L5;} - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":78 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":78 * for i in range(self.vector.size()): * yield (str(FDConvert(it[0].ptr().first).c_str()), it[0].ptr().second) * pinc(it[0]) # ++it # <<<<<<<<<<<<<< @@ -3860,7 +3860,7 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje } } - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":80 * pinc(it[0]) # ++it * finally: * del it # <<<<<<<<<<<<<< @@ -3911,18 +3911,18 @@ static PyObject *__pyx_gb_5_cdec_12SparseVector_12generator1(__pyx_GeneratorObje } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static char __pyx_doc_5_cdec_12SparseVector_13dot[] = "vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors."; -static PyObject *__pyx_pw_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dot (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_13dot(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_13dot(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((PyObject *)__pyx_v_other)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":82 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":82 * del it * * def dot(self, other): # <<<<<<<<<<<<<< @@ -3930,7 +3930,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_14dot(PyObject *__pyx_v_self, Py * if isinstance(other, DenseVector): */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, PyObject *__pyx_v_other) { +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 int __pyx_t_1; @@ -3942,18 +3942,18 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dot", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":84 * def dot(self, other): * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors.""" * if isinstance(other, DenseVector): # <<<<<<<<<<<<<< * return self.vector.dot(( other).vector[0]) * elif isinstance(other, SparseVector): */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_5_cdec_DenseVector)); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_4cdec_5_cdec_DenseVector)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":85 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":85 * """vector.dot(SparseVector/DenseVector other) -> Dot product of the two vectors.""" * if isinstance(other, DenseVector): * return self.vector.dot(( other).vector[0]) # <<<<<<<<<<<<<< @@ -3961,7 +3961,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp * return self.vector.dot(( other).vector[0]) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -3969,18 +3969,18 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":86 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":86 * if isinstance(other, DenseVector): * return self.vector.dot(( other).vector[0]) * elif isinstance(other, SparseVector): # <<<<<<<<<<<<<< * return self.vector.dot(( other).vector[0]) * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) */ - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_5_cdec_SparseVector)); + __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":87 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":87 * return self.vector.dot(( other).vector[0]) * elif isinstance(other, SparseVector): * return self.vector.dot(( other).vector[0]) # <<<<<<<<<<<<<< @@ -3988,7 +3988,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->vector->dot((((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_other)->vector[0]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -3997,7 +3997,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":88 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":88 * elif isinstance(other, SparseVector): * return self.vector.dot(( other).vector[0]) * raise TypeError('cannot take the dot product of %s and SparseVector' % type(other)) # <<<<<<<<<<<<<< @@ -4023,7 +4023,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.SparseVector.dot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.dot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4032,17 +4032,17 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_13dot(struct __pyx_obj_5_cdec_Sp } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) { +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) { 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("__richcmp__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_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_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_5_cdec_12SparseVector_15__richcmp__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_x), ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_y), ((int)__pyx_v_op)); + 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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -4051,7 +4051,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":90 +/* "/home/mdenkows/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): # <<<<<<<<<<<<<< @@ -4059,7 +4059,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_16__richcmp__(PyObject *__pyx_v_ * return x.vector[0] == y.vector[0] */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_y, int __pyx_v_op) { +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 PyObject *__pyx_t_1 = NULL; @@ -4069,7 +4069,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":93 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":93 * if op == 2: # == * return x.vector[0] == y.vector[0] * elif op == 3: # != # <<<<<<<<<<<<<< @@ -4078,7 +4078,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 */ switch (__pyx_v_op) { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":91 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":91 * * def __richcmp__(SparseVector x, SparseVector y, int op): * if op == 2: # == # <<<<<<<<<<<<<< @@ -4087,7 +4087,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 */ case 2: - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":92 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":92 * def __richcmp__(SparseVector x, SparseVector y, int op): * if op == 2: # == * return x.vector[0] == y.vector[0] # <<<<<<<<<<<<<< @@ -4102,7 +4102,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 goto __pyx_L0; break; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":93 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":93 * if op == 2: # == * return x.vector[0] == y.vector[0] * elif op == 3: # != # <<<<<<<<<<<<<< @@ -4111,7 +4111,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 */ case 3: - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":94 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":94 * return x.vector[0] == y.vector[0] * elif op == 3: # != * return not (x == y) # <<<<<<<<<<<<<< @@ -4130,7 +4130,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 break; } - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":95 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":95 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<< @@ -4147,7 +4147,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.SparseVector.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4156,17 +4156,17 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_15__richcmp__(struct __pyx_obj_5 } /* Python wrapper */ -static Py_ssize_t __pyx_pw_5_cdec_12SparseVector_18__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_5_cdec_12SparseVector_18__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_17__len__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_17__len__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":97 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":97 * raise NotImplemented('comparison not implemented for SparseVector') * * def __len__(self): # <<<<<<<<<<<<<< @@ -4174,12 +4174,12 @@ static Py_ssize_t __pyx_pw_5_cdec_12SparseVector_18__len__(PyObject *__pyx_v_sel * */ -static Py_ssize_t __pyx_pf_5_cdec_12SparseVector_17__len__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":98 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":98 * * def __len__(self): * return self.vector.size() # <<<<<<<<<<<<<< @@ -4196,8 +4196,8 @@ static Py_ssize_t __pyx_pf_5_cdec_12SparseVector_17__len__(struct __pyx_obj_5_cd } /* Python wrapper */ -static int __pyx_pw_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname); /*proto*/ -static int __pyx_pw_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_arg_fname) { +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) { char *__pyx_v_fname; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -4210,16 +4210,16 @@ static int __pyx_pw_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.SparseVector.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12SparseVector_19__contains__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_19__contains__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((char *)__pyx_v_fname)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":100 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":100 * return self.vector.size() * * def __contains__(self, char* fname): # <<<<<<<<<<<<<< @@ -4227,12 +4227,12 @@ static int __pyx_pw_5_cdec_12SparseVector_20__contains__(PyObject *__pyx_v_self, * */ -static int __pyx_pf_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, char *__pyx_v_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); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":101 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":101 * * def __contains__(self, char* fname): * return self.vector.nonzero(FDConvert(fname)) # <<<<<<<<<<<<<< @@ -4249,17 +4249,17 @@ static int __pyx_pf_5_cdec_12SparseVector_19__contains__(struct __pyx_obj_5_cdec } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_21__neg__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_21__neg__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":103 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":103 * return self.vector.nonzero(FDConvert(fname)) * * def __neg__(self): # <<<<<<<<<<<<<< @@ -4267,8 +4267,8 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_22__neg__(PyObject *__pyx_v_self * result.vector = new FastSparseVector[weight_t](self.vector[0]) */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self) { - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_result = 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; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4277,20 +4277,20 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__neg__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":104 + /* "/home/mdenkows/cdec/python/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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_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)), ((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_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":105 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":105 * def __neg__(self): * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](self.vector[0]) # <<<<<<<<<<<<<< @@ -4299,7 +4299,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde */ __pyx_v_result->vector = new FastSparseVector((__pyx_v_self->vector[0])); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":106 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":106 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](self.vector[0]) * result.vector[0] *= -1.0 # <<<<<<<<<<<<<< @@ -4308,7 +4308,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde */ (__pyx_v_result->vector[0]) *= -1.0; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":107 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":107 * result.vector = new FastSparseVector[weight_t](self.vector[0]) * result.vector[0] *= -1.0 * return result # <<<<<<<<<<<<<< @@ -4324,7 +4324,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.SparseVector.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); @@ -4334,16 +4334,16 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_21__neg__(struct __pyx_obj_5_cde } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +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) { 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_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_5_cdec_12SparseVector_23__iadd__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_other)); + 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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -4352,7 +4352,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":109 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":109 * return result * * def __iadd__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<< @@ -4360,12 +4360,12 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_24__iadd__(PyObject *__pyx_v_sel * return self */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_other) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":110 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":110 * * def __iadd__(SparseVector self, SparseVector other): * self.vector[0] += other.vector[0] # <<<<<<<<<<<<<< @@ -4374,7 +4374,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) += (__pyx_v_other->vector[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":111 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":111 * def __iadd__(SparseVector self, SparseVector other): * self.vector[0] += other.vector[0] * return self # <<<<<<<<<<<<<< @@ -4394,16 +4394,16 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_23__iadd__(struct __pyx_obj_5_cd } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +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) { 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("__isub__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_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_5_cdec_12SparseVector_25__isub__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_other)); + 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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -4412,7 +4412,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_sel return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":113 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":113 * return self * * def __isub__(SparseVector self, SparseVector other): # <<<<<<<<<<<<<< @@ -4420,12 +4420,12 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_26__isub__(PyObject *__pyx_v_sel * return self */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_other) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":114 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":114 * * def __isub__(SparseVector self, SparseVector other): * self.vector[0] -= other.vector[0] # <<<<<<<<<<<<<< @@ -4434,7 +4434,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) -= (__pyx_v_other->vector[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":115 * def __isub__(SparseVector self, SparseVector other): * self.vector[0] -= other.vector[0] * return self # <<<<<<<<<<<<<< @@ -4454,8 +4454,8 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_25__isub__(struct __pyx_obj_5_cd } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar) { +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) { float __pyx_v_scalar; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -4468,16 +4468,16 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.SparseVector.__imul__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__imul__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12SparseVector_27__imul__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_27__imul__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":117 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":117 * return self * * def __imul__(SparseVector self, float scalar): # <<<<<<<<<<<<<< @@ -4485,12 +4485,12 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_28__imul__(PyObject *__pyx_v_sel * return self */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":118 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":118 * * def __imul__(SparseVector self, float scalar): * self.vector[0] *= scalar # <<<<<<<<<<<<<< @@ -4499,7 +4499,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) *= __pyx_v_scalar; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":119 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":119 * def __imul__(SparseVector self, float scalar): * self.vector[0] *= scalar * return self # <<<<<<<<<<<<<< @@ -4520,8 +4520,8 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_27__imul__(struct __pyx_obj_5_cd /* Python wrapper */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pw_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar) { +static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar); /*proto*/ +static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_arg_scalar) { float __pyx_v_scalar; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -4534,17 +4534,17 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.SparseVector.__idiv__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__idiv__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12SparseVector_29__idiv__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_29__idiv__(((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_self), ((float)__pyx_v_scalar)); __Pyx_RefNannyFinishContext(); return __pyx_r; } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":121 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":121 * return self * * def __idiv__(SparseVector self, float scalar): # <<<<<<<<<<<<<< @@ -4553,12 +4553,12 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_30__idiv__(PyObject *__pyx_v_sel */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_self, float __pyx_v_scalar) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":122 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":122 * * def __idiv__(SparseVector self, float scalar): * self.vector[0] /= scalar # <<<<<<<<<<<<<< @@ -4567,7 +4567,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cd */ (__pyx_v_self->vector[0]) /= __pyx_v_scalar; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":123 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":123 * def __idiv__(SparseVector self, float scalar): * self.vector[0] /= scalar * return self # <<<<<<<<<<<<<< @@ -4588,17 +4588,17 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_29__idiv__(struct __pyx_obj_5_cd #endif /*!(#if PY_MAJOR_VERSION < 3)*/ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +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) { 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("__add__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_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_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_5_cdec_12SparseVector_31__add__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_x), ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_y)); + 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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -4607,7 +4607,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, P return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":125 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":125 * return self * * def __add__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<< @@ -4615,8 +4615,8 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_32__add__(PyObject *__pyx_v_x, P * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_y) { - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_result = 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; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4625,20 +4625,20 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__add__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":126 + /* "/home/mdenkows/cdec/python/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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_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)), ((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_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":127 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":127 * def __add__(SparseVector x, SparseVector y): * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) # <<<<<<<<<<<<<< @@ -4647,7 +4647,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde */ __pyx_v_result->vector = new FastSparseVector(((__pyx_v_x->vector[0]) + (__pyx_v_y->vector[0]))); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":128 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":128 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] + y.vector[0]) * return result # <<<<<<<<<<<<<< @@ -4663,7 +4663,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.SparseVector.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); @@ -4673,17 +4673,17 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_31__add__(struct __pyx_obj_5_cde } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +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) { 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("__sub__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_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_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_5_cdec_12SparseVector_33__sub__(((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_x), ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_y)); + 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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -4692,7 +4692,7 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, P return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":130 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":130 * return result * * def __sub__(SparseVector x, SparseVector y): # <<<<<<<<<<<<<< @@ -4700,8 +4700,8 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_34__sub__(PyObject *__pyx_v_x, P * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cdec_SparseVector *__pyx_v_x, struct __pyx_obj_5_cdec_SparseVector *__pyx_v_y) { - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_result = 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; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4710,20 +4710,20 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__sub__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":131 + /* "/home/mdenkows/cdec/python/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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_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)), ((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_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":132 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":132 * def __sub__(SparseVector x, SparseVector y): * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) # <<<<<<<<<<<<<< @@ -4732,7 +4732,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde */ __pyx_v_result->vector = new FastSparseVector(((__pyx_v_x->vector[0]) - (__pyx_v_y->vector[0]))); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":133 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":133 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](x.vector[0] - y.vector[0]) * return result # <<<<<<<<<<<<<< @@ -4748,7 +4748,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.SparseVector.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); @@ -4758,17 +4758,17 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_33__sub__(struct __pyx_obj_5_cde } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_35__mul__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_35__mul__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":135 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":135 * return result * * def __mul__(x, y): # <<<<<<<<<<<<<< @@ -4776,10 +4776,10 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_36__mul__(PyObject *__pyx_v_x, P * cdef float scalar */ -static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_vector = 0; +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; - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_result = 0; + struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -4791,58 +4791,58 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__mul__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":138 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":138 * cdef SparseVector vector * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<< * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_5_cdec_SparseVector)); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_4cdec_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __pyx_v_x; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_3); + __pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_3); __pyx_t_3 = 0; __pyx_v_scalar = __pyx_t_4; goto __pyx_L3; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":139 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":139 * cdef float scalar * 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) */ - if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_4cdec_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __pyx_v_y; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_3); + __pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_3); __pyx_t_3 = 0; __pyx_v_scalar = __pyx_t_4; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":140 + /* "/home/mdenkows/cdec/python/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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_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)), ((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_GOTREF(__pyx_t_3); - if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":141 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":141 * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) # <<<<<<<<<<<<<< @@ -4851,7 +4851,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P */ __pyx_v_result->vector = new FastSparseVector(((__pyx_v_vector->vector[0]) * __pyx_v_scalar)); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":142 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":142 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] * scalar) * return result # <<<<<<<<<<<<<< @@ -4867,7 +4867,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.SparseVector.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_vector); @@ -4879,18 +4879,18 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_35__mul__(PyObject *__pyx_v_x, P /* Python wrapper */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pw_5_cdec_12SparseVector_38__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12SparseVector_38__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_38__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ +static PyObject *__pyx_pw_4cdec_5_cdec_12SparseVector_38__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__div__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12SparseVector_37__div__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12SparseVector_37__div__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); __Pyx_RefNannyFinishContext(); return __pyx_r; } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":144 +/* "/home/mdenkows/cdec/python/cdec/vectors.pxi":144 * return result * * def __div__(x, y): # <<<<<<<<<<<<<< @@ -4899,10 +4899,10 @@ static PyObject *__pyx_pw_5_cdec_12SparseVector_38__div__(PyObject *__pyx_v_x, P */ #if PY_MAJOR_VERSION < 3 -static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_vector = 0; +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; float __pyx_v_scalar; - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_result = 0; + struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -4914,58 +4914,58 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__div__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":147 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":147 * cdef SparseVector vector * cdef float scalar * if isinstance(x, SparseVector): vector, scalar = x, y # <<<<<<<<<<<<<< * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_5_cdec_SparseVector)); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_4cdec_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __pyx_v_x; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_y); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_3); + __pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_3); __pyx_t_3 = 0; __pyx_v_scalar = __pyx_t_4; goto __pyx_L3; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":148 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":148 * cdef float scalar * 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) */ - if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_4cdec_5_cdec_SparseVector))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __pyx_v_y; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_v_x); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_3); + __pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_3); __pyx_t_3 = 0; __pyx_v_scalar = __pyx_t_4; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":149 + /* "/home/mdenkows/cdec/python/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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_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)), ((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_GOTREF(__pyx_t_3); - if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((struct __pyx_obj_5_cdec_SparseVector *)__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":150 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":150 * else: vector, scalar = y, x * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) # <<<<<<<<<<<<<< @@ -4973,7 +4973,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P */ __pyx_v_result->vector = new FastSparseVector(((__pyx_v_vector->vector[0]) / __pyx_v_scalar)); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":151 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":151 * cdef SparseVector result = SparseVector.__new__(SparseVector) * result.vector = new FastSparseVector[weight_t](vector.vector[0] / scalar) * return result # <<<<<<<<<<<<<< @@ -4987,7 +4987,7 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.SparseVector.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SparseVector.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_vector); @@ -4999,19 +4999,19 @@ static PyObject *__pyx_pf_5_cdec_12SparseVector_37__div__(PyObject *__pyx_v_x, P #endif /*!(#if PY_MAJOR_VERSION < 3)*/ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_v_phrase); /*proto*/ -static PyMethodDef __pyx_mdef_5_cdec_1_phrase = {__Pyx_NAMESTR("_phrase"), (PyCFunction)__pyx_pw_5_cdec_1_phrase, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_5_cdec_1_phrase(PyObject *__pyx_self, PyObject *__pyx_v_phrase) { +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 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_5_cdec__phrase(__pyx_self, ((PyObject *)__pyx_v_phrase)); + __pyx_r = __pyx_pf_4cdec_5_cdec__phrase(__pyx_self, ((PyObject *)__pyx_v_phrase)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6 +/* "/home/mdenkows/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) # <<<<<<<<<<<<<< @@ -5019,25 +5019,25 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__ * cdef class NT: */ -static PyObject *__pyx_pf_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(__pyx_ptype_5_cdec___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_3_genexpr(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7_phrase_2generator18, (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_2generator18, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -5046,7 +5046,7 @@ static PyObject *__pyx_pf_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) { __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec._phrase.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec._phrase.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -5055,9 +5055,9 @@ static PyObject *__pyx_pf_5_cdec_7_phrase_genexpr(PyObject *__pyx_self) { return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)__pyx_generator->closure); + 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; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -5177,7 +5177,7 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__ return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":5 * import cdec.sa._sa as _sa * * def _phrase(phrase): # <<<<<<<<<<<<<< @@ -5185,8 +5185,8 @@ static PyObject *__pyx_gb_5_cdec_7_phrase_2generator18(__pyx_GeneratorObject *__ * */ -static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_phrase) { - struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_phrase) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5196,7 +5196,7 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_phrase", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(__pyx_ptype_5_cdec___pyx_scope_struct_2__phrase, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_2__phrase *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_2__phrase(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_2__phrase, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -5206,7 +5206,7 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6 + /* "/home/mdenkows/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) # <<<<<<<<<<<<<< @@ -5216,7 +5216,7 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO __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_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_pf_5_cdec_7_phrase_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); @@ -5237,7 +5237,7 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec._phrase", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec._phrase", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -5247,12 +5247,12 @@ static PyObject *__pyx_pf_5_cdec__phrase(CYTHON_UNUSED PyObject *__pyx_self, PyO } /* Python wrapper */ -static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5_cdec_2NT___init__[] = "NT(bytes cat, int ref=0) -> Non-terminal from category `cat`."; +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`."; #if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5_cdec_2NT___init__; +struct wrapperbase __pyx_wrapperbase_4cdec_5_cdec_2NT___init__; #endif -static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_cat = 0; unsigned int __pyx_v_ref; int __pyx_lineno = 0; @@ -5306,12 +5306,12 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.NT.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.NT.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __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_5_cdec_2NT___init__(((struct __pyx_obj_5_cdec_NT *)__pyx_v_self), __pyx_v_cat, __pyx_v_ref); + __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); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -5320,7 +5320,7 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":11 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":11 * cdef public bytes cat * cdef public unsigned ref * def __init__(self, bytes cat, unsigned ref=0): # <<<<<<<<<<<<<< @@ -5328,12 +5328,12 @@ static int __pyx_pw_5_cdec_2NT_1__init__(PyObject *__pyx_v_self, PyObject *__pyx * self.cat = cat */ -static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_cat, unsigned int __pyx_v_ref) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":13 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":13 * def __init__(self, bytes cat, unsigned ref=0): * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`.""" * self.cat = cat # <<<<<<<<<<<<<< @@ -5346,7 +5346,7 @@ static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self __Pyx_DECREF(((PyObject *)__pyx_v_self->cat)); __pyx_v_self->cat = __pyx_v_cat; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":14 * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`.""" * self.cat = cat * self.ref = ref # <<<<<<<<<<<<<< @@ -5361,17 +5361,17 @@ static int __pyx_pf_5_cdec_2NT___init__(struct __pyx_obj_5_cdec_NT *__pyx_v_self } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_2NT_3__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_2NT_2__str__(((struct __pyx_obj_5_cdec_NT *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_2NT_2__str__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":16 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":16 * self.ref = ref * * def __str__(self): # <<<<<<<<<<<<<< @@ -5379,7 +5379,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3__str__(PyObject *__pyx_v_self) { * return '[%s,%d]' % (self.cat, self.ref) */ -static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_v_self) { +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 int __pyx_t_1; @@ -5390,7 +5390,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":17 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":17 * * def __str__(self): * if self.ref > 0: # <<<<<<<<<<<<<< @@ -5400,7 +5400,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ __pyx_t_1 = ((__pyx_v_self->ref > 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":18 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":18 * def __str__(self): * if self.ref > 0: * return '[%s,%d]' % (self.cat, self.ref) # <<<<<<<<<<<<<< @@ -5428,7 +5428,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":19 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":19 * if self.ref > 0: * return '[%s,%d]' % (self.cat, self.ref) * return '[%s]' % self.cat # <<<<<<<<<<<<<< @@ -5447,7 +5447,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.NT.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.NT.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5456,17 +5456,17 @@ static PyObject *__pyx_pf_5_cdec_2NT_2__str__(struct __pyx_obj_5_cdec_NT *__pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_2NT_3cat___get__(((struct __pyx_obj_5_cdec_NT *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3cat___get__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":9 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":9 * * cdef class NT: * cdef public bytes cat # <<<<<<<<<<<<<< @@ -5474,7 +5474,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3cat_1__get__(PyObject *__pyx_v_self) { * def __init__(self, bytes cat, unsigned ref=0): */ -static PyObject *__pyx_pf_5_cdec_2NT_3cat___get__(struct __pyx_obj_5_cdec_NT *__pyx_v_self) { +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); @@ -5491,17 +5491,17 @@ static PyObject *__pyx_pf_5_cdec_2NT_3cat___get__(struct __pyx_obj_5_cdec_NT *__ } /* Python wrapper */ -static int __pyx_pw_5_cdec_2NT_3cat_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5_cdec_2NT_3cat_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_2NT_3cat_2__set__(((struct __pyx_obj_5_cdec_NT *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5_cdec_2NT_3cat_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_value) { +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 int __pyx_lineno = 0; @@ -5518,7 +5518,7 @@ static int __pyx_pf_5_cdec_2NT_3cat_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.NT.cat.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.NT.cat.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -5526,17 +5526,17 @@ static int __pyx_pf_5_cdec_2NT_3cat_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v } /* Python wrapper */ -static int __pyx_pw_5_cdec_2NT_3cat_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_5_cdec_2NT_3cat_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_5_cdec_2NT_3cat_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_5_cdec_2NT_3cat_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_2NT_3cat_4__del__(((struct __pyx_obj_5_cdec_NT *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3cat_4__del__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5_cdec_2NT_3cat_4__del__(struct __pyx_obj_5_cdec_NT *__pyx_v_self) { +static int __pyx_pf_4cdec_5_cdec_2NT_3cat_4__del__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -5552,17 +5552,17 @@ static int __pyx_pf_5_cdec_2NT_3cat_4__del__(struct __pyx_obj_5_cdec_NT *__pyx_v } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_2NT_3ref___get__(((struct __pyx_obj_5_cdec_NT *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_2NT_3ref___get__(((struct __pyx_obj_4cdec_5_cdec_NT *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":10 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":10 * cdef class NT: * cdef public bytes cat * cdef public unsigned ref # <<<<<<<<<<<<<< @@ -5570,7 +5570,7 @@ static PyObject *__pyx_pw_5_cdec_2NT_3ref_1__get__(PyObject *__pyx_v_self) { * """NT(bytes cat, int ref=0) -> Non-terminal from category `cat`.""" */ -static PyObject *__pyx_pf_5_cdec_2NT_3ref___get__(struct __pyx_obj_5_cdec_NT *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -5589,7 +5589,7 @@ static PyObject *__pyx_pf_5_cdec_2NT_3ref___get__(struct __pyx_obj_5_cdec_NT *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.NT.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.NT.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5598,17 +5598,17 @@ static PyObject *__pyx_pf_5_cdec_2NT_3ref___get__(struct __pyx_obj_5_cdec_NT *__ } /* Python wrapper */ -static int __pyx_pw_5_cdec_2NT_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5_cdec_2NT_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_5_cdec_2NT_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_5_cdec_2NT_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_2NT_3ref_2__set__(((struct __pyx_obj_5_cdec_NT *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_4cdec_5_cdec_NT *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations unsigned int __pyx_t_1; @@ -5622,7 +5622,7 @@ static int __pyx_pf_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.NT.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.NT.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -5630,12 +5630,12 @@ static int __pyx_pf_5_cdec_2NT_3ref_2__set__(struct __pyx_obj_5_cdec_NT *__pyx_v } /* Python wrapper */ -static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5_cdec_5NTRef___init__[] = "NTRef(int ref) -> Non-terminal reference."; +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."; #if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5_cdec_5NTRef___init__; +struct wrapperbase __pyx_wrapperbase_4cdec_5_cdec_5NTRef___init__; #endif -static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { unsigned int __pyx_v_ref; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -5674,16 +5674,16 @@ static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.NTRef.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.NTRef.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_5NTRef___init__(((struct __pyx_obj_5_cdec_NTRef *)__pyx_v_self), __pyx_v_ref); + __pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef___init__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self), __pyx_v_ref); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":23 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":23 * cdef class NTRef: * cdef public unsigned ref * def __init__(self, unsigned ref): # <<<<<<<<<<<<<< @@ -5691,12 +5691,12 @@ static int __pyx_pw_5_cdec_5NTRef_1__init__(PyObject *__pyx_v_self, PyObject *__ * self.ref = ref */ -static int __pyx_pf_5_cdec_5NTRef___init__(struct __pyx_obj_5_cdec_NTRef *__pyx_v_self, unsigned int __pyx_v_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); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":25 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":25 * def __init__(self, unsigned ref): * """NTRef(int ref) -> Non-terminal reference.""" * self.ref = ref # <<<<<<<<<<<<<< @@ -5711,17 +5711,17 @@ static int __pyx_pf_5_cdec_5NTRef___init__(struct __pyx_obj_5_cdec_NTRef *__pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5NTRef_2__str__(((struct __pyx_obj_5_cdec_NTRef *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef_2__str__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":27 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":27 * self.ref = ref * * def __str__(self): # <<<<<<<<<<<<<< @@ -5729,7 +5729,7 @@ static PyObject *__pyx_pw_5_cdec_5NTRef_3__str__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_5_cdec_5NTRef_2__str__(struct __pyx_obj_5_cdec_NTRef *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -5739,7 +5739,7 @@ static PyObject *__pyx_pf_5_cdec_5NTRef_2__str__(struct __pyx_obj_5_cdec_NTRef * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":28 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":28 * * def __str__(self): * return '[%d]' % self.ref # <<<<<<<<<<<<<< @@ -5761,7 +5761,7 @@ static PyObject *__pyx_pf_5_cdec_5NTRef_2__str__(struct __pyx_obj_5_cdec_NTRef * __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.NTRef.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.NTRef.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5770,17 +5770,17 @@ static PyObject *__pyx_pf_5_cdec_5NTRef_2__str__(struct __pyx_obj_5_cdec_NTRef * } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5NTRef_3ref___get__(((struct __pyx_obj_5_cdec_NTRef *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_5NTRef_3ref___get__(((struct __pyx_obj_4cdec_5_cdec_NTRef *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":22 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":22 * * cdef class NTRef: * cdef public unsigned ref # <<<<<<<<<<<<<< @@ -5788,7 +5788,7 @@ static PyObject *__pyx_pw_5_cdec_5NTRef_3ref_1__get__(PyObject *__pyx_v_self) { * """NTRef(int ref) -> Non-terminal reference.""" */ -static PyObject *__pyx_pf_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_5_cdec_NTRef *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -5807,7 +5807,7 @@ static PyObject *__pyx_pf_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_5_cdec_NTR goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.NTRef.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.NTRef.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5816,17 +5816,17 @@ static PyObject *__pyx_pf_5_cdec_5NTRef_3ref___get__(struct __pyx_obj_5_cdec_NTR } /* Python wrapper */ -static int __pyx_pw_5_cdec_5NTRef_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5_cdec_5NTRef_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_5_cdec_5NTRef_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_5_cdec_5NTRef_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5NTRef_3ref_2__set__(((struct __pyx_obj_5_cdec_NTRef *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_5_cdec_NTRef *__pyx_v_self, PyObject *__pyx_v_value) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations unsigned int __pyx_t_1; @@ -5840,14 +5840,14 @@ static int __pyx_pf_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_5_cdec_NTRef *_ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.NTRef.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.NTRef.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":30 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":30 * return '[%d]' % self.ref * * cdef TRule convert_rule(_sa.Rule rule): # <<<<<<<<<<<<<< @@ -5855,7 +5855,7 @@ static int __pyx_pf_5_cdec_5NTRef_3ref_2__set__(struct __pyx_obj_5_cdec_NTRef *_ * scores = dict(rule.scores) */ -static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_rule) { +static struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_f_4cdec_5_cdec_convert_rule(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_rule) { char *__pyx_v_lhs; PyObject *__pyx_v_scores = NULL; PyObject *__pyx_v_f = NULL; @@ -5864,7 +5864,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o int __pyx_v_i; int *__pyx_v_esyms; PyObject *__pyx_v_a = NULL; - struct __pyx_obj_5_cdec_TRule *__pyx_r = NULL; + struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -5878,7 +5878,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_rule", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":31 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":31 * * cdef TRule convert_rule(_sa.Rule rule): * lhs = _sa.sym_tocat(rule.lhs) # <<<<<<<<<<<<<< @@ -5887,7 +5887,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o */ __pyx_v_lhs = __pyx_f_4cdec_2sa_3_sa_sym_tocat(__pyx_v_rule->lhs); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":32 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":32 * cdef TRule convert_rule(_sa.Rule rule): * lhs = _sa.sym_tocat(rule.lhs) * scores = dict(rule.scores) # <<<<<<<<<<<<<< @@ -5905,7 +5905,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_v_scores = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":33 * lhs = _sa.sym_tocat(rule.lhs) * scores = dict(rule.scores) * f, e = [], [] # <<<<<<<<<<<<<< @@ -5921,7 +5921,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_v_e = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":34 * scores = dict(rule.scores) * f, e = [], [] * cdef int* fsyms = rule.f.syms # <<<<<<<<<<<<<< @@ -5931,7 +5931,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_t_3 = __pyx_v_rule->f->syms; __pyx_v_fsyms = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":35 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":35 * f, e = [], [] * cdef int* fsyms = rule.f.syms * for i in range(rule.f.n): # <<<<<<<<<<<<<< @@ -5942,7 +5942,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":36 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":36 * cdef int* fsyms = rule.f.syms * for i in range(rule.f.n): * if _sa.sym_isvar(fsyms[i]): # <<<<<<<<<<<<<< @@ -5952,7 +5952,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_t_6 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_fsyms[__pyx_v_i])) != 0); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":37 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":37 * for i in range(rule.f.n): * if _sa.sym_isvar(fsyms[i]): * f.append(NT(_sa.sym_tocat(fsyms[i]))) # <<<<<<<<<<<<<< @@ -5966,7 +5966,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_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 = 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_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__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;} @@ -5975,7 +5975,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":39 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":39 * f.append(NT(_sa.sym_tocat(fsyms[i]))) * else: * f.append(_sa.sym_tostring(fsyms[i])) # <<<<<<<<<<<<<< @@ -5990,7 +5990,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":40 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":40 * else: * f.append(_sa.sym_tostring(fsyms[i])) * cdef int* esyms = rule.e.syms # <<<<<<<<<<<<<< @@ -6000,7 +6000,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_t_3 = __pyx_v_rule->e->syms; __pyx_v_esyms = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":41 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":41 * f.append(_sa.sym_tostring(fsyms[i])) * cdef int* esyms = rule.e.syms * for i in range(rule.e.n): # <<<<<<<<<<<<<< @@ -6011,7 +6011,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":42 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":42 * cdef int* esyms = rule.e.syms * for i in range(rule.e.n): * if _sa.sym_isvar(esyms[i]): # <<<<<<<<<<<<<< @@ -6021,7 +6021,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_t_6 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_esyms[__pyx_v_i])) != 0); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":43 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":43 * for i in range(rule.e.n): * if _sa.sym_isvar(esyms[i]): * e.append(NTRef(_sa.sym_getindex(esyms[i]))) # <<<<<<<<<<<<<< @@ -6035,7 +6035,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o 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_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 = 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_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__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;} @@ -6044,7 +6044,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":45 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":45 * e.append(NTRef(_sa.sym_getindex(esyms[i]))) * else: * e.append(_sa.sym_tostring(esyms[i])) # <<<<<<<<<<<<<< @@ -6059,7 +6059,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_L8:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":46 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":46 * else: * e.append(_sa.sym_tostring(esyms[i])) * a = list(rule.alignments()) # <<<<<<<<<<<<<< @@ -6082,7 +6082,7 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o __pyx_v_a = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":47 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":47 * e.append(_sa.sym_tostring(esyms[i])) * a = list(rule.alignments()) * return TRule(lhs, f, e, scores, a) # <<<<<<<<<<<<<< @@ -6109,19 +6109,19 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o 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_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 = 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_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_2); + __pyx_r = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = ((struct __pyx_obj_5_cdec_TRule *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.convert_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.convert_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_scores); @@ -6134,12 +6134,12 @@ static struct __pyx_obj_5_cdec_TRule *__pyx_f_5_cdec_convert_rule(struct __pyx_o } /* Python wrapper */ -static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_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"; +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"; #if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5_cdec_5TRule___init__; +struct wrapperbase __pyx_wrapperbase_4cdec_5_cdec_5TRule___init__; #endif -static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_lhs = 0; PyObject *__pyx_v_f = 0; PyObject *__pyx_v_e = 0; @@ -6155,7 +6155,7 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__a,0}; PyObject* values[5] = {0,0,0,0,0}; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":52 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":52 * cdef shared_ptr[grammar.TRule]* rule * * def __init__(self, lhs, f, e, scores, a=None): # <<<<<<<<<<<<<< @@ -6225,16 +6225,16 @@ static int __pyx_pw_5_cdec_5TRule_1__init__(PyObject *__pyx_v_self, PyObject *__ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.TRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_5TRule___init__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), __pyx_v_lhs, __pyx_v_f, __pyx_v_e, __pyx_v_scores, __pyx_v_a); + __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_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_a) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations TRule *__pyx_t_1; @@ -6244,7 +6244,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":59 * scores: dictionary of feature scores * a: optional list of alignment points""" * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) # <<<<<<<<<<<<<< @@ -6259,7 +6259,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ } __pyx_v_self->rule = new boost::shared_ptr(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":60 * a: optional list of alignment points""" * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) * self.lhs = lhs # <<<<<<<<<<<<<< @@ -6268,7 +6268,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__lhs, __pyx_v_lhs) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":61 * self.rule = new shared_ptr[grammar.TRule](new grammar.TRule()) * self.lhs = lhs * self.e = e # <<<<<<<<<<<<<< @@ -6277,7 +6277,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__e, __pyx_v_e) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":62 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":62 * self.lhs = lhs * self.e = e * self.f = f # <<<<<<<<<<<<<< @@ -6286,7 +6286,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__f, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":63 * self.e = e * self.f = f * self.scores = scores # <<<<<<<<<<<<<< @@ -6295,7 +6295,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scores, __pyx_v_scores) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":64 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":64 * self.f = f * self.scores = scores * if a: # <<<<<<<<<<<<<< @@ -6305,7 +6305,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":65 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":65 * self.scores = scores * if a: * self.a = a # <<<<<<<<<<<<<< @@ -6317,7 +6317,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":66 * if a: * self.a = a * self.rule.get().ComputeArity() # <<<<<<<<<<<<<< @@ -6329,7 +6329,7 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.TRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -6337,15 +6337,15 @@ static int __pyx_pf_5_cdec_5TRule___init__(struct __pyx_obj_5_cdec_TRule *__pyx_ } /* Python wrapper */ -static void __pyx_pw_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self) { +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_5_cdec_5TRule_2__dealloc__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":68 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":68 * self.rule.get().ComputeArity() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -6353,11 +6353,11 @@ static void __pyx_pw_5_cdec_5TRule_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { +static void __pyx_pf_4cdec_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":69 * * def __dealloc__(self): * del self.rule # <<<<<<<<<<<<<< @@ -6370,17 +6370,17 @@ static void __pyx_pf_5_cdec_5TRule_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5 } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_5arity___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_5arity___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":72 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":72 * * property arity: * def __get__(self): # <<<<<<<<<<<<<< @@ -6388,7 +6388,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_5arity_1__get__(PyObject *__pyx_v_self) * */ -static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -6397,7 +6397,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_T int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":73 * property arity: * def __get__(self): * return self.rule.get().arity_ # <<<<<<<<<<<<<< @@ -6415,7 +6415,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_T goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.TRule.arity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.arity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6424,17 +6424,17 @@ static PyObject *__pyx_pf_5_cdec_5TRule_5arity___get__(struct __pyx_obj_5_cdec_T } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_1f___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1f___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":76 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":76 * * property f: * def __get__(self): # <<<<<<<<<<<<<< @@ -6442,7 +6442,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1f_1__get__(PyObject *__pyx_v_self) { * cdef WordID w */ -static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1f___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) { std::vector *__pyx_v_f_; WordID __pyx_v_w; PyObject *__pyx_v_f = 0; @@ -6461,7 +6461,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":77 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":77 * property f: * def __get__(self): * cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<< @@ -6470,7 +6470,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_f_ = (&__pyx_v_self->rule->get()->f_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":79 * cdef vector[WordID]* f_ = &self.rule.get().f_ * cdef WordID w * cdef f = [] # <<<<<<<<<<<<<< @@ -6482,7 +6482,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule __pyx_v_f = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":81 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":81 * cdef f = [] * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -6491,7 +6491,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_idx = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":82 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":82 * cdef unsigned i * cdef int idx = 0 * for i in range(f_.size()): # <<<<<<<<<<<<<< @@ -6502,7 +6502,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":83 * cdef int idx = 0 * for i in range(f_.size()): * w = f_[0][i] # <<<<<<<<<<<<<< @@ -6511,7 +6511,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_w = ((__pyx_v_f_[0])[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":84 * for i in range(f_.size()): * w = f_[0][i] * if w < 0: # <<<<<<<<<<<<<< @@ -6521,7 +6521,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule __pyx_t_4 = ((__pyx_v_w < 0) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":85 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":85 * w = f_[0][i] * if w < 0: * idx += 1 # <<<<<<<<<<<<<< @@ -6530,7 +6530,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":86 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":86 * if w < 0: * idx += 1 * f.append(NT(TDConvert(-w).c_str(), idx)) # <<<<<<<<<<<<<< @@ -6549,7 +6549,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule __Pyx_GIVEREF(__pyx_t_5); __pyx_t_1 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 86; __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -6560,7 +6560,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":88 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":88 * f.append(NT(TDConvert(-w).c_str(), idx)) * else: * f.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<< @@ -6589,7 +6589,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":89 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":89 * else: * f.append(unicode(TDConvert(w).c_str(), encoding='utf8')) * return f # <<<<<<<<<<<<<< @@ -6607,7 +6607,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec.TRule.f.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.f.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -6617,17 +6617,17 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1f___get__(struct __pyx_obj_5_cdec_TRule } /* Python wrapper */ -static int __pyx_pw_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ -static int __pyx_pw_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_1f_2__set__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_f)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":91 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":91 * return f * * def __set__(self, f): # <<<<<<<<<<<<<< @@ -6635,7 +6635,7 @@ static int __pyx_pw_5_cdec_5TRule_1f_3__set__(PyObject *__pyx_v_self, PyObject * * f_.resize(len(f)) */ -static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_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 *__pyx_v_f_; unsigned int __pyx_v_i; CYTHON_UNUSED int __pyx_v_idx; @@ -6654,7 +6654,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":92 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":92 * * def __set__(self, f): * cdef vector[WordID]* f_ = &self.rule.get().f_ # <<<<<<<<<<<<<< @@ -6663,7 +6663,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __pyx_v_f_ = (&__pyx_v_self->rule->get()->f_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":93 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":93 * def __set__(self, f): * cdef vector[WordID]* f_ = &self.rule.get().f_ * f_.resize(len(f)) # <<<<<<<<<<<<<< @@ -6673,7 +6673,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p __pyx_t_1 = PyObject_Length(__pyx_v_f); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f_->resize(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":95 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":95 * f_.resize(len(f)) * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -6682,7 +6682,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __pyx_v_idx = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":96 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":96 * cdef unsigned i * cdef int idx = 0 * for i in range(len(f)): # <<<<<<<<<<<<<< @@ -6693,7 +6693,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":97 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":97 * cdef int idx = 0 * for i in range(len(f)): * if isinstance(f[i], NT): # <<<<<<<<<<<<<< @@ -6702,12 +6702,12 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __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 = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_5_cdec_NT)); + __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":98 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":98 * for i in range(len(f)): * if isinstance(f[i], NT): * f_[0][i] = -TDConvert(( f[i]).cat) # <<<<<<<<<<<<<< @@ -6716,14 +6716,14 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_AsString(((PyObject *)((struct __pyx_obj_5_cdec_NT *)__pyx_t_3)->cat)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; ((__pyx_v_f_[0])[__pyx_v_i]) = (-TD::Convert(__pyx_t_6)); goto __pyx_L5; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":100 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":100 * f_[0][i] = -TDConvert(( f[i]).cat) * else: * fi = as_str(f[i]) # <<<<<<<<<<<<<< @@ -6732,14 +6732,14 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 100; __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_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":101 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":101 * else: * fi = as_str(f[i]) * f_[0][i] = TDConvert(fi) # <<<<<<<<<<<<<< @@ -6757,7 +6757,7 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_cdec.TRule.f.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.f.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_fi); @@ -6766,17 +6766,17 @@ static int __pyx_pf_5_cdec_5TRule_1f_2__set__(struct __pyx_obj_5_cdec_TRule *__p } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_1e___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1e___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":104 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":104 * * property e: * def __get__(self): # <<<<<<<<<<<<<< @@ -6784,7 +6784,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1e_1__get__(PyObject *__pyx_v_self) { * cdef WordID w */ -static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_1e___get__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) { std::vector *__pyx_v_e_; WordID __pyx_v_w; PyObject *__pyx_v_e = 0; @@ -6803,7 +6803,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":105 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":105 * property e: * def __get__(self): * cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<< @@ -6812,7 +6812,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_e_ = (&__pyx_v_self->rule->get()->e_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":107 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":107 * cdef vector[WordID]* e_ = &self.rule.get().e_ * cdef WordID w * cdef e = [] # <<<<<<<<<<<<<< @@ -6824,7 +6824,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule __pyx_v_e = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":109 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":109 * cdef e = [] * cdef unsigned i * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -6833,7 +6833,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_idx = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":110 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":110 * cdef unsigned i * cdef int idx = 0 * for i in range(e_.size()): # <<<<<<<<<<<<<< @@ -6844,7 +6844,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":111 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":111 * cdef int idx = 0 * for i in range(e_.size()): * w = e_[0][i] # <<<<<<<<<<<<<< @@ -6853,7 +6853,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_w = ((__pyx_v_e_[0])[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":112 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":112 * for i in range(e_.size()): * w = e_[0][i] * if w < 1: # <<<<<<<<<<<<<< @@ -6863,7 +6863,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule __pyx_t_4 = ((__pyx_v_w < 1) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":113 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":113 * w = e_[0][i] * if w < 1: * idx += 1 # <<<<<<<<<<<<<< @@ -6872,7 +6872,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_idx = (__pyx_v_idx + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":114 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":114 * if w < 1: * idx += 1 * e.append(NTRef(1-w)) # <<<<<<<<<<<<<< @@ -6886,7 +6886,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule 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_5_cdec_NTRef)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 114; __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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -6897,7 +6897,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":116 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":116 * e.append(NTRef(1-w)) * else: * e.append(unicode(TDConvert(w).c_str(), encoding='utf8')) # <<<<<<<<<<<<<< @@ -6926,7 +6926,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":117 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":117 * else: * e.append(unicode(TDConvert(w).c_str(), encoding='utf8')) * return e # <<<<<<<<<<<<<< @@ -6944,7 +6944,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec.TRule.e.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.e.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e); @@ -6954,17 +6954,17 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1e___get__(struct __pyx_obj_5_cdec_TRule } /* Python wrapper */ -static int __pyx_pw_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_e); /*proto*/ -static int __pyx_pw_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_e) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_1e_2__set__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_e)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":119 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":119 * return e * * def __set__(self, e): # <<<<<<<<<<<<<< @@ -6972,7 +6972,7 @@ static int __pyx_pw_5_cdec_5TRule_1e_3__set__(PyObject *__pyx_v_self, PyObject * * e_.resize(len(e)) */ -static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_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 *__pyx_v_e_; unsigned int __pyx_v_i; PyObject *__pyx_v_ei = NULL; @@ -6991,7 +6991,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":120 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":120 * * def __set__(self, e): * cdef vector[WordID]* e_ = &self.rule.get().e_ # <<<<<<<<<<<<<< @@ -7000,7 +7000,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __pyx_v_e_ = (&__pyx_v_self->rule->get()->e_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":121 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":121 * def __set__(self, e): * cdef vector[WordID]* e_ = &self.rule.get().e_ * e_.resize(len(e)) # <<<<<<<<<<<<<< @@ -7010,7 +7010,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p __pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_e_->resize(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":123 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":123 * e_.resize(len(e)) * cdef unsigned i * for i in range(len(e)): # <<<<<<<<<<<<<< @@ -7021,7 +7021,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":124 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":124 * cdef unsigned i * for i in range(len(e)): * if isinstance(e[i], NTRef): # <<<<<<<<<<<<<< @@ -7030,12 +7030,12 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __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 = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_5_cdec_NTRef)); + __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":125 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":125 * for i in range(len(e)): * if isinstance(e[i], NTRef): * e_[0][i] = 1-e[i].ref # <<<<<<<<<<<<<< @@ -7057,7 +7057,7 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":127 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":127 * e_[0][i] = 1-e[i].ref * else: * ei = as_str(e[i]) # <<<<<<<<<<<<<< @@ -7066,14 +7066,14 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p */ __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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_t_3, NULL)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 127; __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_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":128 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":128 * else: * ei = as_str(e[i]) * e_[0][i] = TDConvert(ei) # <<<<<<<<<<<<<< @@ -7091,27 +7091,27 @@ static int __pyx_pf_5_cdec_5TRule_1e_2__set__(struct __pyx_obj_5_cdec_TRule *__p __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec.TRule.e.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.e.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ei); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_1a___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_1a___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":131 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":131 * * property a: * def __get__(self): # <<<<<<<<<<<<<< @@ -7119,15 +7119,15 @@ static PyObject *__pyx_pw_5_cdec_5TRule_1a_1__get__(PyObject *__pyx_v_self) { * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ */ -static PyObject *__pyx_pf_5_cdec_5TRule_1a___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *__pyx_cur_scope; +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; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(__pyx_ptype_5_cdec___pyx_scope_struct_4___get__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_4___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_4___get__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -7137,7 +7137,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1a___get__(struct __pyx_obj_5_cdec_TRule __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_5TRule_1a_2generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __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); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -7146,7 +7146,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1a___get__(struct __pyx_obj_5_cdec_TRule __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.TRule.a.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.a.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -7155,9 +7155,9 @@ static PyObject *__pyx_pf_5_cdec_5TRule_1a___get__(struct __pyx_obj_5_cdec_TRule return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_4___get__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; size_t __pyx_t_1; unsigned int __pyx_t_2; @@ -7179,7 +7179,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__ __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":133 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":133 * def __get__(self): * cdef unsigned i * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ # <<<<<<<<<<<<<< @@ -7188,7 +7188,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__ */ __pyx_cur_scope->__pyx_v_a = (&__pyx_cur_scope->__pyx_v_self->rule->get()->a_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":134 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":134 * cdef unsigned i * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ * for i in range(a.size()): # <<<<<<<<<<<<<< @@ -7199,7 +7199,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":135 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":135 * cdef vector[grammar.AlignmentPoint]* a = &self.rule.get().a_ * for i in range(a.size()): * yield (a[0][i].s_, a[0][i].t_) # <<<<<<<<<<<<<< @@ -7248,17 +7248,17 @@ static PyObject *__pyx_gb_5_cdec_5TRule_1a_2generator2(__pyx_GeneratorObject *__ } /* Python wrapper */ -static int __pyx_pw_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_a); /*proto*/ -static int __pyx_pw_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_a) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_1a_3__set__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_a)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":137 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":137 * yield (a[0][i].s_, a[0][i].t_) * * def __set__(self, a): # <<<<<<<<<<<<<< @@ -7266,7 +7266,7 @@ static int __pyx_pw_5_cdec_5TRule_1a_4__set__(PyObject *__pyx_v_self, PyObject * * a_.resize(len(a)) */ -static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_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 *__pyx_v_a_; unsigned int __pyx_v_i; int __pyx_v_s; @@ -7287,7 +7287,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":138 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":138 * * def __set__(self, a): * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ # <<<<<<<<<<<<<< @@ -7296,7 +7296,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p */ __pyx_v_a_ = (&__pyx_v_self->rule->get()->a_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":139 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":139 * def __set__(self, a): * cdef vector[grammar.AlignmentPoint]* a_ = &self.rule.get().a_ * a_.resize(len(a)) # <<<<<<<<<<<<<< @@ -7306,7 +7306,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p __pyx_t_1 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_a_->resize(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":142 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":142 * cdef unsigned i * cdef int s, t * for i in range(len(a)): # <<<<<<<<<<<<<< @@ -7317,7 +7317,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":143 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":143 * cdef int s, t * for i in range(len(a)): * s, t = a[i] # <<<<<<<<<<<<<< @@ -7384,7 +7384,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p __pyx_v_s = __pyx_t_8; __pyx_v_t = __pyx_t_9; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":144 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":144 * for i in range(len(a)): * s, t = a[i] * a_[0][i] = grammar.AlignmentPoint(s, t) # <<<<<<<<<<<<<< @@ -7401,7 +7401,7 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec.TRule.a.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.a.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -7409,17 +7409,17 @@ static int __pyx_pf_5_cdec_5TRule_1a_3__set__(struct __pyx_obj_5_cdec_TRule *__p } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_6scores___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_6scores___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":147 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":147 * * property scores: * def __get__(self): # <<<<<<<<<<<<<< @@ -7427,8 +7427,8 @@ static PyObject *__pyx_pw_5_cdec_5TRule_6scores_1__get__(PyObject *__pyx_v_self) * scores.vector = new FastSparseVector[double](self.rule.get().scores_) */ -static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_scores = 0; +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; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7437,20 +7437,20 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":148 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":148 * 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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 148; __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)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_scores = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_scores = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":149 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":149 * def __get__(self): * cdef SparseVector scores = SparseVector.__new__(SparseVector) * scores.vector = new FastSparseVector[double](self.rule.get().scores_) # <<<<<<<<<<<<<< @@ -7459,7 +7459,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_ */ __pyx_v_scores->vector = new FastSparseVector(__pyx_v_self->rule->get()->scores_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":150 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":150 * cdef SparseVector scores = SparseVector.__new__(SparseVector) * scores.vector = new FastSparseVector[double](self.rule.get().scores_) * return scores # <<<<<<<<<<<<<< @@ -7475,7 +7475,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.TRule.scores.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.scores.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_scores); @@ -7485,17 +7485,17 @@ static PyObject *__pyx_pf_5_cdec_5TRule_6scores___get__(struct __pyx_obj_5_cdec_ } /* Python wrapper */ -static int __pyx_pw_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_scores); /*proto*/ -static int __pyx_pw_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_scores) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_6scores_2__set__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_scores)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":152 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":152 * return scores * * def __set__(self, scores): # <<<<<<<<<<<<<< @@ -7503,7 +7503,7 @@ static int __pyx_pw_5_cdec_5TRule_6scores_3__set__(PyObject *__pyx_v_self, PyObj * scores_.clear() */ -static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_scores) { +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 *__pyx_v_scores_; int __pyx_v_fid; float __pyx_v_fval; @@ -7527,7 +7527,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":153 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":153 * * def __set__(self, scores): * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ # <<<<<<<<<<<<<< @@ -7536,7 +7536,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_scores_ = (&__pyx_v_self->rule->get()->scores_); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":154 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":154 * def __set__(self, scores): * cdef FastSparseVector[double]* scores_ = &self.rule.get().scores_ * scores_.clear() # <<<<<<<<<<<<<< @@ -7545,7 +7545,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule */ __pyx_v_scores_->clear(); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":157 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":157 * cdef int fid * cdef float fval * for fname, fval in scores.items(): # <<<<<<<<<<<<<< @@ -7650,20 +7650,20 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule __pyx_t_5 = 0; __pyx_v_fval = __pyx_t_9; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":158 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":158 * 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_5_cdec_as_str(__pyx_v_fname, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 158; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":159 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":159 * for fname, fval in scores.items(): * fn = as_str(fname) * fid = FDConvert(fn) # <<<<<<<<<<<<<< @@ -7673,7 +7673,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule __pyx_t_10 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_fn)); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_fid = FD::Convert(__pyx_t_10); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":160 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":160 * fn = as_str(fname) * fid = FDConvert(fn) * if fid < 0: raise KeyError(fname) # <<<<<<<<<<<<<< @@ -7697,7 +7697,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":161 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":161 * fid = FDConvert(fn) * if fid < 0: raise KeyError(fname) * scores_.set_value(fid, fval) # <<<<<<<<<<<<<< @@ -7716,7 +7716,7 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_cdec.TRule.scores.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.scores.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_fname); @@ -7726,17 +7726,17 @@ static int __pyx_pf_5_cdec_5TRule_6scores_2__set__(struct __pyx_obj_5_cdec_TRule } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_3lhs___get__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_3lhs___get__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":164 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":164 * * property lhs: * def __get__(self): # <<<<<<<<<<<<<< @@ -7744,7 +7744,7 @@ static PyObject *__pyx_pw_5_cdec_5TRule_3lhs_1__get__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -7754,7 +7754,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRu int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":165 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":165 * property lhs: * def __get__(self): * return NT(TDConvert(-self.rule.get().lhs_).c_str()) # <<<<<<<<<<<<<< @@ -7769,7 +7769,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRu PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_NT)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; @@ -7781,7 +7781,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRu __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.TRule.lhs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.lhs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7790,17 +7790,17 @@ static PyObject *__pyx_pf_5_cdec_5TRule_3lhs___get__(struct __pyx_obj_5_cdec_TRu } /* Python wrapper */ -static int __pyx_pw_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_lhs); /*proto*/ -static int __pyx_pw_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_lhs) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_3lhs_2__set__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self), ((PyObject *)__pyx_v_lhs)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":167 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":167 * return NT(TDConvert(-self.rule.get().lhs_).c_str()) * * def __set__(self, lhs): # <<<<<<<<<<<<<< @@ -7808,7 +7808,7 @@ static int __pyx_pw_5_cdec_5TRule_3lhs_3__set__(PyObject *__pyx_v_self, PyObject * lhs = NT(lhs) */ -static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self, PyObject *__pyx_v_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 int __pyx_t_1; @@ -7822,18 +7822,18 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_ __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_lhs); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":168 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":168 * * def __set__(self, lhs): * if not isinstance(lhs, NT): # <<<<<<<<<<<<<< * lhs = NT(lhs) * self.rule.get().lhs_ = -TDConvert(( lhs).cat) */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_lhs, ((PyObject*)__pyx_ptype_5_cdec_NT)); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_lhs, ((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)); __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":169 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":169 * def __set__(self, lhs): * if not isinstance(lhs, NT): * lhs = NT(lhs) # <<<<<<<<<<<<<< @@ -7845,7 +7845,7 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_ __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_5_cdec_NT)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 169; __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); @@ -7855,14 +7855,14 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":170 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":170 * if not isinstance(lhs, NT): * lhs = NT(lhs) * self.rule.get().lhs_ = -TDConvert(( lhs).cat) # <<<<<<<<<<<<<< * * def __str__(self): */ - __pyx_t_5 = __Pyx_PyObject_AsString(((PyObject *)((struct __pyx_obj_5_cdec_NT *)__pyx_v_lhs)->cat)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->rule->get()->lhs_ = (-TD::Convert(__pyx_t_5)); __pyx_r = 0; @@ -7870,7 +7870,7 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.TRule.lhs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.lhs.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_lhs); @@ -7879,18 +7879,18 @@ static int __pyx_pf_5_cdec_5TRule_3lhs_2__set__(struct __pyx_obj_5_cdec_TRule *_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_5TRule_5__str__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_5TRule_4__str__(((struct __pyx_obj_5_cdec_TRule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_5TRule_4__str__(((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":173 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< @@ -7898,25 +7898,25 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj * _phrase(self.f), _phrase(self.e), scores) */ -static PyObject *__pyx_pf_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(__pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_6_genexpr(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_6_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_5TRule_7__str___2generator19, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __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___2generator19, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -7925,7 +7925,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self) { __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.TRule.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -7934,9 +7934,9 @@ static PyObject *__pyx_pf_5_cdec_5TRule_7__str___genexpr(PyObject *__pyx_self) { return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)__pyx_generator->closure); + 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; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -8035,7 +8035,7 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":172 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":172 * self.rule.get().lhs_ = -TDConvert(( lhs).cat) * * def __str__(self): # <<<<<<<<<<<<<< @@ -8043,8 +8043,8 @@ static PyObject *__pyx_gb_5_cdec_5TRule_7__str___2generator19(__pyx_GeneratorObj * return '%s ||| %s ||| %s ||| %s' % (self.lhs, */ -static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_5_cdec_5TRule_4__str__(struct __pyx_obj_4cdec_5_cdec_TRule *__pyx_v_self) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *__pyx_cur_scope; PyObject *__pyx_v_scores = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8057,7 +8057,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule * const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_5___str__(__pyx_ptype_5_cdec___pyx_scope_struct_5___str__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_5___str__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_5___str__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_5___str__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -8067,7 +8067,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule * __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":173 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":173 * * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) # <<<<<<<<<<<<<< @@ -8076,7 +8076,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule * */ __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 = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_pf_5_cdec_5TRule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 173; __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 = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -8090,7 +8090,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule * __pyx_v_scores = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":174 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":174 * def __str__(self): * scores = ' '.join('%s=%s' % feat for feat in self.scores) * return '%s ||| %s ||| %s ||| %s' % (self.lhs, # <<<<<<<<<<<<<< @@ -8101,7 +8101,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule * __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":175 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":175 * scores = ' '.join('%s=%s' % feat for feat in self.scores) * return '%s ||| %s ||| %s ||| %s' % (self.lhs, * _phrase(self.f), _phrase(self.e), scores) # <<<<<<<<<<<<<< @@ -8163,7 +8163,7 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule * __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_cdec.TRule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TRule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_scores); @@ -8174,12 +8174,12 @@ static PyObject *__pyx_pf_5_cdec_5TRule_4__str__(struct __pyx_obj_5_cdec_TRule * } /* Python wrapper */ -static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_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"; +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"; #if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5_cdec_5MRule___init__; +struct wrapperbase __pyx_wrapperbase_4cdec_5_cdec_5MRule___init__; #endif -static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_lhs = 0; PyObject *__pyx_v_rhs = 0; PyObject *__pyx_v_scores = 0; @@ -8236,16 +8236,16 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.MRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.MRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_5MRule___init__(((struct __pyx_obj_5_cdec_MRule *)__pyx_v_self), __pyx_v_lhs, __pyx_v_rhs, __pyx_v_scores); + __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); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":178 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":178 * * cdef class MRule(TRule): * def __init__(self, lhs, rhs, scores): # <<<<<<<<<<<<<< @@ -8253,7 +8253,7 @@ static int __pyx_pw_5_cdec_5MRule_1__init__(PyObject *__pyx_v_self, PyObject *__ * lhs: left hand side non-terminal */ -static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_v_self, PyObject *__pyx_v_lhs, PyObject *__pyx_v_rhs, PyObject *__pyx_v_scores) { +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; PyObject *__pyx_v_s = NULL; @@ -8272,7 +8272,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":183 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":183 * rhs: right hand side phrase (list of words/NT) * scores: dictionary of feature scores""" * cdef unsigned i = 1 # <<<<<<<<<<<<<< @@ -8281,7 +8281,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":184 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":184 * scores: dictionary of feature scores""" * cdef unsigned i = 1 * e = [] # <<<<<<<<<<<<<< @@ -8293,7 +8293,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ __pyx_v_e = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":185 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":185 * cdef unsigned i = 1 * e = [] * for s in rhs: # <<<<<<<<<<<<<< @@ -8338,18 +8338,18 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ __pyx_v_s = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":186 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":186 * e = [] * for s in rhs: * if isinstance(s, NT): # <<<<<<<<<<<<<< * e.append(NTRef(i)) * i += 1 */ - __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_s, ((PyObject*)__pyx_ptype_5_cdec_NT)); + __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_s, ((PyObject*)__pyx_ptype_4cdec_5_cdec_NT)); __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":187 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":187 * for s in rhs: * if isinstance(s, NT): * e.append(NTRef(i)) # <<<<<<<<<<<<<< @@ -8363,13 +8363,13 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ 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_5_cdec_NTRef)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__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 = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":188 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":188 * if isinstance(s, NT): * e.append(NTRef(i)) * i += 1 # <<<<<<<<<<<<<< @@ -8381,7 +8381,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":190 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":190 * i += 1 * else: * e.append(s) # <<<<<<<<<<<<<< @@ -8394,7 +8394,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":191 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":191 * else: * e.append(s) * super(MRule, self).__init__(lhs, rhs, e, scores, None) # <<<<<<<<<<<<<< @@ -8403,9 +8403,9 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ */ __pyx_t_1 = PyTuple_New(2); 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_INCREF(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_MRule))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_5_cdec_MRule))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_MRule))); + __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))); + __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)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); @@ -8444,7 +8444,7 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_cdec.MRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.MRule.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e); @@ -8454,15 +8454,15 @@ static int __pyx_pf_5_cdec_5MRule___init__(struct __pyx_obj_5_cdec_MRule *__pyx_ } /* Python wrapper */ -static void __pyx_pw_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self) { +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_5_cdec_7Grammar___dealloc__(((struct __pyx_obj_5_cdec_Grammar *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":196 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":196 * cdef shared_ptr[grammar.Grammar]* grammar * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -8470,11 +8470,11 @@ static void __pyx_pw_5_cdec_7Grammar_1__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Grammar *__pyx_v_self) { +static void __pyx_pf_4cdec_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Grammar *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":197 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":197 * * def __dealloc__(self): * del self.grammar # <<<<<<<<<<<<<< @@ -8485,20 +8485,20 @@ static void __pyx_pf_5_cdec_7Grammar___dealloc__(CYTHON_UNUSED struct __pyx_obj_ __Pyx_RefNannyFinishContext(); } -static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Grammar_2__iter__(((struct __pyx_obj_5_cdec_Grammar *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Grammar_2__iter__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":199 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":199 * del self.grammar * * def __iter__(self): # <<<<<<<<<<<<<< @@ -8506,15 +8506,15 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_3__iter__(PyObject *__pyx_v_self) { * cdef grammar.const_RuleBin* rbin = root.GetRules() */ -static PyObject *__pyx_pf_5_cdec_7Grammar_2__iter__(struct __pyx_obj_5_cdec_Grammar *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *__pyx_cur_scope; +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; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(__pyx_ptype_5_cdec___pyx_scope_struct_7___iter__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_7___iter__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_7___iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -8524,7 +8524,7 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_2__iter__(struct __pyx_obj_5_cdec_Gram __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Grammar_4generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __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); if (unlikely(!gen)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -8533,7 +8533,7 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_2__iter__(struct __pyx_obj_5_cdec_Gram __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Grammar.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Grammar.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -8542,9 +8542,9 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_2__iter__(struct __pyx_obj_5_cdec_Gram return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; int __pyx_t_1; unsigned int __pyx_t_2; @@ -8564,7 +8564,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":200 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":200 * * def __iter__(self): * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() # <<<<<<<<<<<<<< @@ -8573,7 +8573,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p */ __pyx_cur_scope->__pyx_v_root = __pyx_cur_scope->__pyx_v_self->grammar->get()->GetRoot(); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":201 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":201 * def __iter__(self): * cdef grammar.const_GrammarIter* root = self.grammar.get().GetRoot() * cdef grammar.const_RuleBin* rbin = root.GetRules() # <<<<<<<<<<<<<< @@ -8582,7 +8582,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p */ __pyx_cur_scope->__pyx_v_rbin = __pyx_cur_scope->__pyx_v_root->GetRules(); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":204 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":204 * cdef TRule trule * cdef unsigned i * for i in range(rbin.GetNumRules()): # <<<<<<<<<<<<<< @@ -8593,23 +8593,23 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":205 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":205 * 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_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_TRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __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)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_5_cdec_TRule)))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __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_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_3); + __pyx_cur_scope->__pyx_v_trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":206 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":206 * for i in range(rbin.GetNumRules()): * trule = TRule.__new__(TRule) * trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) # <<<<<<<<<<<<<< @@ -8618,7 +8618,7 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p */ __pyx_cur_scope->__pyx_v_trule->rule = new boost::shared_ptr(__pyx_cur_scope->__pyx_v_rbin->GetIthRule(__pyx_cur_scope->__pyx_v_i)); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":207 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":207 * trule = TRule.__new__(TRule) * trule.rule = new shared_ptr[grammar.TRule](rbin.GetIthRule(i)) * yield trule # <<<<<<<<<<<<<< @@ -8653,17 +8653,17 @@ static PyObject *__pyx_gb_5_cdec_7Grammar_4generator3(__pyx_GeneratorObject *__p } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Grammar_4name___get__(((struct __pyx_obj_5_cdec_Grammar *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Grammar_4name___get__(((struct __pyx_obj_4cdec_5_cdec_Grammar *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":210 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":210 * * property name: * def __get__(self): # <<<<<<<<<<<<<< @@ -8671,7 +8671,7 @@ static PyObject *__pyx_pw_5_cdec_7Grammar_4name_1__get__(PyObject *__pyx_v_self) * */ -static PyObject *__pyx_pf_5_cdec_7Grammar_4name___get__(struct __pyx_obj_5_cdec_Grammar *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -8681,7 +8681,7 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_4name___get__(struct __pyx_obj_5_cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":211 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":211 * property name: * def __get__(self): * str(self.grammar.get().GetGrammarName().c_str()) # <<<<<<<<<<<<<< @@ -8705,7 +8705,7 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_4name___get__(struct __pyx_obj_5_cdec_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Grammar.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Grammar.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8714,17 +8714,17 @@ static PyObject *__pyx_pf_5_cdec_7Grammar_4name___get__(struct __pyx_obj_5_cdec_ } /* Python wrapper */ -static int __pyx_pw_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ -static int __pyx_pw_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Grammar_4name_2__set__(((struct __pyx_obj_5_cdec_Grammar *)__pyx_v_self), ((PyObject *)__pyx_v_name)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":213 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":213 * str(self.grammar.get().GetGrammarName().c_str()) * * def __set__(self, name): # <<<<<<<<<<<<<< @@ -8732,7 +8732,7 @@ static int __pyx_pw_5_cdec_7Grammar_4name_3__set__(PyObject *__pyx_v_self, PyObj * self.grammar.get().SetGrammarName(name) */ -static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Grammar *__pyx_v_self, PyObject *__pyx_v_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 PyObject *__pyx_t_1 = NULL; @@ -8743,20 +8743,20 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_name); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":214 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":214 * * def __set__(self, name): * name = as_str(name) # <<<<<<<<<<<<<< * self.grammar.get().SetGrammarName(name) * */ - __pyx_t_1 = ((PyObject *)__pyx_f_5_cdec_as_str(__pyx_v_name, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_name); __pyx_v_name = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":215 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":215 * def __set__(self, name): * name = as_str(name) * self.grammar.get().SetGrammarName(name) # <<<<<<<<<<<<<< @@ -8770,7 +8770,7 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.Grammar.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Grammar.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_name); @@ -8779,12 +8779,12 @@ static int __pyx_pf_5_cdec_7Grammar_4name_2__set__(struct __pyx_obj_5_cdec_Gramm } /* Python wrapper */ -static int __pyx_pw_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5_cdec_11TextGrammar___init__[] = "TextGrammar(rules) -> SCFG Grammar containing the rules."; +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."; #if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5_cdec_11TextGrammar___init__; +struct wrapperbase __pyx_wrapperbase_4cdec_5_cdec_11TextGrammar___init__; #endif -static int __pyx_pw_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_rules = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -8823,16 +8823,16 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, PyObj __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.TextGrammar.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TextGrammar.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_11TextGrammar___init__(((struct __pyx_obj_5_cdec_TextGrammar *)__pyx_v_self), __pyx_v_rules); + __pyx_r = __pyx_pf_4cdec_5_cdec_11TextGrammar___init__(((struct __pyx_obj_4cdec_5_cdec_TextGrammar *)__pyx_v_self), __pyx_v_rules); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":218 +/* "/home/mdenkows/cdec/python/cdec/grammar.pxi":218 * * cdef class TextGrammar(Grammar): * def __init__(self, rules): # <<<<<<<<<<<<<< @@ -8840,7 +8840,7 @@ static int __pyx_pw_5_cdec_11TextGrammar_1__init__(PyObject *__pyx_v_self, PyObj * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) */ -static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGrammar *__pyx_v_self, PyObject *__pyx_v_rules) { +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; int __pyx_r; @@ -8856,7 +8856,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":220 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":220 * def __init__(self, rules): * """TextGrammar(rules) -> SCFG Grammar containing the rules.""" * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) # <<<<<<<<<<<<<< @@ -8865,7 +8865,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr */ __pyx_v_self->__pyx_base.grammar = new boost::shared_ptr(new TextGrammar()); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":221 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":221 * """TextGrammar(rules) -> SCFG Grammar containing the rules.""" * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) * cdef grammar.TextGrammar* _g = self.grammar.get() # <<<<<<<<<<<<<< @@ -8874,7 +8874,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr */ __pyx_v__g = ((TextGrammar *)__pyx_v_self->__pyx_base.grammar->get()); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":222 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":222 * self.grammar = new shared_ptr[grammar.Grammar](new grammar.TextGrammar()) * cdef grammar.TextGrammar* _g = self.grammar.get() * for trule in rules: # <<<<<<<<<<<<<< @@ -8919,7 +8919,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr __pyx_v_trule = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":223 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":223 * cdef grammar.TextGrammar* _g = self.grammar.get() * for trule in rules: * if isinstance(trule, _sa.Rule): # <<<<<<<<<<<<<< @@ -8930,7 +8930,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":224 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":224 * for trule in rules: * if isinstance(trule, _sa.Rule): * trule = convert_rule(trule) # <<<<<<<<<<<<<< @@ -8938,7 +8938,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr * raise ValueError('the grammar should contain TRule objects') */ 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 = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = ((PyObject *)__pyx_f_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 = 224; __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 = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_v_trule); __pyx_v_trule = __pyx_t_4; @@ -8946,18 +8946,18 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr goto __pyx_L5; } - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":225 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":225 * if isinstance(trule, _sa.Rule): * trule = convert_rule(trule) * elif not isinstance(trule, TRule): # <<<<<<<<<<<<<< * raise ValueError('the grammar should contain TRule objects') * _g.AddRule(( trule).rule[0]) */ - __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_trule, ((PyObject*)__pyx_ptype_5_cdec_TRule)); + __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_trule, ((PyObject*)__pyx_ptype_4cdec_5_cdec_TRule)); __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":226 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":226 * trule = convert_rule(trule) * elif not isinstance(trule, TRule): * raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<< @@ -8972,12 +8972,12 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":227 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":227 * elif not isinstance(trule, TRule): * raise ValueError('the grammar should contain TRule objects') * _g.AddRule(( trule).rule[0]) # <<<<<<<<<<<<<< */ - __pyx_v__g->AddRule((((struct __pyx_obj_5_cdec_TRule *)__pyx_v_trule)->rule[0])); + __pyx_v__g->AddRule((((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_trule)->rule[0])); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -8986,7 +8986,7 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.TextGrammar.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.TextGrammar.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_trule); @@ -8995,15 +8995,15 @@ static int __pyx_pf_5_cdec_11TextGrammar___init__(struct __pyx_obj_5_cdec_TextGr } /* Python wrapper */ -static void __pyx_pw_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_self) { +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_5_cdec_10Hypergraph___dealloc__(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_10Hypergraph___dealloc__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":8 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":8 * cdef MT19937* rng * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -9011,12 +9011,12 @@ static void __pyx_pw_5_cdec_10Hypergraph_1__dealloc__(PyObject *__pyx_v_self) { * if self.rng != NULL: */ -static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":9 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":9 * * def __dealloc__(self): * del self.hg # <<<<<<<<<<<<<< @@ -9025,7 +9025,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp */ delete __pyx_v_self->hg; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":10 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":10 * def __dealloc__(self): * del self.hg * if self.rng != NULL: # <<<<<<<<<<<<<< @@ -9035,7 +9035,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp __pyx_t_1 = ((__pyx_v_self->rng != NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":11 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":11 * del self.hg * if self.rng != NULL: * del self.rng # <<<<<<<<<<<<<< @@ -9050,7 +9050,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":13 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":13 * del self.rng * * cdef MT19937* _rng(self): # <<<<<<<<<<<<<< @@ -9058,7 +9058,7 @@ static void __pyx_pf_5_cdec_10Hypergraph___dealloc__(struct __pyx_obj_5_cdec_Hyp * self.rng = new MT19937() */ -static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { +static MT19937 *__pyx_f_4cdec_5_cdec_10Hypergraph__rng(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) { MT19937 *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -9068,7 +9068,7 @@ static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_rng", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":14 * * cdef MT19937* _rng(self): * if self.rng == NULL: # <<<<<<<<<<<<<< @@ -9078,7 +9078,7 @@ static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergr __pyx_t_1 = ((__pyx_v_self->rng == NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":15 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":15 * cdef MT19937* _rng(self): * if self.rng == NULL: * self.rng = new MT19937() # <<<<<<<<<<<<<< @@ -9096,7 +9096,7 @@ static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergr } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":16 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":16 * if self.rng == NULL: * self.rng = new MT19937() * return self.rng # <<<<<<<<<<<<<< @@ -9109,7 +9109,7 @@ static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergr __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("_cdec.Hypergraph._rng", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec._cdec.Hypergraph._rng", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -9117,18 +9117,18 @@ static MT19937 *__pyx_f_5_cdec_10Hypergraph__rng(struct __pyx_obj_5_cdec_Hypergr } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_2viterbi[] = "hg.viterbi() -> String for the best hypothesis in the hypergraph."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("viterbi (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_2viterbi(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":18 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":18 * return self.rng * * def viterbi(self): # <<<<<<<<<<<<<< @@ -9136,7 +9136,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_3viterbi(PyObject *__pyx_v_self, C * cdef vector[WordID] trans */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) { std::vector __pyx_v_trans; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -9147,7 +9147,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":21 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":21 * """hg.viterbi() -> String for the best hypothesis in the hypergraph.""" * cdef vector[WordID] trans * hypergraph.ViterbiESentence(self.hg[0], &trans) # <<<<<<<<<<<<<< @@ -9156,7 +9156,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H */ ViterbiESentence((__pyx_v_self->hg[0]), (&__pyx_v_trans)); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":22 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":22 * cdef vector[WordID] trans * hypergraph.ViterbiESentence(self.hg[0], &trans) * return unicode(GetString(trans).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9186,7 +9186,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Hypergraph.viterbi", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.viterbi", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9195,18 +9195,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_2viterbi(struct __pyx_obj_5_cdec_H } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_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 "; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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 "; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("viterbi_trees (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_4viterbi_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":24 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":24 * return unicode(GetString(trans).c_str(), 'utf8') * * def viterbi_trees(self): # <<<<<<<<<<<<<< @@ -9214,7 +9214,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees(PyObject *__pyx_v_s * f_tree: Source tree for the best hypothesis in the hypergraph. */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { +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; PyObject *__pyx_r = NULL; @@ -9226,7 +9226,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_trees", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":29 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":29 * e_tree: Target tree for the best hypothesis in the hypergraph. * """ * f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9249,7 +9249,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_ __pyx_v_f_tree = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":30 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":30 * """ * f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8') * e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9272,7 +9272,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_ __pyx_v_e_tree = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":31 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":31 * f_tree = unicode(hypergraph.ViterbiFTree(self.hg[0]).c_str(), 'utf8') * e_tree = unicode(hypergraph.ViterbiETree(self.hg[0]).c_str(), 'utf8') * return (f_tree, e_tree) # <<<<<<<<<<<<<< @@ -9297,7 +9297,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Hypergraph.viterbi_trees", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.viterbi_trees", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f_tree); @@ -9308,18 +9308,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4viterbi_trees(struct __pyx_obj_5_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_6viterbi_features[] = "hg.viterbi_features() -> SparseVector with the features corresponding\n to the best derivation in the hypergraph."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("viterbi_features (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_6viterbi_features(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_6viterbi_features(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":33 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":33 * return (f_tree, e_tree) * * def viterbi_features(self): # <<<<<<<<<<<<<< @@ -9327,8 +9327,8 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_7viterbi_features(PyObject *__pyx_ * to the best derivation in the hypergraph.""" */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_fmap = 0; +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; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9337,20 +9337,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_features", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":36 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":36 * """hg.viterbi_features() -> SparseVector with the features corresponding * to the best derivation in the hypergraph.""" * cdef SparseVector fmap = SparseVector.__new__(SparseVector) # <<<<<<<<<<<<<< * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) * return fmap */ - __pyx_t_1 = __pyx_tp_new_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_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)), ((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_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":37 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":37 * to the best derivation in the hypergraph.""" * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) # <<<<<<<<<<<<<< @@ -9359,7 +9359,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj */ __pyx_v_fmap->vector = new FastSparseVector(ViterbiFeatures((__pyx_v_self->hg[0]))); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":38 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":38 * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](hypergraph.ViterbiFeatures(self.hg[0])) * return fmap # <<<<<<<<<<<<<< @@ -9375,7 +9375,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.Hypergraph.viterbi_features", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.viterbi_features", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_fmap); @@ -9385,17 +9385,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6viterbi_features(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("viterbi_forest (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_8viterbi_forest(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":40 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":40 * return fmap * * def viterbi_forest(self): # <<<<<<<<<<<<<< @@ -9403,8 +9403,8 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_9viterbi_forest(PyObject *__pyx_v_ * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_hg = 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; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9413,19 +9413,19 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_forest", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":41 + /* "/home/mdenkows/cdec/python/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_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 = 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_GOTREF(__pyx_t_1); - __pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_1); + __pyx_v_hg = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":42 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":42 * def viterbi_forest(self): * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) # <<<<<<<<<<<<<< @@ -9434,7 +9434,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5 */ __pyx_v_hg->hg = new Hypergraph(((__pyx_v_self->hg[0]).CreateViterbiHypergraph(NULL).get()[0])); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":43 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":43 * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(self.hg[0].CreateViterbiHypergraph(NULL).get()[0]) * return hg # <<<<<<<<<<<<<< @@ -9450,7 +9450,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5 goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.Hypergraph.viterbi_forest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.viterbi_forest", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_hg); @@ -9460,18 +9460,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_8viterbi_forest(struct __pyx_obj_5 } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_10viterbi_joshua[] = "hg.viterbi_joshua() -> Joshua representation of the best derivation."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("viterbi_joshua (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_10viterbi_joshua(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_10viterbi_joshua(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":45 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":45 * return hg * * def viterbi_joshua(self): # <<<<<<<<<<<<<< @@ -9479,7 +9479,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_11viterbi_joshua(PyObject *__pyx_v * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_10viterbi_joshua(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -9489,7 +9489,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_10viterbi_joshua(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("viterbi_joshua", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":47 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":47 * def viterbi_joshua(self): * """hg.viterbi_joshua() -> Joshua representation of the best derivation.""" * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9519,28 +9519,28 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_10viterbi_joshua(struct __pyx_obj_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Hypergraph.viterbi_joshua", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.viterbi_joshua", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_12kbest[] = "hg.kbest(size) -> List of k-best hypotheses in the hypergraph."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_self, PyObject *__pyx_v_size) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_self, PyObject *__pyx_v_size) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("kbest (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_12kbest(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_12kbest(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":49 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":49 * return unicode(hypergraph.JoshuaVisualizationString(self.hg[0]).c_str(), 'utf8') * * def kbest(self, size): # <<<<<<<<<<<<<< @@ -9548,15 +9548,15 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_13kbest(PyObject *__pyx_v_self, Py * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal](self.hg[0], size) */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) { - struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *__pyx_cur_scope; +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; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("kbest", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)__pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest(__pyx_ptype_5_cdec___pyx_scope_struct_8_kbest, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_8_kbest(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_8_kbest, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -9569,7 +9569,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_5_cdec_Hy __Pyx_INCREF(__pyx_cur_scope->__pyx_v_size); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_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); 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; @@ -9578,7 +9578,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_5_cdec_Hy __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Hypergraph.kbest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.kbest", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -9587,9 +9587,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_12kbest(struct __pyx_obj_5_cdec_Hy return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *)__pyx_generator->closure); PyObject *__pyx_r = NULL; unsigned int __pyx_t_1; long __pyx_t_2; @@ -9611,7 +9611,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":51 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":51 * def kbest(self, size): * """hg.kbest(size) -> List of k-best hypotheses in the hypergraph.""" * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal]* derivations = new kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -9621,7 +9621,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject __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,ESentenceTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":54 * cdef kbest.KBestDerivations[vector[WordID], kbest.ESentenceTraversal].Derivation* derivation * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -9630,7 +9630,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject */ /*try:*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":55 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":55 * cdef unsigned k * try: * for k in range(size): # <<<<<<<<<<<<<< @@ -9641,7 +9641,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":56 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":56 * try: * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -9650,7 +9650,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject */ __pyx_cur_scope->__pyx_v_derivation = __pyx_cur_scope->__pyx_v_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":57 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":57 * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break # <<<<<<<<<<<<<< @@ -9664,7 +9664,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject } __pyx_L9:; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":58 * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break * yield unicode(GetString(derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9701,7 +9701,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject __pyx_L8_break:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":60 * yield unicode(GetString(derivation._yield).c_str(), 'utf8') * finally: * del derivations # <<<<<<<<<<<<<< @@ -9748,21 +9748,21 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_14generator4(__pyx_GeneratorObject __Pyx_RefNannyFinishContext(); return NULL; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_16kbest_trees(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_15kbest_trees[] = "hg.kbest_trees(size) -> List of k-best trees in the hypergraph."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_16kbest_trees(PyObject *__pyx_v_self, PyObject *__pyx_v_size) { +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 hypergraph."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_16kbest_trees(PyObject *__pyx_v_self, PyObject *__pyx_v_size) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("kbest_trees (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_15kbest_trees(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_15kbest_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":62 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":62 * del derivations * * def kbest_trees(self, size): # <<<<<<<<<<<<<< @@ -9770,15 +9770,15 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_16kbest_trees(PyObject *__pyx_v_se * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size) */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) { - struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *__pyx_cur_scope; +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; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("kbest_trees", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)__pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees(__pyx_ptype_5_cdec___pyx_scope_struct_9_kbest_trees, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -9791,7 +9791,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_obj_5_c __Pyx_INCREF(__pyx_cur_scope->__pyx_v_size); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_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); 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; @@ -9800,7 +9800,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_obj_5_c __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Hypergraph.kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.kbest_trees", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -9809,9 +9809,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_15kbest_trees(struct __pyx_obj_5_c return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *)__pyx_generator->closure); PyObject *__pyx_r = NULL; unsigned int __pyx_t_1; long __pyx_t_2; @@ -9835,7 +9835,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":64 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":64 * def kbest_trees(self, size): * """hg.kbest_trees(size) -> List of k-best trees in the hypergraph.""" * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -9845,7 +9845,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __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,FTreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":66 * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal]* f_derivations = new kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal](self.hg[0], size) * cdef kbest.KBestDerivations[vector[WordID], kbest.FTreeTraversal].Derivation* f_derivation * cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal]* e_derivations = new kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -9855,7 +9855,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __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,ETreeTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":69 * cdef kbest.KBestDerivations[vector[WordID], kbest.ETreeTraversal].Derivation* e_derivation * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -9864,7 +9864,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject */ /*try:*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":70 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":70 * cdef unsigned k * try: * for k in range(size): # <<<<<<<<<<<<<< @@ -9875,7 +9875,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":71 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":71 * try: * for k in range(size): * f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -9884,7 +9884,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject */ __pyx_cur_scope->__pyx_v_f_derivation = __pyx_cur_scope->__pyx_v_f_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":72 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":72 * for k in range(size): * f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -9893,7 +9893,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject */ __pyx_cur_scope->__pyx_v_e_derivation = __pyx_cur_scope->__pyx_v_e_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":73 * f_derivation = f_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not f_derivation or not e_derivation: break # <<<<<<<<<<<<<< @@ -9913,7 +9913,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject } __pyx_L9:; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":74 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":74 * e_derivation = e_derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not f_derivation or not e_derivation: break * f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9939,7 +9939,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_cur_scope->__pyx_v_f_tree = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":75 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":75 * if not f_derivation or not e_derivation: break * f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8') * e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -9965,7 +9965,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_cur_scope->__pyx_v_e_tree = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":76 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":76 * f_tree = unicode(GetString(f_derivation._yield).c_str(), 'utf8') * e_tree = unicode(GetString(e_derivation._yield).c_str(), 'utf8') * yield (f_tree, e_tree) # <<<<<<<<<<<<<< @@ -9997,7 +9997,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_L8_break:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":78 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":78 * yield (f_tree, e_tree) * finally: * del f_derivations # <<<<<<<<<<<<<< @@ -10021,7 +10021,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __pyx_L6:; delete __pyx_cur_scope->__pyx_v_f_derivations; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":79 * finally: * del f_derivations * del e_derivations # <<<<<<<<<<<<<< @@ -10053,21 +10053,21 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_17generator5(__pyx_GeneratorObject __Pyx_RefNannyFinishContext(); return NULL; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_19kbest_features(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_18kbest_features[] = "hg.kbest_trees(size) -> List of k-best feature vectors in the hypergraph."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_19kbest_features(PyObject *__pyx_v_self, PyObject *__pyx_v_size) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_19kbest_features(PyObject *__pyx_v_self, PyObject *__pyx_v_size) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("kbest_features (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_18kbest_features(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_18kbest_features(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_size)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":81 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":81 * del e_derivations * * def kbest_features(self, size): # <<<<<<<<<<<<<< @@ -10075,15 +10075,15 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_19kbest_features(PyObject *__pyx_v * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal](self.hg[0], size) */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_18kbest_features(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_size) { - struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_cur_scope; +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; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("kbest_features", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(__pyx_ptype_5_cdec___pyx_scope_struct_10_kbest_features, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_10_kbest_features(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -10096,7 +10096,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_18kbest_features(struct __pyx_obj_ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_size); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_size); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_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); 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; @@ -10105,7 +10105,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_18kbest_features(struct __pyx_obj_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Hypergraph.kbest_features", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.kbest_features", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -10114,9 +10114,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_18kbest_features(struct __pyx_obj_ return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_10_kbest_features *)__pyx_generator->closure); PyObject *__pyx_r = NULL; unsigned int __pyx_t_1; long __pyx_t_2; @@ -10137,7 +10137,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":83 * def kbest_features(self, size): * """hg.kbest_trees(size) -> List of k-best feature vectors in the hypergraph.""" * cdef kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal]* derivations = new kbest.KBestDerivations[FastSparseVector[weight_t], kbest.FeatureVectorTraversal](self.hg[0], size) # <<<<<<<<<<<<<< @@ -10147,7 +10147,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject __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,FeatureVectorTraversal>((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":87 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":87 * cdef SparseVector fmap * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -10156,7 +10156,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject */ /*try:*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":88 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":88 * cdef unsigned k * try: * for k in range(size): # <<<<<<<<<<<<<< @@ -10167,7 +10167,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_2; __pyx_t_1+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":89 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":89 * try: * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) # <<<<<<<<<<<<<< @@ -10176,7 +10176,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject */ __pyx_cur_scope->__pyx_v_derivation = __pyx_cur_scope->__pyx_v_derivations->LazyKthBest((__pyx_cur_scope->__pyx_v_self->hg->nodes_.size() - 1), __pyx_cur_scope->__pyx_v_k); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":90 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":90 * for k in range(size): * derivation = derivations.LazyKthBest(self.hg.nodes_.size() - 1, k) * if not derivation: break # <<<<<<<<<<<<<< @@ -10190,23 +10190,23 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject } __pyx_L9:; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":91 + /* "/home/mdenkows/cdec/python/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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_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)), ((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_GOTREF(__pyx_t_4); - if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_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;} __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_fmap)); __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_4); + __pyx_cur_scope->__pyx_v_fmap = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":92 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":92 * if not derivation: break * fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](derivation._yield) # <<<<<<<<<<<<<< @@ -10215,7 +10215,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject */ __pyx_cur_scope->__pyx_v_fmap->vector = new FastSparseVector(__pyx_cur_scope->__pyx_v_derivation->yield); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":93 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":93 * fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](derivation._yield) * yield fmap # <<<<<<<<<<<<<< @@ -10239,7 +10239,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject __pyx_L8_break:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":95 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":95 * yield fmap * finally: * del derivations # <<<<<<<<<<<<<< @@ -10284,12 +10284,12 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_20generator6(__pyx_GeneratorObject __Pyx_RefNannyFinishContext(); return NULL; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_21sample[] = "hg.sample(n) -> Sample of n hypotheses from the hypergraph."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) { +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/ +static char __pyx_doc_4cdec_5_cdec_10Hypergraph_21sample[] = "hg.sample(n) -> Sample of n hypotheses from the hypergraph."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) { unsigned int __pyx_v_n; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -10302,16 +10302,16 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.Hypergraph.sample", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.sample", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_21sample(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_21sample(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":97 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":97 * del derivations * * def sample(self, unsigned n): # <<<<<<<<<<<<<< @@ -10319,15 +10319,15 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_22sample(PyObject *__pyx_v_self, P * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_21sample(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) { - struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_21sample(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *__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", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(__pyx_ptype_5_cdec___pyx_scope_struct_11_sample, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_sample(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_11_sample, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -10338,7 +10338,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_21sample(struct __pyx_obj_5_cdec_H __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __pyx_cur_scope->__pyx_v_n = __pyx_v_n; { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_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); 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; @@ -10347,7 +10347,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_21sample(struct __pyx_obj_5_cdec_H __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Hypergraph.sample", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.sample", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -10356,9 +10356,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_21sample(struct __pyx_obj_5_cdec_H return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *)__pyx_generator->closure); PyObject *__pyx_r = NULL; std::vector *__pyx_t_1; size_t __pyx_t_2; @@ -10380,7 +10380,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":99 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":99 * def sample(self, unsigned n): * """hg.sample(n) -> Sample of n hypotheses from the hypergraph.""" * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() # <<<<<<<<<<<<<< @@ -10395,16 +10395,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject } __pyx_cur_scope->__pyx_v_hypos = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":100 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":100 * """hg.sample(n) -> Sample of n hypotheses from the hypergraph.""" * cdef vector[hypergraph.Hypothesis]* hypos = new vector[hypergraph.Hypothesis]() * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos) # <<<<<<<<<<<<<< * cdef unsigned k * try: */ - HypergraphSampler::sample_hypotheses((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_5_cdec_Hypergraph *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_rng(__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_hypos); + 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); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":102 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":102 * hypergraph.sample_hypotheses(self.hg[0], n, self._rng(), hypos) * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -10413,7 +10413,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject */ /*try:*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":103 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":103 * cdef unsigned k * try: * for k in range(hypos.size()): # <<<<<<<<<<<<<< @@ -10424,7 +10424,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":104 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":104 * try: * for k in range(hypos.size()): * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -10460,7 +10460,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject } } - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":106 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":106 * yield unicode(GetString(hypos[0][k].words).c_str(), 'utf8') * finally: * del hypos # <<<<<<<<<<<<<< @@ -10507,12 +10507,12 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_23generator7(__pyx_GeneratorObject __Pyx_RefNannyFinishContext(); return NULL; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_25sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_24sample_trees[] = "hg.sample_trees(n) -> Sample of n trees from the hypergraph."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_25sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) { +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_25sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/ +static char __pyx_doc_4cdec_5_cdec_10Hypergraph_24sample_trees[] = "hg.sample_trees(n) -> Sample of n trees from the hypergraph."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_25sample_trees(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) { unsigned int __pyx_v_n; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -10525,16 +10525,16 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_25sample_trees(PyObject *__pyx_v_s } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.Hypergraph.sample_trees", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_5_cdec_10Hypergraph_24sample_trees(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_24sample_trees(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((unsigned int)__pyx_v_n)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":108 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":108 * del hypos * * def sample_trees(self, unsigned n): # <<<<<<<<<<<<<< @@ -10542,15 +10542,15 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_25sample_trees(PyObject *__pyx_v_s * cdef vector[string]* trees = new vector[string]() */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_24sample_trees(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, unsigned int __pyx_v_n) { - struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_24sample_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_12_sample_trees *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("sample_trees", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)__pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees(__pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_sample_trees(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_12_sample_trees, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -10561,7 +10561,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_24sample_trees(struct __pyx_obj_5_ __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __pyx_cur_scope->__pyx_v_n = __pyx_v_n; { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_26generator8, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __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); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -10570,7 +10570,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_24sample_trees(struct __pyx_obj_5_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Hypergraph.sample_trees", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.sample_trees", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -10579,9 +10579,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_24sample_trees(struct __pyx_obj_5_ return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *)__pyx_generator->closure); PyObject *__pyx_r = NULL; std::vector *__pyx_t_1; size_t __pyx_t_2; @@ -10603,7 +10603,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":110 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":110 * def sample_trees(self, unsigned n): * """hg.sample_trees(n) -> Sample of n trees from the hypergraph.""" * cdef vector[string]* trees = new vector[string]() # <<<<<<<<<<<<<< @@ -10618,16 +10618,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject } __pyx_cur_scope->__pyx_v_trees = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":111 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":111 * """hg.sample_trees(n) -> Sample of n trees from the hypergraph.""" * cdef vector[string]* trees = new vector[string]() * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees) # <<<<<<<<<<<<<< * cdef unsigned k * try: */ - HypergraphSampler::sample_trees((__pyx_cur_scope->__pyx_v_self->hg[0]), __pyx_cur_scope->__pyx_v_n, ((struct __pyx_vtabstruct_5_cdec_Hypergraph *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->_rng(__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_trees); + 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); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":113 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":113 * hypergraph.sample_trees(self.hg[0], n, self._rng(), trees) * cdef unsigned k * try: # <<<<<<<<<<<<<< @@ -10636,7 +10636,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject */ /*try:*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":114 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":114 * cdef unsigned k * try: * for k in range(trees.size()): # <<<<<<<<<<<<<< @@ -10647,7 +10647,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_cur_scope->__pyx_v_k = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":115 * try: * for k in range(trees.size()): * yield unicode(trees[0][k].c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -10683,7 +10683,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject } } - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":117 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":117 * yield unicode(trees[0][k].c_str(), 'utf8') * finally: * del trees # <<<<<<<<<<<<<< @@ -10732,18 +10732,18 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_26generator8(__pyx_GeneratorObject } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_28intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_27intersect[] = "hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_28intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp) { +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_28intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp); /*proto*/ +static char __pyx_doc_4cdec_5_cdec_10Hypergraph_27intersect[] = "hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_28intersect(PyObject *__pyx_v_self, PyObject *__pyx_v_inp) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("intersect (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_27intersect(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_inp)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_27intersect(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_inp)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":119 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":119 * del trees * * def intersect(self, inp): # <<<<<<<<<<<<<< @@ -10751,8 +10751,8 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_28intersect(PyObject *__pyx_v_self * cdef Lattice lat */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_inp) { - struct __pyx_obj_5_cdec_Lattice *__pyx_v_lat = 0; +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_27intersect(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 int __pyx_t_1; @@ -10764,30 +10764,30 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intersect", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":122 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":122 * """hg.intersect(Lattice/string): Intersect the hypergraph with the provided reference.""" * cdef Lattice lat * if isinstance(inp, Lattice): # <<<<<<<<<<<<<< * lat = inp * elif isinstance(inp, basestring): */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_inp, ((PyObject*)__pyx_ptype_5_cdec_Lattice)); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_inp, ((PyObject*)__pyx_ptype_4cdec_5_cdec_Lattice)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":123 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":123 * cdef Lattice lat * if isinstance(inp, Lattice): * lat = inp # <<<<<<<<<<<<<< * elif isinstance(inp, basestring): * lat = Lattice(inp) */ - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_inp))); - __pyx_v_lat = ((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_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); goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":124 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":124 * if isinstance(inp, Lattice): * lat = inp * elif isinstance(inp, basestring): # <<<<<<<<<<<<<< @@ -10798,7 +10798,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":125 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":125 * lat = inp * elif isinstance(inp, basestring): * lat = Lattice(inp) # <<<<<<<<<<<<<< @@ -10810,16 +10810,16 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde __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_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_lat = ((struct __pyx_obj_5_cdec_Lattice *)__pyx_t_4); + __pyx_v_lat = ((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L3; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":127 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":127 * lat = Lattice(inp) * else: * raise TypeError('cannot intersect hypergraph with %s' % type(inp)) # <<<<<<<<<<<<<< @@ -10842,7 +10842,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":128 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":128 * else: * raise TypeError('cannot intersect hypergraph with %s' % type(inp)) * return hypergraph.Intersect(lat.lattice[0], self.hg) # <<<<<<<<<<<<<< @@ -10861,7 +10861,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.Hypergraph.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_lat); @@ -10871,9 +10871,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_27intersect(struct __pyx_obj_5_cde } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_30prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_29prune[] = "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_5_cdec_10Hypergraph_30prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_30prune(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cdec_5_cdec_10Hypergraph_29prune[] = "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_30prune(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; @@ -10931,17 +10931,17 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_30prune(PyObject *__pyx_v_self, Py __Pyx_RaiseArgtupleInvalid("prune", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("_cdec.Hypergraph.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_29prune(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), __pyx_v_beam_alpha, __pyx_v_density, __pyx_v_kwargs); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_29prune(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), __pyx_v_beam_alpha, __pyx_v_density, __pyx_v_kwargs); __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":130 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":130 * return hypergraph.Intersect(lat.lattice[0], self.hg) * * def prune(self, beam_alpha=0, density=0, **kwargs): # <<<<<<<<<<<<<< @@ -10949,7 +10949,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_30prune(PyObject *__pyx_v_self, Py * beam_alpha: use beam pruning */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_beam_alpha, PyObject *__pyx_v_density, PyObject *__pyx_v_kwargs) { +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_29prune(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 *__pyx_v_preserve_mask; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10962,7 +10962,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy int __pyx_clineno = 0; __Pyx_RefNannySetupContext("prune", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":134 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":134 * beam_alpha: use beam pruning * density: use density pruning""" * cdef hypergraph.EdgeMask* preserve_mask = NULL # <<<<<<<<<<<<<< @@ -10971,7 +10971,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy */ __pyx_v_preserve_mask = NULL; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":135 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":135 * density: use density pruning""" * cdef hypergraph.EdgeMask* preserve_mask = NULL * if 'csplit_preserve_full_word' in kwargs: # <<<<<<<<<<<<<< @@ -10982,7 +10982,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":136 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":136 * cdef hypergraph.EdgeMask* preserve_mask = NULL * if 'csplit_preserve_full_word' in kwargs: * preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) # <<<<<<<<<<<<<< @@ -10991,7 +10991,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy */ __pyx_v_preserve_mask = new std::vector(__pyx_v_self->hg->edges_.size()); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":137 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":137 * if 'csplit_preserve_full_word' in kwargs: * preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) * preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True # <<<<<<<<<<<<<< @@ -11003,7 +11003,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":138 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":138 * preserve_mask = new hypergraph.EdgeMask(self.hg.edges_.size()) * preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True * self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) # <<<<<<<<<<<<<< @@ -11014,7 +11014,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_density); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->hg->PruneInsideOutside(__pyx_t_3, __pyx_t_4, __pyx_v_preserve_mask, 0, 1.0, 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":139 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":139 * preserve_mask[0][hypergraph.GetFullWordEdgeIndex(self.hg[0])] = True * self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) * if preserve_mask: # <<<<<<<<<<<<<< @@ -11024,7 +11024,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy __pyx_t_2 = (__pyx_v_preserve_mask != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":140 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":140 * self.hg.PruneInsideOutside(beam_alpha, density, preserve_mask, False, 1, False) * if preserve_mask: * del preserve_mask # <<<<<<<<<<<<<< @@ -11039,7 +11039,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Hypergraph.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11048,18 +11048,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_29prune(struct __pyx_obj_5_cdec_Hy } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_32lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_31lattice[] = "hg.lattice() -> Lattice corresponding to the hypergraph."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_32lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_32lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_4cdec_5_cdec_10Hypergraph_31lattice[] = "hg.lattice() -> Lattice corresponding to the hypergraph."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_32lattice(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lattice (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_31lattice(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_31lattice(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":142 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":142 * del preserve_mask * * def lattice(self): # TODO direct hg -> lattice conversion in cdec # <<<<<<<<<<<<<< @@ -11067,7 +11067,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_32lattice(PyObject *__pyx_v_self, * cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str() */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) { PyObject *__pyx_v_plf = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -11079,7 +11079,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_5_cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lattice", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":144 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":144 * def lattice(self): # TODO direct hg -> lattice conversion in cdec * """hg.lattice() -> Lattice corresponding to the hypergraph.""" * cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str() # <<<<<<<<<<<<<< @@ -11091,7 +11091,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_5_cdec_ __pyx_v_plf = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":145 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":145 * """hg.lattice() -> Lattice corresponding to the hypergraph.""" * cdef bytes plf = hypergraph.AsPLF(self.hg[0], True).c_str() * return Lattice(eval(plf)) # <<<<<<<<<<<<<< @@ -11128,7 +11128,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_5_cdec_ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Lattice)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -11141,7 +11141,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_5_cdec_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.Hypergraph.lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_plf); @@ -11151,18 +11151,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_31lattice(struct __pyx_obj_5_cdec_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_34plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_33plf[] = "hg.plf() -> Lattice PLF representation corresponding to the hypergraph."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_34plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_4cdec_5_cdec_10Hypergraph_33plf[] = "hg.plf() -> Lattice PLF representation corresponding to the hypergraph."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_34plf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("plf (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_33plf(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_33plf(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":147 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":147 * return Lattice(eval(plf)) * * def plf(self): # <<<<<<<<<<<<<< @@ -11170,7 +11170,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_34plf(PyObject *__pyx_v_self, CYTH * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_33plf(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_33plf(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11180,7 +11180,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33plf(struct __pyx_obj_5_cdec_Hype int __pyx_clineno = 0; __Pyx_RefNannySetupContext("plf", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":149 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":149 * def plf(self): * """hg.plf() -> Lattice PLF representation corresponding to the hypergraph.""" * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) # <<<<<<<<<<<<<< @@ -11207,7 +11207,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33plf(struct __pyx_obj_5_cdec_Hype __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Hypergraph.plf", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.plf", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11216,18 +11216,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_33plf(struct __pyx_obj_5_cdec_Hype } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_36reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_35reweight[] = "hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_36reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) { +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_36reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/ +static char __pyx_doc_4cdec_5_cdec_10Hypergraph_35reweight[] = "hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_36reweight(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reweight (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_35reweight(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_weights)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_35reweight(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self), ((PyObject *)__pyx_v_weights)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":151 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":151 * return bytes(hypergraph.AsPLF(self.hg[0], True).c_str()) * * def reweight(self, weights): # <<<<<<<<<<<<<< @@ -11235,7 +11235,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_36reweight(PyObject *__pyx_v_self, * if isinstance(weights, SparseVector): */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights) { +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self, PyObject *__pyx_v_weights) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -11247,52 +11247,52 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("reweight", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":153 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":153 * def reweight(self, weights): * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector.""" * if isinstance(weights, SparseVector): # <<<<<<<<<<<<<< * self.hg.Reweight(( weights).vector[0]) * elif isinstance(weights, DenseVector): */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_SparseVector)); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":154 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":154 * """hg.reweight(SparseVector/DenseVector): Reweight the hypergraph with a new vector.""" * if isinstance(weights, SparseVector): * self.hg.Reweight(( weights).vector[0]) # <<<<<<<<<<<<<< * elif isinstance(weights, DenseVector): * self.hg.Reweight(( weights).vector[0]) */ - __pyx_v_self->hg->Reweight((((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_weights)->vector[0])); + __pyx_v_self->hg->Reweight((((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_weights)->vector[0])); goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":155 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":155 * if isinstance(weights, SparseVector): * self.hg.Reweight(( weights).vector[0]) * elif isinstance(weights, DenseVector): # <<<<<<<<<<<<<< * self.hg.Reweight(( weights).vector[0]) * else: */ - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_DenseVector)); + __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_4cdec_5_cdec_DenseVector)); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":156 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":156 * self.hg.Reweight(( weights).vector[0]) * elif isinstance(weights, DenseVector): * self.hg.Reweight(( weights).vector[0]) # <<<<<<<<<<<<<< * else: * raise TypeError('cannot reweight hypergraph with %s' % type(weights)) */ - __pyx_v_self->hg->Reweight((((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_weights)->vector[0])); + __pyx_v_self->hg->Reweight((((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_weights)->vector[0])); goto __pyx_L3; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":158 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":158 * self.hg.Reweight(( weights).vector[0]) * else: * raise TypeError('cannot reweight hypergraph with %s' % type(weights)) # <<<<<<<<<<<<<< @@ -11320,27 +11320,27 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_35reweight(struct __pyx_obj_5_cdec __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.Hypergraph.reweight", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.reweight", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_5edges___get__(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_5edges___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":161 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":161 * * property edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -11348,15 +11348,15 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(PyObject *__pyx_v_ * for i in range(self.hg.edges_.size()): */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *__pyx_cur_scope; +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_13___get__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(__pyx_ptype_5_cdec___pyx_scope_struct_13___get__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_13___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_13___get__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -11366,7 +11366,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_ __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5edges_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator9, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -11375,7 +11375,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Hypergraph.edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -11384,9 +11384,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5edges___get__(struct __pyx_obj_5_ return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5edges_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; size_t __pyx_t_1; unsigned int __pyx_t_2; @@ -11407,7 +11407,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":163 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":163 * def __get__(self): * cdef unsigned i * for i in range(self.hg.edges_.size()): # <<<<<<<<<<<<<< @@ -11418,16 +11418,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":164 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":164 * cdef unsigned i * for i in range(self.hg.edges_.size()): * yield HypergraphEdge().init(self.hg, i) # <<<<<<<<<<<<<< * * property nodes: */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 164; __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 = 164; __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; @@ -11457,20 +11457,20 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5edges_2generator9(__pyx_Generator __Pyx_RefNannyFinishContext(); return NULL; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_5nodes___get__(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_5nodes___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":167 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":167 * * property nodes: * def __get__(self): # <<<<<<<<<<<<<< @@ -11478,15 +11478,15 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(PyObject *__pyx_v_ * for i in range(self.hg.nodes_.size()): */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *__pyx_cur_scope; +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_14___get__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(__pyx_ptype_5_cdec___pyx_scope_struct_14___get__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14___get__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -11496,7 +11496,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_ __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator10, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -11505,7 +11505,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Hypergraph.nodes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.nodes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -11514,9 +11514,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_5nodes___get__(struct __pyx_obj_5_ return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; size_t __pyx_t_1; unsigned int __pyx_t_2; @@ -11537,7 +11537,7 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":169 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":169 * def __get__(self): * cdef unsigned i * for i in range(self.hg.nodes_.size()): # <<<<<<<<<<<<<< @@ -11548,16 +11548,16 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":170 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":170 * cdef unsigned i * for i in range(self.hg.nodes_.size()): * yield HypergraphNode().init(self.hg, i) # <<<<<<<<<<<<<< * * property goal: */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 170; __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 = 170; __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; @@ -11589,17 +11589,17 @@ static PyObject *__pyx_gb_5_cdec_10Hypergraph_5nodes_2generator10(__pyx_Generato } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_4goal___get__(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_4goal___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":173 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":173 * * property goal: * def __get__(self): # <<<<<<<<<<<<<< @@ -11607,7 +11607,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(PyObject *__pyx_v_s * */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -11617,7 +11617,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_c int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":174 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":174 * property goal: * def __get__(self): * return HypergraphNode().init(self.hg, self.hg.GoalNode()) # <<<<<<<<<<<<<< @@ -11625,9 +11625,9 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_c * property npaths: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->hg->GoalNode()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __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 = 174; __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; @@ -11639,7 +11639,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_c __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Hypergraph.goal.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.goal.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11648,17 +11648,17 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_4goal___get__(struct __pyx_obj_5_c } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_6npaths___get__(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_6npaths___get__(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":177 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":177 * * property npaths: * def __get__(self): # <<<<<<<<<<<<<< @@ -11666,7 +11666,7 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(PyObject *__pyx_v * */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -11675,7 +11675,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":178 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":178 * property npaths: * def __get__(self): * return self.hg.NumberOfPaths() # <<<<<<<<<<<<<< @@ -11693,7 +11693,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5 goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.Hypergraph.npaths.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.npaths.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11702,18 +11702,18 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_6npaths___get__(struct __pyx_obj_5 } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_10Hypergraph_38inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_10Hypergraph_37inside_outside[] = "hg.inside_outside() -> SparseVector with inside-outside scores for each feature."; -static PyObject *__pyx_pw_5_cdec_10Hypergraph_38inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_38inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_4cdec_5_cdec_10Hypergraph_37inside_outside[] = "hg.inside_outside() -> SparseVector with inside-outside scores for each feature."; +static PyObject *__pyx_pw_4cdec_5_cdec_10Hypergraph_38inside_outside(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("inside_outside (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_10Hypergraph_37inside_outside(((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":180 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":180 * return self.hg.NumberOfPaths() * * def inside_outside(self): # <<<<<<<<<<<<<< @@ -11721,10 +11721,10 @@ static PyObject *__pyx_pw_5_cdec_10Hypergraph_38inside_outside(PyObject *__pyx_v * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() */ -static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_self) { FastSparseVector *__pyx_v_result; prob_t __pyx_v_z; - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_vector = 0; + struct __pyx_obj_4cdec_5_cdec_SparseVector *__pyx_v_vector = 0; FastSparseVector::const_iterator *__pyx_v_it; CYTHON_UNUSED unsigned int __pyx_v_i; PyObject *__pyx_r = NULL; @@ -11737,7 +11737,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("inside_outside", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":182 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":182 * def inside_outside(self): * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature.""" * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() # <<<<<<<<<<<<<< @@ -11746,7 +11746,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ __pyx_v_result = new FastSparseVector(); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":183 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":183 * """hg.inside_outside() -> SparseVector with inside-outside scores for each feature.""" * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) # <<<<<<<<<<<<<< @@ -11755,7 +11755,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ __pyx_v_z = InsideOutside, EdgeFeaturesAndProbWeightFunction>((__pyx_v_self->hg[0]), __pyx_v_result); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":184 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":184 * cdef FastSparseVector[prob_t]* result = new FastSparseVector[prob_t]() * cdef prob_t z = hypergraph.InsideOutside(self.hg[0], result) * result[0] /= z # <<<<<<<<<<<<<< @@ -11764,20 +11764,20 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ (__pyx_v_result[0]) /= __pyx_v_z; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":185 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":185 * 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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 185; __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)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":186 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":186 * result[0] /= z * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double]() # <<<<<<<<<<<<<< @@ -11786,7 +11786,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ __pyx_v_vector->vector = new FastSparseVector(); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":187 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":187 * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double]() * cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False) # <<<<<<<<<<<<<< @@ -11795,7 +11795,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ __pyx_v_it = new FastSparseVector::const_iterator((__pyx_v_result[0]), 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":189 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":189 * cdef FastSparseVector[prob_t].const_iterator* it = new FastSparseVector[prob_t].const_iterator(result[0], False) * cdef unsigned i * for i in range(result.size()): # <<<<<<<<<<<<<< @@ -11806,7 +11806,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":190 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":190 * cdef unsigned i * for i in range(result.size()): * vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) # <<<<<<<<<<<<<< @@ -11815,7 +11815,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ __pyx_v_vector->vector->set_value((__pyx_v_it[0]).operator->()->first, log((__pyx_v_it[0]).operator->()->second)); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":191 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":191 * for i in range(result.size()): * vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) * pinc(it[0]) # ++it # <<<<<<<<<<<<<< @@ -11825,7 +11825,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ (++(__pyx_v_it[0])); } - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":192 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":192 * vector.vector.set_value(it[0].ptr().first, log(it[0].ptr().second)) * pinc(it[0]) # ++it * del it # <<<<<<<<<<<<<< @@ -11834,7 +11834,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ delete __pyx_v_it; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":193 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":193 * pinc(it[0]) # ++it * del it * del result # <<<<<<<<<<<<<< @@ -11843,7 +11843,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ */ delete __pyx_v_result; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":194 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":194 * del it * del result * return vector # <<<<<<<<<<<<<< @@ -11859,7 +11859,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.Hypergraph.inside_outside", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Hypergraph.inside_outside", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_vector); @@ -11868,7 +11868,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":201 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":201 * cdef public TRule trule * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<< @@ -11876,7 +11876,7 @@ static PyObject *__pyx_pf_5_cdec_10Hypergraph_37inside_outside(struct __pyx_obj_ * self.edge = &hg.edges_[i] */ -static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self, Hypergraph *__pyx_v_hg, unsigned int __pyx_v_i) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11885,7 +11885,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy int __pyx_clineno = 0; __Pyx_RefNannySetupContext("init", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":202 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":202 * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg # <<<<<<<<<<<<<< @@ -11894,7 +11894,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy */ __pyx_v_self->hg = __pyx_v_hg; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":203 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":203 * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg * self.edge = &hg.edges_[i] # <<<<<<<<<<<<<< @@ -11903,23 +11903,23 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy */ __pyx_v_self->edge = (&(__pyx_v_hg->edges_[__pyx_v_i])); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":204 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":204 * 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_5_cdec_TRule(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_TRule)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __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)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_TRule)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 204; __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 = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->trule); __Pyx_DECREF(((PyObject *)__pyx_v_self->trule)); - __pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_t_1); + __pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":205 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":205 * self.edge = &hg.edges_[i] * self.trule = TRule.__new__(TRule) * self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) # <<<<<<<<<<<<<< @@ -11928,7 +11928,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy */ __pyx_v_self->trule->rule = new boost::shared_ptr(__pyx_v_self->edge->rule_); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":206 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":206 * self.trule = TRule.__new__(TRule) * self.trule.rule = new shared_ptr[grammar.TRule](self.edge.rule_) * return self # <<<<<<<<<<<<<< @@ -11944,7 +11944,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.HypergraphEdge.init", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphEdge.init", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11953,17 +11953,17 @@ static PyObject *__pyx_f_5_cdec_14HypergraphEdge_init(struct __pyx_obj_5_cdec_Hy } /* Python wrapper */ -static Py_ssize_t __pyx_pw_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge___len__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge___len__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":208 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":208 * return self * * def __len__(self): # <<<<<<<<<<<<<< @@ -11971,12 +11971,12 @@ static Py_ssize_t __pyx_pw_5_cdec_14HypergraphEdge_1__len__(PyObject *__pyx_v_se * */ -static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":209 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":209 * * def __len__(self): * return self.edge.tail_nodes_.size() # <<<<<<<<<<<<<< @@ -11993,17 +11993,17 @@ static Py_ssize_t __pyx_pf_5_cdec_14HypergraphEdge___len__(struct __pyx_obj_5_cd } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_9head_node___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":212 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":212 * * property head_node: * def __get__(self): # <<<<<<<<<<<<<< @@ -12011,7 +12011,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_9head_node_1__get__(PyObject * * */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -12021,7 +12021,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":213 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":213 * property head_node: * def __get__(self): * return HypergraphNode().init(self.hg, self.edge.head_node_) # <<<<<<<<<<<<<< @@ -12029,9 +12029,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py * property tail_nodes: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_1), __pyx_v_self->hg, __pyx_v_self->edge->head_node_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 213; __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 = 213; __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; @@ -12043,27 +12043,27 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_9head_node___get__(struct __py __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.HypergraphEdge.head_node.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphEdge.head_node.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_10tail_nodes___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":216 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":216 * * property tail_nodes: * def __get__(self): # <<<<<<<<<<<<<< @@ -12071,15 +12071,15 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(PyObject * for i in range(self.edge.tail_nodes_.size()): */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *__pyx_cur_scope; +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_15___get__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(__pyx_ptype_5_cdec___pyx_scope_struct_15___get__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15___get__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15___get__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -12089,7 +12089,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __ __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __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_2generator11, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -12098,7 +12098,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.HypergraphEdge.tail_nodes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphEdge.tail_nodes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -12107,9 +12107,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_10tail_nodes___get__(struct __ return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; unsigned int __pyx_t_1; unsigned int __pyx_t_2; @@ -12130,7 +12130,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":218 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":218 * def __get__(self): * cdef unsigned i * for i in range(self.edge.tail_nodes_.size()): # <<<<<<<<<<<<<< @@ -12141,16 +12141,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":219 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":219 * cdef unsigned i * for i in range(self.edge.tail_nodes_.size()): * yield HypergraphNode().init(self.hg, self.edge.tail_nodes_[i]) # <<<<<<<<<<<<<< * * property span: */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphNode *)((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->edge->tail_nodes_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __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 = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; @@ -12182,17 +12182,17 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphEdge_10tail_nodes_2generator11(__py } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_4span___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_4span___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":222 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":222 * * property span: * def __get__(self): # <<<<<<<<<<<<<< @@ -12200,7 +12200,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4span_1__get__(PyObject *__pyx * */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -12211,7 +12211,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":223 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":223 * property span: * def __get__(self): * return (self.edge.i_, self.edge.j_) # <<<<<<<<<<<<<< @@ -12241,7 +12241,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.HypergraphEdge.span.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphEdge.span.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -12250,17 +12250,17 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4span___get__(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_8src_span___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_8src_span___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":226 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":226 * * property src_span: * def __get__(self): # <<<<<<<<<<<<<< @@ -12268,7 +12268,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_8src_span_1__get__(PyObject *_ * */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_8src_span___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -12279,7 +12279,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_8src_span___get__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":227 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":227 * property src_span: * def __get__(self): * return (self.edge.prev_i_, self.edge.prev_j_) # <<<<<<<<<<<<<< @@ -12309,7 +12309,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_8src_span___get__(struct __pyx __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.HypergraphEdge.src_span.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphEdge.src_span.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -12318,17 +12318,17 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_8src_span___get__(struct __pyx } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_14feature_values___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":230 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":230 * * property feature_values: * def __get__(self): # <<<<<<<<<<<<<< @@ -12336,8 +12336,8 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(PyOb * vector.vector = new FastSparseVector[double](self.edge.feature_values_) */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) { - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_vector = 0; +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; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -12346,20 +12346,20 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":231 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":231 * 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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 231; __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)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_vector = ((struct __pyx_obj_5_cdec_SparseVector *)__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_vector = ((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":232 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":232 * def __get__(self): * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double](self.edge.feature_values_) # <<<<<<<<<<<<<< @@ -12368,7 +12368,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc */ __pyx_v_vector->vector = new FastSparseVector(__pyx_v_self->edge->feature_values_); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":233 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":233 * cdef SparseVector vector = SparseVector.__new__(SparseVector) * vector.vector = new FastSparseVector[double](self.edge.feature_values_) * return vector # <<<<<<<<<<<<<< @@ -12384,7 +12384,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.HypergraphEdge.feature_values.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphEdge.feature_values.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_vector); @@ -12394,17 +12394,17 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_14feature_values___get__(struc } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_4prob___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":236 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":236 * * property prob: * def __get__(self): # <<<<<<<<<<<<<< @@ -12412,7 +12412,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(PyObject *__pyx * */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -12421,7 +12421,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":237 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":237 * property prob: * def __get__(self): * return self.edge.edge_prob_.as_float() # <<<<<<<<<<<<<< @@ -12439,7 +12439,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.HypergraphEdge.prob.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphEdge.prob.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -12448,17 +12448,17 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_4prob___get__(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) { +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) { 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("__richcmp__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5_cdec_HypergraphEdge, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5_cdec_HypergraphEdge, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_x), ((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_y), ((int)__pyx_v_op)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_HypergraphEdge, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 239; __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 = 239; __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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -12467,7 +12467,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":239 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":239 * return self.edge.edge_prob_.as_float() * * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): # <<<<<<<<<<<<<< @@ -12475,7 +12475,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__(PyObject *__pyx_v * return x.edge == y.edge */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_x, struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_y, int __pyx_v_op) { +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 PyObject *__pyx_t_1 = NULL; @@ -12485,7 +12485,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":242 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":242 * if op == 2: # == * return x.edge == y.edge * elif op == 3: # != # <<<<<<<<<<<<<< @@ -12494,7 +12494,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ */ switch (__pyx_v_op) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":240 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":240 * * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): * if op == 2: # == # <<<<<<<<<<<<<< @@ -12503,7 +12503,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ */ case 2: - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":241 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":241 * def __richcmp__(HypergraphEdge x, HypergraphEdge y, int op): * if op == 2: # == * return x.edge == y.edge # <<<<<<<<<<<<<< @@ -12518,7 +12518,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ goto __pyx_L0; break; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":242 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":242 * if op == 2: # == * return x.edge == y.edge * elif op == 3: # != # <<<<<<<<<<<<<< @@ -12527,7 +12527,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ */ case 3: - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":243 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":243 * return x.edge == y.edge * elif op == 3: # != * return not (x == y) # <<<<<<<<<<<<<< @@ -12546,7 +12546,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ break; } - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":244 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":244 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<< @@ -12563,7 +12563,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.HypergraphEdge.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphEdge.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -12572,17 +12572,17 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_2__richcmp__(struct __pyx_obj_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_5trule___get__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":199 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":199 * cdef hypergraph.Hypergraph* hg * cdef hypergraph.HypergraphEdge* edge * cdef public TRule trule # <<<<<<<<<<<<<< @@ -12590,7 +12590,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(PyObject *__py * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): */ -static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_5trule___get__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) { +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 __Pyx_RefNannySetupContext("__get__", 0); @@ -12607,34 +12607,34 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphEdge_5trule___get__(struct __pyx_ob } /* Python wrapper */ -static int __pyx_pw_5_cdec_14HypergraphEdge_5trule_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5_cdec_14HypergraphEdge_5trule_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_5trule_2__set__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_2__set__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self, PyObject *__pyx_v_value) { +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 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5_cdec_TRule))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); __Pyx_GOTREF(__pyx_v_self->trule); __Pyx_DECREF(((PyObject *)__pyx_v_self->trule)); - __pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)__pyx_v_value); + __pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)__pyx_v_value); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.HypergraphEdge.trule.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphEdge.trule.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -12642,17 +12642,17 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_2__set__(struct __pyx_obj_5_c } /* Python wrapper */ -static int __pyx_pw_5_cdec_14HypergraphEdge_5trule_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_5_cdec_14HypergraphEdge_5trule_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_5_cdec_14HypergraphEdge_5trule_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_4__del__(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_cdec_HypergraphEdge *__pyx_v_self) { +static int __pyx_pf_4cdec_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -12660,14 +12660,14 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_c __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->trule); __Pyx_DECREF(((PyObject *)__pyx_v_self->trule)); - __pyx_v_self->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); + __pyx_v_self->trule = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":250 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":250 * cdef hypergraph.HypergraphNode* node * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): # <<<<<<<<<<<<<< @@ -12675,12 +12675,12 @@ static int __pyx_pf_5_cdec_14HypergraphEdge_5trule_4__del__(struct __pyx_obj_5_c * self.node = &hg.nodes_[i] */ -static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self, Hypergraph *__pyx_v_hg, unsigned int __pyx_v_i) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":251 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":251 * * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg # <<<<<<<<<<<<<< @@ -12689,7 +12689,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy */ __pyx_v_self->hg = __pyx_v_hg; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":252 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":252 * cdef init(self, hypergraph.Hypergraph* hg, unsigned i): * self.hg = hg * self.node = &hg.nodes_[i] # <<<<<<<<<<<<<< @@ -12698,7 +12698,7 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy */ __pyx_v_self->node = (&(__pyx_v_hg->nodes_[__pyx_v_i])); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":253 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":253 * self.hg = hg * self.node = &hg.nodes_[i] * return self # <<<<<<<<<<<<<< @@ -12716,20 +12716,20 @@ static PyObject *__pyx_f_5_cdec_14HypergraphNode_init(struct __pyx_obj_5_cdec_Hy __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_8in_edges___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":256 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":256 * * property in_edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -12737,15 +12737,15 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(PyObject *_ * for i in range(self.node.in_edges_.size()): */ -static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *__pyx_cur_scope; +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_16___get__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(__pyx_ptype_5_cdec___pyx_scope_struct_16___get__, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -12755,7 +12755,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator12, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -12764,7 +12764,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.HypergraphNode.in_edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphNode.in_edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -12773,9 +12773,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_8in_edges___get__(struct __pyx return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)__pyx_generator->closure); + struct __pyx_obj_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); PyObject *__pyx_r = NULL; size_t __pyx_t_1; unsigned int __pyx_t_2; @@ -12796,7 +12796,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":258 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":258 * def __get__(self): * cdef unsigned i * for i in range(self.node.in_edges_.size()): # <<<<<<<<<<<<<< @@ -12807,16 +12807,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":259 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":259 * cdef unsigned i * for i in range(self.node.in_edges_.size()): * yield HypergraphEdge().init(self.hg, self.node.in_edges_[i]) # <<<<<<<<<<<<<< * * property out_edges: */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->in_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *)((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->in_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 259; __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; @@ -12846,20 +12846,20 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_8in_edges_2generator12(__pyx_G __Pyx_RefNannyFinishContext(); return NULL; } -static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_9out_edges___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":262 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":262 * * property out_edges: * def __get__(self): # <<<<<<<<<<<<<< @@ -12867,15 +12867,15 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(PyObject * * for i in range(self.node.out_edges_.size()): */ -static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *__pyx_cur_scope; +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_17___get__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_17___get__(__pyx_ptype_5_cdec___pyx_scope_struct_17___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; @@ -12885,7 +12885,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __py __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -12894,7 +12894,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __py __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.HypergraphNode.out_edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphNode.out_edges.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -12903,9 +12903,9 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_9out_edges___get__(struct __py return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)__pyx_generator->closure); + 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; @@ -12926,7 +12926,7 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_ __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":264 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":264 * def __get__(self): * cdef unsigned i * for i in range(self.node.out_edges_.size()): # <<<<<<<<<<<<<< @@ -12937,16 +12937,16 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":265 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":265 * cdef unsigned i * for i in range(self.node.out_edges_.size()): * yield HypergraphEdge().init(self.hg, self.node.out_edges_[i]) # <<<<<<<<<<<<<< * * property span: */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_5_cdec_HypergraphEdge)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = ((struct __pyx_vtabstruct_5_cdec_HypergraphEdge *)((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->out_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge *)((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3)->__pyx_vtab)->init(((struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)__pyx_t_3), __pyx_cur_scope->__pyx_v_self->hg, (__pyx_cur_scope->__pyx_v_self->node->out_edges_[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 265; __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; @@ -12978,17 +12978,17 @@ static PyObject *__pyx_gb_5_cdec_14HypergraphNode_9out_edges_2generator13(__pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphNode_4span___get__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_4span___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":268 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":268 * * property span: * def __get__(self): # <<<<<<<<<<<<<< @@ -12996,7 +12996,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(PyObject *__pyx * */ -static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -13006,7 +13006,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":269 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":269 * property span: * def __get__(self): * return next(self.in_edges).span # <<<<<<<<<<<<<< @@ -13031,7 +13031,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.HypergraphNode.span.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphNode.span.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13040,17 +13040,17 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_4span___get__(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_14HypergraphNode_3cat___get__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode_3cat___get__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":272 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":272 * * property cat: * def __get__(self): # <<<<<<<<<<<<<< @@ -13058,7 +13058,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(PyObject *__pyx_ * return str(TDConvert(-self.node.cat_).c_str()) */ -static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_self) { +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 int __pyx_t_1; @@ -13069,7 +13069,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":273 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":273 * property cat: * def __get__(self): * if self.node.cat_: # <<<<<<<<<<<<<< @@ -13079,7 +13079,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_ __pyx_t_1 = (__pyx_v_self->node->cat_ != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":274 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":274 * def __get__(self): * if self.node.cat_: * return str(TDConvert(-self.node.cat_).c_str()) # <<<<<<<<<<<<<< @@ -13109,7 +13109,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.HypergraphNode.cat.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphNode.cat.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13118,17 +13118,17 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode_3cat___get__(struct __pyx_obj_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/ -static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) { +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) { 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("__richcmp__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5_cdec_HypergraphNode, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5_cdec_HypergraphNode, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_14HypergraphNode___richcmp__(((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_x), ((struct __pyx_obj_5_cdec_HypergraphNode *)__pyx_v_y), ((int)__pyx_v_op)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_4cdec_5_cdec_HypergraphNode, 1, "x", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_4cdec_5_cdec_HypergraphNode, 1, "y", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_5_cdec_14HypergraphNode___richcmp__(((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_x), ((struct __pyx_obj_4cdec_5_cdec_HypergraphNode *)__pyx_v_y), ((int)__pyx_v_op)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -13137,7 +13137,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":276 +/* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":276 * return str(TDConvert(-self.node.cat_).c_str()) * * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): # <<<<<<<<<<<<<< @@ -13145,7 +13145,7 @@ static PyObject *__pyx_pw_5_cdec_14HypergraphNode_1__richcmp__(PyObject *__pyx_v * return x.node == y.node */ -static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_x, struct __pyx_obj_5_cdec_HypergraphNode *__pyx_v_y, int __pyx_v_op) { +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 PyObject *__pyx_t_1 = NULL; @@ -13155,7 +13155,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":279 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":279 * if op == 2: # == * return x.node == y.node * elif op == 3: # != # <<<<<<<<<<<<<< @@ -13164,7 +13164,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 */ switch (__pyx_v_op) { - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":277 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":277 * * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): * if op == 2: # == # <<<<<<<<<<<<<< @@ -13173,7 +13173,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 */ case 2: - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":278 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":278 * def __richcmp__(HypergraphNode x, HypergraphNode y, int op): * if op == 2: # == * return x.node == y.node # <<<<<<<<<<<<<< @@ -13188,7 +13188,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 goto __pyx_L0; break; - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":279 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":279 * if op == 2: # == * return x.node == y.node * elif op == 3: # != # <<<<<<<<<<<<<< @@ -13197,7 +13197,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 */ case 3: - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":280 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":280 * return x.node == y.node * elif op == 3: # != * return not (x == y) # <<<<<<<<<<<<<< @@ -13215,7 +13215,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 break; } - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":281 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":281 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<< @@ -13230,7 +13230,7 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.HypergraphNode.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.HypergraphNode.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13239,20 +13239,20 @@ static PyObject *__pyx_pf_5_cdec_14HypergraphNode___richcmp__(struct __pyx_obj_5 } /* Python wrapper */ -static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __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_5_cdec_7Lattice___cinit__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice___cinit__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":6 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":6 * cdef lattice.Lattice* lattice * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -13260,12 +13260,12 @@ static int __pyx_pw_5_cdec_7Lattice_1__cinit__(PyObject *__pyx_v_self, PyObject * */ -static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":7 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":7 * * def __cinit__(self): * self.lattice = new lattice.Lattice() # <<<<<<<<<<<<<< @@ -13280,12 +13280,12 @@ static int __pyx_pf_5_cdec_7Lattice___cinit__(struct __pyx_obj_5_cdec_Lattice *_ } /* Python wrapper */ -static int __pyx_pw_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5_cdec_7Lattice_2__init__[] = "Lattice(tuple) -> Lattice from node list.\n Lattice(string) -> Lattice from PLF representation."; +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."; #if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5_cdec_7Lattice_2__init__; +struct wrapperbase __pyx_wrapperbase_4cdec_5_cdec_7Lattice_2__init__; #endif -static int __pyx_pw_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_inp = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -13324,16 +13324,16 @@ static int __pyx_pw_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject * __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.Lattice.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_7Lattice_2__init__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), __pyx_v_inp); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_2__init__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self), __pyx_v_inp); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":9 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":9 * self.lattice = new lattice.Lattice() * * def __init__(self, inp): # <<<<<<<<<<<<<< @@ -13341,7 +13341,7 @@ static int __pyx_pw_5_cdec_7Lattice_3__init__(PyObject *__pyx_v_self, PyObject * * Lattice(string) -> Lattice from PLF representation.""" */ -static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, PyObject *__pyx_v_inp) { +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; int __pyx_r; @@ -13359,7 +13359,7 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":12 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":12 * """Lattice(tuple) -> Lattice from node list. * Lattice(string) -> Lattice from PLF representation.""" * if isinstance(inp, tuple): # <<<<<<<<<<<<<< @@ -13370,7 +13370,7 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":13 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":13 * Lattice(string) -> Lattice from PLF representation.""" * if isinstance(inp, tuple): * self.lattice.resize(len(inp)) # <<<<<<<<<<<<<< @@ -13380,7 +13380,7 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ __pyx_t_3 = PyObject_Length(__pyx_v_inp); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->lattice->resize(__pyx_t_3); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":14 * if isinstance(inp, tuple): * self.lattice.resize(len(inp)) * for i, arcs in enumerate(inp): # <<<<<<<<<<<<<< @@ -13435,7 +13435,7 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ __pyx_t_4 = __pyx_t_7; __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":15 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":15 * self.lattice.resize(len(inp)) * for i, arcs in enumerate(inp): * self[i] = arcs # <<<<<<<<<<<<<< @@ -13449,7 +13449,7 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":16 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":16 * for i, arcs in enumerate(inp): * self[i] = arcs * elif isinstance(inp, basestring): # <<<<<<<<<<<<<< @@ -13460,14 +13460,14 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":17 + /* "/home/mdenkows/cdec/python/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_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 = ((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_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; @@ -13476,7 +13476,7 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":19 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":19 * lattice.ConvertTextOrPLF(as_str(inp), self.lattice) * else: * raise TypeError('cannot create lattice from %s' % type(inp)) # <<<<<<<<<<<<<< @@ -13505,7 +13505,7 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_cdec.Lattice.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_i); @@ -13515,15 +13515,15 @@ static int __pyx_pf_5_cdec_7Lattice_2__init__(struct __pyx_obj_5_cdec_Lattice *_ } /* Python wrapper */ -static void __pyx_pw_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self) { +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_5_cdec_7Lattice_4__dealloc__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":21 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":21 * raise TypeError('cannot create lattice from %s' % type(inp)) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -13531,11 +13531,11 @@ static void __pyx_pw_5_cdec_7Lattice_5__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { +static void __pyx_pf_4cdec_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Lattice *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":22 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":22 * * def __dealloc__(self): * del self.lattice # <<<<<<<<<<<<<< @@ -13548,8 +13548,8 @@ static void __pyx_pf_5_cdec_7Lattice_4__dealloc__(CYTHON_UNUSED struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { +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) { int __pyx_v_index; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -13562,16 +13562,16 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.Lattice.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_7Lattice_6__getitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":24 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":24 * del self.lattice * * def __getitem__(self, int index): # <<<<<<<<<<<<<< @@ -13579,7 +13579,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_7__getitem__(PyObject *__pyx_v_self, P * raise IndexError('lattice index out of range') */ -static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index) { +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 __pyx_v_arc_vector; LatticeArc *__pyx_v_arc; @@ -13601,7 +13601,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":25 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":25 * * def __getitem__(self, int index): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -13616,7 +13616,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":26 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< @@ -13632,7 +13632,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":27 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":27 * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') * arcs = [] # <<<<<<<<<<<<<< @@ -13644,7 +13644,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L __pyx_v_arcs = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":28 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":28 * raise IndexError('lattice index out of range') * arcs = [] * cdef vector[lattice.LatticeArc] arc_vector = self.lattice[0][index] # <<<<<<<<<<<<<< @@ -13653,7 +13653,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L */ __pyx_v_arc_vector = ((__pyx_v_self->lattice[0])[__pyx_v_index]); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":31 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":31 * cdef lattice.LatticeArc* arc * cdef unsigned i * for i in range(arc_vector.size()): # <<<<<<<<<<<<<< @@ -13664,7 +13664,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":32 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":32 * cdef unsigned i * for i in range(arc_vector.size()): * arc = &arc_vector[i] # <<<<<<<<<<<<<< @@ -13673,7 +13673,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L */ __pyx_v_arc = (&(__pyx_v_arc_vector[__pyx_v_i])); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":33 * for i in range(arc_vector.size()): * arc = &arc_vector[i] * label = unicode(TDConvert(arc.label).c_str(), 'utf8') # <<<<<<<<<<<<<< @@ -13697,7 +13697,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L __pyx_v_label = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":34 * arc = &arc_vector[i] * label = unicode(TDConvert(arc.label).c_str(), 'utf8') * arcs.append((label, arc.cost, arc.dist2next)) # <<<<<<<<<<<<<< @@ -13723,7 +13723,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":35 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":35 * label = unicode(TDConvert(arc.label).c_str(), 'utf8') * arcs.append((label, arc.cost, arc.dist2next)) * return tuple(arcs) # <<<<<<<<<<<<<< @@ -13743,7 +13743,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_cdec.Lattice.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_arcs); @@ -13754,8 +13754,8 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_6__getitem__(struct __pyx_obj_5_cdec_L } /* Python wrapper */ -static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs); /*proto*/ -static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_arcs) { +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) { int __pyx_v_index; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -13768,12 +13768,12 @@ static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.Lattice.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arcs), (&PyTuple_Type), 1, "arcs", 1))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_7Lattice_8__setitem__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self), ((int)__pyx_v_index), ((PyObject*)__pyx_v_arcs)); + __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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -13782,7 +13782,7 @@ static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":37 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":37 * return tuple(arcs) * * def __setitem__(self, int index, tuple arcs): # <<<<<<<<<<<<<< @@ -13790,7 +13790,7 @@ static int __pyx_pw_5_cdec_7Lattice_9__setitem__(PyObject *__pyx_v_self, PyObjec * raise IndexError('lattice index out of range') */ -static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self, int __pyx_v_index, PyObject *__pyx_v_arcs) { +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; PyObject *__pyx_v_cost = NULL; @@ -13816,7 +13816,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":38 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":38 * * def __setitem__(self, int index, tuple arcs): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -13831,7 +13831,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":39 * def __setitem__(self, int index, tuple arcs): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< @@ -13847,7 +13847,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":41 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":41 * raise IndexError('lattice index out of range') * cdef lattice.LatticeArc* arc * for (label, cost, dist2next) in arcs: # <<<<<<<<<<<<<< @@ -13934,20 +13934,20 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice __pyx_v_dist2next = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":42 + /* "/home/mdenkows/cdec/python/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_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 = ((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_GOTREF(__pyx_t_5); __Pyx_XDECREF(((PyObject *)__pyx_v_label_str)); __pyx_v_label_str = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":43 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":43 * for (label, cost, dist2next) in arcs: * label_str = as_str(label) * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) # <<<<<<<<<<<<<< @@ -13959,7 +13959,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_dist2next); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_arc = new LatticeArc(TD::Convert(__pyx_t_11), __pyx_t_12, __pyx_t_13); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":44 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":44 * label_str = as_str(label) * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) * self.lattice[0][index].push_back(arc[0]) # <<<<<<<<<<<<<< @@ -13968,7 +13968,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice */ ((__pyx_v_self->lattice[0])[__pyx_v_index]).push_back((__pyx_v_arc[0])); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":45 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":45 * arc = new lattice.LatticeArc(TDConvert(label_str), cost, dist2next) * self.lattice[0][index].push_back(arc[0]) * del arc # <<<<<<<<<<<<<< @@ -13988,7 +13988,7 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("_cdec.Lattice.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_label); @@ -14000,17 +14000,17 @@ static int __pyx_pf_5_cdec_7Lattice_8__setitem__(struct __pyx_obj_5_cdec_Lattice } /* Python wrapper */ -static Py_ssize_t __pyx_pw_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Lattice_10__len__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_10__len__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":47 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":47 * del arc * * def __len__(self): # <<<<<<<<<<<<<< @@ -14018,12 +14018,12 @@ static Py_ssize_t __pyx_pw_5_cdec_7Lattice_11__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_5_cdec_7Lattice_10__len__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":48 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":48 * * def __len__(self): * return self.lattice.size() # <<<<<<<<<<<<<< @@ -14040,17 +14040,17 @@ static Py_ssize_t __pyx_pf_5_cdec_7Lattice_10__len__(struct __pyx_obj_5_cdec_Lat } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Lattice_12__str__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_12__str__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":50 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":50 * return self.lattice.size() * * def __str__(self): # <<<<<<<<<<<<<< @@ -14058,7 +14058,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_13__str__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_5_cdec_7Lattice_12__str__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -14068,7 +14068,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_12__str__(struct __pyx_obj_5_cdec_Latt int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":51 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":51 * * def __str__(self): * return str(hypergraph.AsPLF(self.lattice[0], True).c_str()) # <<<<<<<<<<<<<< @@ -14095,7 +14095,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_12__str__(struct __pyx_obj_5_cdec_Latt __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Lattice.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -14104,17 +14104,17 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_12__str__(struct __pyx_obj_5_cdec_Latt } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__unicode__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Lattice_14__unicode__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_14__unicode__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":53 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":53 * return str(hypergraph.AsPLF(self.lattice[0], True).c_str()) * * def __unicode__(self): # <<<<<<<<<<<<<< @@ -14122,7 +14122,7 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_15__unicode__(PyObject *__pyx_v_self, * */ -static PyObject *__pyx_pf_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -14132,7 +14132,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_5_cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__unicode__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":54 * * def __unicode__(self): * return unicode(str(self), 'utf8') # <<<<<<<<<<<<<< @@ -14168,27 +14168,27 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_14__unicode__(struct __pyx_obj_5_cdec_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Lattice.__unicode__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.__unicode__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Lattice_16__iter__(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_16__iter__(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":56 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":56 * return unicode(str(self), 'utf8') * * def __iter__(self): # <<<<<<<<<<<<<< @@ -14196,15 +14196,15 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_17__iter__(PyObject *__pyx_v_self) { * for i in range(len(self)): */ -static PyObject *__pyx_pf_5_cdec_7Lattice_16__iter__(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *__pyx_cur_scope; +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_18___iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(__pyx_ptype_5_cdec___pyx_scope_struct_18___iter__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___iter__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -14214,7 +14214,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_16__iter__(struct __pyx_obj_5_cdec_Lat __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_18generator14, (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_18generator14, (PyObject *) __pyx_cur_scope); 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; @@ -14223,7 +14223,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_16__iter__(struct __pyx_obj_5_cdec_Lat __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Lattice.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -14232,9 +14232,9 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_16__iter__(struct __pyx_obj_5_cdec_Lat return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; Py_ssize_t __pyx_t_1; unsigned int __pyx_t_2; @@ -14254,7 +14254,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *_ __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":58 * def __iter__(self): * cdef unsigned i * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -14265,7 +14265,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *_ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":59 * cdef unsigned i * for i in range(len(self)): * yield self[i] # <<<<<<<<<<<<<< @@ -14302,31 +14302,31 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_18generator14(__pyx_GeneratorObject *_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Lattice_20todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_7Lattice_19todot[] = "lattice.todot() -> Representation of the lattice in GraphViz dot format."; -static PyObject *__pyx_pw_5_cdec_7Lattice_20todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_20todot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("todot (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Lattice_19todot(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_19todot(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_5_cdec_7Lattice_5todot_1lines = {__Pyx_NAMESTR("lines"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_5todot_1lines, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +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 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_5_cdec_7Lattice_5todot_lines(__pyx_self); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(__pyx_self); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":63 * def todot(self): * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): # <<<<<<<<<<<<<< @@ -14334,25 +14334,25 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_5todot_1lines(PyObject *__pyx_self, CY * yield 'rankdir = LR;' */ -static PyObject *__pyx_pf_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lines", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)__pyx_tp_new_5_cdec___pyx_scope_struct_20_lines(__pyx_ptype_5_cdec___pyx_scope_struct_20_lines, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20_lines(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_20_lines, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *) __Pyx_CyFunction_GetClosure(__pyx_self); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_7Lattice_5todot_2generator20, (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_2generator20, (PyObject *) __pyx_cur_scope); 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; @@ -14361,7 +14361,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) { __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Lattice.todot.lines", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.todot.lines", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -14370,9 +14370,9 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_5todot_lines(PyObject *__pyx_self) { return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -14406,7 +14406,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":64 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":64 * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): * yield 'digraph lattice {' # <<<<<<<<<<<<<< @@ -14423,7 +14423,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_L4_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":65 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":65 * def lines(): * yield 'digraph lattice {' * yield 'rankdir = LR;' # <<<<<<<<<<<<<< @@ -14440,7 +14440,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_L5_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":66 * yield 'digraph lattice {' * yield 'rankdir = LR;' * yield 'node [shape=circle];' # <<<<<<<<<<<<<< @@ -14457,7 +14457,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_L6_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":67 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":67 * yield 'rankdir = LR;' * yield 'node [shape=circle];' * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -14520,7 +14520,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_cur_scope->__pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":68 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":68 * yield 'node [shape=circle];' * for i in range(len(self)): * for label, weight, delta in self[i]: # <<<<<<<<<<<<<< @@ -14638,7 +14638,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_cur_scope->__pyx_v_delta = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":69 * for i in range(len(self)): * for label, weight, delta in self[i]: * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<< @@ -14698,7 +14698,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":70 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":70 * for label, weight, delta in self[i]: * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) * yield '%d [shape=doublecircle]' % len(self) # <<<<<<<<<<<<<< @@ -14724,7 +14724,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj __pyx_L14_resume_from_yield:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":71 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":71 * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) * yield '%d [shape=doublecircle]' % len(self) * yield '}' # <<<<<<<<<<<<<< @@ -14759,7 +14759,7 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":61 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":61 * yield self[i] * * def todot(self): # <<<<<<<<<<<<<< @@ -14767,8 +14767,8 @@ static PyObject *__pyx_gb_5_cdec_7Lattice_5todot_2generator20(__pyx_GeneratorObj * def lines(): */ -static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *__pyx_cur_scope; +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_19_todot *__pyx_cur_scope; PyObject *__pyx_v_lines = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -14779,7 +14779,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("todot", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)__pyx_tp_new_5_cdec___pyx_scope_struct_19_todot(__pyx_ptype_5_cdec___pyx_scope_struct_19_todot, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_19_todot(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_19_todot, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -14789,19 +14789,19 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63 + /* "/home/mdenkows/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;' */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5_cdec_7Lattice_5todot_1lines, 0, __pyx_n_s_38, ((PyObject*)__pyx_cur_scope), __pyx_n_s___cdec, ((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_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_GOTREF(__pyx_t_1); __pyx_v_lines = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":72 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":72 * yield '%d [shape=doublecircle]' % len(self) * yield '}' * return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<< @@ -14809,9 +14809,9 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic * def as_hypergraph(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_39), __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_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_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_pf_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_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); @@ -14825,7 +14825,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -14838,7 +14838,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.Lattice.todot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.todot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_lines); @@ -14849,18 +14849,18 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_19todot(struct __pyx_obj_5_cdec_Lattic } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_7Lattice_21as_hypergraph[] = "lattice.as_hypergraph() -> Hypergraph representation of the lattice."; -static PyObject *__pyx_pw_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("as_hypergraph (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Lattice_21as_hypergraph(((struct __pyx_obj_5_cdec_Lattice *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Lattice_21as_hypergraph(((struct __pyx_obj_4cdec_5_cdec_Lattice *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":74 +/* "/home/mdenkows/cdec/python/cdec/lattice.pxi":74 * return '\n'.join(lines()).encode('utf8') * * def as_hypergraph(self): # <<<<<<<<<<<<<< @@ -14868,8 +14868,8 @@ static PyObject *__pyx_pw_5_cdec_7Lattice_22as_hypergraph(PyObject *__pyx_v_self * cdef Hypergraph result = Hypergraph.__new__(Hypergraph) */ -static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cdec_Lattice *__pyx_v_self) { - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_result = 0; +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -14881,20 +14881,20 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("as_hypergraph", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":76 + /* "/home/mdenkows/cdec/python/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_5_cdec_Hypergraph(((PyTypeObject *)((PyObject*)__pyx_ptype_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)), ((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_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_Hypergraph)))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((struct __pyx_obj_5_cdec_Hypergraph *)__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":77 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":77 * """lattice.as_hypergraph() -> Hypergraph representation of the lattice.""" * cdef Hypergraph result = Hypergraph.__new__(Hypergraph) * result.hg = new hypergraph.Hypergraph() # <<<<<<<<<<<<<< @@ -14903,7 +14903,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde */ __pyx_v_result->hg = new Hypergraph(); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":78 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":78 * cdef Hypergraph result = Hypergraph.__new__(Hypergraph) * result.hg = new hypergraph.Hypergraph() * cdef bytes plf = str(self) # <<<<<<<<<<<<<< @@ -14922,7 +14922,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde __pyx_v_plf = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":79 * result.hg = new hypergraph.Hypergraph() * cdef bytes plf = str(self) * hypergraph.ReadFromPLF(plf, result.hg) # <<<<<<<<<<<<<< @@ -14931,7 +14931,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde __pyx_t_3 = __pyx_convert_string_from_py_(((PyObject *)__pyx_v_plf)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} HypergraphIO::ReadFromPLF(__pyx_t_3, __pyx_v_result->hg); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":80 * cdef bytes plf = str(self) * hypergraph.ReadFromPLF(plf, result.hg) * return result # <<<<<<<<<<<<<< @@ -14946,7 +14946,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Lattice.as_hypergraph", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Lattice.as_hypergraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); @@ -14956,7 +14956,7 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":3 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":3 * cimport mteval * * cdef SufficientStats as_stats(x, y): # <<<<<<<<<<<<<< @@ -14964,9 +14964,9 @@ static PyObject *__pyx_pf_5_cdec_7Lattice_21as_hypergraph(struct __pyx_obj_5_cde * return x */ -static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { - struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_stats = NULL; - struct __pyx_obj_5_cdec_SufficientStats *__pyx_r = NULL; +static struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_f_4cdec_5_cdec_as_stats(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { + struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_stats = NULL; + struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; @@ -14978,18 +14978,18 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("as_stats", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":4 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":4 * * cdef SufficientStats as_stats(x, y): * if isinstance(x, SufficientStats): # <<<<<<<<<<<<<< * return x * elif x == 0 and isinstance(y, SufficientStats): */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_5_cdec_SufficientStats)); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":5 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":5 * cdef SufficientStats as_stats(x, y): * if isinstance(x, SufficientStats): * return x # <<<<<<<<<<<<<< @@ -14997,14 +14997,14 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject * stats = SufficientStats() */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_5_cdec_SufficientStats))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_4cdec_5_cdec_SufficientStats))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_x); - __pyx_r = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_x); + __pyx_r = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_x); goto __pyx_L0; goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":6 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":6 * if isinstance(x, SufficientStats): * return x * elif x == 0 and isinstance(y, SufficientStats): # <<<<<<<<<<<<<< @@ -15015,26 +15015,26 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_2) { - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_y, ((PyObject*)__pyx_ptype_5_cdec_SufficientStats)); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_y, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SufficientStats)); __pyx_t_4 = __pyx_t_1; } else { __pyx_t_4 = __pyx_t_2; } if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":7 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":7 * return x * elif x == 0 and isinstance(y, SufficientStats): * stats = SufficientStats() # <<<<<<<<<<<<<< * stats.stats = new mteval.SufficientStats() * stats.metric = ( y).metric */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_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 = 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_GOTREF(__pyx_t_3); - __pyx_v_stats = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_3); + __pyx_v_stats = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":8 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":8 * elif x == 0 and isinstance(y, SufficientStats): * stats = SufficientStats() * stats.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<< @@ -15043,17 +15043,17 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject */ __pyx_v_stats->stats = new SufficientStats(); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":9 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":9 * stats = SufficientStats() * stats.stats = new mteval.SufficientStats() * stats.metric = ( y).metric # <<<<<<<<<<<<<< * return stats * */ - __pyx_t_5 = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_y)->metric; + __pyx_t_5 = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_y)->metric; __pyx_v_stats->metric = __pyx_t_5; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":10 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":10 * stats.stats = new mteval.SufficientStats() * stats.metric = ( y).metric * return stats # <<<<<<<<<<<<<< @@ -15068,11 +15068,11 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject } __pyx_L3:; - __pyx_r = ((struct __pyx_obj_5_cdec_SufficientStats *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.as_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.as_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_stats); @@ -15082,17 +15082,17 @@ static struct __pyx_obj_5_cdec_SufficientStats *__pyx_f_5_cdec_as_stats(PyObject } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9Candidate_5words___get__(((struct __pyx_obj_5_cdec_Candidate *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_5words___get__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":17 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":17 * * property words: * def __get__(self): # <<<<<<<<<<<<<< @@ -15100,7 +15100,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5words_1__get__(PyObject *__pyx_v_se * */ -static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -15111,7 +15111,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cd int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":18 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":18 * property words: * def __get__(self): * return unicode(GetString(self.candidate.ewords).c_str(), encoding='utf8') # <<<<<<<<<<<<<< @@ -15143,7 +15143,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cd __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.Candidate.words.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Candidate.words.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -15152,17 +15152,17 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5words___get__(struct __pyx_obj_5_cd } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9Candidate_4fmap___get__(((struct __pyx_obj_5_cdec_Candidate *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_4fmap___get__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":21 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":21 * * property fmap: * def __get__(self): # <<<<<<<<<<<<<< @@ -15170,8 +15170,8 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_4fmap_1__get__(PyObject *__pyx_v_sel * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) */ -static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self) { - struct __pyx_obj_5_cdec_SparseVector *__pyx_v_fmap = 0; +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; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -15180,20 +15180,20 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":22 + /* "/home/mdenkows/cdec/python/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_5_cdec_SparseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_5_cdec_SparseVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_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_GOTREF(__pyx_t_1); - if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5_cdec_SparseVector)))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_fmap = ((struct __pyx_obj_5_cdec_SparseVector *)__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":23 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":23 * def __get__(self): * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) # <<<<<<<<<<<<<< @@ -15202,7 +15202,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde */ __pyx_v_fmap->vector = new FastSparseVector(__pyx_v_self->candidate->fmap); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":24 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":24 * cdef SparseVector fmap = SparseVector.__new__(SparseVector) * fmap.vector = new FastSparseVector[weight_t](self.candidate.fmap) * return fmap # <<<<<<<<<<<<<< @@ -15218,7 +15218,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.Candidate.fmap.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Candidate.fmap.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_fmap); @@ -15228,17 +15228,17 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_4fmap___get__(struct __pyx_obj_5_cde } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9Candidate_5score___get__(((struct __pyx_obj_5_cdec_Candidate *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_9Candidate_5score___get__(((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":14 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":14 * cdef class Candidate: * cdef mteval.const_Candidate* candidate * cdef public float score # <<<<<<<<<<<<<< @@ -15246,7 +15246,7 @@ static PyObject *__pyx_pw_5_cdec_9Candidate_5score_1__get__(PyObject *__pyx_v_se * property words: */ -static PyObject *__pyx_pf_5_cdec_9Candidate_5score___get__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -15265,7 +15265,7 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5score___get__(struct __pyx_obj_5_cd goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.Candidate.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Candidate.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -15274,17 +15274,17 @@ static PyObject *__pyx_pf_5_cdec_9Candidate_5score___get__(struct __pyx_obj_5_cd } /* Python wrapper */ -static int __pyx_pw_5_cdec_9Candidate_5score_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5_cdec_9Candidate_5score_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_5_cdec_9Candidate_5score_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_5_cdec_9Candidate_5score_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_9Candidate_5score_2__set__(((struct __pyx_obj_5_cdec_Candidate *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_5_cdec_Candidate *__pyx_v_self, PyObject *__pyx_v_value) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations float __pyx_t_1; @@ -15298,7 +15298,7 @@ static int __pyx_pf_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_5_cdec_Ca __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Candidate.score.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Candidate.score.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -15306,15 +15306,15 @@ static int __pyx_pf_5_cdec_9Candidate_5score_2__set__(struct __pyx_obj_5_cdec_Ca } /* Python wrapper */ -static void __pyx_pw_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_self) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_5_cdec_15SufficientStats___dealloc__(((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":30 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":30 * cdef mteval.EvaluationMetric* metric * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -15322,11 +15322,11 @@ static void __pyx_pw_5_cdec_15SufficientStats_1__dealloc__(PyObject *__pyx_v_sel * */ -static void __pyx_pf_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self) { +static void __pyx_pf_4cdec_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":31 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":31 * * def __dealloc__(self): * del self.stats # <<<<<<<<<<<<<< @@ -15339,17 +15339,17 @@ static void __pyx_pf_5_cdec_15SufficientStats___dealloc__(CYTHON_UNUSED struct _ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_5score_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_5score_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_15SufficientStats_5score___get__(((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_5score___get__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":34 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":34 * * property score: * def __get__(self): # <<<<<<<<<<<<<< @@ -15357,7 +15357,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5score_1__get__(PyObject *__p * */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_5score___get__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -15366,7 +15366,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_5score___get__(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":35 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":35 * property score: * def __get__(self): * return self.metric.ComputeScore(self.stats[0]) # <<<<<<<<<<<<<< @@ -15384,7 +15384,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_5score___get__(struct __pyx_o goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.SufficientStats.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SufficientStats.score.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -15393,17 +15393,17 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_5score___get__(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_15SufficientStats_6detail___get__(((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_6detail___get__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":38 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":38 * * property detail: * def __get__(self): # <<<<<<<<<<<<<< @@ -15411,7 +15411,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(PyObject *__ * */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -15421,7 +15421,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":39 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":39 * property detail: * def __get__(self): * return str(self.metric.DetailedScore(self.stats[0]).c_str()) # <<<<<<<<<<<<<< @@ -15448,7 +15448,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.SufficientStats.detail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SufficientStats.detail.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -15457,17 +15457,17 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_6detail___get__(struct __pyx_ } /* Python wrapper */ -static Py_ssize_t __pyx_pw_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_15SufficientStats_2__len__(((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":41 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":41 * return str(self.metric.DetailedScore(self.stats[0]).c_str()) * * def __len__(self): # <<<<<<<<<<<<<< @@ -15475,12 +15475,12 @@ static Py_ssize_t __pyx_pw_5_cdec_15SufficientStats_3__len__(PyObject *__pyx_v_s * */ -static Py_ssize_t __pyx_pf_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self) { +static Py_ssize_t __pyx_pf_4cdec_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":42 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":42 * * def __len__(self): * return self.stats.size() # <<<<<<<<<<<<<< @@ -15495,20 +15495,20 @@ static Py_ssize_t __pyx_pf_5_cdec_15SufficientStats_2__len__(struct __pyx_obj_5_ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_15SufficientStats_4__iter__(((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_4__iter__(((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":44 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":44 * return self.stats.size() * * def __iter__(self): # <<<<<<<<<<<<<< @@ -15516,15 +15516,15 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_5__iter__(PyObject *__pyx_v_s * yield self[i] */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *__pyx_cur_scope; +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_21___iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(__pyx_ptype_5_cdec___pyx_scope_struct_21___iter__, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -15534,7 +15534,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_5_ __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_15SufficientStats_6generator15, (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_6generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -15543,7 +15543,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_5_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.SufficientStats.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SufficientStats.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -15552,9 +15552,9 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_4__iter__(struct __pyx_obj_5_ return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)__pyx_generator->closure); + struct __pyx_obj_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); PyObject *__pyx_r = NULL; Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -15575,7 +15575,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":45 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":45 * * def __iter__(self): * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -15634,7 +15634,7 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO __pyx_cur_scope->__pyx_v_i = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":46 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":46 * def __iter__(self): * for i in range(len(self)): * yield self[i] # <<<<<<<<<<<<<< @@ -15678,8 +15678,8 @@ static PyObject *__pyx_gb_5_cdec_15SufficientStats_6generator15(__pyx_GeneratorO } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { +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) { int __pyx_v_index; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -15692,16 +15692,16 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_ } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.SufficientStats.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SufficientStats.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_15SufficientStats_7__getitem__(((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_self), ((int)__pyx_v_index)); + __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_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":48 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":48 * yield self[i] * * def __getitem__(self, int index): # <<<<<<<<<<<<<< @@ -15709,7 +15709,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_8__getitem__(PyObject *__pyx_ * raise IndexError('sufficient stats vector index out of range') */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self, int __pyx_v_index) { +static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_7__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; @@ -15721,7 +15721,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":49 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":49 * * def __getitem__(self, int index): * if not 0 <= index < len(self): # <<<<<<<<<<<<<< @@ -15736,14 +15736,14 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":50 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":50 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<< * return self.stats[0][index] * */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -15752,7 +15752,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":51 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":51 * if not 0 <= index < len(self): * raise IndexError('sufficient stats vector index out of range') * return self.stats[0][index] # <<<<<<<<<<<<<< @@ -15770,7 +15770,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.SufficientStats.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SufficientStats.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -15779,16 +15779,16 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_7__getitem__(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +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) { 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_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_5_cdec_15SufficientStats_9__iadd__(((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_v_self), ((struct __pyx_obj_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 = 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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -15797,7 +15797,7 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":53 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":53 * return self.stats[0][index] * * def __iadd__(SufficientStats self, SufficientStats other): # <<<<<<<<<<<<<< @@ -15805,12 +15805,12 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_10__iadd__(PyObject *__pyx_v_ * return self */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_self, struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_other) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iadd__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":54 * * def __iadd__(SufficientStats self, SufficientStats other): * self.stats[0] += other.stats[0] # <<<<<<<<<<<<<< @@ -15819,7 +15819,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_5_ */ (__pyx_v_self->stats[0]) += (__pyx_v_other->stats[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":55 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":55 * def __iadd__(SufficientStats self, SufficientStats other): * self.stats[0] += other.stats[0] * return self # <<<<<<<<<<<<<< @@ -15839,17 +15839,17 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_9__iadd__(struct __pyx_obj_5_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_12__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ -static PyObject *__pyx_pw_5_cdec_15SufficientStats_12__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__add__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_15SufficientStats_11__add__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); + __pyx_r = __pyx_pf_4cdec_5_cdec_15SufficientStats_11__add__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":57 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":57 * return self * * def __add__(x, y): # <<<<<<<<<<<<<< @@ -15857,10 +15857,10 @@ static PyObject *__pyx_pw_5_cdec_15SufficientStats_12__add__(PyObject *__pyx_v_x * cdef SufficientStats sy = as_stats(y, x) */ -static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { - struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_sx = 0; - struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_sy = 0; - struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_result = 0; +static PyObject *__pyx_pf_4cdec_5_cdec_15SufficientStats_11__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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -15870,43 +15870,43 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__add__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":58 * * def __add__(x, y): * cdef SufficientStats sx = as_stats(x, y) # <<<<<<<<<<<<<< * cdef SufficientStats sy = as_stats(y, x) * cdef SufficientStats result = SufficientStats() */ - __pyx_t_1 = ((PyObject *)__pyx_f_5_cdec_as_stats(__pyx_v_x, __pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[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 = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_sx = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1); + __pyx_v_sx = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":59 * def __add__(x, y): * cdef SufficientStats sx = as_stats(x, y) * cdef SufficientStats sy = as_stats(y, x) # <<<<<<<<<<<<<< * cdef SufficientStats result = SufficientStats() * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) */ - __pyx_t_1 = ((PyObject *)__pyx_f_5_cdec_as_stats(__pyx_v_y, __pyx_v_x)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_sy = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1); + __pyx_v_sy = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":60 * cdef SufficientStats sx = as_stats(x, y) * cdef SufficientStats sy = as_stats(y, x) * cdef SufficientStats result = SufficientStats() # <<<<<<<<<<<<<< * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) * result.metric = sx.metric */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_SufficientStats)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_1); - __pyx_v_result = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1); + __pyx_v_result = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":61 * cdef SufficientStats sy = as_stats(y, x) * cdef SufficientStats result = SufficientStats() * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) # <<<<<<<<<<<<<< @@ -15915,7 +15915,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x */ __pyx_v_result->stats = new SufficientStats(operator+((__pyx_v_sx->stats[0]), (__pyx_v_sy->stats[0]))); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":62 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":62 * cdef SufficientStats result = SufficientStats() * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) * result.metric = sx.metric # <<<<<<<<<<<<<< @@ -15925,7 +15925,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x __pyx_t_2 = __pyx_v_sx->metric; __pyx_v_result->metric = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":63 * result.stats = new mteval.SufficientStats(mteval.add(sx.stats[0], sy.stats[0])) * result.metric = sx.metric * return result # <<<<<<<<<<<<<< @@ -15941,7 +15941,7 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.SufficientStats.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SufficientStats.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_sx); @@ -15953,9 +15953,9 @@ static PyObject *__pyx_pf_5_cdec_15SufficientStats_11__add__(PyObject *__pyx_v_x } /* Python wrapper */ -static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_evaluator = 0; +static 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) { + struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_evaluator = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -15987,18 +15987,18 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_evaluator = ((struct __pyx_obj_5_cdec_SegmentEvaluator *)values[0]); + __pyx_v_evaluator = ((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)values[0]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.CandidateSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_5_cdec_SegmentEvaluator, 1, "evaluator", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_12CandidateSet___cinit__(((struct __pyx_obj_5_cdec_CandidateSet *)__pyx_v_self), __pyx_v_evaluator); + 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;} + __pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet___cinit__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self), __pyx_v_evaluator); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -16007,7 +16007,7 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":70 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":70 * cdef mteval.CandidateSet* cs * * def __cinit__(self, SegmentEvaluator evaluator): # <<<<<<<<<<<<<< @@ -16015,13 +16015,13 @@ static int __pyx_pw_5_cdec_12CandidateSet_1__cinit__(PyObject *__pyx_v_self, PyO * self.metric = evaluator.metric */ -static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_evaluator) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":71 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":71 * * def __cinit__(self, SegmentEvaluator evaluator): * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) # <<<<<<<<<<<<<< @@ -16030,7 +16030,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand */ __pyx_v_self->scorer = new boost::shared_ptr((__pyx_v_evaluator->scorer[0])); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":72 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":72 * def __cinit__(self, SegmentEvaluator evaluator): * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) * self.metric = evaluator.metric # <<<<<<<<<<<<<< @@ -16040,7 +16040,7 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand __pyx_t_1 = __pyx_v_evaluator->metric; __pyx_v_self->metric = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":73 * self.scorer = new shared_ptr[mteval.SegmentEvaluator](evaluator.scorer[0]) * self.metric = evaluator.metric * self.cs = new mteval.CandidateSet() # <<<<<<<<<<<<<< @@ -16055,15 +16055,15 @@ static int __pyx_pf_5_cdec_12CandidateSet___cinit__(struct __pyx_obj_5_cdec_Cand } /* Python wrapper */ -static void __pyx_pw_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self) { +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_5_cdec_12CandidateSet_2__dealloc__(((struct __pyx_obj_5_cdec_CandidateSet *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":75 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":75 * self.cs = new mteval.CandidateSet() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -16071,11 +16071,11 @@ static void __pyx_pw_5_cdec_12CandidateSet_3__dealloc__(PyObject *__pyx_v_self) * del self.cs */ -static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self) { +static void __pyx_pf_4cdec_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_CandidateSet *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":76 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":76 * * def __dealloc__(self): * del self.scorer # <<<<<<<<<<<<<< @@ -16084,7 +16084,7 @@ static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __p */ delete __pyx_v_self->scorer; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":77 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":77 * def __dealloc__(self): * del self.scorer * del self.cs # <<<<<<<<<<<<<< @@ -16097,17 +16097,17 @@ static void __pyx_pf_5_cdec_12CandidateSet_2__dealloc__(CYTHON_UNUSED struct __p } /* Python wrapper */ -static Py_ssize_t __pyx_pw_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self) { +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) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12CandidateSet_4__len__(((struct __pyx_obj_5_cdec_CandidateSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_4__len__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":79 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":79 * del self.cs * * def __len__(self): # <<<<<<<<<<<<<< @@ -16115,12 +16115,12 @@ static Py_ssize_t __pyx_pw_5_cdec_12CandidateSet_5__len__(PyObject *__pyx_v_self * */ -static Py_ssize_t __pyx_pf_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":80 * * def __len__(self): * return self.cs.size() # <<<<<<<<<<<<<< @@ -16137,8 +16137,8 @@ static Py_ssize_t __pyx_pf_5_cdec_12CandidateSet_4__len__(struct __pyx_obj_5_cde } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) { +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) { int __pyx_v_k; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -16151,16 +16151,16 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_s } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.CandidateSet.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.CandidateSet.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_12CandidateSet_6__getitem__(((struct __pyx_obj_5_cdec_CandidateSet *)__pyx_v_self), ((int)__pyx_v_k)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_6__getitem__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self), ((int)__pyx_v_k)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":82 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":82 * return self.cs.size() * * def __getitem__(self,int k): # <<<<<<<<<<<<<< @@ -16168,8 +16168,8 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_7__getitem__(PyObject *__pyx_v_s * raise IndexError('candidate set index out of range') */ -static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self, int __pyx_v_k) { - struct __pyx_obj_5_cdec_Candidate *__pyx_v_candidate = 0; +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; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -16180,7 +16180,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":83 * * def __getitem__(self,int k): * if not 0 <= k < self.cs.size(): # <<<<<<<<<<<<<< @@ -16194,14 +16194,14 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":84 * def __getitem__(self,int k): * if not 0 <= k < self.cs.size(): * raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<< * cdef Candidate candidate = Candidate() * candidate.candidate = &self.cs[0][k] */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -16210,19 +16210,19 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":85 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":85 * if not 0 <= k < self.cs.size(): * raise IndexError('candidate set index out of range') * cdef Candidate candidate = Candidate() # <<<<<<<<<<<<<< * candidate.candidate = &self.cs[0][k] * candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Candidate)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_3); - __pyx_v_candidate = ((struct __pyx_obj_5_cdec_Candidate *)__pyx_t_3); + __pyx_v_candidate = ((struct __pyx_obj_4cdec_5_cdec_Candidate *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":86 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":86 * raise IndexError('candidate set index out of range') * cdef Candidate candidate = Candidate() * candidate.candidate = &self.cs[0][k] # <<<<<<<<<<<<<< @@ -16231,7 +16231,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ */ __pyx_v_candidate->candidate = (&((__pyx_v_self->cs[0])[__pyx_v_k])); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":87 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":87 * cdef Candidate candidate = Candidate() * candidate.candidate = &self.cs[0][k] * candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) # <<<<<<<<<<<<<< @@ -16240,7 +16240,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ */ __pyx_v_candidate->score = __pyx_v_self->metric->ComputeScore(((__pyx_v_self->cs[0])[__pyx_v_k]).eval_feats); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":88 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":88 * candidate.candidate = &self.cs[0][k] * candidate.score = self.metric.ComputeScore(self.cs[0][k].eval_feats) * return candidate # <<<<<<<<<<<<<< @@ -16256,7 +16256,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.CandidateSet.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.CandidateSet.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_candidate); @@ -16264,20 +16264,20 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_6__getitem__(struct __pyx_obj_5_ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_12CandidateSet_8__iter__(((struct __pyx_obj_5_cdec_CandidateSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_12CandidateSet_8__iter__(((struct __pyx_obj_4cdec_5_cdec_CandidateSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":90 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":90 * return candidate * * def __iter__(self): # <<<<<<<<<<<<<< @@ -16285,15 +16285,15 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_9__iter__(PyObject *__pyx_v_self * for i in range(len(self)): */ -static PyObject *__pyx_pf_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *__pyx_cur_scope; +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_22___iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__(__pyx_ptype_5_cdec___pyx_scope_struct_22___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; @@ -16303,7 +16303,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_5_cde __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_12CandidateSet_10generator16, (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_10generator16, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -16312,7 +16312,7 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_5_cde __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.CandidateSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.CandidateSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -16321,9 +16321,9 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_8__iter__(struct __pyx_obj_5_cde return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)__pyx_generator->closure); + 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; @@ -16343,7 +16343,7 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":92 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":92 * def __iter__(self): * cdef unsigned i * for i in range(len(self)): # <<<<<<<<<<<<<< @@ -16354,7 +16354,7 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":93 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":93 * cdef unsigned i * for i in range(len(self)): * yield self[i] # <<<<<<<<<<<<<< @@ -16391,10 +16391,10 @@ static PyObject *__pyx_gb_5_cdec_12CandidateSet_10generator16(__pyx_GeneratorObj } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_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."; -static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_hypergraph = 0; +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_hypergraph = 0; unsigned int __pyx_v_k; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -16434,19 +16434,19 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_hypergraph = ((struct __pyx_obj_5_cdec_Hypergraph *)values[0]); + __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;} } 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_L3_error:; - __Pyx_AddTraceback("_cdec.CandidateSet.add_kbest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_5_cdec_Hypergraph, 1, "hypergraph", 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_cdec_12CandidateSet_11add_kbest(((struct __pyx_obj_5_cdec_CandidateSet *)__pyx_v_self), __pyx_v_hypergraph, __pyx_v_k); + 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;} + __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); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -16455,7 +16455,7 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":95 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":95 * yield self[i] * * def add_kbest(self, Hypergraph hypergraph, unsigned k): # <<<<<<<<<<<<<< @@ -16463,12 +16463,12 @@ static PyObject *__pyx_pw_5_cdec_12CandidateSet_12add_kbest(PyObject *__pyx_v_se * from the hypergraph and add them to the candidate set.""" */ -static PyObject *__pyx_pf_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_5_cdec_CandidateSet *__pyx_v_self, struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_hypergraph, unsigned int __pyx_v_k) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":98 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":98 * """cs.add_kbest(Hypergraph hypergraph, int k) -> Extract K-best hypotheses * from the hypergraph and add them to the candidate set.""" * self.cs.AddKBestCandidates(hypergraph.hg[0], k, self.scorer.get()) # <<<<<<<<<<<<<< @@ -16484,15 +16484,15 @@ static PyObject *__pyx_pf_5_cdec_12CandidateSet_11add_kbest(struct __pyx_obj_5_c } /* Python wrapper */ -static void __pyx_pw_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_self) { +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_5_cdec_16SegmentEvaluator___dealloc__(((struct __pyx_obj_5_cdec_SegmentEvaluator *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":104 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":104 * cdef mteval.EvaluationMetric* metric * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -16500,11 +16500,11 @@ static void __pyx_pw_5_cdec_16SegmentEvaluator_1__dealloc__(PyObject *__pyx_v_se * */ -static void __pyx_pf_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_self) { +static void __pyx_pf_4cdec_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":105 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":105 * * def __dealloc__(self): * del self.scorer # <<<<<<<<<<<<<< @@ -16517,18 +16517,18 @@ static void __pyx_pf_5_cdec_16SegmentEvaluator___dealloc__(CYTHON_UNUSED struct } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__pyx_v_self, PyObject *__pyx_v_sentence); /*proto*/ -static char __pyx_doc_5_cdec_16SegmentEvaluator_2evaluate[] = "se.evaluate(sentence) -> SufficientStats for the given hypothesis."; -static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__pyx_v_self, PyObject *__pyx_v_sentence) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__pyx_v_self, PyObject *__pyx_v_sentence) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("evaluate (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(((struct __pyx_obj_5_cdec_SegmentEvaluator *)__pyx_v_self), ((PyObject *)__pyx_v_sentence)); + __pyx_r = __pyx_pf_4cdec_5_cdec_16SegmentEvaluator_2evaluate(((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_v_self), ((PyObject *)__pyx_v_sentence)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":107 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":107 * del self.scorer * * def evaluate(self, sentence): # <<<<<<<<<<<<<< @@ -16536,9 +16536,9 @@ static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_3evaluate(PyObject *__pyx_v_ * cdef vector[WordID] hyp */ -static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_self, PyObject *__pyx_v_sentence) { +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 __pyx_v_hyp; - struct __pyx_obj_5_cdec_SufficientStats *__pyx_v_sf = 0; + struct __pyx_obj_4cdec_5_cdec_SufficientStats *__pyx_v_sf = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -16550,19 +16550,19 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("evaluate", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":110 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":110 * """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_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 = 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_GOTREF(__pyx_t_1); - __pyx_v_sf = ((struct __pyx_obj_5_cdec_SufficientStats *)__pyx_t_1); + __pyx_v_sf = ((struct __pyx_obj_4cdec_5_cdec_SufficientStats *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":111 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":111 * cdef vector[WordID] hyp * cdef SufficientStats sf = SufficientStats() * sf.metric = self.metric # <<<<<<<<<<<<<< @@ -16572,7 +16572,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 __pyx_t_2 = __pyx_v_self->metric; __pyx_v_sf->metric = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":112 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":112 * cdef SufficientStats sf = SufficientStats() * sf.metric = self.metric * sf.stats = new mteval.SufficientStats() # <<<<<<<<<<<<<< @@ -16581,7 +16581,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 */ __pyx_v_sf->stats = new SufficientStats(); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":113 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":113 * sf.metric = self.metric * sf.stats = new mteval.SufficientStats() * ConvertSentence(as_str(sentence.strip()), &hyp) # <<<<<<<<<<<<<< @@ -16593,14 +16593,14 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 __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_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = ((PyObject *)__pyx_f_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_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_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; TD::ConvertSentence(__pyx_t_4, (&__pyx_v_hyp)); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":114 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":114 * sf.stats = new mteval.SufficientStats() * ConvertSentence(as_str(sentence.strip()), &hyp) * self.scorer.get().Evaluate(hyp, sf.stats) # <<<<<<<<<<<<<< @@ -16609,7 +16609,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 */ __pyx_v_self->scorer->get()->Evaluate(__pyx_v_hyp, __pyx_v_sf->stats); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":115 * ConvertSentence(as_str(sentence.strip()), &hyp) * self.scorer.get().Evaluate(hyp, sf.stats) * return sf # <<<<<<<<<<<<<< @@ -16626,7 +16626,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_cdec.SegmentEvaluator.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SegmentEvaluator.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_sf); @@ -16636,18 +16636,18 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_2evaluate(struct __pyx_obj_5 } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_5candidate_set(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5_cdec_16SegmentEvaluator_4candidate_set[] = "se.candidate_set() -> Candidate set using this segment evaluator for scoring."; -static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_5candidate_set(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +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."; +static PyObject *__pyx_pw_4cdec_5_cdec_16SegmentEvaluator_5candidate_set(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("candidate_set (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(((struct __pyx_obj_5_cdec_SegmentEvaluator *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_16SegmentEvaluator_4candidate_set(((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":117 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":117 * return sf * * def candidate_set(self): # <<<<<<<<<<<<<< @@ -16655,7 +16655,7 @@ static PyObject *__pyx_pw_5_cdec_16SegmentEvaluator_5candidate_set(PyObject *__p * return CandidateSet(self) */ -static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_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 PyObject *__pyx_t_1 = NULL; @@ -16665,7 +16665,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("candidate_set", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":119 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":119 * def candidate_set(self): * """se.candidate_set() -> Candidate set using this segment evaluator for scoring.""" * return CandidateSet(self) # <<<<<<<<<<<<<< @@ -16678,7 +16678,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_ __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_CandidateSet)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; @@ -16690,7 +16690,7 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.SegmentEvaluator.candidate_set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.SegmentEvaluator.candidate_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -16699,8 +16699,8 @@ static PyObject *__pyx_pf_5_cdec_16SegmentEvaluator_4candidate_set(struct __pyx_ } /* Python wrapper */ -static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_name = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -16712,7 +16712,7 @@ static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject * static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0}; PyObject* values[1] = {0}; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":125 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":125 * cdef mteval.EvaluationMetric* metric * * def __cinit__(self, bytes name=None): # <<<<<<<<<<<<<< @@ -16752,12 +16752,12 @@ static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject * __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_L3_error:; - __Pyx_AddTraceback("_cdec.Scorer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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;} - __pyx_r = __pyx_pf_5_cdec_6Scorer___cinit__(((struct __pyx_obj_5_cdec_Scorer *)__pyx_v_self), __pyx_v_name); + __pyx_r = __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self), __pyx_v_name); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -16766,7 +16766,7 @@ static int __pyx_pw_5_cdec_6Scorer_1__cinit__(PyObject *__pyx_v_self, PyObject * return __pyx_r; } -static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_name) { +static int __pyx_pf_4cdec_5_cdec_6Scorer___cinit__(struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_name) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -16777,7 +16777,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":126 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":126 * * def __cinit__(self, bytes name=None): * if name: # <<<<<<<<<<<<<< @@ -16787,7 +16787,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p __pyx_t_1 = (((PyObject *)__pyx_v_name) != Py_None) && (PyBytes_GET_SIZE(((PyObject *)__pyx_v_name)) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":127 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":127 * def __cinit__(self, bytes name=None): * if name: * self.name = new string(name) # <<<<<<<<<<<<<< @@ -16803,7 +16803,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p } __pyx_v_self->name = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":128 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":128 * if name: * self.name = new string(name) * self.metric = mteval.MetricInstance(self.name[0]) # <<<<<<<<<<<<<< @@ -16818,7 +16818,7 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Scorer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Scorer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -16826,15 +16826,15 @@ static int __pyx_pf_5_cdec_6Scorer___cinit__(struct __pyx_obj_5_cdec_Scorer *__p } /* Python wrapper */ -static void __pyx_pw_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self) { +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_5_cdec_6Scorer_2__dealloc__(((struct __pyx_obj_5_cdec_Scorer *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":130 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":130 * self.metric = mteval.MetricInstance(self.name[0]) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -16842,11 +16842,11 @@ static void __pyx_pw_5_cdec_6Scorer_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Scorer *__pyx_v_self) { +static void __pyx_pf_4cdec_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Scorer *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":131 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":131 * * def __dealloc__(self): * del self.name # <<<<<<<<<<<<<< @@ -16859,8 +16859,8 @@ static void __pyx_pf_5_cdec_6Scorer_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_refs = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -16899,16 +16899,16 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj __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_L3_error:; - __Pyx_AddTraceback("_cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_5_cdec_6Scorer_4__call__(((struct __pyx_obj_5_cdec_Scorer *)__pyx_v_self), __pyx_v_refs); + __pyx_r = __pyx_pf_4cdec_5_cdec_6Scorer_4__call__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self), __pyx_v_refs); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":133 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":133 * del self.name * * def __call__(self, refs): # <<<<<<<<<<<<<< @@ -16916,11 +16916,11 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_5__call__(PyObject *__pyx_v_self, PyObj * refs = [refs] */ -static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Scorer *__pyx_v_self, PyObject *__pyx_v_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 > *__pyx_v_refsv; std::vector *__pyx_v_refv; PyObject *__pyx_v_ref = NULL; - struct __pyx_obj_5_cdec_SegmentEvaluator *__pyx_v_evaluator = 0; + struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *__pyx_v_evaluator = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -16940,7 +16940,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score __Pyx_RefNannySetupContext("__call__", 0); __Pyx_INCREF(__pyx_v_refs); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":134 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":134 * * def __call__(self, refs): * if isinstance(refs, basestring): # <<<<<<<<<<<<<< @@ -16951,7 +16951,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":135 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":135 * def __call__(self, refs): * if isinstance(refs, basestring): * refs = [refs] # <<<<<<<<<<<<<< @@ -16970,7 +16970,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":136 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":136 * if isinstance(refs, basestring): * refs = [refs] * cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() # <<<<<<<<<<<<<< @@ -16985,7 +16985,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score } __pyx_v_refsv = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":138 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":138 * cdef vector[vector[WordID]]* refsv = new vector[vector[WordID]]() * cdef vector[WordID]* refv * for ref in refs: # <<<<<<<<<<<<<< @@ -17030,7 +17030,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score __pyx_v_ref = __pyx_t_7; __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":139 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":139 * cdef vector[WordID]* refv * for ref in refs: * refv = new vector[WordID]() # <<<<<<<<<<<<<< @@ -17045,7 +17045,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score } __pyx_v_refv = __pyx_t_8; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":140 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":140 * for ref in refs: * refv = new vector[WordID]() * ConvertSentence(as_str(ref.strip()), refv) # <<<<<<<<<<<<<< @@ -17057,14 +17057,14 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score __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_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = ((PyObject *)__pyx_f_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_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_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_DECREF(__pyx_t_7); __pyx_t_7 = 0; TD::ConvertSentence(__pyx_t_10, __pyx_v_refv); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":141 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":141 * refv = new vector[WordID]() * ConvertSentence(as_str(ref.strip()), refv) * refsv.push_back(refv[0]) # <<<<<<<<<<<<<< @@ -17073,7 +17073,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score */ __pyx_v_refsv->push_back((__pyx_v_refv[0])); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":142 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":142 * ConvertSentence(as_str(ref.strip()), refv) * refsv.push_back(refv[0]) * del refv # <<<<<<<<<<<<<< @@ -17084,19 +17084,19 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":144 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":144 * 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_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 = 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_GOTREF(__pyx_t_3); - __pyx_v_evaluator = ((struct __pyx_obj_5_cdec_SegmentEvaluator *)__pyx_t_3); + __pyx_v_evaluator = ((struct __pyx_obj_4cdec_5_cdec_SegmentEvaluator *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":145 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":145 * cdef unsigned i * cdef SegmentEvaluator evaluator = SegmentEvaluator() * evaluator.metric = self.metric # <<<<<<<<<<<<<< @@ -17106,7 +17106,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score __pyx_t_11 = __pyx_v_self->metric; __pyx_v_evaluator->metric = __pyx_t_11; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":146 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":146 * cdef SegmentEvaluator evaluator = SegmentEvaluator() * evaluator.metric = self.metric * evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( # <<<<<<<<<<<<<< @@ -17115,7 +17115,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score */ __pyx_v_evaluator->scorer = new boost::shared_ptr(__pyx_v_self->metric->CreateSegmentEvaluator((__pyx_v_refsv[0]))); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":148 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":148 * evaluator.scorer = new shared_ptr[mteval.SegmentEvaluator]( * self.metric.CreateSegmentEvaluator(refsv[0])) * del refsv # in theory should not delete but store in SegmentEvaluator # <<<<<<<<<<<<<< @@ -17124,7 +17124,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score */ delete __pyx_v_refsv; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":149 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":149 * self.metric.CreateSegmentEvaluator(refsv[0])) * del refsv # in theory should not delete but store in SegmentEvaluator * return evaluator # <<<<<<<<<<<<<< @@ -17142,7 +17142,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("_cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Scorer.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ref); @@ -17154,17 +17154,17 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_4__call__(struct __pyx_obj_5_cdec_Score } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_6Scorer_6__str__(((struct __pyx_obj_5_cdec_Scorer *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_6Scorer_6__str__(((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":151 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":151 * return evaluator * * def __str__(self): # <<<<<<<<<<<<<< @@ -17172,7 +17172,7 @@ static PyObject *__pyx_pw_5_cdec_6Scorer_7__str__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer *__pyx_v_self) { +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 PyObject *__pyx_t_1 = NULL; @@ -17182,7 +17182,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":152 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":152 * * def __str__(self): * return str(self.name.c_str()) # <<<<<<<<<<<<<< @@ -17209,7 +17209,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Scorer.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Scorer.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17217,7 +17217,7 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":154 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":154 * return str(self.name.c_str()) * * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): # <<<<<<<<<<<<<< @@ -17225,8 +17225,8 @@ static PyObject *__pyx_pf_5_cdec_6Scorer_6__str__(struct __pyx_obj_5_cdec_Scorer * cdef list ss = [] */ -static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStats *__pyx_v_stats) { - struct __pyx_obj_5_cdec_Metric *__pyx_v_metric = 0; +static float __pyx_f_4cdec_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStats *__pyx_v_stats) { + struct __pyx_obj_4cdec_5_cdec_Metric *__pyx_v_metric = 0; PyObject *__pyx_v_ss = 0; unsigned int __pyx_v_i; float __pyx_r; @@ -17243,17 +17243,17 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_compute_score", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":155 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":155 * * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): * cdef Metric metric = metric_ # <<<<<<<<<<<<<< * cdef list ss = [] * cdef unsigned i */ - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_))); - __pyx_v_metric = ((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_))); + __pyx_v_metric = ((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":156 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":156 * cdef float _compute_score(void* metric_, mteval.SufficientStats* stats): * cdef Metric metric = metric_ * cdef list ss = [] # <<<<<<<<<<<<<< @@ -17265,7 +17265,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat __pyx_v_ss = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":158 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":158 * cdef list ss = [] * cdef unsigned i * for i in range(stats.size()): # <<<<<<<<<<<<<< @@ -17276,7 +17276,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":159 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":159 * cdef unsigned i * for i in range(stats.size()): * ss.append(stats[0][i]) # <<<<<<<<<<<<<< @@ -17289,7 +17289,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":160 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":160 * for i in range(stats.size()): * ss.append(stats[0][i]) * return metric.score(ss) # <<<<<<<<<<<<<< @@ -17318,7 +17318,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("_cdec._compute_score", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec._cdec._compute_score", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_metric); @@ -17327,7 +17327,7 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":162 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":162 * return metric.score(ss) * * cdef void _compute_sufficient_stats(void* metric_, # <<<<<<<<<<<<<< @@ -17335,8 +17335,8 @@ static float __pyx_f_5_cdec__compute_score(void *__pyx_v_metric_, SufficientStat * vector[string]* refs, */ -static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std::string *__pyx_v_hyp, std::vector *__pyx_v_refs, SufficientStats *__pyx_v_out) { - struct __pyx_obj_5_cdec_Metric *__pyx_v_metric = 0; +static void __pyx_f_4cdec_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std::string *__pyx_v_hyp, std::vector *__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; PyObject *__pyx_v_ss = 0; @@ -17354,17 +17354,17 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_compute_sufficient_stats", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":166 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":166 * vector[string]* refs, * mteval.SufficientStats* out): * cdef Metric metric = metric_ # <<<<<<<<<<<<<< * cdef list refs_ = [] * cdef unsigned i */ - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_))); - __pyx_v_metric = ((struct __pyx_obj_5_cdec_Metric *)__pyx_v_metric_); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_))); + __pyx_v_metric = ((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_metric_); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":167 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":167 * mteval.SufficientStats* out): * cdef Metric metric = metric_ * cdef list refs_ = [] # <<<<<<<<<<<<<< @@ -17376,7 +17376,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: __pyx_v_refs_ = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":169 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":169 * cdef list refs_ = [] * cdef unsigned i * for i in range(refs.size()): # <<<<<<<<<<<<<< @@ -17387,7 +17387,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":170 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":170 * cdef unsigned i * for i in range(refs.size()): * refs_.append(str(refs[0][i].c_str())) # <<<<<<<<<<<<<< @@ -17408,7 +17408,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":171 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":171 * for i in range(refs.size()): * refs_.append(str(refs[0][i].c_str())) * cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) # <<<<<<<<<<<<<< @@ -17443,7 +17443,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: __pyx_v_ss = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":172 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":172 * refs_.append(str(refs[0][i].c_str())) * cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) * out.fields.resize(len(ss)) # <<<<<<<<<<<<<< @@ -17457,7 +17457,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":173 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":173 * cdef list ss = metric.evaluate(str(hyp.c_str()), refs_) * out.fields.resize(len(ss)) * for i in range(len(ss)): # <<<<<<<<<<<<<< @@ -17472,7 +17472,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_7; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":174 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":174 * out.fields.resize(len(ss)) * for i in range(len(ss)): * out.fields[i] = ss[i] # <<<<<<<<<<<<<< @@ -17495,7 +17495,7 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("_cdec._compute_sufficient_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec._cdec._compute_sufficient_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_metric); __Pyx_XDECREF(__pyx_v_refs_); @@ -17504,20 +17504,20 @@ static void __pyx_f_5_cdec__compute_sufficient_stats(void *__pyx_v_metric_, std: } /* Python wrapper */ -static int __pyx_pw_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __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_5_cdec_6Metric___cinit__(((struct __pyx_obj_5_cdec_Metric *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_6Metric___cinit__(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":178 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":178 * cdef class Metric: * cdef Scorer scorer * def __cinit__(self): # <<<<<<<<<<<<<< @@ -17525,7 +17525,7 @@ static int __pyx_pw_5_cdec_6Metric_1__cinit__(PyObject *__pyx_v_self, PyObject * * cdef bytes class_name = self.__class__.__name__ */ -static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__pyx_v_self) { +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; __Pyx_RefNannyDeclarations @@ -17538,22 +17538,22 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":179 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":179 * 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_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 = 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_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->scorer); __Pyx_DECREF(((PyObject *)__pyx_v_self->scorer)); - __pyx_v_self->scorer = ((struct __pyx_obj_5_cdec_Scorer *)__pyx_t_1); + __pyx_v_self->scorer = ((struct __pyx_obj_4cdec_5_cdec_Scorer *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":180 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":180 * def __cinit__(self): * self.scorer = Scorer() * cdef bytes class_name = self.__class__.__name__ # <<<<<<<<<<<<<< @@ -17569,7 +17569,7 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p __pyx_v_class_name = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":181 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":181 * self.scorer = Scorer() * cdef bytes class_name = self.__class__.__name__ * self.scorer.name = new string(class_name) # <<<<<<<<<<<<<< @@ -17585,21 +17585,21 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p } __pyx_v_self->scorer->name = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":182 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":182 * cdef bytes class_name = self.__class__.__name__ * self.scorer.name = new string(class_name) * self.scorer.metric = mteval.PyMetricInstance(self.scorer.name[0], # <<<<<<<<<<<<<< * self, _compute_sufficient_stats, _compute_score) * */ - __pyx_v_self->scorer->metric = PythonEvaluationMetric::Instance((__pyx_v_self->scorer->name[0]), ((void *)__pyx_v_self), __pyx_f_5_cdec__compute_sufficient_stats, __pyx_f_5_cdec__compute_score); + __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); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Metric.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Metric.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_class_name); @@ -17608,8 +17608,8 @@ static int __pyx_pf_5_cdec_6Metric___cinit__(struct __pyx_obj_5_cdec_Metric *__p } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { PyObject *__pyx_v_refs = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -17648,16 +17648,16 @@ static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObj __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_L3_error:; - __Pyx_AddTraceback("_cdec.Metric.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_5_cdec_6Metric_2__call__(((struct __pyx_obj_5_cdec_Metric *)__pyx_v_self), __pyx_v_refs); + __pyx_r = __pyx_pf_4cdec_5_cdec_6Metric_2__call__(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_self), __pyx_v_refs); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":185 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":185 * self, _compute_sufficient_stats, _compute_score) * * def __call__(self, refs): # <<<<<<<<<<<<<< @@ -17665,7 +17665,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_3__call__(PyObject *__pyx_v_self, PyObj * */ -static PyObject *__pyx_pf_5_cdec_6Metric_2__call__(struct __pyx_obj_5_cdec_Metric *__pyx_v_self, PyObject *__pyx_v_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; @@ -17675,7 +17675,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_2__call__(struct __pyx_obj_5_cdec_Metri int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__call__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":186 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":186 * * def __call__(self, refs): * return self.scorer(refs) # <<<<<<<<<<<<<< @@ -17700,7 +17700,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_2__call__(struct __pyx_obj_5_cdec_Metri __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Metric.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Metric.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17709,17 +17709,17 @@ static PyObject *__pyx_pf_5_cdec_6Metric_2__call__(struct __pyx_obj_5_cdec_Metri } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, CYTHON_UNUSED PyObject *unused) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("score (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_6Metric_4score(((struct __pyx_obj_5_cdec_Metric *)__pyx_v_stats)); + __pyx_r = __pyx_pf_4cdec_5_cdec_6Metric_4score(((struct __pyx_obj_4cdec_5_cdec_Metric *)__pyx_v_stats)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":188 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":188 * return self.scorer(refs) * * def score(SufficientStats stats): # <<<<<<<<<<<<<< @@ -17727,12 +17727,12 @@ static PyObject *__pyx_pw_5_cdec_6Metric_5score(PyObject *__pyx_v_stats, CYTHON_ * */ -static PyObject *__pyx_pf_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx_obj_5_cdec_Metric *__pyx_v_stats) { +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); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":189 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":189 * * def score(SufficientStats stats): * return 0 # <<<<<<<<<<<<<< @@ -17752,8 +17752,8 @@ static PyObject *__pyx_pf_5_cdec_6Metric_4score(CYTHON_UNUSED struct __pyx_obj_5 } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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) { CYTHON_UNUSED PyObject *__pyx_v_hyp = 0; CYTHON_UNUSED PyObject *__pyx_v_refs = 0; int __pyx_lineno = 0; @@ -17801,16 +17801,16 @@ static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObj __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_L3_error:; - __Pyx_AddTraceback("_cdec.Metric.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_5_cdec_6Metric_6evaluate(((struct __pyx_obj_5_cdec_Metric *)__pyx_v_self), __pyx_v_hyp, __pyx_v_refs); + __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); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":191 +/* "/home/mdenkows/cdec/python/cdec/mteval.pxi":191 * return 0 * * def evaluate(self, hyp, refs): # <<<<<<<<<<<<<< @@ -17818,7 +17818,7 @@ static PyObject *__pyx_pw_5_cdec_6Metric_7evaluate(PyObject *__pyx_v_self, PyObj * */ -static PyObject *__pyx_pf_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_obj_5_cdec_Metric *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_hyp, CYTHON_UNUSED PyObject *__pyx_v_refs) { +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 PyObject *__pyx_t_1 = NULL; @@ -17827,7 +17827,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("evaluate", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":192 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":192 * * def evaluate(self, hyp, refs): * return [] # <<<<<<<<<<<<<< @@ -17845,7 +17845,7 @@ static PyObject *__pyx_pf_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_ob goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_cdec.Metric.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Metric.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17854,19 +17854,19 @@ static PyObject *__pyx_pf_5_cdec_6Metric_6evaluate(CYTHON_UNUSED struct __pyx_ob } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_3set_silent(PyObject *__pyx_self, PyObject *__pyx_v_yn); /*proto*/ -static char __pyx_doc_5_cdec_2set_silent[] = "set_silent(bool): Configure the verbosity of cdec."; -static PyMethodDef __pyx_mdef_5_cdec_3set_silent = {__Pyx_NAMESTR("set_silent"), (PyCFunction)__pyx_pw_5_cdec_3set_silent, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_2set_silent)}; -static PyObject *__pyx_pw_5_cdec_3set_silent(PyObject *__pyx_self, PyObject *__pyx_v_yn) { +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 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_5_cdec_2set_silent(__pyx_self, ((PyObject *)__pyx_v_yn)); + __pyx_r = __pyx_pf_4cdec_5_cdec_2set_silent(__pyx_self, ((PyObject *)__pyx_v_yn)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_cdec.pyx":28 +/* "cdec/_cdec.pyx":28 * class ParseFailed(Exception): pass * * def set_silent(yn): # <<<<<<<<<<<<<< @@ -17874,7 +17874,7 @@ static PyObject *__pyx_pw_5_cdec_3set_silent(PyObject *__pyx_self, PyObject *__p * SetSilent(yn) */ -static PyObject *__pyx_pf_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_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 int __pyx_t_1; @@ -17883,7 +17883,7 @@ static PyObject *__pyx_pf_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_silent", 0); - /* "_cdec.pyx":30 + /* "cdec/_cdec.pyx":30 * def set_silent(yn): * """set_silent(bool): Configure the verbosity of cdec.""" * SetSilent(yn) # <<<<<<<<<<<<<< @@ -17896,28 +17896,28 @@ static PyObject *__pyx_pf_5_cdec_2set_silent(CYTHON_UNUSED PyObject *__pyx_self, __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.set_silent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.set_silent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_5_make_config(PyObject *__pyx_self, PyObject *__pyx_v_config); /*proto*/ -static PyMethodDef __pyx_mdef_5_cdec_5_make_config = {__Pyx_NAMESTR("_make_config"), (PyCFunction)__pyx_pw_5_cdec_5_make_config, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_5_cdec_5_make_config(PyObject *__pyx_self, PyObject *__pyx_v_config) { +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 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_5_cdec_4_make_config(__pyx_self, ((PyObject *)__pyx_v_config)); + __pyx_r = __pyx_pf_4cdec_5_cdec_4_make_config(__pyx_self, ((PyObject *)__pyx_v_config)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_cdec.pyx":32 +/* "cdec/_cdec.pyx":32 * SetSilent(yn) * * def _make_config(config): # <<<<<<<<<<<<<< @@ -17925,15 +17925,15 @@ static PyObject *__pyx_pw_5_cdec_5_make_config(PyObject *__pyx_self, PyObject *_ * if isinstance(value, dict): */ -static PyObject *__pyx_pf_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_config) { - struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *__pyx_cur_scope; +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_23__make_config *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_make_config", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)__pyx_tp_new_5_cdec___pyx_scope_struct_23__make_config(__pyx_ptype_5_cdec___pyx_scope_struct_23__make_config, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23__make_config(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_23__make_config, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -17943,7 +17943,7 @@ static PyObject *__pyx_pf_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_INCREF(__pyx_cur_scope->__pyx_v_config); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_config); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_5_cdec_6generator17, (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_6generator17, (PyObject *) __pyx_cur_scope); 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; @@ -17952,7 +17952,7 @@ static PyObject *__pyx_pf_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_sel __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec._make_config", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec._make_config", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -17961,9 +17961,9 @@ static PyObject *__pyx_pf_5_cdec_4_make_config(CYTHON_UNUSED PyObject *__pyx_sel return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -17995,7 +17995,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_cdec.pyx":33 + /* "cdec/_cdec.pyx":33 * * def _make_config(config): * for key, value in config.items(): # <<<<<<<<<<<<<< @@ -18104,7 +18104,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener __pyx_cur_scope->__pyx_v_value = __pyx_t_6; __pyx_t_6 = 0; - /* "_cdec.pyx":34 + /* "cdec/_cdec.pyx":34 * def _make_config(config): * for key, value in config.items(): * if isinstance(value, dict): # <<<<<<<<<<<<<< @@ -18115,7 +18115,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener __pyx_t_10 = (__pyx_t_9 != 0); if (__pyx_t_10) { - /* "_cdec.pyx":35 + /* "cdec/_cdec.pyx":35 * for key, value in config.items(): * if isinstance(value, dict): * for name, info in value.items(): # <<<<<<<<<<<<<< @@ -18224,7 +18224,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener __pyx_cur_scope->__pyx_v_info = __pyx_t_7; __pyx_t_7 = 0; - /* "_cdec.pyx":36 + /* "cdec/_cdec.pyx":36 * if isinstance(value, dict): * for name, info in value.items(): * yield key, '%s %s' % (name, info) # <<<<<<<<<<<<<< @@ -18239,7 +18239,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener __Pyx_INCREF(__pyx_cur_scope->__pyx_v_info); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_info); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_info); - __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} @@ -18282,7 +18282,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener goto __pyx_L8; } - /* "_cdec.pyx":37 + /* "cdec/_cdec.pyx":37 * for name, info in value.items(): * yield key, '%s %s' % (name, info) * elif isinstance(value, list): # <<<<<<<<<<<<<< @@ -18293,7 +18293,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener __pyx_t_9 = (__pyx_t_10 != 0); if (__pyx_t_9) { - /* "_cdec.pyx":38 + /* "cdec/_cdec.pyx":38 * yield key, '%s %s' % (name, info) * elif isinstance(value, list): * for name in value: # <<<<<<<<<<<<<< @@ -18340,7 +18340,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener __pyx_cur_scope->__pyx_v_name = __pyx_t_6; __pyx_t_6 = 0; - /* "_cdec.pyx":39 + /* "cdec/_cdec.pyx":39 * elif isinstance(value, list): * for name in value: * yield key, name # <<<<<<<<<<<<<< @@ -18388,7 +18388,7 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener } /*else*/ { - /* "_cdec.pyx":41 + /* "cdec/_cdec.pyx":41 * yield key, name * else: * yield key, str(value) # <<<<<<<<<<<<<< @@ -18452,12 +18452,12 @@ static PyObject *__pyx_gb_5_cdec_6generator17(__pyx_GeneratorObject *__pyx_gener } /* Python wrapper */ -static int __pyx_pw_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_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."; +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."; #if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_5_cdec_7Decoder___init__; +struct wrapperbase __pyx_wrapperbase_4cdec_5_cdec_7Decoder___init__; #endif -static int __pyx_pw_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_config_str = 0; PyObject *__pyx_v_config = 0; int __pyx_lineno = 0; @@ -18472,7 +18472,7 @@ static int __pyx_pw_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyObject * static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__config_str,0}; PyObject* values[1] = {0}; - /* "_cdec.pyx":47 + /* "cdec/_cdec.pyx":47 * cdef DenseVector weights * * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<< @@ -18513,18 +18513,18 @@ static int __pyx_pw_5_cdec_7Decoder_1__init__(PyObject *__pyx_v_self, PyObject * __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_CLEAR(__pyx_v_config); - __Pyx_AddTraceback("_cdec.Decoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Decoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_7Decoder___init__(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self), __pyx_v_config_str, __pyx_v_config); + __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); __Pyx_XDECREF(__pyx_v_config); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7Decoder_8__init___2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "_cdec.pyx":56 +/* "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)) # <<<<<<<<<<<<<< @@ -18532,25 +18532,25 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_8__init___2generator21(__pyx_Generator * self.dec = new decoder.Decoder(config_stream) */ -static PyObject *__pyx_pf_5_cdec_7Decoder_8__init___genexpr(PyObject *__pyx_self) { - struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_5_cdec_7Decoder_8__init___genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)__pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr(__pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25_genexpr(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___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_5_cdec_7Decoder_8__init___2generator21, (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___2generator21, (PyObject *) __pyx_cur_scope); 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; @@ -18559,7 +18559,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_8__init___genexpr(PyObject *__pyx_self __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_cdec.Decoder.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Decoder.__init__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -18568,9 +18568,9 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_8__init___genexpr(PyObject *__pyx_self return __pyx_r; } -static PyObject *__pyx_gb_5_cdec_7Decoder_8__init___2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_5_cdec_7Decoder_8__init___2generator21(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)__pyx_generator->closure); + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *__pyx_cur_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -18643,7 +18643,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_8__init___2generator21(__pyx_Generator __Pyx_GIVEREF(__pyx_t_3); __pyx_cur_scope->__pyx_v_kv = __pyx_t_3; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), __pyx_cur_scope->__pyx_v_kv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; @@ -18680,7 +18680,7 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_8__init___2generator21(__pyx_Generator return NULL; } -/* "_cdec.pyx":47 +/* "cdec/_cdec.pyx":47 * cdef DenseVector weights * * def __init__(self, config_str=None, **config): # <<<<<<<<<<<<<< @@ -18688,8 +18688,8 @@ static PyObject *__pyx_gb_5_cdec_7Decoder_8__init___2generator21(__pyx_Generator * Decoder(formalism='scfg') -> initialize from named parameters */ -static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_config_str, PyObject *__pyx_v_config) { - struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *__pyx_cur_scope; +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_24___init__ *__pyx_cur_scope; PyObject *__pyx_v_formalism = NULL; std::istringstream *__pyx_v_config_stream; int __pyx_r; @@ -18705,7 +18705,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - __pyx_cur_scope = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)__pyx_tp_new_5_cdec___pyx_scope_struct_24___init__(__pyx_ptype_5_cdec___pyx_scope_struct_24___init__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *)__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___init__(__pyx_ptype_4cdec_5_cdec___pyx_scope_struct_24___init__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return -1; @@ -18716,7 +18716,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_config); __Pyx_INCREF(__pyx_v_config_str); - /* "_cdec.pyx":51 + /* "cdec/_cdec.pyx":51 * Decoder(formalism='scfg') -> initialize from named parameters * Create a decoder using a given configuration. Formalism is required.""" * if config_str is None: # <<<<<<<<<<<<<< @@ -18727,7 +18727,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "_cdec.pyx":52 + /* "cdec/_cdec.pyx":52 * Create a decoder using a given configuration. Formalism is required.""" * if config_str is None: * formalism = config.get('formalism', None) # <<<<<<<<<<<<<< @@ -18739,7 +18739,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ __pyx_v_formalism = __pyx_t_3; __pyx_t_3 = 0; - /* "_cdec.pyx":53 + /* "cdec/_cdec.pyx":53 * if config_str is None: * formalism = config.get('formalism', None) * if formalism not in ('scfg', 'fst', 'lextrans', 'pb', # <<<<<<<<<<<<<< @@ -18803,7 +18803,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "_cdec.pyx":55 + /* "cdec/_cdec.pyx":55 * if formalism not in ('scfg', 'fst', 'lextrans', 'pb', * 'csplit', 'tagger', 'lexalign'): * raise InvalidConfig('formalism "%s" unknown' % formalism) # <<<<<<<<<<<<<< @@ -18812,7 +18812,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ */ __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_47), __pyx_v_formalism); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); @@ -18830,16 +18830,16 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ } __pyx_L4:; - /* "_cdec.pyx":56 + /* "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) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_39), __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_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_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_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_GOTREF(__pyx_t_3); @@ -18857,7 +18857,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ } __pyx_L3:; - /* "_cdec.pyx":57 + /* "cdec/_cdec.pyx":57 * 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) # <<<<<<<<<<<<<< @@ -18867,7 +18867,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ __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); - /* "_cdec.pyx":58 + /* "cdec/_cdec.pyx":58 * 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) # <<<<<<<<<<<<<< @@ -18876,7 +18876,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ */ __pyx_v_self->dec = new Decoder(__pyx_v_config_stream); - /* "_cdec.pyx":59 + /* "cdec/_cdec.pyx":59 * cdef istringstream* config_stream = new istringstream(config_str) * self.dec = new decoder.Decoder(config_stream) * del config_stream # <<<<<<<<<<<<<< @@ -18885,23 +18885,23 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ */ delete __pyx_v_config_stream; - /* "_cdec.pyx":60 + /* "cdec/_cdec.pyx":60 * self.dec = new decoder.Decoder(config_stream) * del config_stream * self.weights = DenseVector.__new__(DenseVector) # <<<<<<<<<<<<<< * self.weights.vector = &self.dec.CurrentWeightVector() * self.weights.owned = True */ - __pyx_t_6 = __pyx_tp_new_5_cdec_DenseVector(((PyTypeObject *)((PyObject*)__pyx_ptype_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_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_5_cdec_DenseVector)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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_GOTREF(__pyx_v_self->weights); __Pyx_DECREF(((PyObject *)__pyx_v_self->weights)); - __pyx_v_self->weights = ((struct __pyx_obj_5_cdec_DenseVector *)__pyx_t_6); + __pyx_v_self->weights = ((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_t_6); __pyx_t_6 = 0; - /* "_cdec.pyx":61 + /* "cdec/_cdec.pyx":61 * del config_stream * self.weights = DenseVector.__new__(DenseVector) * self.weights.vector = &self.dec.CurrentWeightVector() # <<<<<<<<<<<<<< @@ -18910,7 +18910,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ */ __pyx_v_self->weights->vector = (&__pyx_v_self->dec->CurrentWeightVector()); - /* "_cdec.pyx":62 + /* "cdec/_cdec.pyx":62 * self.weights = DenseVector.__new__(DenseVector) * self.weights.vector = &self.dec.CurrentWeightVector() * self.weights.owned = True # <<<<<<<<<<<<<< @@ -18925,7 +18925,7 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_cdec.Decoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Decoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_formalism); @@ -18936,15 +18936,15 @@ static int __pyx_pf_5_cdec_7Decoder___init__(struct __pyx_obj_5_cdec_Decoder *__ } /* Python wrapper */ -static void __pyx_pw_5_cdec_7Decoder_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_5_cdec_7Decoder_3__dealloc__(PyObject *__pyx_v_self) { +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_5_cdec_7Decoder_2__dealloc__(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self)); + __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "_cdec.pyx":64 +/* "cdec/_cdec.pyx":64 * self.weights.owned = True * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -18952,11 +18952,11 @@ static void __pyx_pw_5_cdec_7Decoder_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_5_cdec_Decoder *__pyx_v_self) { +static void __pyx_pf_4cdec_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_5_cdec_Decoder *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "_cdec.pyx":65 + /* "cdec/_cdec.pyx":65 * * def __dealloc__(self): * del self.dec # <<<<<<<<<<<<<< @@ -18969,17 +18969,17 @@ static void __pyx_pf_5_cdec_7Decoder_2__dealloc__(CYTHON_UNUSED struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Decoder_7weights_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Decoder_7weights_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Decoder_7weights___get__(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_7weights___get__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_cdec.pyx":68 +/* "cdec/_cdec.pyx":68 * * property weights: * def __get__(self): # <<<<<<<<<<<<<< @@ -18987,12 +18987,12 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7weights_1__get__(PyObject *__pyx_v_se * */ -static PyObject *__pyx_pf_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self) { +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 __Pyx_RefNannySetupContext("__get__", 0); - /* "_cdec.pyx":69 + /* "cdec/_cdec.pyx":69 * property weights: * def __get__(self): * return self.weights # <<<<<<<<<<<<<< @@ -19012,17 +19012,17 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_7weights___get__(struct __pyx_obj_5_cd } /* Python wrapper */ -static int __pyx_pw_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/ -static int __pyx_pw_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_weights) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Decoder_7weights_2__set__(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self), ((PyObject *)__pyx_v_weights)); + __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_cdec.pyx":71 +/* "cdec/_cdec.pyx":71 * return self.weights * * def __set__(self, weights): # <<<<<<<<<<<<<< @@ -19030,7 +19030,7 @@ static int __pyx_pw_5_cdec_7Decoder_7weights_3__set__(PyObject *__pyx_v_self, Py * self.weights.vector[0] = ( weights).vector[0] */ -static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_weights) { +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; int __pyx_r; @@ -19050,51 +19050,51 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - /* "_cdec.pyx":72 + /* "cdec/_cdec.pyx":72 * * def __set__(self, weights): * if isinstance(weights, DenseVector): # <<<<<<<<<<<<<< * self.weights.vector[0] = ( weights).vector[0] * elif isinstance(weights, SparseVector): */ - __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_DenseVector)); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_4cdec_5_cdec_DenseVector)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "_cdec.pyx":73 + /* "cdec/_cdec.pyx":73 * def __set__(self, weights): * if isinstance(weights, DenseVector): * self.weights.vector[0] = ( weights).vector[0] # <<<<<<<<<<<<<< * elif isinstance(weights, SparseVector): * (( weights).vector[0]).init_vector(self.weights.vector) */ - (__pyx_v_self->weights->vector[0]) = (((struct __pyx_obj_5_cdec_DenseVector *)__pyx_v_weights)->vector[0]); + (__pyx_v_self->weights->vector[0]) = (((struct __pyx_obj_4cdec_5_cdec_DenseVector *)__pyx_v_weights)->vector[0]); goto __pyx_L3; } - /* "_cdec.pyx":74 + /* "cdec/_cdec.pyx":74 * if isinstance(weights, DenseVector): * self.weights.vector[0] = ( weights).vector[0] * elif isinstance(weights, SparseVector): # <<<<<<<<<<<<<< * (( weights).vector[0]).init_vector(self.weights.vector) * elif isinstance(weights, dict): */ - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_5_cdec_SparseVector)); + __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_weights, ((PyObject*)__pyx_ptype_4cdec_5_cdec_SparseVector)); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "_cdec.pyx":75 + /* "cdec/_cdec.pyx":75 * self.weights.vector[0] = ( weights).vector[0] * elif isinstance(weights, SparseVector): * (( weights).vector[0]).init_vector(self.weights.vector) # <<<<<<<<<<<<<< * elif isinstance(weights, dict): * self.weights.vector.clear() */ - (((struct __pyx_obj_5_cdec_SparseVector *)__pyx_v_weights)->vector[0]).init_vector(__pyx_v_self->weights->vector); + (((struct __pyx_obj_4cdec_5_cdec_SparseVector *)__pyx_v_weights)->vector[0]).init_vector(__pyx_v_self->weights->vector); goto __pyx_L3; } - /* "_cdec.pyx":76 + /* "cdec/_cdec.pyx":76 * elif isinstance(weights, SparseVector): * (( weights).vector[0]).init_vector(self.weights.vector) * elif isinstance(weights, dict): # <<<<<<<<<<<<<< @@ -19105,7 +19105,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "_cdec.pyx":77 + /* "cdec/_cdec.pyx":77 * (( weights).vector[0]).init_vector(self.weights.vector) * elif isinstance(weights, dict): * self.weights.vector.clear() # <<<<<<<<<<<<<< @@ -19114,7 +19114,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De */ __pyx_v_self->weights->vector->clear(); - /* "_cdec.pyx":78 + /* "cdec/_cdec.pyx":78 * elif isinstance(weights, dict): * self.weights.vector.clear() * for fname, fval in weights.items(): # <<<<<<<<<<<<<< @@ -19219,7 +19219,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De __pyx_v_fval = __pyx_t_8; __pyx_t_8 = 0; - /* "_cdec.pyx":79 + /* "cdec/_cdec.pyx":79 * self.weights.vector.clear() * for fname, fval in weights.items(): * self.weights[fname] = fval # <<<<<<<<<<<<<< @@ -19233,14 +19233,14 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De } /*else*/ { - /* "_cdec.pyx":81 + /* "cdec/_cdec.pyx":81 * self.weights[fname] = fval * else: * raise TypeError('cannot initialize weights with %s' % type(weights)) # <<<<<<<<<<<<<< * * property formalism: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((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_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_GOTREF(__pyx_t_4); @@ -19264,7 +19264,7 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("_cdec.Decoder.weights.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Decoder.weights.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_fname); @@ -19274,17 +19274,17 @@ static int __pyx_pf_5_cdec_7Decoder_7weights_2__set__(struct __pyx_obj_5_cdec_De } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_self) { +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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Decoder_9formalism___get__(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_9formalism___get__(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_cdec.pyx":84 +/* "cdec/_cdec.pyx":84 * * property formalism: * def __get__(self): # <<<<<<<<<<<<<< @@ -19292,7 +19292,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_9formalism_1__get__(PyObject *__pyx_v_ * return str(conf[0]['formalism'].as_str().c_str()) */ -static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self) { +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; __Pyx_RefNannyDeclarations @@ -19303,7 +19303,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "_cdec.pyx":85 + /* "cdec/_cdec.pyx":85 * property formalism: * def __get__(self): * cdef variables_map* conf = &self.dec.GetConf() # <<<<<<<<<<<<<< @@ -19312,7 +19312,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_ */ __pyx_v_conf = (&__pyx_v_self->dec->GetConf()); - /* "_cdec.pyx":86 + /* "cdec/_cdec.pyx":86 * def __get__(self): * cdef variables_map* conf = &self.dec.GetConf() * return str(conf[0]['formalism'].as_str().c_str()) # <<<<<<<<<<<<<< @@ -19339,7 +19339,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_cdec.Decoder.formalism.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Decoder.formalism.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19348,18 +19348,18 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_9formalism___get__(struct __pyx_obj_5_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, PyObject *__pyx_v_weights); /*proto*/ -static char __pyx_doc_5_cdec_7Decoder_4read_weights[] = "decoder.read_weights(filename): Read decoder weights from a file."; -static PyObject *__pyx_pw_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_v_weights); /*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) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_weights (wrapper)", 0); - __pyx_r = __pyx_pf_5_cdec_7Decoder_4read_weights(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self), ((PyObject *)__pyx_v_weights)); + __pyx_r = __pyx_pf_4cdec_5_cdec_7Decoder_4read_weights(((struct __pyx_obj_4cdec_5_cdec_Decoder *)__pyx_v_self), ((PyObject *)__pyx_v_weights)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_cdec.pyx":88 +/* "cdec/_cdec.pyx":88 * return str(conf[0]['formalism'].as_str().c_str()) * * def read_weights(self, weights): # <<<<<<<<<<<<<< @@ -19367,7 +19367,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_5read_weights(PyObject *__pyx_v_self, * with open(weights) as fp: */ -static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_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_fp = NULL; PyObject *__pyx_v_line = NULL; PyObject *__pyx_v_fname = NULL; @@ -19395,7 +19395,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_weights", 0); - /* "_cdec.pyx":90 + /* "cdec/_cdec.pyx":90 * def read_weights(self, weights): * """decoder.read_weights(filename): Read decoder weights from a file.""" * with open(weights) as fp: # <<<<<<<<<<<<<< @@ -19430,7 +19430,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __pyx_v_fp = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "_cdec.pyx":91 + /* "cdec/_cdec.pyx":91 * """decoder.read_weights(filename): Read decoder weights from a file.""" * with open(weights) as fp: * for line in fp: # <<<<<<<<<<<<<< @@ -19475,7 +19475,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __pyx_v_line = __pyx_t_2; __pyx_t_2 = 0; - /* "_cdec.pyx":92 + /* "cdec/_cdec.pyx":92 * with open(weights) as fp: * for line in fp: * if line.strip().startswith('#'): continue # <<<<<<<<<<<<<< @@ -19490,7 +19490,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __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_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_50), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_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_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;} @@ -19501,7 +19501,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ } __pyx_L18:; - /* "_cdec.pyx":93 + /* "cdec/_cdec.pyx":93 * for line in fp: * if line.strip().startswith('#'): continue * fname, value = line.split() # <<<<<<<<<<<<<< @@ -19571,7 +19571,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __pyx_v_value = __pyx_t_11; __pyx_t_11 = 0; - /* "_cdec.pyx":94 + /* "cdec/_cdec.pyx":94 * if line.strip().startswith('#'): continue * fname, value = line.split() * self.weights[fname.strip()] = float(value) # <<<<<<<<<<<<<< @@ -19604,7 +19604,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "_cdec.pyx":90 + /* "cdec/_cdec.pyx":90 * def read_weights(self, weights): * """decoder.read_weights(filename): Read decoder weights from a file.""" * with open(weights) as fp: # <<<<<<<<<<<<<< @@ -19612,7 +19612,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ * if line.strip().startswith('#'): continue */ /*except:*/ { - __Pyx_AddTraceback("_cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_2); @@ -19668,7 +19668,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ } /*finally:*/ { if (__pyx_t_3) { - __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_51, NULL); + __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); @@ -19692,7 +19692,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Decoder.read_weights", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_fp); @@ -19705,9 +19705,9 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_4read_weights(struct __pyx_obj_5_cdec_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5_cdec_7Decoder_6translate[] = "decoder.translate(sentence, grammar=None) -> Hypergraph\n Translate a sentence (string/Lattice) with a grammar (string/list of rules)."; -static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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)."; +static PyObject *__pyx_pw_4cdec_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_sentence = 0; PyObject *__pyx_v_grammar = 0; int __pyx_lineno = 0; @@ -19720,7 +19720,7 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sentence,&__pyx_n_s__grammar,0}; PyObject* values[2] = {0,0}; - /* "_cdec.pyx":96 + /* "cdec/_cdec.pyx":96 * self.weights[fname.strip()] = float(value) * * def translate(self, sentence, grammar=None): # <<<<<<<<<<<<<< @@ -19766,19 +19766,19 @@ static PyObject *__pyx_pw_5_cdec_7Decoder_7translate(PyObject *__pyx_v_self, PyO __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("translate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_cdec_7Decoder_6translate(((struct __pyx_obj_5_cdec_Decoder *)__pyx_v_self), __pyx_v_sentence, __pyx_v_grammar); + __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); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Decoder *__pyx_v_self, PyObject *__pyx_v_sentence, PyObject *__pyx_v_grammar) { +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) { PyObject *__pyx_v_input_str = 0; BasicObserver __pyx_v_observer; - struct __pyx_obj_5_cdec_Hypergraph *__pyx_v_hg = 0; + struct __pyx_obj_4cdec_5_cdec_Hypergraph *__pyx_v_hg = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -19791,7 +19791,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("translate", 0); - /* "_cdec.pyx":100 + /* "cdec/_cdec.pyx":100 * Translate a sentence (string/Lattice) with a grammar (string/list of rules).""" * cdef bytes input_str * if isinstance(sentence, basestring): # <<<<<<<<<<<<<< @@ -19802,7 +19802,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "_cdec.pyx":101 + /* "cdec/_cdec.pyx":101 * cdef bytes input_str * if isinstance(sentence, basestring): * input_str = as_str(sentence.strip()) # <<<<<<<<<<<<<< @@ -19814,7 +19814,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __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_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = ((PyObject *)__pyx_f_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_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_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_input_str = ((PyObject*)__pyx_t_3); @@ -19822,18 +19822,18 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec goto __pyx_L3; } - /* "_cdec.pyx":102 + /* "cdec/_cdec.pyx":102 * if isinstance(sentence, basestring): * input_str = as_str(sentence.strip()) * elif isinstance(sentence, Lattice): # <<<<<<<<<<<<<< * input_str = str(sentence) # PLF format * else: */ - __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_sentence, ((PyObject*)__pyx_ptype_5_cdec_Lattice)); + __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_sentence, ((PyObject*)__pyx_ptype_4cdec_5_cdec_Lattice)); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "_cdec.pyx":103 + /* "cdec/_cdec.pyx":103 * input_str = as_str(sentence.strip()) * elif isinstance(sentence, Lattice): * input_str = str(sentence) # PLF format # <<<<<<<<<<<<<< @@ -19855,14 +19855,14 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec } /*else*/ { - /* "_cdec.pyx":105 + /* "cdec/_cdec.pyx":105 * input_str = str(sentence) # PLF format * else: * raise TypeError('Cannot translate input type %s' % type(sentence)) # <<<<<<<<<<<<<< * if grammar: * if isinstance(grammar, basestring): */ - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((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_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_GOTREF(__pyx_t_3); @@ -19878,7 +19878,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec } __pyx_L3:; - /* "_cdec.pyx":106 + /* "cdec/_cdec.pyx":106 * else: * raise TypeError('Cannot translate input type %s' % type(sentence)) * if grammar: # <<<<<<<<<<<<<< @@ -19888,7 +19888,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_grammar); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "_cdec.pyx":107 + /* "cdec/_cdec.pyx":107 * raise TypeError('Cannot translate input type %s' % type(sentence)) * if grammar: * if isinstance(grammar, basestring): # <<<<<<<<<<<<<< @@ -19899,14 +19899,14 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "_cdec.pyx":108 + /* "cdec/_cdec.pyx":108 * if grammar: * if isinstance(grammar, basestring): * self.dec.AddSupplementalGrammarFromString(as_str(grammar)) # <<<<<<<<<<<<<< * else: * self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0]) */ - __pyx_t_4 = ((PyObject *)__pyx_f_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_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; @@ -19915,7 +19915,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec } /*else*/ { - /* "_cdec.pyx":110 + /* "cdec/_cdec.pyx":110 * self.dec.AddSupplementalGrammarFromString(as_str(grammar)) * else: * self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0]) # <<<<<<<<<<<<<< @@ -19927,10 +19927,10 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __Pyx_INCREF(__pyx_v_grammar); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_grammar); __Pyx_GIVEREF(__pyx_v_grammar); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_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_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_5_cdec_TextGrammar *)__pyx_t_3)->__pyx_base.grammar[0])); + __pyx_v_self->dec->AddSupplementalGrammar((((struct __pyx_obj_4cdec_5_cdec_TextGrammar *)__pyx_t_3)->__pyx_base.grammar[0])); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_L5:; @@ -19938,7 +19938,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec } __pyx_L4:; - /* "_cdec.pyx":111 + /* "cdec/_cdec.pyx":111 * else: * self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0]) * cdef decoder.BasicObserver observer = decoder.BasicObserver() # <<<<<<<<<<<<<< @@ -19947,7 +19947,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec */ __pyx_v_observer = BasicObserver(); - /* "_cdec.pyx":112 + /* "cdec/_cdec.pyx":112 * self.dec.AddSupplementalGrammar(TextGrammar(grammar).grammar[0]) * cdef decoder.BasicObserver observer = decoder.BasicObserver() * self.dec.Decode(input_str, &observer) # <<<<<<<<<<<<<< @@ -19957,7 +19957,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __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)); - /* "_cdec.pyx":113 + /* "cdec/_cdec.pyx":113 * cdef decoder.BasicObserver observer = decoder.BasicObserver() * self.dec.Decode(input_str, &observer) * if observer.hypergraph == NULL: # <<<<<<<<<<<<<< @@ -19967,7 +19967,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __pyx_t_2 = ((__pyx_v_observer.hypergraph == NULL) != 0); if (__pyx_t_2) { - /* "_cdec.pyx":114 + /* "cdec/_cdec.pyx":114 * self.dec.Decode(input_str, &observer) * if observer.hypergraph == NULL: * raise ParseFailed() # <<<<<<<<<<<<<< @@ -19986,19 +19986,19 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec } __pyx_L6:; - /* "_cdec.pyx":115 + /* "cdec/_cdec.pyx":115 * if observer.hypergraph == NULL: * raise ParseFailed() * cdef Hypergraph hg = Hypergraph() # <<<<<<<<<<<<<< * hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) * return hg */ - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_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 = 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_GOTREF(__pyx_t_4); - __pyx_v_hg = ((struct __pyx_obj_5_cdec_Hypergraph *)__pyx_t_4); + __pyx_v_hg = ((struct __pyx_obj_4cdec_5_cdec_Hypergraph *)__pyx_t_4); __pyx_t_4 = 0; - /* "_cdec.pyx":116 + /* "cdec/_cdec.pyx":116 * raise ParseFailed() * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) # <<<<<<<<<<<<<< @@ -20006,7 +20006,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec */ __pyx_v_hg->hg = new Hypergraph((__pyx_v_observer.hypergraph[0])); - /* "_cdec.pyx":117 + /* "cdec/_cdec.pyx":117 * cdef Hypergraph hg = Hypergraph() * hg.hg = new hypergraph.Hypergraph(observer.hypergraph[0]) * return hg # <<<<<<<<<<<<<< @@ -20021,7 +20021,7 @@ static PyObject *__pyx_pf_5_cdec_7Decoder_6translate(struct __pyx_obj_5_cdec_Dec __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec._cdec.Decoder.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_input_str); @@ -20065,44 +20065,191 @@ 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; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +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 (unlikely(!o)) return 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_5_cdec_TRule(PyObject *o) { + { + 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); + } + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_4cdec_5_cdec_5TRule_arity(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_5_cdec_5TRule_5arity_1__get__(o); +} + +static PyObject *__pyx_getprop_4cdec_5_cdec_5TRule_f(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_5_cdec_5TRule_1f_1__get__(o); +} + +static int __pyx_setprop_4cdec_5_cdec_5TRule_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_5_cdec_5TRule_1f_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_4cdec_5_cdec_5TRule_e(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_5_cdec_5TRule_1e_1__get__(o); +} + +static int __pyx_setprop_4cdec_5_cdec_5TRule_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_5_cdec_5TRule_1e_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_4cdec_5_cdec_5TRule_a(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_5_cdec_5TRule_1a_1__get__(o); +} + +static int __pyx_setprop_4cdec_5_cdec_5TRule_a(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_5_cdec_5TRule_1a_4__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_4cdec_5_cdec_5TRule_scores(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_5_cdec_5TRule_6scores_1__get__(o); } -static PyObject *__pyx_tp_new_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - if (unlikely(__pyx_pw_5_cdec_6Scorer_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; +static int __pyx_setprop_4cdec_5_cdec_5TRule_scores(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_5_cdec_5TRule_6scores_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; } - return o; } -static void __pyx_tp_dealloc_5_cdec_Scorer(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5_cdec_6Scorer_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); +static PyObject *__pyx_getprop_4cdec_5_cdec_5TRule_lhs(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_5_cdec_5TRule_3lhs_1__get__(o); +} + +static int __pyx_setprop_4cdec_5_cdec_5TRule_lhs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_5_cdec_5TRule_3lhs_3__set__(o, v); } - (*Py_TYPE(o)->tp_free)(o); + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_4cdec_5_cdec_TRule[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_TRule[] = { + {(char *)"arity", __pyx_getprop_4cdec_5_cdec_5TRule_arity, 0, 0, 0}, + {(char *)"f", __pyx_getprop_4cdec_5_cdec_5TRule_f, __pyx_setprop_4cdec_5_cdec_5TRule_f, 0, 0}, + {(char *)"e", __pyx_getprop_4cdec_5_cdec_5TRule_e, __pyx_setprop_4cdec_5_cdec_5TRule_e, 0, 0}, + {(char *)"a", __pyx_getprop_4cdec_5_cdec_5TRule_a, __pyx_setprop_4cdec_5_cdec_5TRule_a, 0, 0}, + {(char *)"scores", __pyx_getprop_4cdec_5_cdec_5TRule_scores, __pyx_setprop_4cdec_5_cdec_5TRule_scores, 0, 0}, + {(char *)"lhs", __pyx_getprop_4cdec_5_cdec_5TRule_lhs, __pyx_setprop_4cdec_5_cdec_5TRule_lhs, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_5_cdec_TRule = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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_5TRule_5__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_TRule, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4cdec_5_cdec_TRule, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_4cdec_5_cdec_5TRule_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_5_cdec_TRule, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_4cdec_5_cdec_MRule(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_4cdec_5_cdec_TRule(t, a, k); + if (unlikely(!o)) return 0; + return o; } -static PyMethodDef __pyx_methods_5_cdec_Scorer[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec_MRule[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec_Scorer = { +static PyTypeObject __pyx_type_4cdec_5_cdec_MRule = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.Scorer"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_Scorer), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.MRule"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_MRule), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_Scorer, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_TRule, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -20116,8 +20263,12 @@ static PyTypeObject __pyx_type_5_cdec_Scorer = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ - __pyx_pw_5_cdec_6Scorer_5__call__, /*tp_call*/ - __pyx_pw_5_cdec_6Scorer_7__str__, /*tp_str*/ + 0, /*tp_call*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_4cdec_5_cdec_5TRule_5__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ @@ -20129,7 +20280,7 @@ static PyTypeObject __pyx_type_5_cdec_Scorer = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_Scorer, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_MRule, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -20137,9 +20288,9 @@ static PyTypeObject __pyx_type_5_cdec_Scorer = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_4cdec_5_cdec_5MRule_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_Scorer, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_MRule, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20153,65 +20304,65 @@ static PyTypeObject __pyx_type_5_cdec_Scorer = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *__pyx_freelist_5_cdec___pyx_scope_struct_24___init__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_24___init__ = 0; +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_5_cdec___pyx_scope_struct_24___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *p; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_24___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_24___init__[--__pyx_freecount_5_cdec___pyx_scope_struct_24___init__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__)); + if (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__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o); - p->__pyx_v_config = 0; + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_22___iter__ *)o); + p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_24___init__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)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); - Py_CLEAR(p->__pyx_v_config); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_24___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_24___init__[__pyx_freecount_5_cdec___pyx_scope_struct_24___init__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o); + Py_CLEAR(p->__pyx_v_self); + if ((__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); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_24___init__(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_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o; - if (p->__pyx_v_config) { - e = (*v)(p->__pyx_v_config, 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_5_cdec___pyx_scope_struct_24___init__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__ *)o; +static int __pyx_tp_clear_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* tmp; - tmp = ((PyObject*)p->__pyx_v_config); - p->__pyx_v_config = ((PyObject*)Py_None); Py_INCREF(Py_None); + 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_5_cdec___pyx_scope_struct_24___init__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_22___iter__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24___init__ = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_22___iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_24___init__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_24___init__), /*tp_basicsize*/ + __Pyx_NAMESTR("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_5_cdec___pyx_scope_struct_24___init__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_22___iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -20232,13 +20383,13 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24___init__ = { 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_5_cdec___pyx_scope_struct_24___init__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_24___init__, /*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_5_cdec___pyx_scope_struct_24___init__, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_22___iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -20248,7 +20399,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24___init__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_24___init__, /*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*/ @@ -20262,46 +20413,75 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_24___init__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_NTRef(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_4cdec_5_cdec_DenseVector(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_5_cdec_NTRef(PyObject *o) { +static void __pyx_tp_dealloc_4cdec_5_cdec_DenseVector(PyObject *o) { + { + 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); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } (*Py_TYPE(o)->tp_free)(o); } - -static PyObject *__pyx_getprop_5_cdec_5NTRef_ref(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_5NTRef_3ref_1__get__(o); +static 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_setprop_5_cdec_5NTRef_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { +static int __pyx_mp_ass_subscript_4cdec_5_cdec_DenseVector(PyObject *o, PyObject *i, PyObject *v) { if (v) { - return __pyx_pw_5_cdec_5NTRef_3ref_3__set__(o, v); + return __pyx_pw_4cdec_5_cdec_11DenseVector_9__setitem__(o, i, v); } else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); return -1; } } -static PyMethodDef __pyx_methods_5_cdec_NTRef[] = { +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)}, {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_5_cdec_NTRef[] = { - {(char *)"ref", __pyx_getprop_5_cdec_5NTRef_ref, __pyx_setprop_5_cdec_5NTRef_ref, 0, 0}, - {0, 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_5_cdec_NTRef = { +static PyTypeObject __pyx_type_4cdec_5_cdec_DenseVector = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.NTRef"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_NTRef), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.DenseVector"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_DenseVector), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_NTRef, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_DenseVector, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -20312,11 +20492,11 @@ static PyTypeObject __pyx_type_5_cdec_NTRef = { #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ + &__pyx_tp_as_sequence_DenseVector, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_DenseVector, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_5_cdec_5NTRef_3__str__, /*tp_str*/ + 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ @@ -20326,19 +20506,19 @@ static PyTypeObject __pyx_type_5_cdec_NTRef = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ + __pyx_pw_4cdec_5_cdec_11DenseVector_11__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_NTRef, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_DenseVector, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_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_5_cdec_5NTRef_1__init__, /*tp_init*/ + __pyx_pw_4cdec_5_cdec_11DenseVector_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_NTRef, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_DenseVector, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20352,164 +20532,134 @@ static PyTypeObject __pyx_type_5_cdec_NTRef = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *__pyx_freelist_5_cdec___pyx_scope_struct_22___iter__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_22___iter__ = 0; - -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec_SufficientStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_22___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_22___iter__[--__pyx_freecount_5_cdec___pyx_scope_struct_22___iter__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22___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_5_cdec___pyx_scope_struct_22___iter__ *)o); - p->__pyx_v_self = 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_22___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_22___iter__[__pyx_freecount_5_cdec___pyx_scope_struct_22___iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o); - } else { - (*Py_TYPE(o)->tp_free)(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 int __pyx_tp_traverse_5_cdec___pyx_scope_struct_22___iter__(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; - } - return 0; +static 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 int __pyx_tp_clear_5_cdec___pyx_scope_struct_22___iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__ *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_CandidateSet *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +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_5_cdec___pyx_scope_struct_22___iter__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec_SufficientStats[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_22___iter__ = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_22___iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_22___iter__), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_22___iter__, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ +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, /*tp_compare*/ + 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, /*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_5_cdec___pyx_scope_struct_22___iter__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_22___iter__, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_22___iter__, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_22___iter__, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ + 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 PyObject *__pyx_tp_new_5_cdec_Grammar(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_5_cdec_Grammar(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5_cdec_7Grammar_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_getprop_5_cdec_7Grammar_name(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_7Grammar_4name_1__get__(o); -} - -static int __pyx_setprop_5_cdec_7Grammar_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_5_cdec_7Grammar_4name_3__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyMethodDef __pyx_methods_5_cdec_Grammar[] = { - {0, 0, 0, 0} +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 struct PyGetSetDef __pyx_getsets_5_cdec_Grammar[] = { - {(char *)"name", __pyx_getprop_5_cdec_7Grammar_name, __pyx_setprop_5_cdec_7Grammar_name, 0, 0}, - {0, 0, 0, 0, 0} +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_5_cdec_Grammar = { +static PyTypeObject __pyx_type_4cdec_5_cdec_SufficientStats = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.Grammar"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_Grammar), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.SufficientStats"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_SufficientStats), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_Grammar, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_SufficientStats, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -20519,9 +20669,9 @@ static PyTypeObject __pyx_type_5_cdec_Grammar = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*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*/ @@ -20534,11 +20684,11 @@ static PyTypeObject __pyx_type_5_cdec_Grammar = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_5_cdec_7Grammar_3__iter__, /*tp_iter*/ + __pyx_pw_4cdec_5_cdec_15SufficientStats_5__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_Grammar, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_SufficientStats, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_5_cdec_Grammar, /*tp_getset*/ + __pyx_getsets_4cdec_5_cdec_SufficientStats, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -20546,7 +20696,7 @@ static PyTypeObject __pyx_type_5_cdec_Grammar = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_Grammar, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_SufficientStats, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20560,113 +20710,81 @@ static PyTypeObject __pyx_type_5_cdec_Grammar = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *__pyx_freelist_5_cdec___pyx_scope_struct_20_lines[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_20_lines = 0; +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_tp_new_5_cdec___pyx_scope_struct_20_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p; +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_5_cdec___pyx_scope_struct_20_lines > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_20_lines[--__pyx_freecount_5_cdec___pyx_scope_struct_20_lines]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines)); + 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_5_cdec___pyx_scope_struct_20_lines *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_delta = 0; + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_21___iter__ *)o); p->__pyx_v_i = 0; - p->__pyx_v_label = 0; - p->__pyx_v_weight = 0; + p->__pyx_v_self = 0; p->__pyx_t_1 = 0; - p->__pyx_t_3 = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20_lines(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o; +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_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_v_self); Py_CLEAR(p->__pyx_t_1); - Py_CLEAR(p->__pyx_t_3); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_20_lines < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines))) { - __pyx_freelist_5_cdec___pyx_scope_struct_20_lines[__pyx_freecount_5_cdec___pyx_scope_struct_20_lines++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o); + 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 int __pyx_tp_traverse_5_cdec___pyx_scope_struct_20_lines(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_21___iter__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_delta) { - e = (*v)(p->__pyx_v_delta, a); if (e) return 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_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_v_self) { + e = (*v)(((PyObject*)p->__pyx_v_self), 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_5_cdec___pyx_scope_struct_20_lines(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines *)o; +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_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_delta); - p->__pyx_v_delta = Py_None; Py_INCREF(Py_None); - 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); + 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); - 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_5_cdec___pyx_scope_struct_20_lines[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_21___iter__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_21___iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_20_lines"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_20_lines), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_20_lines, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -20687,13 +20805,13 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = { 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_5_cdec___pyx_scope_struct_20_lines, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_20_lines, /*tp_clear*/ + __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*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_20_lines, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -20703,7 +20821,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_20_lines, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_21___iter__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20717,65 +20835,56 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_20_lines = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *__pyx_freelist_5_cdec___pyx_scope_struct_12_sample_trees[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_12_sample_trees = 0; - -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p; +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_5_cdec___pyx_scope_struct_12_sample_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_12_sample_trees[--__pyx_freecount_5_cdec___pyx_scope_struct_12_sample_trees]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + 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; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o); - p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o; +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->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_12_sample_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees))) { - __pyx_freelist_5_cdec___pyx_scope_struct_12_sample_trees[__pyx_freecount_5_cdec___pyx_scope_struct_12_sample_trees++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } + Py_CLEAR(p->scorer); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_12_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_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + 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_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees *)o; +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->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None); + 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_5_cdec___pyx_scope_struct_12_sample_trees[] = { +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12_sample_trees = { +static PyTypeObject __pyx_type_4cdec_5_cdec_Metric = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_12_sample_trees"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_12_sample_trees), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.Metric"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_Metric), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_Metric, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -20789,20 +20898,20 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12_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_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_12_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_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_Metric, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -20812,7 +20921,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12_sample_trees = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_Metric, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -20826,174 +20935,56 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_12_sample_trees = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_13___get__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_13___get__ = 0; - -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_13___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec_Candidate(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_13___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_13___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_13___get__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o); - p->__pyx_v_self = 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_13___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_13___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_13___get__[__pyx_freecount_5_cdec___pyx_scope_struct_13___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } +static void __pyx_tp_dealloc_4cdec_5_cdec_Candidate(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_13___get__(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; - } - return 0; +static PyObject *__pyx_getprop_4cdec_5_cdec_9Candidate_words(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_5_cdec_9Candidate_5words_1__get__(o); } -static int __pyx_tp_clear_5_cdec___pyx_scope_struct_13___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__ *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +static PyObject *__pyx_getprop_4cdec_5_cdec_9Candidate_fmap(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_5_cdec_9Candidate_4fmap_1__get__(o); } -static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_13___get__[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_13___get__ = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_13___get__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_13___get__), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_13___get__, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 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_5_cdec___pyx_scope_struct_13___get__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_13___get__, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_13___get__, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_13___get__, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *__pyx_freelist_5_cdec___pyx_scope_struct_2__phrase[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_2__phrase = 0; - -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p; - PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_2__phrase > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_2__phrase[--__pyx_freecount_5_cdec___pyx_scope_struct_2__phrase]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o); - p->__pyx_v_phrase = 0; - return o; +static PyObject *__pyx_getprop_4cdec_5_cdec_9Candidate_score(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_5_cdec_9Candidate_5score_1__get__(o); } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_phrase); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_2__phrase < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase))) { - __pyx_freelist_5_cdec___pyx_scope_struct_2__phrase[__pyx_freecount_5_cdec___pyx_scope_struct_2__phrase++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); +static int __pyx_setprop_4cdec_5_cdec_9Candidate_score(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_5_cdec_9Candidate_5score_3__set__(o, v); } -} - -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_2__phrase(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o; - if (p->__pyx_v_phrase) { - e = (*v)(p->__pyx_v_phrase, a); if (e) return e; + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; } - return 0; } -static int __pyx_tp_clear_5_cdec___pyx_scope_struct_2__phrase(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_phrase); - p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_2__phrase[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec_Candidate[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2__phrase = { +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}, + {(char *)"score", __pyx_getprop_4cdec_5_cdec_9Candidate_score, __pyx_setprop_4cdec_5_cdec_9Candidate_score, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_5_cdec_Candidate = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_2__phrase"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_2__phrase), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.Candidate"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_Candidate), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_2__phrase, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_Candidate, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -21012,17 +21003,17 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2__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_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_5_cdec___pyx_scope_struct_2__phrase, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_2__phrase, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_2__phrase, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_Candidate, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_4cdec_5_cdec_Candidate, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -21030,7 +21021,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2__phrase = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_2__phrase, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_Candidate, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -21044,29 +21035,26 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_2__phrase = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_4cdec_5_cdec_SparseVector(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_5_cdec_12CandidateSet_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } return o; } -static void __pyx_tp_dealloc_5_cdec_CandidateSet(PyObject *o) { +static void __pyx_tp_dealloc_4cdec_5_cdec_SparseVector(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_5_cdec_12CandidateSet_3__dealloc__(o); + __pyx_pw_4cdec_5_cdec_12SparseVector_3__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_5_cdec_CandidateSet(PyObject *o, Py_ssize_t i) { +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); @@ -21074,36 +21062,106 @@ static PyObject *__pyx_sq_item_5_cdec_CandidateSet(PyObject *o, Py_ssize_t i) { return r; } -static PyMethodDef __pyx_methods_5_cdec_CandidateSet[] = { - {__Pyx_NAMESTR("add_kbest"), (PyCFunction)__pyx_pw_5_cdec_12CandidateSet_12add_kbest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_cdec_12CandidateSet_11add_kbest)}, +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 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)}, {0, 0, 0, 0} }; -static PySequenceMethods __pyx_tp_as_sequence_CandidateSet = { - __pyx_pw_5_cdec_12CandidateSet_5__len__, /*sq_length*/ +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*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #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_5_cdec_CandidateSet, /*sq_item*/ + __pyx_sq_item_4cdec_5_cdec_SparseVector, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ + __pyx_pw_4cdec_5_cdec_12SparseVector_20__contains__, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_CandidateSet = { - __pyx_pw_5_cdec_12CandidateSet_5__len__, /*mp_length*/ - __pyx_pw_5_cdec_12CandidateSet_7__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ +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_5_cdec_CandidateSet = { +static PyTypeObject __pyx_type_4cdec_5_cdec_SparseVector = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.CandidateSet"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_CandidateSet), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.SparseVector"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_SparseVector), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_CandidateSet, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_SparseVector, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -21113,9 +21171,9 @@ static PyTypeObject __pyx_type_5_cdec_CandidateSet = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_CandidateSet, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_CandidateSet, /*tp_as_mapping*/ + &__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*/ @@ -21126,11 +21184,11 @@ static PyTypeObject __pyx_type_5_cdec_CandidateSet = { 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ - 0, /*tp_richcompare*/ + __pyx_pw_4cdec_5_cdec_12SparseVector_16__richcmp__, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_5_cdec_12CandidateSet_9__iter__, /*tp_iter*/ + __pyx_pw_4cdec_5_cdec_12SparseVector_11__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_CandidateSet, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_SparseVector, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -21138,9 +21196,9 @@ static PyTypeObject __pyx_type_5_cdec_CandidateSet = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_4cdec_5_cdec_12SparseVector_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_CandidateSet, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_SparseVector, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -21154,65 +21212,65 @@ static PyTypeObject __pyx_type_5_cdec_CandidateSet = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_14___get__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_14___get__ = 0; +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15___get__[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15___get__ = 0; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_14___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *p; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_14___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_14___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_14___get__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__)); + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15___get__]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o); + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_14___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o; +static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_15___get__(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_14___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_14___get__[__pyx_freecount_5_cdec___pyx_scope_struct_14___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o); + if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_15___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_15___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_14___get__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_15___get__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_5_cdec___pyx_scope_struct_14___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__ *)o; +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_15___get__(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__ *)o; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)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_5_cdec___pyx_scope_struct_14___get__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_15___get__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_14___get__ = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_15___get__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_14___get__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_14___get__), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_15___get__"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_15___get__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_14___get__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_15___get__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -21233,13 +21291,13 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_14___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_5_cdec___pyx_scope_struct_14___get__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_14___get__, /*tp_clear*/ + __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_15___get__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_15___get__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_14___get__, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_15___get__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -21249,7 +21307,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_14___get__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_14___get__, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_15___get__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -21263,93 +21321,61 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_14___get__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_TRule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +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; o = (*t->tp_alloc)(t, 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_5_cdec_TRule(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5_cdec_5TRule_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_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 PyObject *__pyx_getprop_5_cdec_5TRule_arity(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_5TRule_5arity_1__get__(o); -} - -static PyObject *__pyx_getprop_5_cdec_5TRule_f(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_5TRule_1f_1__get__(o); -} - -static int __pyx_setprop_5_cdec_5TRule_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_5_cdec_5TRule_1f_3__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_5_cdec_5TRule_e(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_5TRule_1e_1__get__(o); -} - -static int __pyx_setprop_5_cdec_5TRule_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_5_cdec_5TRule_1e_3__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; +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 PyObject *__pyx_getprop_5_cdec_5TRule_a(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_5TRule_1a_1__get__(o); -} - -static int __pyx_setprop_5_cdec_5TRule_a(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_5_cdec_5TRule_1a_4__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } +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_5_cdec_5TRule_scores(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_5TRule_6scores_1__get__(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_5_cdec_5TRule_scores(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { +static int __pyx_setprop_4cdec_5_cdec_2NT_cat(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_5_cdec_5TRule_6scores_3__set__(o, v); + return __pyx_pw_4cdec_5_cdec_2NT_3cat_3__set__(o, v); } else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; + return __pyx_pw_4cdec_5_cdec_2NT_3cat_5__del__(o); } } -static PyObject *__pyx_getprop_5_cdec_5TRule_lhs(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_5TRule_3lhs_1__get__(o); +static 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_5_cdec_5TRule_lhs(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { +static int __pyx_setprop_4cdec_5_cdec_2NT_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_5_cdec_5TRule_3lhs_3__set__(o, v); + return __pyx_pw_4cdec_5_cdec_2NT_3ref_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); @@ -21357,26 +21383,22 @@ static int __pyx_setprop_5_cdec_5TRule_lhs(PyObject *o, PyObject *v, CYTHON_UNUS } } -static PyMethodDef __pyx_methods_5_cdec_TRule[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec_NT[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_5_cdec_TRule[] = { - {(char *)"arity", __pyx_getprop_5_cdec_5TRule_arity, 0, 0, 0}, - {(char *)"f", __pyx_getprop_5_cdec_5TRule_f, __pyx_setprop_5_cdec_5TRule_f, 0, 0}, - {(char *)"e", __pyx_getprop_5_cdec_5TRule_e, __pyx_setprop_5_cdec_5TRule_e, 0, 0}, - {(char *)"a", __pyx_getprop_5_cdec_5TRule_a, __pyx_setprop_5_cdec_5TRule_a, 0, 0}, - {(char *)"scores", __pyx_getprop_5_cdec_5TRule_scores, __pyx_setprop_5_cdec_5TRule_scores, 0, 0}, - {(char *)"lhs", __pyx_getprop_5_cdec_5TRule_lhs, __pyx_setprop_5_cdec_5TRule_lhs, 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_5_cdec_TRule = { +static PyTypeObject __pyx_type_4cdec_5_cdec_NT = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.TRule"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_TRule), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.NT"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_NT), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_TRule, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_NT, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -21391,29 +21413,29 @@ static PyTypeObject __pyx_type_5_cdec_TRule = { 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_5_cdec_5TRule_5__str__, /*tp_str*/ + __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*/ + 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_5_cdec_NT, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec_NT, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_TRule, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_NT, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_5_cdec_TRule, /*tp_getset*/ + __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_5_cdec_5TRule_1__init__, /*tp_init*/ + __pyx_pw_4cdec_5_cdec_2NT_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_TRule, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_NT, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -21427,81 +21449,79 @@ static PyTypeObject __pyx_type_5_cdec_TRule = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *__pyx_freelist_5_cdec___pyx_scope_struct_3_genexpr[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_3_genexpr = 0; - -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p; +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_5_cdec___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_3_genexpr[--__pyx_freecount_5_cdec___pyx_scope_struct_3_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + o = (*t->tp_alloc)(t, 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_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_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)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_5_cdec___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr))) { - __pyx_freelist_5_cdec___pyx_scope_struct_3_genexpr[__pyx_freecount_5_cdec___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); +static void __pyx_tp_dealloc_4cdec_5_cdec_Lattice(PyObject *o) { + { + 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); + --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_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_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; +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_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); + return -1; } - return 0; -} - -static int __pyx_tp_clear_5_cdec___pyx_scope_struct_3_genexpr(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_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); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; } -static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_3_genexpr[] = { +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_genexpr = { +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.__pyx_scope_struct_3_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_3_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.Lattice"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_Lattice), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_3_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_Lattice, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -21512,23 +21532,23 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_genexpr = { #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_5_cdec___pyx_scope_struct_3_genexpr, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_3_genexpr, /*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_5_cdec___pyx_scope_struct_3_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_Lattice, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -21536,9 +21556,9 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_genexpr = { 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_5_cdec___pyx_scope_struct_3_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_Lattice, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -21552,22 +21572,113 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_3_genexpr = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_MRule(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = __pyx_tp_new_5_cdec_TRule(t, a, k); - if (unlikely(!o)) return 0; +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23__make_config[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23__make_config = 0; + +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23__make_config(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *p; + PyObject *o; + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23__make_config > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23__make_config[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23__make_config]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config)); + 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_23__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 PyMethodDef __pyx_methods_5_cdec_MRule[] = { +static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_23__make_config(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__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_23__make_config < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_23__make_config[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_23__make_config++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_23__make_config(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *)o; + if (p->__pyx_v_config) { + e = (*v)(p->__pyx_v_config, a); if (e) return e; + } + if (p->__pyx_v_info) { + e = (*v)(p->__pyx_v_info, a); if (e) return e; + } + if (p->__pyx_v_key) { + e = (*v)(p->__pyx_v_key, a); if (e) return e; + } + if (p->__pyx_v_name) { + e = (*v)(p->__pyx_v_name, a); if (e) return e; + } + if (p->__pyx_v_value) { + e = (*v)(p->__pyx_v_value, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + if (p->__pyx_t_1) { + e = (*v)(p->__pyx_t_1, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_23__make_config(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_config); + p->__pyx_v_config = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_info); + p->__pyx_v_info = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_key); + p->__pyx_v_key = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_name); + p->__pyx_v_name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_value); + p->__pyx_v_value = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_0); + p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_1); + p->__pyx_t_1 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_23__make_config[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec_MRule = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_23__make_config = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.MRule"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_MRule), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_23__make_config"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_23__make_config), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_TRule, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_23__make_config, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -21582,23 +21693,19 @@ static PyTypeObject __pyx_type_5_cdec_MRule = { 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_5_cdec_5TRule_5__str__, /*tp_str*/ - #else 0, /*tp_str*/ - #endif 0, /*tp_getattro*/ 0, /*tp_setattro*/ 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_23__make_config, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_23__make_config, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_MRule, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_23__make_config, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -21606,9 +21713,9 @@ static PyTypeObject __pyx_type_5_cdec_MRule = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_5_cdec_5MRule_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_MRule, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_23__make_config, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -21621,39 +21728,121 @@ static PyTypeObject __pyx_type_5_cdec_MRule = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphEdge __pyx_vtable_4cdec_5_cdec_HypergraphEdge; -static PyObject *__pyx_tp_new_5_cdec_SegmentEvaluator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +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; o = (*t->tp_alloc)(t, 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_5_cdec_SegmentEvaluator(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5_cdec_16SegmentEvaluator_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_HypergraphEdge(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *p = (struct __pyx_obj_4cdec_5_cdec_HypergraphEdge *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->trule); (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_5_cdec_SegmentEvaluator[] = { - {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_5_cdec_16SegmentEvaluator_3evaluate, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_16SegmentEvaluator_2evaluate)}, - {__Pyx_NAMESTR("candidate_set"), (PyCFunction)__pyx_pw_5_cdec_16SegmentEvaluator_5candidate_set, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_16SegmentEvaluator_4candidate_set)}, +static int __pyx_tp_traverse_4cdec_5_cdec_HypergraphEdge(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; + } + 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; + PyObject* tmp; + 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 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 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_5_cdec_SegmentEvaluator = { +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.SegmentEvaluator"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_SegmentEvaluator), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.HypergraphEdge"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_HypergraphEdge), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_SegmentEvaluator, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_HypergraphEdge, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -21664,25 +21853,25 @@ static PyTypeObject __pyx_type_5_cdec_SegmentEvaluator = { #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_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*/ - 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_5_cdec_SegmentEvaluator, /*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*/ @@ -21690,7 +21879,7 @@ static PyTypeObject __pyx_type_5_cdec_SegmentEvaluator = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_SegmentEvaluator, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_HypergraphEdge, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -21704,81 +21893,65 @@ static PyTypeObject __pyx_type_5_cdec_SegmentEvaluator = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *__pyx_freelist_5_cdec___pyx_scope_struct_25_genexpr[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_25_genexpr = 0; +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_5_cdec___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p; +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; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_25_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_25_genexpr[--__pyx_freecount_5_cdec___pyx_scope_struct_25_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr)); + 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); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_kv = 0; - p->__pyx_t_0 = 0; + 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_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o; +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_outer_scope); - Py_CLEAR(p->__pyx_v_kv); - Py_CLEAR(p->__pyx_t_0); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_25_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr))) { - __pyx_freelist_5_cdec___pyx_scope_struct_25_genexpr[__pyx_freecount_5_cdec___pyx_scope_struct_25_genexpr++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_2__phrase(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - 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_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 int __pyx_tp_clear_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr *)o; +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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_24___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); + tmp = ((PyObject*)p->__pyx_v_phrase); + p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_25_genexpr[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_2__phrase[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_25_genexpr = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_2__phrase = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_25_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_25_genexpr), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_25_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -21799,13 +21972,13 @@ static PyTypeObject __pyx_type_5_cdec___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_5_cdec___pyx_scope_struct_25_genexpr, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_25_genexpr, /*tp_clear*/ + __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_5_cdec___pyx_scope_struct_25_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_2__phrase, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -21815,7 +21988,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_25_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_25_genexpr, /*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*/ @@ -21829,65 +22002,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_25_genexpr = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *__pyx_freelist_5_cdec___pyx_scope_struct_19_todot[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_19_todot = 0; +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_13___get__[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13___get__ = 0; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_19_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_13___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *p; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_19_todot > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_19_todot[--__pyx_freecount_5_cdec___pyx_scope_struct_19_todot]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot)); + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_13___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13___get__]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o); + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_todot(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o; +static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_13___get__(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_19_todot < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot))) { - __pyx_freelist_5_cdec___pyx_scope_struct_19_todot[__pyx_freecount_5_cdec___pyx_scope_struct_19_todot++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o); + if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_13___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_13___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_19_todot(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_13___get__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_5_cdec___pyx_scope_struct_19_todot(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot *)o; +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_13___get__(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__ *)o; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_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); return 0; } -static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_19_todot[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_13___get__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_todot = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_13___get__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_19_todot"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_19_todot), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_13___get__"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_13___get__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_19_todot, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_13___get__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -21908,13 +22081,13 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_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_5_cdec___pyx_scope_struct_19_todot, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_19_todot, /*tp_clear*/ + __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_13___get__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_13___get__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_19_todot, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_13___get__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -21924,107 +22097,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_19_todot = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_19_todot, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_5_cdec_Candidate(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_5_cdec_Candidate(PyObject *o) { - (*Py_TYPE(o)->tp_free)(o); -} - -static PyObject *__pyx_getprop_5_cdec_9Candidate_words(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_9Candidate_5words_1__get__(o); -} - -static PyObject *__pyx_getprop_5_cdec_9Candidate_fmap(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_9Candidate_4fmap_1__get__(o); -} - -static PyObject *__pyx_getprop_5_cdec_9Candidate_score(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_9Candidate_5score_1__get__(o); -} - -static int __pyx_setprop_5_cdec_9Candidate_score(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_5_cdec_9Candidate_5score_3__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyMethodDef __pyx_methods_5_cdec_Candidate[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_5_cdec_Candidate[] = { - {(char *)"words", __pyx_getprop_5_cdec_9Candidate_words, 0, 0, 0}, - {(char *)"fmap", __pyx_getprop_5_cdec_9Candidate_fmap, 0, 0, 0}, - {(char *)"score", __pyx_getprop_5_cdec_9Candidate_score, __pyx_setprop_5_cdec_9Candidate_score, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5_cdec_Candidate = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.Candidate"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_Candidate), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_Candidate, /*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*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5_cdec_Candidate, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_5_cdec_Candidate, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_Candidate, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_13___get__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22038,81 +22111,113 @@ static PyTypeObject __pyx_type_5_cdec_Candidate = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *__pyx_freelist_5_cdec___pyx_scope_struct_6_genexpr[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_6_genexpr = 0; +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20_lines[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20_lines = 0; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20_lines(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *p; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_6_genexpr[--__pyx_freecount_5_cdec___pyx_scope_struct_6_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr)); + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20_lines > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20_lines[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20_lines]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o); + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *)o); p->__pyx_outer_scope = 0; - p->__pyx_v_feat = 0; - p->__pyx_t_0 = 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; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o; +static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_20_lines(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *)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_5_cdec___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr))) { - __pyx_freelist_5_cdec___pyx_scope_struct_6_genexpr[__pyx_freecount_5_cdec___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o); + 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_20_lines < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_20_lines[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_20_lines++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_20_lines(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - if (p->__pyx_v_feat) { - e = (*v)(p->__pyx_v_feat, a); if (e) return e; + if (p->__pyx_v_delta) { + e = (*v)(p->__pyx_v_delta, 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_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_5_cdec___pyx_scope_struct_6_genexpr(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr *)o; +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_20_lines(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines *)o; PyObject* tmp; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_delta); + p->__pyx_v_delta = Py_None; Py_INCREF(Py_None); + 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_v_feat); - p->__pyx_v_feat = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_t_1); + p->__pyx_t_1 = 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_t_3); + p->__pyx_t_3 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_6_genexpr[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_20_lines[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6_genexpr = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_20_lines = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_6_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_6_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_20_lines"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_20_lines), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_6_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_20_lines, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -22133,13 +22238,13 @@ static PyTypeObject __pyx_type_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_5_cdec___pyx_scope_struct_6_genexpr, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_6_genexpr, /*tp_clear*/ + __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_20_lines, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_20_lines, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_6_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_20_lines, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22149,7 +22254,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_6_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_20_lines, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22163,84 +22268,39 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_6_genexpr = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_NT(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec_NT *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec_Scorer(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5_cdec_NT *)o); - p->cat = ((PyObject*)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_5_cdec_NT(PyObject *o) { - struct __pyx_obj_5_cdec_NT *p = (struct __pyx_obj_5_cdec_NT *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->cat); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_5_cdec_NT(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5_cdec_NT *p = (struct __pyx_obj_5_cdec_NT *)o; - if (p->cat) { - e = (*v)(p->cat, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5_cdec_NT(PyObject *o) { - struct __pyx_obj_5_cdec_NT *p = (struct __pyx_obj_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_5_cdec_2NT_cat(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_2NT_3cat_1__get__(o); -} - -static int __pyx_setprop_5_cdec_2NT_cat(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_5_cdec_2NT_3cat_3__set__(o, v); - } - else { - return __pyx_pw_5_cdec_2NT_3cat_5__del__(o); + if (unlikely(__pyx_pw_4cdec_5_cdec_6Scorer_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; } + return o; } -static PyObject *__pyx_getprop_5_cdec_2NT_ref(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_2NT_3ref_1__get__(o); -} - -static int __pyx_setprop_5_cdec_2NT_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_5_cdec_2NT_3ref_3__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; +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); } + (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_5_cdec_NT[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec_Scorer[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_5_cdec_NT[] = { - {(char *)"cat", __pyx_getprop_5_cdec_2NT_cat, __pyx_setprop_5_cdec_2NT_cat, 0, 0}, - {(char *)"ref", __pyx_getprop_5_cdec_2NT_ref, __pyx_setprop_5_cdec_2NT_ref, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5_cdec_NT = { +static PyTypeObject __pyx_type_4cdec_5_cdec_Scorer = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.NT"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_NT), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.Scorer"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_Scorer), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_NT, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_Scorer, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -22254,30 +22314,30 @@ static PyTypeObject __pyx_type_5_cdec_NT = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_5_cdec_2NT_3__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*/ - 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_5_cdec_NT, /*tp_traverse*/ - __pyx_tp_clear_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_5_cdec_NT, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_Scorer, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_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_5_cdec_2NT_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_NT, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_Scorer, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22290,121 +22350,56 @@ static PyTypeObject __pyx_type_5_cdec_NT = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_5_cdec_HypergraphEdge __pyx_vtable_5_cdec_HypergraphEdge; +static struct __pyx_vtabstruct_4cdec_5_cdec_HypergraphNode __pyx_vtable_4cdec_5_cdec_HypergraphNode; -static PyObject *__pyx_tp_new_5_cdec_HypergraphEdge(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec_HypergraphEdge *p; +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_5_cdec_HypergraphEdge *)o); - p->__pyx_vtab = __pyx_vtabptr_5_cdec_HypergraphEdge; - p->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None); + 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_5_cdec_HypergraphEdge(PyObject *o) { - struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->trule); +static void __pyx_tp_dealloc_4cdec_5_cdec_HypergraphNode(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_5_cdec_HypergraphEdge(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o; - if (p->trule) { - e = (*v)(((PyObject*)p->trule), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5_cdec_HypergraphEdge(PyObject *o) { - struct __pyx_obj_5_cdec_HypergraphEdge *p = (struct __pyx_obj_5_cdec_HypergraphEdge *)o; - PyObject* tmp; - tmp = ((PyObject*)p->trule); - p->trule = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_head_node(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphEdge_9head_node_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_5_cdec_14HypergraphEdge_tail_nodes(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphEdge_10tail_nodes_1__get__(o); +static PyObject *__pyx_getprop_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_5_cdec_14HypergraphEdge_span(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphEdge_4span_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_5_cdec_14HypergraphEdge_src_span(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphEdge_8src_span_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 PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_feature_values(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphEdge_14feature_values_1__get__(o); -} - -static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_prob(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphEdge_4prob_1__get__(o); -} - -static PyObject *__pyx_getprop_5_cdec_14HypergraphEdge_trule(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphEdge_5trule_1__get__(o); -} - -static int __pyx_setprop_5_cdec_14HypergraphEdge_trule(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_5_cdec_14HypergraphEdge_5trule_3__set__(o, v); - } - else { - return __pyx_pw_5_cdec_14HypergraphEdge_5trule_5__del__(o); - } -} - -static PyMethodDef __pyx_methods_5_cdec_HypergraphEdge[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec_HypergraphNode[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_5_cdec_HypergraphEdge[] = { - {(char *)"head_node", __pyx_getprop_5_cdec_14HypergraphEdge_head_node, 0, 0, 0}, - {(char *)"tail_nodes", __pyx_getprop_5_cdec_14HypergraphEdge_tail_nodes, 0, 0, 0}, - {(char *)"span", __pyx_getprop_5_cdec_14HypergraphEdge_span, 0, 0, 0}, - {(char *)"src_span", __pyx_getprop_5_cdec_14HypergraphEdge_src_span, 0, 0, 0}, - {(char *)"feature_values", __pyx_getprop_5_cdec_14HypergraphEdge_feature_values, 0, 0, 0}, - {(char *)"prob", __pyx_getprop_5_cdec_14HypergraphEdge_prob, 0, 0, 0}, - {(char *)"trule", __pyx_getprop_5_cdec_14HypergraphEdge_trule, __pyx_setprop_5_cdec_14HypergraphEdge_trule, 0, 0}, +static struct PyGetSetDef __pyx_getsets_4cdec_5_cdec_HypergraphNode[] = { + {(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 PySequenceMethods __pyx_tp_as_sequence_HypergraphEdge = { - __pyx_pw_5_cdec_14HypergraphEdge_1__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_HypergraphEdge = { - __pyx_pw_5_cdec_14HypergraphEdge_1__len__, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_5_cdec_HypergraphEdge = { +static PyTypeObject __pyx_type_4cdec_5_cdec_HypergraphNode = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.HypergraphEdge"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_HypergraphEdge), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.HypergraphNode"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_HypergraphNode), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_HypergraphEdge, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_HypergraphNode, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -22415,25 +22410,25 @@ static PyTypeObject __pyx_type_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*/ 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_5_cdec_HypergraphEdge, /*tp_traverse*/ - __pyx_tp_clear_5_cdec_HypergraphEdge, /*tp_clear*/ - __pyx_pw_5_cdec_14HypergraphEdge_3__richcmp__, /*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_5_cdec_HypergraphEdge, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_HypergraphNode, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_5_cdec_HypergraphEdge, /*tp_getset*/ + __pyx_getsets_4cdec_5_cdec_HypergraphNode, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -22441,7 +22436,7 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphEdge = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_HypergraphEdge, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_HypergraphNode, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22455,65 +22450,81 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphEdge = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *__pyx_freelist_5_cdec___pyx_scope_struct_1___iter__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_1___iter__ = 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_5_cdec___pyx_scope_struct_1___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *p; +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; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_1___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_1___iter__[--__pyx_freecount_5_cdec___pyx_scope_struct_1___iter__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__)); + 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); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)o); + 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_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)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_5_cdec___pyx_scope_struct_1___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_1___iter__[__pyx_freecount_5_cdec___pyx_scope_struct_1___iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_1___iter__(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_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)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_5_cdec___pyx_scope_struct_1___iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__ *)o; +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; 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); + Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_SparseVector *)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_5_cdec___pyx_scope_struct_1___iter__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_10_kbest_features[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_1___iter__ = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_10_kbest_features = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_1___iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_1___iter__), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_1___iter__, /*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*/ @@ -22534,13 +22545,13 @@ static PyTypeObject __pyx_type_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_5_cdec___pyx_scope_struct_1___iter__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_1___iter__, /*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_5_cdec___pyx_scope_struct_1___iter__, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22550,7 +22561,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_1___iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_1___iter__, /*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*/ @@ -22564,65 +22575,145 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_1___iter__ = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_16___get__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_16___get__ = 0; - -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_16___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec_NTRef(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_16___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_16___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_16___get__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o); - p->__pyx_v_self = 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_16___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_16___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_16___get__[__pyx_freecount_5_cdec___pyx_scope_struct_16___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o); - } else { - (*Py_TYPE(o)->tp_free)(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 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_5_cdec___pyx_scope_struct_16___get__(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; +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 PyTypeObject __pyx_type_4cdec_5_cdec_NTRef = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("cdec._cdec.NTRef"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_NTRef), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_5_cdec_NTRef, /*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_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_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_NTRef, /*tp_methods*/ + 0, /*tp_members*/ + __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*/ + __pyx_pw_4cdec_5_cdec_5NTRef_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_5_cdec_NTRef, /*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_Grammar(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_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); } - return 0; + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_clear_5_cdec___pyx_scope_struct_16___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__ *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +static 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 PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_16___get__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec_Grammar[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = { +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_Grammar = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_16___get__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_16___get__), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.Grammar"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_Grammar), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_16___get__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_Grammar, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -22641,17 +22732,17 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = { 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_5_cdec___pyx_scope_struct_16___get__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_16___get__, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ + __pyx_pw_4cdec_5_cdec_7Grammar_3__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_16___get__, /*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*/ @@ -22659,7 +22750,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_16___get__, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_Grammar, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22672,66 +22763,81 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_16___get__ = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_5_cdec_Hypergraph __pyx_vtable_4cdec_5_cdec_Hypergraph; -static struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_4___get__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_4___get__ = 0; - -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_4___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p; +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_5_cdec___pyx_scope_struct_4___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_4___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_4___get__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o); - p->__pyx_v_self = 0; + 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; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_4___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_4___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_4___get__[__pyx_freecount_5_cdec___pyx_scope_struct_4___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o); - } else { - (*Py_TYPE(o)->tp_free)(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); } + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_4___get__(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_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 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_5_cdec___pyx_scope_struct_4___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__ *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; +static 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_5_cdec___pyx_scope_struct_4___get__[] = { +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("sample"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_22sample, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_21sample)}, + {__Pyx_NAMESTR("sample_trees"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_25sample_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_24sample_trees)}, + {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_28intersect, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_27intersect)}, + {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_30prune, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_29prune)}, + {__Pyx_NAMESTR("lattice"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_32lattice, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_31lattice)}, + {__Pyx_NAMESTR("plf"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_34plf, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_33plf)}, + {__Pyx_NAMESTR("reweight"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_36reweight, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_35reweight)}, + {__Pyx_NAMESTR("inside_outside"), (PyCFunction)__pyx_pw_4cdec_5_cdec_10Hypergraph_38inside_outside, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_4cdec_5_cdec_10Hypergraph_37inside_outside)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_4___get__ = { +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.__pyx_scope_struct_4___get__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_4___get__), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.Hypergraph"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_Hypergraph), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_4___get__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_Hypergraph, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -22750,17 +22856,17 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_4___get__ = { 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_5_cdec___pyx_scope_struct_4___get__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_4___get__, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_4___get__, /*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*/ @@ -22768,7 +22874,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_4___get__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_4___get__, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_Hypergraph, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22782,65 +22888,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_4___get__ = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *__pyx_freelist_5_cdec___pyx_scope_struct_18___iter__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_18___iter__ = 0; +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___init__[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___init__ = 0; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *p; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_18___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_18___iter__[--__pyx_freecount_5_cdec___pyx_scope_struct_18___iter__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__)); + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___init__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___init__]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o); - p->__pyx_v_self = 0; + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *)o); + p->__pyx_v_config = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18___iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o; +static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_24___init__(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_18___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_18___iter__[__pyx_freecount_5_cdec___pyx_scope_struct_18___iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o); + Py_CLEAR(p->__pyx_v_config); + if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_24___init__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_24___init__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_18___iter__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_24___init__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___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_5_cdec___pyx_scope_struct_18___iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__ *)o; +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_24___init__(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Lattice *)Py_None); Py_INCREF(Py_None); + 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_5_cdec___pyx_scope_struct_18___iter__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_24___init__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___iter__ = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_24___init__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_18___iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_18___iter__), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_24___init__"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_18___iter__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_24___init__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -22861,13 +22967,13 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___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_5_cdec___pyx_scope_struct_18___iter__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_18___iter__, /*tp_clear*/ + __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_24___init__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_24___init__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_18___iter__, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_24___init__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22877,7 +22983,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_18___iter__, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_24___init__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -22891,86 +22997,66 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_18___iter__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_Decoder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec_Decoder *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec_CandidateSet(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5_cdec_Decoder *)o); - p->weights = ((struct __pyx_obj_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_5_cdec_12CandidateSet_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } return o; } -static void __pyx_tp_dealloc_5_cdec_Decoder(PyObject *o) { - struct __pyx_obj_5_cdec_Decoder *p = (struct __pyx_obj_5_cdec_Decoder *)o; - PyObject_GC_UnTrack(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_5_cdec_7Decoder_3__dealloc__(o); + __pyx_pw_4cdec_5_cdec_12CandidateSet_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } - Py_CLEAR(p->weights); (*Py_TYPE(o)->tp_free)(o); } - -static int __pyx_tp_traverse_5_cdec_Decoder(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5_cdec_Decoder *p = (struct __pyx_obj_5_cdec_Decoder *)o; - if (p->weights) { - e = (*v)(((PyObject*)p->weights), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5_cdec_Decoder(PyObject *o) { - struct __pyx_obj_5_cdec_Decoder *p = (struct __pyx_obj_5_cdec_Decoder *)o; - PyObject* tmp; - tmp = ((PyObject*)p->weights); - p->weights = ((struct __pyx_obj_5_cdec_DenseVector *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_5_cdec_7Decoder_weights(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_7Decoder_7weights_1__get__(o); -} - -static int __pyx_setprop_5_cdec_7Decoder_weights(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_5_cdec_7Decoder_7weights_3__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_5_cdec_7Decoder_formalism(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_7Decoder_9formalism_1__get__(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_5_cdec_Decoder[] = { - {__Pyx_NAMESTR("read_weights"), (PyCFunction)__pyx_pw_5_cdec_7Decoder_5read_weights, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Decoder_4read_weights)}, - {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_5_cdec_7Decoder_7translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Decoder_6translate)}, +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 struct PyGetSetDef __pyx_getsets_5_cdec_Decoder[] = { - {(char *)"weights", __pyx_getprop_5_cdec_7Decoder_weights, __pyx_setprop_5_cdec_7Decoder_weights, 0, 0}, - {(char *)"formalism", __pyx_getprop_5_cdec_7Decoder_formalism, 0, 0, 0}, - {0, 0, 0, 0, 0} +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_5_cdec_Decoder = { +static PyTypeObject __pyx_type_4cdec_5_cdec_CandidateSet = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.Decoder"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_Decoder), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.CandidateSet"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_CandidateSet), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_Decoder, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_CandidateSet, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -22981,33 +23067,33 @@ static PyTypeObject __pyx_type_5_cdec_Decoder = { #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_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_5_cdec_Decoder, /*tp_traverse*/ - __pyx_tp_clear_5_cdec_Decoder, /*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_5_cdec_Decoder, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_CandidateSet, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_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_5_cdec_7Decoder_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_Decoder, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_CandidateSet, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23020,56 +23106,90 @@ static PyTypeObject __pyx_type_5_cdec_Decoder = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_5_cdec_HypergraphNode __pyx_vtable_5_cdec_HypergraphNode; -static PyObject *__pyx_tp_new_5_cdec_HypergraphNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec_HypergraphNode *p; +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees[8]; +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; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5_cdec_HypergraphNode *)o); - p->__pyx_vtab = __pyx_vtabptr_5_cdec_HypergraphNode; + 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)))) { + 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); + 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; } -static void __pyx_tp_dealloc_5_cdec_HypergraphNode(PyObject *o) { - (*Py_TYPE(o)->tp_free)(o); -} - -static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_in_edges(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphNode_8in_edges_1__get__(o); -} - -static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_out_edges(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphNode_9out_edges_1__get__(o); +static void __pyx_tp_dealloc_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_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_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); + } } -static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_span(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphNode_4span_1__get__(o); +static 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; + } + if (p->__pyx_v_size) { + e = (*v)(p->__pyx_v_size, a); if (e) return e; + } + return 0; } -static PyObject *__pyx_getprop_5_cdec_14HypergraphNode_cat(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_14HypergraphNode_3cat_1__get__(o); +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); + 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_5_cdec_HypergraphNode[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_5_cdec_HypergraphNode[] = { - {(char *)"in_edges", __pyx_getprop_5_cdec_14HypergraphNode_in_edges, 0, 0, 0}, - {(char *)"out_edges", __pyx_getprop_5_cdec_14HypergraphNode_out_edges, 0, 0, 0}, - {(char *)"span", __pyx_getprop_5_cdec_14HypergraphNode_span, 0, 0, 0}, - {(char *)"cat", __pyx_getprop_5_cdec_14HypergraphNode_cat, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5_cdec_HypergraphNode = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.HypergraphNode"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_HypergraphNode), /*tp_basicsize*/ + __Pyx_NAMESTR("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_5_cdec_HypergraphNode, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23088,17 +23208,17 @@ static PyTypeObject __pyx_type_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_5_cdec_14HypergraphNode_1__richcmp__, /*tp_richcompare*/ + __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_clear*/ + 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_HypergraphNode, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_5_cdec_HypergraphNode, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -23106,7 +23226,7 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphNode = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_HypergraphNode, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23120,133 +23240,65 @@ static PyTypeObject __pyx_type_5_cdec_HypergraphNode = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_SparseVector(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 struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_19_todot[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19_todot = 0; -static void __pyx_tp_dealloc_5_cdec_SparseVector(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5_cdec_12SparseVector_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_19_todot(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *p; + PyObject *o; + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19_todot > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_19_todot[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19_todot]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot)); + PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; } - (*Py_TYPE(o)->tp_free)(o); -} -static PyObject *__pyx_sq_item_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; + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *)o); + p->__pyx_v_self = 0; + return o; } -static int __pyx_mp_ass_subscript_5_cdec_SparseVector(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_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 void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_19_todot(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19_todot < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_19_todot[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_19_todot++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); } -} - -static PyMethodDef __pyx_methods_5_cdec_SparseVector[] = { - {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pw_5_cdec_12SparseVector_5copy, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_12SparseVector_4copy)}, - {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_5_cdec_12SparseVector_14dot, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_12SparseVector_13dot)}, - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_SparseVector = { - __pyx_pw_5_cdec_12SparseVector_32__add__, /*nb_add*/ - __pyx_pw_5_cdec_12SparseVector_34__sub__, /*nb_subtract*/ - __pyx_pw_5_cdec_12SparseVector_36__mul__, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - __pyx_pw_5_cdec_12SparseVector_38__div__, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - __pyx_pw_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_5_cdec_12SparseVector_24__iadd__, /*nb_inplace_add*/ - __pyx_pw_5_cdec_12SparseVector_26__isub__, /*nb_inplace_subtract*/ - __pyx_pw_5_cdec_12SparseVector_28__imul__, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - __pyx_pw_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*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; +} -static PySequenceMethods __pyx_tp_as_sequence_SparseVector = { - __pyx_pw_5_cdec_12SparseVector_18__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_5_cdec_SparseVector, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - __pyx_pw_5_cdec_12SparseVector_20__contains__, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_19_todot(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + } + return 0; +} -static PyMappingMethods __pyx_tp_as_mapping_SparseVector = { - __pyx_pw_5_cdec_12SparseVector_18__len__, /*mp_length*/ - __pyx_pw_5_cdec_12SparseVector_7__getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_5_cdec_SparseVector, /*mp_ass_subscript*/ +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_19_todot(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot *)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 PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_19_todot[] = { + {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec_SparseVector = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_19_todot = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.SparseVector"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_SparseVector), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_19_todot"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_19_todot), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_SparseVector, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_19_todot, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23256,24 +23308,24 @@ static PyTypeObject __pyx_type_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*/ + 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*/ + 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_5_cdec_12SparseVector_16__richcmp__, /*tp_richcompare*/ + __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_19_todot, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_19_todot, /*tp_clear*/ + 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_5_cdec_12SparseVector_11__iter__, /*tp_iter*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_SparseVector, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_19_todot, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23281,9 +23333,9 @@ static PyTypeObject __pyx_type_5_cdec_SparseVector = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_5_cdec_12SparseVector_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_SparseVector, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_19_todot, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23297,65 +23349,65 @@ static PyTypeObject __pyx_type_5_cdec_SparseVector = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_17___get__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_17___get__ = 0; +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_5_cdec___pyx_scope_struct_17___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p; +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; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_17___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_17___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_17___get__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__)); + 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); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o); + 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_5_cdec___pyx_scope_struct_17___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o; +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 ((__pyx_freecount_5_cdec___pyx_scope_struct_17___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_17___get__[__pyx_freecount_5_cdec___pyx_scope_struct_17___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_17___get__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_5___str__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o; + 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 int __pyx_tp_clear_5_cdec___pyx_scope_struct_17___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__ *)o; +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; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphNode *)Py_None); Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_4cdec_5_cdec_TRule *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_17___get__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_5___str__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___get__ = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_17___get__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_17___get__), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_17___get__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_5___str__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23376,13 +23428,95 @@ static PyTypeObject __pyx_type_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_5_cdec___pyx_scope_struct_17___get__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_17___get__, /*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*/ + 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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_17___get__, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_SegmentEvaluator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23392,7 +23526,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___get__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_17___get__, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_SegmentEvaluator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23406,65 +23540,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_17___get__ = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *__pyx_freelist_5_cdec___pyx_scope_struct____iter__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct____iter__ = 0; +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 PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p; +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; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct____iter__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct____iter__[--__pyx_freecount_5_cdec___pyx_scope_struct____iter__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct____iter__)); + 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); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o); + 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_5_cdec___pyx_scope_struct____iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)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; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct____iter__))) { - __pyx_freelist_5_cdec___pyx_scope_struct____iter__[__pyx_freecount_5_cdec___pyx_scope_struct____iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_16___get__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)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; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_5_cdec___pyx_scope_struct____iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct____iter__ *)o; +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; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_DenseVector *)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_5_cdec___pyx_scope_struct____iter__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_16___get__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct____iter__ = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct____iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct____iter__), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct____iter__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23485,13 +23619,13 @@ static PyTypeObject __pyx_type_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_5_cdec___pyx_scope_struct____iter__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct____iter__, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct____iter__, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23501,7 +23635,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct____iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct____iter__, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_16___get__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23515,81 +23649,81 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct____iter__ = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *__pyx_freelist_5_cdec___pyx_scope_struct_21___iter__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_21___iter__ = 0; +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25_genexpr[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25_genexpr = 0; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *p; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_21___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_21___iter__[--__pyx_freecount_5_cdec___pyx_scope_struct_21___iter__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__)); + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25_genexpr[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25_genexpr]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o); - p->__pyx_v_i = 0; - p->__pyx_v_self = 0; - p->__pyx_t_1 = 0; + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_kv = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o; +static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *)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_5_cdec___pyx_scope_struct_21___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_21___iter__[__pyx_freecount_5_cdec___pyx_scope_struct_21___iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)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_25_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_25_genexpr[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_25_genexpr++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_21___iter__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o; - if (p->__pyx_v_i) { - e = (*v)(p->__pyx_v_i, a); if (e) return e; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), 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_1) { - e = (*v)(p->__pyx_t_1, a); if (e) return e; + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__ *)o; +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_25_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_i); - p->__pyx_v_i = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_24___init__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_SufficientStats *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_kv); + p->__pyx_v_kv = 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); + tmp = ((PyObject*)p->__pyx_t_0); + p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_21___iter__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_25_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_25_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_21___iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_21___iter__), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_25_genexpr"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_25_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_21___iter__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_25_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23610,13 +23744,13 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___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_5_cdec___pyx_scope_struct_21___iter__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_21___iter__, /*tp_clear*/ + __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_25_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_25_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_21___iter__, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_25_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23626,7 +23760,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_21___iter__, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_25_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23640,75 +23774,81 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_21___iter__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_DenseVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +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_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_3_genexpr *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + 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); + 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_5_cdec_DenseVector(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5_cdec_11DenseVector_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_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_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); + } else { + (*Py_TYPE(o)->tp_free)(o); } - (*Py_TYPE(o)->tp_free)(o); -} -static PyObject *__pyx_sq_item_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_5_cdec_DenseVector(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_5_cdec_11DenseVector_9__setitem__(o, i, v); +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_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; } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); - return -1; + if (p->__pyx_v_w) { + e = (*v)(p->__pyx_v_w, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; } + return 0; } -static PyMethodDef __pyx_methods_5_cdec_DenseVector[] = { - {__Pyx_NAMESTR("dot"), (PyCFunction)__pyx_pw_5_cdec_11DenseVector_14dot, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_11DenseVector_13dot)}, - {__Pyx_NAMESTR("tosparse"), (PyCFunction)__pyx_pw_5_cdec_11DenseVector_16tosparse, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_11DenseVector_15tosparse)}, - {0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_DenseVector = { - __pyx_pw_5_cdec_11DenseVector_5__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_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 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; + 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); + 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 PyMappingMethods __pyx_tp_as_mapping_DenseVector = { - __pyx_pw_5_cdec_11DenseVector_5__len__, /*mp_length*/ - __pyx_pw_5_cdec_11DenseVector_7__getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_5_cdec_DenseVector, /*mp_ass_subscript*/ +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_3_genexpr[] = { + {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec_DenseVector = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_3_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.DenseVector"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_DenseVector), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_DenseVector, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23719,23 +23859,23 @@ static PyTypeObject __pyx_type_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*/ 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_3_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_5_cdec_11DenseVector_11__iter__, /*tp_iter*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_DenseVector, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_3_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23743,9 +23883,9 @@ static PyTypeObject __pyx_type_5_cdec_DenseVector = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_5_cdec_11DenseVector_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_DenseVector, /*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*/ @@ -23759,73 +23899,65 @@ static PyTypeObject __pyx_type_5_cdec_DenseVector = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *__pyx_freelist_5_cdec___pyx_scope_struct_7___iter__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_7___iter__ = 0; +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_sample[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_sample = 0; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_sample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *p; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_7___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_7___iter__[--__pyx_freecount_5_cdec___pyx_scope_struct_7___iter__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__)); + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_sample > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_sample[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_sample]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o); + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *)o); p->__pyx_v_self = 0; - p->__pyx_v_trule = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o; +static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_11_sample(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); - Py_CLEAR(p->__pyx_v_trule); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_7___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_7___iter__[__pyx_freecount_5_cdec___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o); + if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_sample < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_11_sample[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_11_sample++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_11_sample(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *)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_5_cdec___pyx_scope_struct_7___iter__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__ *)o; +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_11_sample(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample *)o; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_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_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_5_cdec___pyx_scope_struct_7___iter__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_11_sample[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7___iter__ = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_11_sample = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_7___iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_7___iter__), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_11_sample"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_11_sample), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_7___iter__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_11_sample, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23846,13 +23978,13 @@ static PyTypeObject __pyx_type_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_5_cdec___pyx_scope_struct_7___iter__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_7___iter__, /*tp_clear*/ + __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_11_sample, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_11_sample, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_7___iter__, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_11_sample, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23862,7 +23994,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7___iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_7___iter__, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_11_sample, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -23876,56 +24008,73 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_7___iter__ = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_Metric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec_Metric *p; +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_8_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_8_kbest *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5_cdec_Metric *)o); - p->scorer = ((struct __pyx_obj_5_cdec_Scorer *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_5_cdec_6Metric_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; + 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); + 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_5_cdec_Metric(PyObject *o) { - struct __pyx_obj_5_cdec_Metric *p = (struct __pyx_obj_5_cdec_Metric *)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->scorer); - (*Py_TYPE(o)->tp_free)(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); + } else { + (*Py_TYPE(o)->tp_free)(o); + } } -static int __pyx_tp_traverse_5_cdec_Metric(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_5_cdec_Metric *p = (struct __pyx_obj_5_cdec_Metric *)o; - if (p->scorer) { - e = (*v)(((PyObject*)p->scorer), a); if (e) return 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; + 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_5_cdec_Metric(PyObject *o) { - struct __pyx_obj_5_cdec_Metric *p = (struct __pyx_obj_5_cdec_Metric *)o; +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; PyObject* tmp; - tmp = ((PyObject*)p->scorer); - p->scorer = ((struct __pyx_obj_5_cdec_Scorer *)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); + 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_5_cdec_Metric[] = { - {__Pyx_NAMESTR("score"), (PyCFunction)__pyx_pw_5_cdec_6Metric_5score, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("evaluate"), (PyCFunction)__pyx_pw_5_cdec_6Metric_7evaluate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_8_kbest[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec_Metric = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_8_kbest = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.Metric"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_Metric), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_Metric, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -23939,20 +24088,20 @@ static PyTypeObject __pyx_type_5_cdec_Metric = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ - __pyx_pw_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_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_5_cdec_Metric, /*tp_traverse*/ - __pyx_tp_clear_5_cdec_Metric, /*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_5_cdec_Metric, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_8_kbest, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -23962,7 +24111,7 @@ static PyTypeObject __pyx_type_5_cdec_Metric = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_Metric, /*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*/ @@ -23976,134 +24125,65 @@ static PyTypeObject __pyx_type_5_cdec_Metric = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_SufficientStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14___get__[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14___get__ = 0; + +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14___get__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14___get__]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__)); + 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___get__ *)o); + p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_5_cdec_SufficientStats(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5_cdec_15SufficientStats_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_14___get__(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_14___get__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_14___get__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); } - (*Py_TYPE(o)->tp_free)(o); -} -static PyObject *__pyx_sq_item_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_5_cdec_15SufficientStats_score(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_15SufficientStats_5score_1__get__(o); +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_14___get__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + } + return 0; } -static PyObject *__pyx_getprop_5_cdec_15SufficientStats_detail(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_15SufficientStats_6detail_1__get__(o); +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_14___get__(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__ *)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); + return 0; } -static PyMethodDef __pyx_methods_5_cdec_SufficientStats[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_14___get__[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_5_cdec_SufficientStats[] = { - {(char *)"score", __pyx_getprop_5_cdec_15SufficientStats_score, 0, 0, 0}, - {(char *)"detail", __pyx_getprop_5_cdec_15SufficientStats_detail, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_SufficientStats = { - __pyx_pw_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_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_5_cdec_15SufficientStats_3__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_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_5_cdec_15SufficientStats_3__len__, /*mp_length*/ - __pyx_pw_5_cdec_15SufficientStats_8__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_5_cdec_SufficientStats = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_14___get__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.SufficientStats"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_SufficientStats), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_14___get__"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_14___get__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_SufficientStats, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_14___get__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24113,26 +24193,26 @@ static PyTypeObject __pyx_type_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*/ 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_14___get__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_14___get__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_5_cdec_15SufficientStats_5__iter__, /*tp_iter*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_SufficientStats, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_14___get__, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_5_cdec_SufficientStats, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -24140,7 +24220,7 @@ static PyTypeObject __pyx_type_5_cdec_SufficientStats = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_SufficientStats, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_14___get__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24154,73 +24234,73 @@ static PyTypeObject __pyx_type_5_cdec_SufficientStats = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *__pyx_freelist_5_cdec___pyx_scope_struct_8_kbest[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_8_kbest = 0; +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_5_cdec___pyx_scope_struct_8_kbest(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p; +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; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_8_kbest > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_8_kbest[--__pyx_freecount_5_cdec___pyx_scope_struct_8_kbest]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest)); + 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); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o); + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_7___iter__ *)o); p->__pyx_v_self = 0; - p->__pyx_v_size = 0; + p->__pyx_v_trule = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)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; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); - Py_CLEAR(p->__pyx_v_size); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_8_kbest < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest))) { - __pyx_freelist_5_cdec___pyx_scope_struct_8_kbest[__pyx_freecount_5_cdec___pyx_scope_struct_8_kbest++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_8_kbest(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)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; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } - if (p->__pyx_v_size) { - e = (*v)(p->__pyx_v_size, a); if (e) return e; + if (p->__pyx_v_trule) { + e = (*v)(((PyObject*)p->__pyx_v_trule), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_5_cdec___pyx_scope_struct_8_kbest(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest *)o; +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; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None); + 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_size); - p->__pyx_v_size = Py_None; Py_INCREF(Py_None); + 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 PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_8_kbest[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_7___iter__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_kbest = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_8_kbest"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_8_kbest), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_8_kbest, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24241,13 +24321,13 @@ static PyTypeObject __pyx_type_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_5_cdec___pyx_scope_struct_8_kbest, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_8_kbest, /*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*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_8_kbest, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_7___iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24257,7 +24337,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_kbest = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_8_kbest, /*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*/ @@ -24271,81 +24351,22 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_8_kbest = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *__pyx_freelist_5_cdec___pyx_scope_struct_10_kbest_features[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_10_kbest_features = 0; - -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_10_kbest_features(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p; - PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_10_kbest_features > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_10_kbest_features[--__pyx_freecount_5_cdec___pyx_scope_struct_10_kbest_features]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o); - p->__pyx_v_fmap = 0; - p->__pyx_v_self = 0; - p->__pyx_v_size = 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_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_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); - Py_CLEAR(p->__pyx_v_size); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_10_kbest_features < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features))) { - __pyx_freelist_5_cdec___pyx_scope_struct_10_kbest_features[__pyx_freecount_5_cdec___pyx_scope_struct_10_kbest_features++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_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_5_cdec___pyx_scope_struct_10_kbest_features(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_fmap); - p->__pyx_v_fmap = ((struct __pyx_obj_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_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_5_cdec___pyx_scope_struct_10_kbest_features[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec_TextGrammar[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10_kbest_features = { +static PyTypeObject __pyx_type_4cdec_5_cdec_TextGrammar = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_10_kbest_features"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_10_kbest_features), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.TextGrammar"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_TextGrammar), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_Grammar, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24364,15 +24385,19 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10_kbest_features = { 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_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*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_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_TextGrammar, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24380,9 +24405,9 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10_kbest_features = { 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_5_cdec___pyx_scope_struct_10_kbest_features, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_TextGrammar, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24396,65 +24421,86 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_10_kbest_features = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *__pyx_freelist_5_cdec___pyx_scope_struct_15___get__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_15___get__ = 0; - -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_15___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p; +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; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_15___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_15___get__[--__pyx_freecount_5_cdec___pyx_scope_struct_15___get__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o); - p->__pyx_v_self = 0; + 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); return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_15___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o; +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; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_15___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_15___get__[__pyx_freecount_5_cdec___pyx_scope_struct_15___get__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o); - } else { - (*Py_TYPE(o)->tp_free)(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->weights); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_15___get__(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_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___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_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_5_cdec___pyx_scope_struct_15___get__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__ *)o; +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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_HypergraphEdge *)Py_None); Py_INCREF(Py_None); + 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 PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_15___get__[] = { +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 PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_15___get__ = { +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 = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_15___get__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_15___get__), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.Decoder"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec_Decoder), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_15___get__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec_Decoder, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24473,25 +24519,25 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_15___get__ = { 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_5_cdec___pyx_scope_struct_15___get__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_15___get__, /*tp_clear*/ + __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_5_cdec___pyx_scope_struct_15___get__, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec_Decoder, /*tp_methods*/ 0, /*tp_members*/ - 0, /*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_5_cdec___pyx_scope_struct_15___get__, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec_Decoder, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24505,65 +24551,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_15___get__ = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *__pyx_freelist_5_cdec___pyx_scope_struct_5___str__[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_5___str__ = 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_5_cdec___pyx_scope_struct_5___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p; +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; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_5___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_5___str__[--__pyx_freecount_5_cdec___pyx_scope_struct_5___str__]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__)); + 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); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o); + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct____iter__ *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_5___str__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)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_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_5___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__))) { - __pyx_freelist_5_cdec___pyx_scope_struct_5___str__[__pyx_freecount_5_cdec___pyx_scope_struct_5___str__++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_5___str__(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_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o; + 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_5_cdec___pyx_scope_struct_5___str__(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__ *)o; +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; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_TRule *)Py_None); Py_INCREF(Py_None); + 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_5_cdec___pyx_scope_struct_5___str__[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct____iter__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_5___str__ = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_5___str__"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_5___str__), /*tp_basicsize*/ + __Pyx_NAMESTR("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_5_cdec___pyx_scope_struct_5___str__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24584,13 +24630,13 @@ static PyTypeObject __pyx_type_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_5_cdec___pyx_scope_struct_5___str__, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_5___str__, /*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_5_cdec___pyx_scope_struct_5___str__, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24600,7 +24646,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_5___str__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_5___str__, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct____iter__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24614,89 +24660,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_5___str__ = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *__pyx_freelist_5_cdec___pyx_scope_struct_9_kbest_trees[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_9_kbest_trees = 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_5_cdec___pyx_scope_struct_9_kbest_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p; +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; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_9_kbest_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_9_kbest_trees[--__pyx_freecount_5_cdec___pyx_scope_struct_9_kbest_trees]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees)); + 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); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o); - p->__pyx_v_e_tree = 0; - p->__pyx_v_f_tree = 0; + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_17___get__ *)o); p->__pyx_v_self = 0; - p->__pyx_v_size = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)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_e_tree); - Py_CLEAR(p->__pyx_v_f_tree); Py_CLEAR(p->__pyx_v_self); - Py_CLEAR(p->__pyx_v_size); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_9_kbest_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees))) { - __pyx_freelist_5_cdec___pyx_scope_struct_9_kbest_trees[__pyx_freecount_5_cdec___pyx_scope_struct_9_kbest_trees++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_9_kbest_trees(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_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_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; - } + 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; } - if (p->__pyx_v_size) { - e = (*v)(p->__pyx_v_size, a); if (e) return e; - } return 0; } -static int __pyx_tp_clear_5_cdec___pyx_scope_struct_9_kbest_trees(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees *)o; +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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_e_tree); - p->__pyx_v_e_tree = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f_tree); - p->__pyx_v_f_tree = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_size); - p->__pyx_v_size = Py_None; Py_INCREF(Py_None); + 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_5_cdec___pyx_scope_struct_9_kbest_trees[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_17___get__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_9_kbest_trees"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_9_kbest_trees), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24717,13 +24739,13 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees = { 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_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_9_kbest_trees, /*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_5_cdec___pyx_scope_struct_9_kbest_trees, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_17___get__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24733,7 +24755,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_9_kbest_trees, /*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*/ @@ -24746,81 +24768,66 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_5_cdec_Hypergraph __pyx_vtable_5_cdec_Hypergraph; -static PyObject *__pyx_tp_new_5_cdec_Hypergraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec_Hypergraph *p; +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___iter__[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___iter__ = 0; + +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5_cdec_Hypergraph *)o); - p->__pyx_vtab = __pyx_vtabptr_5_cdec_Hypergraph; + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___iter__[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___iter__]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___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_18___iter__ *)o); + p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_5_cdec_Hypergraph(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_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_18___iter__(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_self); + if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_18___iter__[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_18___iter__++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); } - (*Py_TYPE(o)->tp_free)(o); -} - -static PyObject *__pyx_getprop_5_cdec_10Hypergraph_edges(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_10Hypergraph_5edges_1__get__(o); -} - -static PyObject *__pyx_getprop_5_cdec_10Hypergraph_nodes(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_10Hypergraph_5nodes_1__get__(o); } -static PyObject *__pyx_getprop_5_cdec_10Hypergraph_goal(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_10Hypergraph_4goal_1__get__(o); +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_18___iter__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *)o; + if (p->__pyx_v_self) { + e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + } + return 0; } -static PyObject *__pyx_getprop_5_cdec_10Hypergraph_npaths(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5_cdec_10Hypergraph_6npaths_1__get__(o); +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_18___iter__(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___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 PyMethodDef __pyx_methods_5_cdec_Hypergraph[] = { - {__Pyx_NAMESTR("viterbi"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_3viterbi, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_2viterbi)}, - {__Pyx_NAMESTR("viterbi_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_5viterbi_trees, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_4viterbi_trees)}, - {__Pyx_NAMESTR("viterbi_features"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_7viterbi_features, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_6viterbi_features)}, - {__Pyx_NAMESTR("viterbi_forest"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_9viterbi_forest, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("viterbi_joshua"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_11viterbi_joshua, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_10viterbi_joshua)}, - {__Pyx_NAMESTR("kbest"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_13kbest, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_12kbest)}, - {__Pyx_NAMESTR("kbest_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_16kbest_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_15kbest_trees)}, - {__Pyx_NAMESTR("kbest_features"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_19kbest_features, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_18kbest_features)}, - {__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_22sample, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_21sample)}, - {__Pyx_NAMESTR("sample_trees"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_25sample_trees, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_24sample_trees)}, - {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_28intersect, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_27intersect)}, - {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_30prune, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_29prune)}, - {__Pyx_NAMESTR("lattice"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_32lattice, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_31lattice)}, - {__Pyx_NAMESTR("plf"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_34plf, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_33plf)}, - {__Pyx_NAMESTR("reweight"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_36reweight, METH_O, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_35reweight)}, - {__Pyx_NAMESTR("inside_outside"), (PyCFunction)__pyx_pw_5_cdec_10Hypergraph_38inside_outside, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_10Hypergraph_37inside_outside)}, +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_18___iter__[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_5_cdec_Hypergraph[] = { - {(char *)"edges", __pyx_getprop_5_cdec_10Hypergraph_edges, 0, 0, 0}, - {(char *)"nodes", __pyx_getprop_5_cdec_10Hypergraph_nodes, 0, 0, 0}, - {(char *)"goal", __pyx_getprop_5_cdec_10Hypergraph_goal, 0, 0, 0}, - {(char *)"npaths", __pyx_getprop_5_cdec_10Hypergraph_npaths, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5_cdec_Hypergraph = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_18___iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.Hypergraph"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_Hypergraph), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_18___iter__"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_18___iter__), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_Hypergraph, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_18___iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24839,17 +24846,17 @@ static PyTypeObject __pyx_type_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_18___iter__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_18___iter__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_Hypergraph, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_18___iter__, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_5_cdec_Hypergraph, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -24857,7 +24864,7 @@ static PyTypeObject __pyx_type_5_cdec_Hypergraph = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_Hypergraph, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_18___iter__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -24871,79 +24878,81 @@ static PyTypeObject __pyx_type_5_cdec_Hypergraph = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_Lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +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) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_6_genexpr *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - if (unlikely(__pyx_pw_5_cdec_7Lattice_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; + 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); + 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_5_cdec_Lattice(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_5_cdec_7Lattice_5__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 ((__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_sq_item_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_5_cdec_Lattice(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_5_cdec_7Lattice_9__setitem__(o, i, v); +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; } - else { - PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); - return -1; + 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 PyMethodDef __pyx_methods_5_cdec_Lattice[] = { - {__Pyx_NAMESTR("__unicode__"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_15__unicode__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("todot"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_20todot, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Lattice_19todot)}, - {__Pyx_NAMESTR("as_hypergraph"), (PyCFunction)__pyx_pw_5_cdec_7Lattice_22as_hypergraph, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5_cdec_7Lattice_21as_hypergraph)}, - {0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_Lattice = { - __pyx_pw_5_cdec_7Lattice_11__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_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 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; + 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); + Py_XDECREF(tmp); + return 0; +} -static PyMappingMethods __pyx_tp_as_mapping_Lattice = { - __pyx_pw_5_cdec_7Lattice_11__len__, /*mp_length*/ - __pyx_pw_5_cdec_7Lattice_7__getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_5_cdec_Lattice, /*mp_ass_subscript*/ +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_6_genexpr[] = { + {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec_Lattice = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.Lattice"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_Lattice), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_Lattice, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -24954,23 +24963,23 @@ static PyTypeObject __pyx_type_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_5_cdec_7Lattice_13__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_6_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_5_cdec_7Lattice_17__iter__, /*tp_iter*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec_Lattice, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_6_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -24978,9 +24987,9 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_5_cdec_7Lattice_3__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_Lattice, /*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*/ @@ -24994,65 +25003,65 @@ static PyTypeObject __pyx_type_5_cdec_Lattice = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *__pyx_freelist_5_cdec___pyx_scope_struct_11_sample[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_11_sample = 0; +static struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_sample_trees[8]; +static int __pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_sample_trees = 0; -static PyObject *__pyx_tp_new_5_cdec___pyx_scope_struct_11_sample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p; +static PyObject *__pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_sample_trees(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *p; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_11_sample > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_11_sample[--__pyx_freecount_5_cdec___pyx_scope_struct_11_sample]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample)); + if (likely((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_sample_trees > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees)))) { + o = (PyObject*)__pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_sample_trees[--__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_sample_trees]; + memset(o, 0, sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o); + p = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_5_cdec___pyx_scope_struct_11_sample(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o; +static void __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_5_cdec___pyx_scope_struct_11_sample < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample))) { - __pyx_freelist_5_cdec___pyx_scope_struct_11_sample[__pyx_freecount_5_cdec___pyx_scope_struct_11_sample++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o); + if ((__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_sample_trees < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees))) { + __pyx_freelist_4cdec_5_cdec___pyx_scope_struct_12_sample_trees[__pyx_freecount_4cdec_5_cdec___pyx_scope_struct_12_sample_trees++] = ((struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_11_sample(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o; + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_5_cdec___pyx_scope_struct_11_sample(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample *)o; +static int __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_12_sample_trees(PyObject *o) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *p = (struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees *)o; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_5_cdec_Hypergraph *)Py_None); Py_INCREF(Py_None); + 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_5_cdec___pyx_scope_struct_11_sample[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_12_sample_trees[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_12_sample_trees = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_11_sample"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_11_sample), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec._cdec.__pyx_scope_struct_12_sample_trees"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_12_sample_trees), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_11_sample, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25073,13 +25082,13 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_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_5_cdec___pyx_scope_struct_11_sample, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_11_sample, /*tp_clear*/ + __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_5_cdec___pyx_scope_struct_11_sample, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -25089,7 +25098,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_11_sample, /*tp_new*/ + __pyx_tp_new_4cdec_5_cdec___pyx_scope_struct_12_sample_trees, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -25103,113 +25112,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_11_sample = { #endif }; -static struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *__pyx_freelist_5_cdec___pyx_scope_struct_23__make_config[8]; -static int __pyx_freecount_5_cdec___pyx_scope_struct_23__make_config = 0; +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_5_cdec___pyx_scope_struct_23__make_config(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *p; +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; PyObject *o; - if (likely((__pyx_freecount_5_cdec___pyx_scope_struct_23__make_config > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config)))) { - o = (PyObject*)__pyx_freelist_5_cdec___pyx_scope_struct_23__make_config[--__pyx_freecount_5_cdec___pyx_scope_struct_23__make_config]; - memset(o, 0, sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config)); + 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); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o); - p->__pyx_v_config = 0; - p->__pyx_v_info = 0; - p->__pyx_v_key = 0; - p->__pyx_v_name = 0; - p->__pyx_v_value = 0; - p->__pyx_t_0 = 0; - p->__pyx_t_1 = 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_5_cdec___pyx_scope_struct_23__make_config(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o; +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_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_5_cdec___pyx_scope_struct_23__make_config < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config))) { - __pyx_freelist_5_cdec___pyx_scope_struct_23__make_config[__pyx_freecount_5_cdec___pyx_scope_struct_23__make_config++] = ((struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_5_cdec___pyx_scope_struct_23__make_config(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_5_cdec___pyx_scope_struct_4___get__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o; - if (p->__pyx_v_config) { - e = (*v)(p->__pyx_v_config, a); if (e) return e; - } - if (p->__pyx_v_info) { - e = (*v)(p->__pyx_v_info, a); if (e) return e; - } - if (p->__pyx_v_key) { - e = (*v)(p->__pyx_v_key, a); if (e) return e; - } - if (p->__pyx_v_name) { - e = (*v)(p->__pyx_v_name, a); if (e) return e; - } - if (p->__pyx_v_value) { - e = (*v)(p->__pyx_v_value, a); if (e) return e; - } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } - if (p->__pyx_t_1) { - e = (*v)(p->__pyx_t_1, a); if (e) return e; + 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 int __pyx_tp_clear_5_cdec___pyx_scope_struct_23__make_config(PyObject *o) { - struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *p = (struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config *)o; +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; 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); + 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 PyMethodDef __pyx_methods_5_cdec___pyx_scope_struct_23__make_config[] = { +static PyMethodDef __pyx_methods_4cdec_5_cdec___pyx_scope_struct_4___get__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23__make_config = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.__pyx_scope_struct_23__make_config"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec___pyx_scope_struct_23__make_config), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec___pyx_scope_struct_23__make_config, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25230,13 +25191,13 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23__make_config = { 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_5_cdec___pyx_scope_struct_23__make_config, /*tp_traverse*/ - __pyx_tp_clear_5_cdec___pyx_scope_struct_23__make_config, /*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_5_cdec___pyx_scope_struct_23__make_config, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_4___get__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -25246,7 +25207,7 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23__make_config = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec___pyx_scope_struct_23__make_config, /*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*/ @@ -25260,22 +25221,65 @@ static PyTypeObject __pyx_type_5_cdec___pyx_scope_struct_23__make_config = { #endif }; -static PyObject *__pyx_tp_new_5_cdec_TextGrammar(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = __pyx_tp_new_5_cdec_Grammar(t, a, k); - if (unlikely(!o)) return 0; +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) { + struct __pyx_obj_4cdec_5_cdec___pyx_scope_struct_1___iter__ *p; + 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); + 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 PyMethodDef __pyx_methods_5_cdec_TextGrammar[] = { +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 ((__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); + } +} + +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 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; + 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); + 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_5_cdec_TextGrammar = { +static PyTypeObject __pyx_type_4cdec_5_cdec___pyx_scope_struct_1___iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_cdec.TextGrammar"), /*tp_name*/ - sizeof(struct __pyx_obj_5_cdec_TextGrammar), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5_cdec_Grammar, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -25294,19 +25298,15 @@ static PyTypeObject __pyx_type_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_1___iter__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_5_cdec_7Grammar_3__iter__, /*tp_iter*/ - #else 0, /*tp_iter*/ - #endif 0, /*tp_iternext*/ - __pyx_methods_5_cdec_TextGrammar, /*tp_methods*/ + __pyx_methods_4cdec_5_cdec___pyx_scope_struct_1___iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -25314,9 +25314,9 @@ static PyTypeObject __pyx_type_5_cdec_TextGrammar = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_5_cdec_11TextGrammar_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5_cdec_TextGrammar, /*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*/ @@ -25375,20 +25375,21 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0}, + {&__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_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0}, - {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0}, - {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 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_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0}, - {&__pyx_n_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 1}, + {&__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_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0}, - {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0}, + {&__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}, @@ -25420,7 +25421,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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___cdec, __pyx_k___cdec, sizeof(__pyx_k___cdec), 0, 0, 1, 1}, {&__pyx_n_s___make_config, __pyx_k___make_config, sizeof(__pyx_k___make_config), 0, 0, 1, 1}, {&__pyx_n_s___phrase, __pyx_k___phrase, sizeof(__pyx_k___phrase), 0, 0, 1, 1}, {&__pyx_n_s___sa, __pyx_k___sa, sizeof(__pyx_k___sa), 0, 0, 1, 1}, @@ -25518,7 +25518,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "_cdec.pyx":9 + /* "cdec/_cdec.pyx":9 * cdef bytes ret * if isinstance(data, unicode): * ret = data.encode('utf8') # <<<<<<<<<<<<<< @@ -25529,7 +25529,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "/Users/vchahun/Sandbox/cdec/python/src/vectors.pxi":95 + /* "/home/mdenkows/cdec/python/cdec/vectors.pxi":95 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for SparseVector') # <<<<<<<<<<<<<< @@ -25540,7 +25540,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":6 + /* "/home/mdenkows/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) # <<<<<<<<<<<<<< @@ -25551,7 +25551,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":226 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":226 * trule = convert_rule(trule) * elif not isinstance(trule, TRule): * raise ValueError('the grammar should contain TRule objects') # <<<<<<<<<<<<<< @@ -25561,7 +25561,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":244 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":244 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphEdge') # <<<<<<<<<<<<<< @@ -25572,7 +25572,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_19); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); - /* "/Users/vchahun/Sandbox/cdec/python/src/hypergraph.pxi":281 + /* "/home/mdenkows/cdec/python/cdec/hypergraph.pxi":281 * elif op == 3: # != * return not (x == y) * raise NotImplemented('comparison not implemented for HypergraphNode') # <<<<<<<<<<<<<< @@ -25581,7 +25581,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_21); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":26 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< @@ -25592,7 +25592,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":39 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":39 * def __setitem__(self, int index, tuple arcs): * if not 0 <= index < len(self): * raise IndexError('lattice index out of range') # <<<<<<<<<<<<<< @@ -25603,7 +25603,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":69 * for i in range(len(self)): * for label, weight, delta in self[i]: * yield '%d -> %d [label="%s"];' % (i, i+delta, label.replace('"', '\\"')) # <<<<<<<<<<<<<< @@ -25614,7 +25614,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_32); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":63 * def todot(self): * """lattice.todot() -> Representation of the lattice in GraphViz dot format.""" * def lines(): # <<<<<<<<<<<<<< @@ -25626,148 +25626,148 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); __pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_37, __pyx_n_s__lines, 63, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/lattice.pxi":72 + /* "/home/mdenkows/cdec/python/cdec/lattice.pxi":72 * yield '%d [shape=doublecircle]' % len(self) * yield '}' * return '\n'.join(lines()).encode('utf8') # <<<<<<<<<<<<<< * * def as_hypergraph(self): */ - __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__utf8)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_40); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":50 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":50 * def __getitem__(self, int index): * if not 0 <= index < len(self): * raise IndexError('sufficient stats vector index out of range') # <<<<<<<<<<<<<< * return self.stats[0][index] * */ - __pyx_k_tuple_42 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_41)); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_42); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":84 * def __getitem__(self,int k): * if not 0 <= k < self.cs.size(): * raise IndexError('candidate set index out of range') # <<<<<<<<<<<<<< * cdef Candidate candidate = Candidate() * candidate.candidate = &self.cs[0][k] */ - __pyx_k_tuple_44 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_43)); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_44); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44)); + __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)); - /* "_cdec.pyx":92 + /* "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) */ - __pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_49)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_50); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50)); + __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)); - /* "_cdec.pyx":90 + /* "cdec/_cdec.pyx":90 * def read_weights(self, weights): * """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_51 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_51); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5 + /* "/home/mdenkows/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) * */ - __pyx_k_tuple_55 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_55); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); - __pyx_k_codeobj_56 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_57, __pyx_n_s___phrase, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_56)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":194 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":194 * return [] * * BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<< * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') */ - __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__IBM_BLEU)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_58); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":195 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":195 * * BLEU = Scorer('IBM_BLEU') * QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<< * TER = Scorer('TER') * CER = Scorer('CER') */ - __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__QCRI_BLEU)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_59); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":196 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":196 * BLEU = Scorer('IBM_BLEU') * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') # <<<<<<<<<<<<<< * CER = Scorer('CER') * SSK = Scorer('SSK') */ - __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__TER)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_60); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":197 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":197 * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') * CER = Scorer('CER') # <<<<<<<<<<<<<< * SSK = Scorer('SSK') */ - __pyx_k_tuple_61 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__CER)); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_61); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":198 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":198 * TER = Scorer('TER') * CER = Scorer('CER') * SSK = Scorer('SSK') # <<<<<<<<<<<<<< */ - __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__SSK)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_62); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62)); + __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)); - /* "_cdec.pyx":28 + /* "cdec/_cdec.pyx":28 * class ParseFailed(Exception): pass * * def set_silent(yn): # <<<<<<<<<<<<<< * """set_silent(bool): Configure the verbosity of cdec.""" * SetSilent(yn) */ - __pyx_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__yn)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_63); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63)); - __pyx_k_codeobj_64 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s__set_silent, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} - /* "_cdec.pyx":32 + /* "cdec/_cdec.pyx":32 * SetSilent(yn) * * def _make_config(config): # <<<<<<<<<<<<<< * for key, value in config.items(): * if isinstance(value, dict): */ - __pyx_k_tuple_66 = 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_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_66); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66)); - __pyx_k_codeobj_67 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_65, __pyx_n_s___make_config, 32, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -25841,8 +25841,8 @@ PyMODINIT_FUNC PyInit__cdec(void) #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")) { - if (unlikely(PyDict_SetItemString(modules, "_cdec", __pyx_m) < 0)) {__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 @@ -25856,7 +25856,7 @@ PyMODINIT_FUNC PyInit__cdec(void) #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) { + 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;}; } /*--- Builtin init code ---*/ @@ -25867,216 +25867,216 @@ PyMODINIT_FUNC PyInit__cdec(void) /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_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_5_cdec_Scorer) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_Scorer = &__pyx_type_5_cdec_Scorer; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_24___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_24___init__ = &__pyx_type_5_cdec___pyx_scope_struct_24___init__; - if (PyType_Ready(&__pyx_type_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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_5_cdec_NTRef, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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_5_cdec_5NTRef___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5_cdec_5NTRef___init__.doc = __pyx_doc_5_cdec_5NTRef___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_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_5_cdec_NTRef) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_NTRef = &__pyx_type_5_cdec_NTRef; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_22___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_22___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_22___iter__; - if (PyType_Ready(&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Grammar", (PyObject *)&__pyx_type_5_cdec_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_Grammar = &__pyx_type_5_cdec_Grammar; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_20_lines) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_20_lines = &__pyx_type_5_cdec___pyx_scope_struct_20_lines; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_12_sample_trees = &__pyx_type_5_cdec___pyx_scope_struct_12_sample_trees; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_13___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_13___get__ = &__pyx_type_5_cdec___pyx_scope_struct_13___get__; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_2__phrase) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_2__phrase = &__pyx_type_5_cdec___pyx_scope_struct_2__phrase; - if (PyType_Ready(&__pyx_type_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_5_cdec_CandidateSet) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_CandidateSet = &__pyx_type_5_cdec_CandidateSet; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_14___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_14___get__ = &__pyx_type_5_cdec___pyx_scope_struct_14___get__; - if (PyType_Ready(&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_TRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_MRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_5_cdec_5TRule___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5_cdec_5TRule___init__.doc = __pyx_doc_5_cdec_5TRule___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_5TRule___init__; + __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, "TRule", (PyObject *)&__pyx_type_5_cdec_TRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_TRule = &__pyx_type_5_cdec_TRule; - if (PyType_Ready(&__pyx_type_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_5_cdec___pyx_scope_struct_3_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_3_genexpr; - __pyx_type_5_cdec_MRule.tp_base = __pyx_ptype_5_cdec_TRule; - if (PyType_Ready(&__pyx_type_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "MRule", (PyObject *)&__pyx_type_4cdec_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __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___pyx_scope_struct_22___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_22___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_22___iter__; + 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;} #if CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_MRule, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_5_cdec_5MRule___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5_cdec_5MRule___init__.doc = __pyx_doc_5_cdec_5MRule___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_5MRule___init__; + __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__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_11DenseVector___init__; } } #endif - if (__Pyx_SetAttrString(__pyx_m, "MRule", (PyObject *)&__pyx_type_5_cdec_MRule) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_MRule = &__pyx_type_5_cdec_MRule; - if (PyType_Ready(&__pyx_type_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_5_cdec_SegmentEvaluator) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_SegmentEvaluator = &__pyx_type_5_cdec_SegmentEvaluator; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_25_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_25_genexpr; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_19_todot) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_19_todot = &__pyx_type_5_cdec___pyx_scope_struct_19_todot; - if (PyType_Ready(&__pyx_type_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Candidate", (PyObject *)&__pyx_type_5_cdec_Candidate) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_Candidate = &__pyx_type_5_cdec_Candidate; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_6_genexpr = &__pyx_type_5_cdec___pyx_scope_struct_6_genexpr; - if (PyType_Ready(&__pyx_type_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __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_21___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_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_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;} #if CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_NT, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_5_cdec_2NT___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5_cdec_2NT___init__.doc = __pyx_doc_5_cdec_2NT___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_2NT___init__; + __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__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_12SparseVector___init__; } } #endif - if (__Pyx_SetAttrString(__pyx_m, "NT", (PyObject *)&__pyx_type_5_cdec_NT) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_NT = &__pyx_type_5_cdec_NT; - __pyx_vtabptr_5_cdec_HypergraphEdge = &__pyx_vtable_5_cdec_HypergraphEdge; - __pyx_vtable_5_cdec_HypergraphEdge.init = (PyObject *(*)(struct __pyx_obj_5_cdec_HypergraphEdge *, Hypergraph *, unsigned int))__pyx_f_5_cdec_14HypergraphEdge_init; - if (PyType_Ready(&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphEdge.tp_dict, __pyx_vtabptr_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "HypergraphEdge", (PyObject *)&__pyx_type_5_cdec_HypergraphEdge) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_HypergraphEdge = &__pyx_type_5_cdec_HypergraphEdge; - if (PyType_Ready(&__pyx_type_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_5_cdec___pyx_scope_struct_1___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_1___iter__; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_16___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_16___get__ = &__pyx_type_5_cdec___pyx_scope_struct_16___get__; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_4___get__ = &__pyx_type_5_cdec___pyx_scope_struct_4___get__; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_18___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_18___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_18___iter__; - if (PyType_Ready(&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __pyx_ptype_4cdec_5_cdec_SparseVector = &__pyx_type_4cdec_5_cdec_SparseVector; + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_15___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_15___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_15___get__; + 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;} #if CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_Decoder, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_5_cdec_7Decoder___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5_cdec_7Decoder___init__.doc = __pyx_doc_5_cdec_7Decoder___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_7Decoder___init__; + __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__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_2NT___init__; } } #endif - if (__Pyx_SetAttrString(__pyx_m, "Decoder", (PyObject *)&__pyx_type_5_cdec_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_Decoder = &__pyx_type_5_cdec_Decoder; - __pyx_vtabptr_5_cdec_HypergraphNode = &__pyx_vtable_5_cdec_HypergraphNode; - __pyx_vtable_5_cdec_HypergraphNode.init = (PyObject *(*)(struct __pyx_obj_5_cdec_HypergraphNode *, Hypergraph *, unsigned int))__pyx_f_5_cdec_14HypergraphNode_init; - if (PyType_Ready(&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_5_cdec_HypergraphNode.tp_dict, __pyx_vtabptr_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "HypergraphNode", (PyObject *)&__pyx_type_5_cdec_HypergraphNode) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_HypergraphNode = &__pyx_type_5_cdec_HypergraphNode; - if (PyType_Ready(&__pyx_type_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __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 CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_SparseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_5_cdec_12SparseVector___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5_cdec_12SparseVector___init__.doc = __pyx_doc_5_cdec_12SparseVector___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_12SparseVector___init__; + __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 (__Pyx_SetAttrString(__pyx_m, "SparseVector", (PyObject *)&__pyx_type_5_cdec_SparseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_SparseVector = &__pyx_type_5_cdec_SparseVector; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_17___get__ = &__pyx_type_5_cdec___pyx_scope_struct_17___get__; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct____iter__ = &__pyx_type_5_cdec___pyx_scope_struct____iter__; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_21___iter__) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_21___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_21___iter__; - if (PyType_Ready(&__pyx_type_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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_23__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_23__make_config = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_23__make_config; + __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 = 196; __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 = 196; __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 = 196; __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___pyx_scope_struct_13___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_13___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_13___get__; + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_20_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_20_lines = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_20_lines; + 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 = 246; __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 = 246; __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 = 246; __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 CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_DenseVector, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_5_cdec_11DenseVector___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5_cdec_11DenseVector___init__.doc = __pyx_doc_5_cdec_11DenseVector___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_11DenseVector___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, "DenseVector", (PyObject *)&__pyx_type_5_cdec_DenseVector) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_DenseVector = &__pyx_type_5_cdec_DenseVector; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_7___iter__ = &__pyx_type_5_cdec___pyx_scope_struct_7___iter__; - if (PyType_Ready(&__pyx_type_5_cdec_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_5_cdec_Metric) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_Metric = &__pyx_type_5_cdec_Metric; - if (PyType_Ready(&__pyx_type_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "SufficientStats", (PyObject *)&__pyx_type_5_cdec_SufficientStats) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_SufficientStats = &__pyx_type_5_cdec_SufficientStats; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_8_kbest) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_8_kbest = &__pyx_type_5_cdec___pyx_scope_struct_8_kbest; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_10_kbest_features) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_10_kbest_features = &__pyx_type_5_cdec___pyx_scope_struct_10_kbest_features; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_15___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_15___get__ = &__pyx_type_5_cdec___pyx_scope_struct_15___get__; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_5___str__ = &__pyx_type_5_cdec___pyx_scope_struct_5___str__; - if (PyType_Ready(&__pyx_type_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_5_cdec___pyx_scope_struct_9_kbest_trees = &__pyx_type_5_cdec___pyx_scope_struct_9_kbest_trees; - __pyx_vtabptr_5_cdec_Hypergraph = &__pyx_vtable_5_cdec_Hypergraph; - __pyx_vtable_5_cdec_Hypergraph._rng = (MT19937 *(*)(struct __pyx_obj_5_cdec_Hypergraph *))__pyx_f_5_cdec_10Hypergraph__rng; - if (PyType_Ready(&__pyx_type_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_5_cdec_Hypergraph.tp_dict, __pyx_vtabptr_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Hypergraph", (PyObject *)&__pyx_type_5_cdec_Hypergraph) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_Hypergraph = &__pyx_type_5_cdec_Hypergraph; - if (PyType_Ready(&__pyx_type_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "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_Grammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __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 = 193; __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___pyx_scope_struct_24___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_24___init__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_24___init__; + 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_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_19_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_19_todot = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_19_todot; + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_5___str__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __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 = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_16___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_16___get__; + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_25_genexpr = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_25_genexpr; + 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_11_sample) < 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_sample = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_11_sample; + 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_14___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_14___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_14___get__; + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_7___iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __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__; + __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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_Lattice, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_4cdec_5_cdec_TextGrammar, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_5_cdec_7Lattice_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5_cdec_7Lattice_2__init__.doc = __pyx_doc_5_cdec_7Lattice_2__init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_7Lattice_2__init__; + __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__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_11TextGrammar___init__; } } #endif - if (__Pyx_SetAttrString(__pyx_m, "Lattice", (PyObject *)&__pyx_type_5_cdec_Lattice) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_Lattice = &__pyx_type_5_cdec_Lattice; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_11_sample) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_11_sample = &__pyx_type_5_cdec___pyx_scope_struct_11_sample; - if (PyType_Ready(&__pyx_type_5_cdec___pyx_scope_struct_23__make_config) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec___pyx_scope_struct_23__make_config = &__pyx_type_5_cdec___pyx_scope_struct_23__make_config; - __pyx_type_5_cdec_TextGrammar.tp_base = __pyx_ptype_5_cdec_Grammar; - if (PyType_Ready(&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_4cdec_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __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_Decoder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_CPYTHON { - PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5_cdec_TextGrammar, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_5_cdec_11TextGrammar___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_5_cdec_11TextGrammar___init__.doc = __pyx_doc_5_cdec_11TextGrammar___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5_cdec_11TextGrammar___init__; + __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__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4cdec_5_cdec_7Decoder___init__; } } #endif - if (__Pyx_SetAttrString(__pyx_m, "TextGrammar", (PyObject *)&__pyx_type_5_cdec_TextGrammar) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5_cdec_TextGrammar = &__pyx_type_5_cdec_TextGrammar; + 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;} + __pyx_ptype_4cdec_5_cdec_Decoder = &__pyx_type_4cdec_5_cdec_Decoder; + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_5_cdec___pyx_scope_struct____iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct____iter__; + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_17___get__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_17___get__; + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___iter__) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_18___iter__ = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_18___iter__; + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_12_sample_trees) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_5_cdec___pyx_scope_struct_12_sample_trees = &__pyx_type_4cdec_5_cdec___pyx_scope_struct_12_sample_trees; + if (PyType_Ready(&__pyx_type_4cdec_5_cdec___pyx_scope_struct_4___get__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __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__; /*--- 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;} @@ -26096,7 +26096,7 @@ PyMODINIT_FUNC PyInit__cdec(void) Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Execution code ---*/ - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":3 + /* "/home/mdenkows/cdec/python/cdec/grammar.pxi":3 * cimport grammar * cimport cdec.sa._sa as _sa * import cdec.sa._sa as _sa # <<<<<<<<<<<<<< @@ -26105,85 +26105,85 @@ 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_54)); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_54)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s_54)); - __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_53), ((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(((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_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_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/grammar.pxi":5 + /* "/home/mdenkows/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) * */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_1_phrase, NULL, __pyx_n_s___cdec); 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_39); 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;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":194 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":194 * return [] * * BLEU = Scorer('IBM_BLEU') # <<<<<<<<<<<<<< * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":195 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":195 * * BLEU = Scorer('IBM_BLEU') * QCRI = Scorer('QCRI_BLEU') # <<<<<<<<<<<<<< * TER = Scorer('TER') * CER = Scorer('CER') */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":196 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":196 * 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_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":197 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":197 * QCRI = Scorer('QCRI_BLEU') * TER = Scorer('TER') * CER = Scorer('CER') # <<<<<<<<<<<<<< * SSK = Scorer('SSK') */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/mteval.pxi":198 + /* "/home/mdenkows/cdec/python/cdec/mteval.pxi":198 * TER = Scorer('TER') * CER = Scorer('CER') * SSK = Scorer('SSK') # <<<<<<<<<<<<<< */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5_cdec_Scorer)), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_cdec.pyx":22 + /* "cdec/_cdec.pyx":22 * include "mteval.pxi" * * SetSilent(True) # <<<<<<<<<<<<<< @@ -26192,7 +26192,7 @@ PyMODINIT_FUNC PyInit__cdec(void) */ SetSilent(1); - /* "_cdec.pyx":23 + /* "cdec/_cdec.pyx":23 * * SetSilent(True) * decoder.register_feature_functions() # <<<<<<<<<<<<<< @@ -26201,7 +26201,7 @@ PyMODINIT_FUNC PyInit__cdec(void) */ register_feature_functions(); - /* "_cdec.pyx":25 + /* "cdec/_cdec.pyx":25 * decoder.register_feature_functions() * * class InvalidConfig(Exception): pass # <<<<<<<<<<<<<< @@ -26215,14 +26215,14 @@ PyMODINIT_FUNC PyInit__cdec(void) __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_2, 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___cdec); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - /* "_cdec.pyx":26 + /* "cdec/_cdec.pyx":26 * * class InvalidConfig(Exception): pass * class ParseFailed(Exception): pass # <<<<<<<<<<<<<< @@ -26236,38 +26236,38 @@ PyMODINIT_FUNC PyInit__cdec(void) __Pyx_INCREF(__pyx_builtin_Exception); PyTuple_SET_ITEM(__pyx_t_4, 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___cdec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - /* "_cdec.pyx":28 + /* "cdec/_cdec.pyx":28 * class ParseFailed(Exception): pass * * def set_silent(yn): # <<<<<<<<<<<<<< * """set_silent(bool): Configure the verbosity of cdec.""" * SetSilent(yn) */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_3set_silent, NULL, __pyx_n_s___cdec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_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_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;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_cdec.pyx":32 + /* "cdec/_cdec.pyx":32 * SetSilent(yn) * * def _make_config(config): # <<<<<<<<<<<<<< * for key, value in config.items(): * if isinstance(value, dict): */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5_cdec_5_make_config, NULL, __pyx_n_s___cdec); 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_39); 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;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_cdec.pyx":1 + /* "cdec/_cdec.pyx":1 * from libcpp.string cimport string # <<<<<<<<<<<<<< * from libcpp.vector cimport vector * from utils cimport * @@ -26291,10 +26291,10 @@ PyMODINIT_FUNC PyInit__cdec(void) __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); if (__pyx_m) { - __Pyx_AddTraceback("init _cdec", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init cdec._cdec", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init _cdec"); + PyErr_SetString(PyExc_ImportError, "init cdec._cdec"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); diff --git a/python/cdec/sa/_sa.c b/python/cdec/sa/_sa.c index 2e565e22..0352a202 100644 --- a/python/cdec/sa/_sa.c +++ b/python/cdec/sa/_sa.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sun Jun 2 14:47:43 2013 */ +/* Generated by Cython 0.19.1 on Mon Sep 23 08:03:57 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -306,8 +306,8 @@ static CYTHON_INLINE float __PYX_NAN() { #define _USE_MATH_DEFINES #endif #include -#define __PYX_HAVE___sa -#define __PYX_HAVE_API___sa +#define __PYX_HAVE__cdec__sa___sa +#define __PYX_HAVE_API__cdec__sa___sa #include "string.h" #include "stdio.h" #include "stdlib.h" @@ -503,105 +503,106 @@ static const char *__pyx_f[] = { }; /*--- Type declarations ---*/ -struct __pyx_obj_3_sa_HieroCachingRuleFactory; -struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence; -struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr; -struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr; -struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats; -struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr; -struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr; -struct __pyx_obj_3_sa_IntList; -struct __pyx_obj_3_sa_VEBIterator; -struct __pyx_obj_3_sa_BiLex; -struct __pyx_obj_3_sa_VEB; -struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words; -struct __pyx_obj_3_sa_LCP; -struct __pyx_obj_3_sa_DataArray; -struct __pyx_obj_3_sa_BitSetIterator; -struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr; -struct __pyx_obj_3_sa_Precomputation; -struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments; -struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr; -struct __pyx_obj_3_sa_SuffixArray; -struct __pyx_obj_3_sa___pyx_scope_struct_16___str__; -struct __pyx_obj_3_sa_Alphabet; -struct __pyx_obj_3_sa_Rule; -struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr; -struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance; -struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr; -struct __pyx_obj_3_sa_PhraseLocation; -struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__; -struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule; -struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr; -struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule; -struct __pyx_obj_3_sa___pyx_scope_struct_28___str__; -struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext; -struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words; -struct __pyx_obj_3_sa_FeatureVector; -struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice; -struct __pyx_obj_3_sa___pyx_scope_struct_19_input; -struct __pyx_obj_3_sa_Scorer; -struct __pyx_obj_3_sa_Alignment; -struct __pyx_obj_3_sa_BitSet; -struct __pyx_obj_3_sa_Sampler; -struct __pyx_obj_3_sa_StringMap; -struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases; -struct __pyx_obj_3_sa_TrieNode; -struct __pyx_obj_3_sa_ExtendedTrieNode; -struct __pyx_obj_3_sa_TrieMap; -struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr; -struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice; -struct __pyx_obj_3_sa_Phrase; -struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__; -struct __pyx_obj_3_sa___pyx_scope_struct____iter__; -struct __pyx_obj_3_sa_TrieTable; -struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr; -struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr; -struct __pyx_obj_3_sa_FloatList; -struct __pyx_t_3_sa__node; -struct __pyx_t_3_sa__BitSet; -struct __pyx_t_3_sa__VEB; -struct __pyx_t_3_sa__Trie_Edge; -struct __pyx_t_3_sa__Trie_Node; -struct __pyx_t_3_sa_match_node; -struct __pyx_t_3_sa_Matching; - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":9 +struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector; +struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule; +struct __pyx_obj_4cdec_2sa_3_sa_LCP; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats; +struct __pyx_obj_4cdec_2sa_3_sa_IntList; +struct __pyx_obj_4cdec_2sa_3_sa_Phrase; +struct __pyx_obj_4cdec_2sa_3_sa_TrieNode; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases; +struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode; +struct __pyx_obj_4cdec_2sa_3_sa_Alignment; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_Rule; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_Precomputation; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance; +struct __pyx_obj_4cdec_2sa_3_sa_TrieMap; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments; +struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_FloatList; +struct __pyx_obj_4cdec_2sa_3_sa_StringMap; +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_TrieTable; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_VEB; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice; +struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation; +struct __pyx_obj_4cdec_2sa_3_sa_Scorer; +struct __pyx_obj_4cdec_2sa_3_sa_Sampler; +struct __pyx_obj_4cdec_2sa_3_sa_Alphabet; +struct __pyx_obj_4cdec_2sa_3_sa_BiLex; +struct __pyx_obj_4cdec_2sa_3_sa_DataArray; +struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator; +struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_BitSet; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence; +struct __pyx_t_4cdec_2sa_3_sa__node; +struct __pyx_t_4cdec_2sa_3_sa__BitSet; +struct __pyx_t_4cdec_2sa_3_sa__VEB; +struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge; +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; + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":9 * from libc.string cimport memset, strcpy * * cdef struct _node: # <<<<<<<<<<<<<< * _node* smaller * _node* bigger */ -struct __pyx_t_3_sa__node { - struct __pyx_t_3_sa__node *smaller; - struct __pyx_t_3_sa__node *bigger; +struct __pyx_t_4cdec_2sa_3_sa__node { + struct __pyx_t_4cdec_2sa_3_sa__node *smaller; + struct __pyx_t_4cdec_2sa_3_sa__node *bigger; int key; int val; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":30 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":30 * _init_lower_mask() * * cdef struct _BitSet: # <<<<<<<<<<<<<< * long bitset * int min_val */ -struct __pyx_t_3_sa__BitSet { +struct __pyx_t_4cdec_2sa_3_sa__BitSet { long bitset; int min_val; int max_val; int size; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":168 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":168 * return result * * cdef struct _VEB: # <<<<<<<<<<<<<< * int top_universe_size * int num_bottom_bits */ -struct __pyx_t_3_sa__VEB { +struct __pyx_t_4cdec_2sa_3_sa__VEB { int top_universe_size; int num_bottom_bits; int max_val; @@ -611,53 +612,53 @@ struct __pyx_t_3_sa__VEB { void **bottom; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":10 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":10 * cdef struct _Trie_Node # forward decl * * cdef struct _Trie_Edge: # <<<<<<<<<<<<<< * int val * _Trie_Node* node */ -struct __pyx_t_3_sa__Trie_Edge { +struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge { int val; - struct __pyx_t_3_sa__Trie_Node *node; - struct __pyx_t_3_sa__Trie_Edge *bigger; - struct __pyx_t_3_sa__Trie_Edge *smaller; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *node; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *bigger; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *smaller; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":8 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":8 * from libc.string cimport memset, memcpy * * cdef struct _Trie_Node # forward decl # <<<<<<<<<<<<<< * * cdef struct _Trie_Edge: */ -struct __pyx_t_3_sa__Trie_Node { - struct __pyx_t_3_sa__Trie_Edge *root; +struct __pyx_t_4cdec_2sa_3_sa__Trie_Node { + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *root; int *arr; int arr_len; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":76 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":101 * * # linked list structure for storing matches in BaselineRuleFactory * cdef struct match_node: # <<<<<<<<<<<<<< * int* match * match_node* next */ -struct __pyx_t_3_sa_match_node { +struct __pyx_t_4cdec_2sa_3_sa_match_node { int *match; - struct __pyx_t_3_sa_match_node *next; + struct __pyx_t_4cdec_2sa_3_sa_match_node *next; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":172 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":197 * * # struct used to encapsulate a single matching * cdef struct Matching: # <<<<<<<<<<<<<< * int* arr * int start */ -struct __pyx_t_3_sa_Matching { +struct __pyx_t_4cdec_2sa_3_sa_Matching { int *arr; int start; int end; @@ -665,187 +666,125 @@ struct __pyx_t_3_sa_Matching { int size; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":228 - * +/* "cdec/sa/_sa.pxd":25 + * cdef void read_handle(self, FILE* f) * - * cdef class HieroCachingRuleFactory: # <<<<<<<<<<<<<< - * '''This RuleFactory implements a caching - * method using TrieTable, which makes phrase + * cdef class FeatureVector: # <<<<<<<<<<<<<< + * cdef IntList names + * cdef FloatList values */ -struct __pyx_obj_3_sa_HieroCachingRuleFactory { +struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector { PyObject_HEAD - struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *__pyx_vtab; - struct __pyx_obj_3_sa_TrieTable *rules; - struct __pyx_obj_3_sa_Sampler *sampler; - struct __pyx_obj_3_sa_Scorer *scorer; - int max_chunks; - int max_target_chunks; - int max_length; - int max_target_length; - int max_nonterminals; - int max_initial_size; - int train_max_initial_size; - int min_gap_size; - int train_min_gap_size; - int category; - PyObject *precomputed_index; - PyObject *precomputed_collocations; - PyObject *precompute_file; - PyObject *max_rank; - int precompute_rank; - int precompute_secondary_rank; - int use_baeza_yates; - int use_index; - int use_collocations; - float by_slack_factor; - PyObject *prev_norm_prefix; - float extract_time; - float intersect_time; - struct __pyx_obj_3_sa_SuffixArray *fsa; - struct __pyx_obj_3_sa_DataArray *fda; - struct __pyx_obj_3_sa_DataArray *eda; - struct __pyx_obj_3_sa_Alignment *alignment; - struct __pyx_obj_3_sa_IntList *eid2symid; - struct __pyx_obj_3_sa_IntList *fid2symid; - int tight_phrases; - int require_aligned_terminal; - int require_aligned_chunks; - struct __pyx_obj_3_sa_IntList *findexes; - struct __pyx_obj_3_sa_IntList *findexes1; - int online; - PyObject *samples_f; - PyObject *phrases_f; - PyObject *phrases_e; - PyObject *phrases_fe; - PyObject *phrases_al; - PyObject *bilex_f; - PyObject *bilex_e; - PyObject *bilex_fe; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *names; + struct __pyx_obj_4cdec_2sa_3_sa_FloatList *values; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":118 - * for arc in node for node in lattice) - * - * def decode_sentence(lattice): # <<<<<<<<<<<<<< - * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":6 + * from libc.stdio cimport FILE, fclose, fopen * + * cdef class SuffixArray: # <<<<<<<<<<<<<< + * cdef DataArray darray + * cdef IntList sa */ -struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence { +struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray { PyObject_HEAD - PyObject *__pyx_v_lattice; + struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *__pyx_vtab; + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *darray; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *sa; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *ha; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":187 - * 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) +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110 + * return sym_isvar(sym) * + * def make_lattice(words): # <<<<<<<<<<<<<< + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) */ -struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr { +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice { PyObject_HEAD - struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *__pyx_outer_scope; - PyObject *__pyx_v_a; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); + PyObject *__pyx_v_word_ids; + PyObject *__pyx_v_words; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1187 - * # Online rule extraction and scoring - * if self.online: - * 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 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2128 + * + * # 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_3_sa___pyx_scope_struct_20_genexpr { +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule { PyObject_HEAD - struct __pyx_obj_3_sa___pyx_scope_struct_19_input *__pyx_outer_scope; - PyObject *__pyx_v_word; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); + PyObject *__pyx_v_a; + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":36 - * logger.info("LCP array completed") +/* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":5 + * as k most frequent n-grams""" * - * def compute_stats(self, int max_n): # <<<<<<<<<<<<<< - * """Note: the output of this function is not exact. In - * particular, the frequency associated with each word is + * cdef class LCP: # <<<<<<<<<<<<<< + * cdef SuffixArray sa + * cdef IntList lcp */ -struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats { +struct __pyx_obj_4cdec_2sa_3_sa_LCP { PyObject_HEAD - int __pyx_v_N; - int __pyx_v_freq; - int __pyx_v_h; - int __pyx_v_i; - int __pyx_v_ii; - int __pyx_v_iii; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_max_n; - int __pyx_v_n; - PyObject *__pyx_v_ngram; - struct __pyx_obj_3_sa_IntList *__pyx_v_ngram_start; - PyObject *__pyx_v_ngram_starts; - int __pyx_v_rs; - struct __pyx_obj_3_sa_IntList *__pyx_v_run_start; - struct __pyx_obj_3_sa_LCP *__pyx_v_self; - int __pyx_v_valid; - struct __pyx_obj_3_sa_VEB *__pyx_v_veb; - int __pyx_t_0; + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *sa; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *lcp; }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":122 - * - * def encode_words(words): - * return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186 + * 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) * - * def decode_words(syms): */ -struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr { +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr { PyObject_HEAD - struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *__pyx_outer_scope; - PyObject *__pyx_v_word; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *__pyx_outer_scope; + PyObject *__pyx_v_a; PyObject *__pyx_t_0; Py_ssize_t __pyx_t_1; PyObject *(*__pyx_t_2)(PyObject *); }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":21 - * - * def __str__(self): - * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":39 + * ]) * - * cdef class Scorer: + * cdef class OnlineStats: # <<<<<<<<<<<<<< + * cdef public samples_f + * cdef public phrases_f */ -struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr { +struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats { PyObject_HEAD - struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *__pyx_outer_scope; - PyObject *__pyx_v_feat; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); + PyObject *samples_f; + PyObject *phrases_f; + PyObject *phrases_e; + PyObject *phrases_fe; + PyObject *phrases_al; + PyObject *bilex_f; + PyObject *bilex_e; + PyObject *bilex_fe; }; -/* "_sa.pxd":12 +/* "cdec/sa/_sa.pxd":12 * cdef void read_handle(self, FILE* f) * * cdef class IntList: # <<<<<<<<<<<<<< * cdef int size * cdef int increment */ -struct __pyx_obj_3_sa_IntList { +struct __pyx_obj_4cdec_2sa_3_sa_IntList { PyObject_HEAD - struct __pyx_vtabstruct_3_sa_IntList *__pyx_vtab; + struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *__pyx_vtab; int size; int increment; int len; @@ -853,300 +792,46 @@ struct __pyx_obj_3_sa_IntList { }; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":340 - * - * - * cdef class VEBIterator: # <<<<<<<<<<<<<< - * cdef _VEB* v - * cdef int next_val - */ -struct __pyx_obj_3_sa_VEBIterator { - PyObject_HEAD - struct __pyx_t_3_sa__VEB *v; - int next_val; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":47 - * - * - * cdef class BiLex: # <<<<<<<<<<<<<< - * cdef FloatList col1 - * cdef FloatList col2 - */ -struct __pyx_obj_3_sa_BiLex { - PyObject_HEAD - struct __pyx_vtabstruct_3_sa_BiLex *__pyx_vtab; - struct __pyx_obj_3_sa_FloatList *col1; - struct __pyx_obj_3_sa_FloatList *col2; - struct __pyx_obj_3_sa_IntList *f_index; - struct __pyx_obj_3_sa_IntList *e_index; - PyObject *id2eword; - PyObject *id2fword; - PyObject *eword2id; - PyObject *fword2id; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":354 - * - * - * cdef class VEB: # <<<<<<<<<<<<<< - * cdef _VEB* veb - * cdef int _findsucc(self, int i) - */ -struct __pyx_obj_3_sa_VEB { - PyObject_HEAD - struct __pyx_vtabstruct_3_sa_VEB *__pyx_vtab; - struct __pyx_t_3_sa__VEB *veb; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":121 - * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) - * - * def encode_words(words): # <<<<<<<<<<<<<< - * return tuple(sym_fromstring(word, True) for word in words) - * - */ -struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words { - PyObject_HEAD - PyObject *__pyx_v_words; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":5 - * as k most frequent n-grams""" - * - * cdef class LCP: # <<<<<<<<<<<<<< - * cdef SuffixArray sa - * cdef IntList lcp - */ -struct __pyx_obj_3_sa_LCP { - PyObject_HEAD - struct __pyx_obj_3_sa_SuffixArray *sa; - struct __pyx_obj_3_sa_IntList *lcp; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":9 - * from libc.string cimport memset, strcpy - * - * cdef class DataArray: # <<<<<<<<<<<<<< - * cdef public word2id - * cdef public id2word - */ -struct __pyx_obj_3_sa_DataArray { - PyObject_HEAD - struct __pyx_vtabstruct_3_sa_DataArray *__pyx_vtab; - PyObject *word2id; - PyObject *id2word; - struct __pyx_obj_3_sa_IntList *data; - struct __pyx_obj_3_sa_IntList *sent_id; - struct __pyx_obj_3_sa_IntList *sent_index; - int use_sent_id; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":100 - * - * - * cdef class BitSetIterator: # <<<<<<<<<<<<<< - * cdef _BitSet* b - * cdef int next_val - */ -struct __pyx_obj_3_sa_BitSetIterator { - PyObject_HEAD - struct __pyx_t_3_sa__BitSet *b; - int next_val; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2116 - * 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_3_sa___pyx_scope_struct_23_genexpr { - PyObject_HEAD - struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *__pyx_outer_scope; - PyObject *__pyx_v_i; - PyObject *__pyx_v_j; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":188 - * - * - * cdef class Precomputation: # <<<<<<<<<<<<<< - * cdef int precompute_rank - * cdef int precompute_secondary_rank - */ -struct __pyx_obj_3_sa_Precomputation { - PyObject_HEAD - struct __pyx_vtabstruct_3_sa_Precomputation *__pyx_vtab; - int precompute_rank; - int precompute_secondary_rank; - int max_length; - int max_nonterminals; - int train_max_initial_size; - int train_min_gap_size; - PyObject *precomputed_index; - PyObject *precomputed_collocations; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":190 - * return ' ||| '.join(fields) - * - * def alignments(self): # <<<<<<<<<<<<<< - * for point in self.word_alignments: - * yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE - */ -struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments { - PyObject_HEAD - PyObject *__pyx_v_point; - struct __pyx_obj_3_sa_Rule *__pyx_v_self; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":125 - * - * def decode_words(syms): - * return tuple(sym_tostring(sym) for sym in syms) # <<<<<<<<<<<<<< - */ -struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr { - PyObject_HEAD - struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *__pyx_outer_scope; - PyObject *__pyx_v_sym; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":6 - * from libc.stdio cimport FILE, fclose, fopen - * - * cdef class SuffixArray: # <<<<<<<<<<<<<< - * cdef DataArray darray - * cdef IntList sa - */ -struct __pyx_obj_3_sa_SuffixArray { - PyObject_HEAD - struct __pyx_vtabstruct_3_sa_SuffixArray *__pyx_vtab; - struct __pyx_obj_3_sa_DataArray *darray; - struct __pyx_obj_3_sa_IntList *sa; - struct __pyx_obj_3_sa_IntList *ha; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":183 - * 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_3_sa___pyx_scope_struct_16___str__ { - PyObject_HEAD - struct __pyx_obj_3_sa_Rule *__pyx_v_self; -}; - - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":7 - * cdef int INDEX_MASK = (1< size: # <<<<<<<<<<<<<< @@ -4055,7 +4065,7 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_3_sa_FloatList *_ __pyx_t_1 = ((__pyx_v_initial_len > __pyx_v_size) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":13 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -4067,7 +4077,7 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_3_sa_FloatList *_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":14 * if initial_len > size: * size = initial_len * self.size = size # <<<<<<<<<<<<<< @@ -4076,7 +4086,7 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_3_sa_FloatList *_ */ __pyx_v_self->size = __pyx_v_size; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":15 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":15 * size = initial_len * self.size = size * self.increment = increment # <<<<<<<<<<<<<< @@ -4085,7 +4095,7 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_3_sa_FloatList *_ */ __pyx_v_self->increment = __pyx_v_increment; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":16 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":16 * self.size = size * self.increment = increment * self.len = initial_len # <<<<<<<<<<<<<< @@ -4094,7 +4104,7 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_3_sa_FloatList *_ */ __pyx_v_self->len = __pyx_v_initial_len; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":17 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":17 * self.increment = increment * self.len = initial_len * self.arr = malloc(size*sizeof(float)) # <<<<<<<<<<<<<< @@ -4103,7 +4113,7 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_3_sa_FloatList *_ */ __pyx_v_self->arr = ((float *)malloc((__pyx_v_size * (sizeof(float))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":18 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":18 * self.len = initial_len * self.arr = malloc(size*sizeof(float)) * memset(self.arr, 0, initial_len*sizeof(float)) # <<<<<<<<<<<<<< @@ -4118,15 +4128,15 @@ static int __pyx_pf_3_sa_9FloatList___cinit__(struct __pyx_obj_3_sa_FloatList *_ } /* Python wrapper */ -static void __pyx_pw_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_4cdec_2sa_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3_sa_9FloatList_2__dealloc__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)); + __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":20 +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":20 * memset(self.arr, 0, initial_len*sizeof(float)) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -4134,11 +4144,11 @@ static void __pyx_pw_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self) { +static void __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":21 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":21 * * def __dealloc__(self): * free(self.arr) # <<<<<<<<<<<<<< @@ -4151,17 +4161,17 @@ static void __pyx_pf_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_3_sa_FloatLis } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9FloatList_4__getitem__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":23 +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":23 * free(self.arr) * * def __getitem__(self, i): # <<<<<<<<<<<<<< @@ -4169,7 +4179,7 @@ static PyObject *__pyx_pw_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, P * if i<0: */ -static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_v_j = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -4184,7 +4194,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_Flo int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":24 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":24 * * def __getitem__(self, i): * j = i # <<<<<<<<<<<<<< @@ -4194,7 +4204,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_Flo __Pyx_INCREF(__pyx_v_i); __pyx_v_j = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":25 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":25 * def __getitem__(self, i): * j = i * if i<0: # <<<<<<<<<<<<<< @@ -4206,7 +4216,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_Flo __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":26 * j = i * if i<0: * j = self.len + i # <<<<<<<<<<<<<< @@ -4225,7 +4235,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_Flo } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":27 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":27 * if i<0: * j = self.len + i * if j<0 or j>=self.len: # <<<<<<<<<<<<<< @@ -4248,7 +4258,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_Flo } if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":28 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -4283,7 +4293,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_Flo } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":29 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< @@ -4303,7 +4313,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_Flo __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.FloatList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.FloatList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_j); @@ -4312,7 +4322,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_Flo return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":31 +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":31 * return self.arr[j] * * cdef void set(self, int i, float v): # <<<<<<<<<<<<<< @@ -4320,7 +4330,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_4__getitem__(struct __pyx_obj_3_sa_Flo * if i<0: */ -static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, int __pyx_v_i, float __pyx_v_v) { +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) { int __pyx_v_j; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -4334,7 +4344,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":32 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":32 * * cdef void set(self, int i, float v): * j = i # <<<<<<<<<<<<<< @@ -4343,7 +4353,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v */ __pyx_v_j = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":33 * cdef void set(self, int i, float v): * j = i * if i<0: # <<<<<<<<<<<<<< @@ -4353,7 +4363,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v __pyx_t_1 = ((__pyx_v_i < 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":34 * j = i * if i<0: * j = self.len + i # <<<<<<<<<<<<<< @@ -4365,7 +4375,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":35 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":35 * if i<0: * j = self.len + i * if j<0 or j>=self.len: # <<<<<<<<<<<<<< @@ -4381,7 +4391,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":36 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -4418,7 +4428,7 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":37 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -4432,23 +4442,23 @@ static void __pyx_f_3_sa_9FloatList_set(struct __pyx_obj_3_sa_FloatList *__pyx_v __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("_sa.FloatList.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.FloatList.set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ -static int __pyx_pw_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ -static int __pyx_pw_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { +static int __pyx_pw_4cdec_2sa_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9FloatList_6__setitem__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":39 +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":39 * self.arr[j] = v * * def __setitem__(self, i, val): # <<<<<<<<<<<<<< @@ -4456,7 +4466,7 @@ static int __pyx_pw_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObjec * */ -static int __pyx_pf_3_sa_9FloatList_6__setitem__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { +static int __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -4466,7 +4476,7 @@ static int __pyx_pf_3_sa_9FloatList_6__setitem__(struct __pyx_obj_3_sa_FloatList int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":40 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":40 * * def __setitem__(self, i, val): * self.set(i, val) # <<<<<<<<<<<<<< @@ -4475,12 +4485,12 @@ static int __pyx_pf_3_sa_9FloatList_6__setitem__(struct __pyx_obj_3_sa_FloatList */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __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_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_t_1, __pyx_t_2); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_t_1, __pyx_t_2); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.FloatList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.FloatList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -4488,17 +4498,17 @@ static int __pyx_pf_3_sa_9FloatList_6__setitem__(struct __pyx_obj_3_sa_FloatList } /* Python wrapper */ -static Py_ssize_t __pyx_pw_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9FloatList_8__len__(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":42 +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":42 * self.set(i, val) * * def __len__(self): # <<<<<<<<<<<<<< @@ -4506,12 +4516,12 @@ static Py_ssize_t __pyx_pw_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_3_sa_9FloatList_8__len__(struct __pyx_obj_3_sa_FloatList *__pyx_v_self) { +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":43 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":43 * * def __len__(self): * return self.len # <<<<<<<<<<<<<< @@ -4528,8 +4538,8 @@ static Py_ssize_t __pyx_pf_3_sa_9FloatList_8__len__(struct __pyx_obj_3_sa_FloatL } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static PyObject *__pyx_pw_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { float __pyx_v_val; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -4542,16 +4552,16 @@ static PyObject *__pyx_pw_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.FloatList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.FloatList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9FloatList_10append(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((float)__pyx_v_val)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((float)__pyx_v_val)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":45 +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":45 * return self.len * * def append(self, float val): # <<<<<<<<<<<<<< @@ -4559,13 +4569,13 @@ static PyObject *__pyx_pw_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObj * self.size = self.size + self.increment */ -static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, float __pyx_v_val) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, float __pyx_v_val) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("append", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":46 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":46 * * def append(self, float val): * if self.len == self.size: # <<<<<<<<<<<<<< @@ -4575,7 +4585,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatLi __pyx_t_1 = ((__pyx_v_self->len == __pyx_v_self->size) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":47 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":47 * def append(self, float val): * if self.len == self.size: * self.size = self.size + self.increment # <<<<<<<<<<<<<< @@ -4584,7 +4594,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatLi */ __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->increment); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":48 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":48 * if self.len == self.size: * self.size = self.size + self.increment * self.arr = realloc(self.arr, self.size*sizeof(float)) # <<<<<<<<<<<<<< @@ -4596,7 +4606,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatLi } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":49 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":49 * self.size = self.size + self.increment * self.arr = realloc(self.arr, self.size*sizeof(float)) * self.arr[self.len] = val # <<<<<<<<<<<<<< @@ -4605,7 +4615,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatLi */ (__pyx_v_self->arr[__pyx_v_self->len]) = __pyx_v_val; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":50 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":50 * self.arr = realloc(self.arr, self.size*sizeof(float)) * self.arr[self.len] = val * self.len = self.len + 1 # <<<<<<<<<<<<<< @@ -4620,7 +4630,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatLi return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":52 +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":52 * self.len = self.len + 1 * * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -4628,11 +4638,11 @@ static PyObject *__pyx_pf_3_sa_9FloatList_10append(struct __pyx_obj_3_sa_FloatLi * fwrite(self.arr, sizeof(float), self.len, f) */ -static void __pyx_f_3_sa_9FloatList_write_handle(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, FILE *__pyx_v_f) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_handle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":53 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":53 * * cdef void write_handle(self, FILE* f): * fwrite(&(self.len), sizeof(float), 1, f) # <<<<<<<<<<<<<< @@ -4641,7 +4651,7 @@ static void __pyx_f_3_sa_9FloatList_write_handle(struct __pyx_obj_3_sa_FloatList */ fwrite((&__pyx_v_self->len), (sizeof(float)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":54 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -4654,8 +4664,8 @@ static void __pyx_f_3_sa_9FloatList_write_handle(struct __pyx_obj_3_sa_FloatList } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -4668,16 +4678,16 @@ static PyObject *__pyx_pw_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.FloatList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.FloatList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9FloatList_12write(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":56 +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":56 * fwrite(self.arr, sizeof(float), self.len, f) * * def write(self, char* filename): # <<<<<<<<<<<<<< @@ -4685,13 +4695,13 @@ static PyObject *__pyx_pw_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObje * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_3_sa_9FloatList_12write(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":58 * def write(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -4700,16 +4710,16 @@ static PyObject *__pyx_pf_3_sa_9FloatList_12write(struct __pyx_obj_3_sa_FloatLis */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":59 * cdef FILE* f * f = fopen(filename, "w") * self.write_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":60 * f = fopen(filename, "w") * self.write_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -4724,7 +4734,7 @@ static PyObject *__pyx_pf_3_sa_9FloatList_12write(struct __pyx_obj_3_sa_FloatLis return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":62 +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":62 * fclose(f) * * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -4732,12 +4742,12 @@ static PyObject *__pyx_pf_3_sa_9FloatList_12write(struct __pyx_obj_3_sa_FloatLis * fread(&(self.len), sizeof(float), 1, f) */ -static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, FILE *__pyx_v_f) { +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) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("read_handle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":63 * * cdef void read_handle(self, FILE* f): * free(self.arr) # <<<<<<<<<<<<<< @@ -4746,7 +4756,7 @@ static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList */ free(__pyx_v_self->arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":64 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":64 * cdef void read_handle(self, FILE* f): * free(self.arr) * fread(&(self.len), sizeof(float), 1, f) # <<<<<<<<<<<<<< @@ -4755,7 +4765,7 @@ static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList */ fread((&__pyx_v_self->len), (sizeof(float)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":65 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":65 * free(self.arr) * fread(&(self.len), sizeof(float), 1, f) * self.arr = malloc(self.len * sizeof(float)) # <<<<<<<<<<<<<< @@ -4764,7 +4774,7 @@ static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList */ __pyx_v_self->arr = ((float *)malloc((__pyx_v_self->len * (sizeof(float))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":66 * fread(&(self.len), sizeof(float), 1, f) * self.arr = malloc(self.len * sizeof(float)) * self.size = self.len # <<<<<<<<<<<<<< @@ -4774,7 +4784,7 @@ static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList __pyx_t_1 = __pyx_v_self->len; __pyx_v_self->size = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":67 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":67 * self.arr = malloc(self.len * sizeof(float)) * self.size = self.len * fread(self.arr, sizeof(float), self.len, f) # <<<<<<<<<<<<<< @@ -4787,8 +4797,8 @@ static void __pyx_f_3_sa_9FloatList_read_handle(struct __pyx_obj_3_sa_FloatList } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -4801,16 +4811,16 @@ static PyObject *__pyx_pw_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.FloatList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.FloatList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9FloatList_14read(((struct __pyx_obj_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":69 +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":69 * fread(self.arr, sizeof(float), self.len, f) * * def read(self, char* filename): # <<<<<<<<<<<<<< @@ -4818,13 +4828,13 @@ static PyObject *__pyx_pw_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObjec * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_3_sa_9FloatList_14read(struct __pyx_obj_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":71 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":71 * def read(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -4833,15 +4843,15 @@ static PyObject *__pyx_pf_3_sa_9FloatList_14read(struct __pyx_obj_3_sa_FloatList */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":72 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":72 * cdef FILE* f * f = fopen(filename, "r") * self.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/float_list.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":73 * f = fopen(filename, "r") * self.read_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -4855,8 +4865,8 @@ static PyObject *__pyx_pf_3_sa_9FloatList_14read(struct __pyx_obj_3_sa_FloatList } /* Python wrapper */ -static int __pyx_pw_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_size; int __pyx_v_increment; int __pyx_v_initial_len; @@ -4929,16 +4939,16 @@ static int __pyx_pw_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *_ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.IntList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_7IntList___cinit__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":11 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":11 * cdef class IntList: * * def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<< @@ -4946,13 +4956,13 @@ static int __pyx_pw_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *_ * size = initial_len */ -static int __pyx_pf_3_sa_7IntList___cinit__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len) { +static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":12 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":12 * * def __cinit__(self, int size=0, int increment=1, int initial_len=0): * if initial_len > size: # <<<<<<<<<<<<<< @@ -4962,7 +4972,7 @@ static int __pyx_pf_3_sa_7IntList___cinit__(struct __pyx_obj_3_sa_IntList *__pyx __pyx_t_1 = ((__pyx_v_initial_len > __pyx_v_size) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":13 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -4974,7 +4984,7 @@ static int __pyx_pf_3_sa_7IntList___cinit__(struct __pyx_obj_3_sa_IntList *__pyx } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":14 * if initial_len > size: * size = initial_len * self.size = size # <<<<<<<<<<<<<< @@ -4983,7 +4993,7 @@ static int __pyx_pf_3_sa_7IntList___cinit__(struct __pyx_obj_3_sa_IntList *__pyx */ __pyx_v_self->size = __pyx_v_size; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":15 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":15 * size = initial_len * self.size = size * self.increment = increment # <<<<<<<<<<<<<< @@ -4992,7 +5002,7 @@ static int __pyx_pf_3_sa_7IntList___cinit__(struct __pyx_obj_3_sa_IntList *__pyx */ __pyx_v_self->increment = __pyx_v_increment; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":16 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":16 * self.size = size * self.increment = increment * self.len = initial_len # <<<<<<<<<<<<<< @@ -5001,7 +5011,7 @@ static int __pyx_pf_3_sa_7IntList___cinit__(struct __pyx_obj_3_sa_IntList *__pyx */ __pyx_v_self->len = __pyx_v_initial_len; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":17 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":17 * self.increment = increment * self.len = initial_len * self.arr = malloc(size*sizeof(int)) # <<<<<<<<<<<<<< @@ -5010,7 +5020,7 @@ static int __pyx_pf_3_sa_7IntList___cinit__(struct __pyx_obj_3_sa_IntList *__pyx */ __pyx_v_self->arr = ((int *)malloc((__pyx_v_size * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":18 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":18 * self.len = initial_len * self.arr = malloc(size*sizeof(int)) * memset(self.arr, 0, initial_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -5025,17 +5035,17 @@ static int __pyx_pf_3_sa_7IntList___cinit__(struct __pyx_obj_3_sa_IntList *__pyx } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_3__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_3__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_3__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_3__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7IntList_2__str__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":20 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":20 * memset(self.arr, 0, initial_len*sizeof(int)) * * def __str__(self): # <<<<<<<<<<<<<< @@ -5043,7 +5053,7 @@ static PyObject *__pyx_pw_3_sa_7IntList_3__str__(PyObject *__pyx_v_self) { * ret = "IntList[" */ -static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_v_ret = NULL; int __pyx_v_idx; PyObject *__pyx_r = NULL; @@ -5058,7 +5068,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":22 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":22 * def __str__(self): * cdef unsigned i * ret = "IntList[" # <<<<<<<<<<<<<< @@ -5068,7 +5078,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); __pyx_v_ret = ((PyObject *)__pyx_kp_s_3); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":23 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":23 * cdef unsigned i * ret = "IntList[" * for idx in range(self.size): # <<<<<<<<<<<<<< @@ -5079,7 +5089,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_idx = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":24 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":24 * ret = "IntList[" * for idx in range(self.size): * if idx>0: # <<<<<<<<<<<<<< @@ -5089,7 +5099,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * __pyx_t_3 = ((__pyx_v_idx > 0) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":25 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":25 * for idx in range(self.size): * if idx>0: * ret += "," # <<<<<<<<<<<<<< @@ -5105,7 +5115,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":26 * if idx>0: * ret += "," * ret += str(self.arr[idx]) # <<<<<<<<<<<<<< @@ -5130,7 +5140,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * __pyx_t_5 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":27 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":27 * ret += "," * ret += str(self.arr[idx]) * ret += "]" # <<<<<<<<<<<<<< @@ -5143,7 +5153,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * __pyx_v_ret = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":28 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":28 * ret += str(self.arr[idx]) * ret += "]" * ret += "len=" # <<<<<<<<<<<<<< @@ -5156,7 +5166,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * __pyx_v_ret = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":29 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":29 * ret += "]" * ret += "len=" * ret += str(self.len) # <<<<<<<<<<<<<< @@ -5180,7 +5190,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * __pyx_v_ret = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":30 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":30 * ret += "len=" * ret += str(self.len) * return ret # <<<<<<<<<<<<<< @@ -5197,7 +5207,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.IntList.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ret); @@ -5207,8 +5217,8 @@ static PyObject *__pyx_pf_3_sa_7IntList_2__str__(struct __pyx_obj_3_sa_IntList * } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { int __pyx_v_val; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -5221,16 +5231,16 @@ static PyObject *__pyx_pw_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.IntList.index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.index", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_7IntList_4index(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_4index(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":32 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":32 * return ret * * def index(self, int val): # <<<<<<<<<<<<<< @@ -5238,7 +5248,7 @@ static PyObject *__pyx_pw_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject * for i in range(self.len): */ -static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { unsigned int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5252,7 +5262,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("index", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":34 * def index(self, int val): * cdef unsigned i * for i in range(self.len): # <<<<<<<<<<<<<< @@ -5263,7 +5273,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":35 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":35 * cdef unsigned i * for i in range(self.len): * if self.arr[i] == val: # <<<<<<<<<<<<<< @@ -5273,7 +5283,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__ __pyx_t_3 = (((__pyx_v_self->arr[__pyx_v_i]) == __pyx_v_val) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":36 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":36 * for i in range(self.len): * if self.arr[i] == val: * return i # <<<<<<<<<<<<<< @@ -5291,7 +5301,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__ __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":37 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":37 * if self.arr[i] == val: * return i * raise ValueError('%s not in IntList' % val) # <<<<<<<<<<<<<< @@ -5320,7 +5330,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.IntList.index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.index", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5329,8 +5339,8 @@ static PyObject *__pyx_pf_3_sa_7IntList_4index(struct __pyx_obj_3_sa_IntList *__ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_end = 0; int __pyx_lineno = 0; @@ -5378,16 +5388,16 @@ static PyObject *__pyx_pw_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObj __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("partition", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_7IntList_6partition(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":39 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":39 * raise ValueError('%s not in IntList' % val) * * def partition(self,start,end): # <<<<<<<<<<<<<< @@ -5395,7 +5405,7 @@ static PyObject *__pyx_pw_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObj * bottom = start-1 */ -static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { PyObject *__pyx_v_pivot = NULL; PyObject *__pyx_v_bottom = NULL; PyObject *__pyx_v_top = NULL; @@ -5413,7 +5423,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList int __pyx_clineno = 0; __Pyx_RefNannySetupContext("partition", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":40 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":40 * * def partition(self,start,end): * pivot = self.arr[end] # <<<<<<<<<<<<<< @@ -5426,7 +5436,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __pyx_v_pivot = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":41 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":41 * def partition(self,start,end): * pivot = self.arr[end] * bottom = start-1 # <<<<<<<<<<<<<< @@ -5438,7 +5448,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __pyx_v_bottom = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":42 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":42 * pivot = self.arr[end] * bottom = start-1 * top = end # <<<<<<<<<<<<<< @@ -5448,7 +5458,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __Pyx_INCREF(__pyx_v_end); __pyx_v_top = __pyx_v_end; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":43 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":43 * bottom = start-1 * top = end * done = 0 # <<<<<<<<<<<<<< @@ -5457,7 +5467,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList */ __pyx_v_done = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":44 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":44 * top = end * done = 0 * while not done: # <<<<<<<<<<<<<< @@ -5468,7 +5478,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __pyx_t_3 = ((!(__pyx_v_done != 0)) != 0); if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":45 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":45 * done = 0 * while not done: * while not done: # <<<<<<<<<<<<<< @@ -5479,7 +5489,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __pyx_t_3 = ((!(__pyx_v_done != 0)) != 0); if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":46 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":46 * while not done: * while not done: * bottom += 1 # <<<<<<<<<<<<<< @@ -5492,7 +5502,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __pyx_v_bottom = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":47 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":47 * while not done: * bottom += 1 * if bottom == top: # <<<<<<<<<<<<<< @@ -5504,7 +5514,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":48 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":48 * bottom += 1 * if bottom == top: * done = 1 # <<<<<<<<<<<<<< @@ -5513,7 +5523,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList */ __pyx_v_done = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":49 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":49 * if bottom == top: * done = 1 * break # <<<<<<<<<<<<<< @@ -5525,7 +5535,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":50 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":50 * done = 1 * break * if self.arr[bottom] > pivot: # <<<<<<<<<<<<<< @@ -5541,7 +5551,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":51 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":51 * break * if self.arr[bottom] > pivot: * self.arr[top] = self.arr[bottom] # <<<<<<<<<<<<<< @@ -5552,7 +5562,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __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]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":52 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":52 * if self.arr[bottom] > pivot: * self.arr[top] = self.arr[bottom] * break # <<<<<<<<<<<<<< @@ -5566,7 +5576,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList } __pyx_L6_break:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":53 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":53 * self.arr[top] = self.arr[bottom] * break * while not done: # <<<<<<<<<<<<<< @@ -5577,7 +5587,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __pyx_t_3 = ((!(__pyx_v_done != 0)) != 0); if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":54 * break * while not done: * top -= 1 # <<<<<<<<<<<<<< @@ -5590,7 +5600,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __pyx_v_top = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":55 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":55 * while not done: * top -= 1 * if top == bottom: # <<<<<<<<<<<<<< @@ -5602,7 +5612,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":56 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":56 * top -= 1 * if top == bottom: * done = 1 # <<<<<<<<<<<<<< @@ -5611,7 +5621,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList */ __pyx_v_done = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":57 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":57 * if top == bottom: * done = 1 * break # <<<<<<<<<<<<<< @@ -5623,7 +5633,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList } __pyx_L11:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":58 * done = 1 * break * if self.arr[top] < pivot: # <<<<<<<<<<<<<< @@ -5639,7 +5649,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":59 * break * if self.arr[top] < pivot: * self.arr[bottom] = self.arr[top] # <<<<<<<<<<<<<< @@ -5650,7 +5660,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __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]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":60 * if self.arr[top] < pivot: * self.arr[bottom] = self.arr[top] * break # <<<<<<<<<<<<<< @@ -5665,7 +5675,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __pyx_L10_break:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":61 * self.arr[bottom] = self.arr[top] * break * self.arr[top] = pivot # <<<<<<<<<<<<<< @@ -5676,7 +5686,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":62 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":62 * break * self.arr[top] = pivot * return top # <<<<<<<<<<<<<< @@ -5693,7 +5703,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_pivot); @@ -5705,8 +5715,8 @@ static PyObject *__pyx_pf_3_sa_7IntList_6partition(struct __pyx_obj_3_sa_IntList } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_end = 0; int __pyx_lineno = 0; @@ -5754,16 +5764,16 @@ static PyObject *__pyx_pw_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, Py __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_doquicksort", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_7IntList_8_doquicksort(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":64 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":64 * return top * * def _doquicksort(self,start,end): # <<<<<<<<<<<<<< @@ -5771,7 +5781,7 @@ static PyObject *__pyx_pw_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, Py * split = self.partition(start,end) */ -static PyObject *__pyx_pf_3_sa_7IntList_8_doquicksort(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { PyObject *__pyx_v_split = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5784,7 +5794,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_8_doquicksort(struct __pyx_obj_3_sa_IntL int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_doquicksort", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":65 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":65 * * def _doquicksort(self,start,end): * if start < end: # <<<<<<<<<<<<<< @@ -5796,7 +5806,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_8_doquicksort(struct __pyx_obj_3_sa_IntL __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":66 * def _doquicksort(self,start,end): * if start < end: * split = self.partition(start,end) # <<<<<<<<<<<<<< @@ -5820,7 +5830,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_8_doquicksort(struct __pyx_obj_3_sa_IntL __pyx_v_split = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":67 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":67 * if start < end: * split = self.partition(start,end) * self._doquicksort(start,split-1) # <<<<<<<<<<<<<< @@ -5845,7 +5855,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_8_doquicksort(struct __pyx_obj_3_sa_IntL __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":68 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":68 * split = self.partition(start,end) * self._doquicksort(start,split-1) * self._doquicksort(split+1,end) # <<<<<<<<<<<<<< @@ -5873,7 +5883,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_8_doquicksort(struct __pyx_obj_3_sa_IntL } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":70 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":70 * self._doquicksort(split+1,end) * else: * return # <<<<<<<<<<<<<< @@ -5892,7 +5902,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_8_doquicksort(struct __pyx_obj_3_sa_IntL __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_split); @@ -5902,17 +5912,17 @@ static PyObject *__pyx_pf_3_sa_7IntList_8_doquicksort(struct __pyx_obj_3_sa_IntL } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("sort (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7IntList_10sort(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":72 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":72 * return * * def sort(self): # <<<<<<<<<<<<<< @@ -5920,7 +5930,7 @@ static PyObject *__pyx_pw_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UN * */ -static PyObject *__pyx_pf_3_sa_7IntList_10sort(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5931,7 +5941,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10sort(struct __pyx_obj_3_sa_IntList *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("sort", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":73 * * def sort(self): * self._doquicksort(0,self.len-1) # <<<<<<<<<<<<<< @@ -5962,7 +5972,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_10sort(struct __pyx_obj_3_sa_IntList *__ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.IntList.sort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.sort", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5971,17 +5981,17 @@ static PyObject *__pyx_pf_3_sa_7IntList_10sort(struct __pyx_obj_3_sa_IntList *__ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reset (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7IntList_12reset(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":75 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":75 * self._doquicksort(0,self.len-1) * * def reset(self): # <<<<<<<<<<<<<< @@ -5989,12 +5999,12 @@ static PyObject *__pyx_pw_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_U * */ -static PyObject *__pyx_pf_3_sa_7IntList_12reset(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reset", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":76 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":76 * * def reset(self): * self.len = 0 # <<<<<<<<<<<<<< @@ -6010,15 +6020,15 @@ static PyObject *__pyx_pf_3_sa_7IntList_12reset(struct __pyx_obj_3_sa_IntList *_ } /* Python wrapper */ -static void __pyx_pw_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_4cdec_2sa_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3_sa_7IntList_14__dealloc__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":78 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":78 * self.len = 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -6026,11 +6036,11 @@ static void __pyx_pw_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_3_sa_7IntList_14__dealloc__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { +static void __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":79 * * def __dealloc__(self): * free(self.arr) # <<<<<<<<<<<<<< @@ -6041,20 +6051,20 @@ static void __pyx_pf_3_sa_7IntList_14__dealloc__(struct __pyx_obj_3_sa_IntList * __Pyx_RefNannyFinishContext(); } -static PyObject *__pyx_gb_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7IntList_16__iter__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_16__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":81 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":81 * free(self.arr) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -6062,15 +6072,15 @@ static PyObject *__pyx_pw_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self) { * for i in range(self.len): */ -static PyObject *__pyx_pf_3_sa_7IntList_16__iter__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { - struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_16__iter__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____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_3_sa___pyx_scope_struct____iter__ *)__pyx_tp_new_3_sa___pyx_scope_struct____iter__(__pyx_ptype_3_sa___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct____iter__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -6080,7 +6090,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_16__iter__(struct __pyx_obj_3_sa_IntList __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_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); 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; @@ -6089,7 +6099,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_16__iter__(struct __pyx_obj_3_sa_IntList __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.IntList.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -6098,9 +6108,9 @@ static PyObject *__pyx_pf_3_sa_7IntList_16__iter__(struct __pyx_obj_3_sa_IntList return __pyx_r; } -static PyObject *__pyx_gb_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)__pyx_generator->closure); + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; int __pyx_t_1; int __pyx_t_2; @@ -6120,7 +6130,7 @@ static PyObject *__pyx_gb_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":83 * def __iter__(self): * cdef int i * for i in range(self.len): # <<<<<<<<<<<<<< @@ -6131,7 +6141,7 @@ static PyObject *__pyx_gb_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":84 * cdef int i * for i in range(self.len): * yield self.arr[i] # <<<<<<<<<<<<<< @@ -6168,17 +6178,17 @@ static PyObject *__pyx_gb_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7IntList_19__getitem__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_index)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":86 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":86 * yield self.arr[i] * * def __getitem__(self, index): # <<<<<<<<<<<<<< @@ -6186,7 +6196,7 @@ static PyObject *__pyx_pw_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, Py * if isinstance(index, int): */ -static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; @@ -6208,7 +6218,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":88 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":88 * def __getitem__(self, index): * cdef int i, j, k * if isinstance(index, int): # <<<<<<<<<<<<<< @@ -6219,7 +6229,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":89 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":89 * cdef int i, j, k * if isinstance(index, int): * j = index # <<<<<<<<<<<<<< @@ -6229,7 +6239,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __pyx_t_3 = __Pyx_PyInt_AsInt(__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":90 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":90 * if isinstance(index, int): * j = index * if j < 0: # <<<<<<<<<<<<<< @@ -6239,7 +6249,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __pyx_t_2 = ((__pyx_v_j < 0) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":91 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":91 * j = index * if j < 0: * j = self.len + j # <<<<<<<<<<<<<< @@ -6251,7 +6261,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":92 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":92 * if j < 0: * j = self.len + j * if j<0 or j>=self.len: # <<<<<<<<<<<<<< @@ -6267,7 +6277,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL } if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":93 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -6302,7 +6312,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":94 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< @@ -6318,7 +6328,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":95 + /* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -6329,7 +6339,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __pyx_t_2 = (__pyx_t_4 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":96 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":96 * return self.arr[j] * elif isinstance(index, slice): * i = index.start # <<<<<<<<<<<<<< @@ -6342,7 +6352,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_i = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":97 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":97 * elif isinstance(index, slice): * i = index.start * j = index.stop # <<<<<<<<<<<<<< @@ -6355,7 +6365,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_j = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":98 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":98 * i = index.start * j = index.stop * if i < 0: # <<<<<<<<<<<<<< @@ -6365,7 +6375,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __pyx_t_2 = ((__pyx_v_i < 0) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":99 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":99 * j = index.stop * if i < 0: * i = self.len + i # <<<<<<<<<<<<<< @@ -6377,7 +6387,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":100 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":100 * if i < 0: * i = self.len + i * if j < 0: # <<<<<<<<<<<<<< @@ -6387,7 +6397,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __pyx_t_2 = ((__pyx_v_j < 0) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":101 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":101 * i = self.len + i * if j < 0: * j = self.len + j # <<<<<<<<<<<<<< @@ -6399,7 +6409,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":102 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -6427,7 +6437,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL } if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":103 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -6469,7 +6479,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":104 + /* "/home/mdenkows/cdec/python/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 = () # <<<<<<<<<<<<<< @@ -6479,7 +6489,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); __pyx_v_result = __pyx_empty_tuple; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":105 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -6489,7 +6499,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __pyx_t_3 = __pyx_v_j; for (__pyx_v_k = __pyx_v_i; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":106 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":106 * result = () * for k from i <= k < j: * result = result + (self.arr[k],) # <<<<<<<<<<<<<< @@ -6511,7 +6521,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __pyx_t_9 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":107 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":107 * for k from i <= k < j: * result = result + (self.arr[k],) * return result # <<<<<<<<<<<<<< @@ -6526,7 +6536,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":109 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":109 * return result * else: * raise TypeError("Illegal key type %s for IntList" % type(index)) # <<<<<<<<<<<<<< @@ -6556,7 +6566,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_sa.IntList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -6565,7 +6575,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":111 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":111 * raise TypeError("Illegal key type %s for IntList" % type(index)) * * cdef void set(self, int i, int val): # <<<<<<<<<<<<<< @@ -6573,7 +6583,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_19__getitem__(struct __pyx_obj_3_sa_IntL * if i<0: */ -static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_i, int __pyx_v_val) { +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) { int __pyx_v_j; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -6587,7 +6597,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":112 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":112 * * cdef void set(self, int i, int val): * j = i # <<<<<<<<<<<<<< @@ -6596,7 +6606,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel */ __pyx_v_j = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":113 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":113 * cdef void set(self, int i, int val): * j = i * if i<0: # <<<<<<<<<<<<<< @@ -6606,7 +6616,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel __pyx_t_1 = ((__pyx_v_i < 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":114 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":114 * j = i * if i<0: * j = self.len + i # <<<<<<<<<<<<<< @@ -6618,7 +6628,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":115 * if i<0: * j = self.len + i * if j<0 or j>=self.len: # <<<<<<<<<<<<<< @@ -6634,7 +6644,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":116 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -6671,7 +6681,7 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":117 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -6685,23 +6695,23 @@ static void __pyx_f_3_sa_7IntList_set(struct __pyx_obj_3_sa_IntList *__pyx_v_sel __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("_sa.IntList.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.IntList.set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ -static int __pyx_pw_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ -static int __pyx_pw_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { +static int __pyx_pw_4cdec_2sa_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7IntList_21__setitem__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":119 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":119 * self.arr[j] = val * * def __setitem__(self, i, val): # <<<<<<<<<<<<<< @@ -6709,7 +6719,7 @@ static int __pyx_pw_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject * */ -static int __pyx_pf_3_sa_7IntList_21__setitem__(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { +static int __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -6719,7 +6729,7 @@ static int __pyx_pf_3_sa_7IntList_21__setitem__(struct __pyx_obj_3_sa_IntList *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":120 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":120 * * def __setitem__(self, i, val): * self.set(i, val) # <<<<<<<<<<<<<< @@ -6728,12 +6738,12 @@ static int __pyx_pf_3_sa_7IntList_21__setitem__(struct __pyx_obj_3_sa_IntList *_ */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = __Pyx_PyInt_AsInt(__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_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_t_1, __pyx_t_2); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->set(__pyx_v_self, __pyx_t_1, __pyx_t_2); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.IntList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -6741,17 +6751,17 @@ static int __pyx_pf_3_sa_7IntList_21__setitem__(struct __pyx_obj_3_sa_IntList *_ } /* Python wrapper */ -static Py_ssize_t __pyx_pw_3_sa_7IntList_24__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_3_sa_7IntList_24__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7IntList_23__len__(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":122 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":122 * self.set(i, val) * * def __len__(self): # <<<<<<<<<<<<<< @@ -6759,12 +6769,12 @@ static Py_ssize_t __pyx_pw_3_sa_7IntList_24__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_3_sa_7IntList_23__len__(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":123 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":123 * * def __len__(self): * return self.len # <<<<<<<<<<<<<< @@ -6781,17 +6791,17 @@ static Py_ssize_t __pyx_pf_3_sa_7IntList_23__len__(struct __pyx_obj_3_sa_IntList } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_size (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7IntList_25get_size(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":125 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":125 * return self.len * * def get_size(self): # <<<<<<<<<<<<<< @@ -6799,7 +6809,7 @@ static PyObject *__pyx_pw_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHO * */ -static PyObject *__pyx_pf_3_sa_7IntList_25get_size(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6808,7 +6818,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_25get_size(struct __pyx_obj_3_sa_IntList int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_size", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":126 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":126 * * def get_size(self): * return self.size # <<<<<<<<<<<<<< @@ -6826,7 +6836,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_25get_size(struct __pyx_obj_3_sa_IntList goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.IntList.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6835,8 +6845,8 @@ static PyObject *__pyx_pf_3_sa_7IntList_25get_size(struct __pyx_obj_3_sa_IntList } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { int __pyx_v_val; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -6849,16 +6859,16 @@ static PyObject *__pyx_pw_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.IntList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_7IntList_27append(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_27append(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":128 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":128 * return self.size * * def append(self, int val): # <<<<<<<<<<<<<< @@ -6866,19 +6876,19 @@ static PyObject *__pyx_pw_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObjec * */ -static PyObject *__pyx_pf_3_sa_7IntList_27append(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_27append(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("append", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":129 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":129 * * def append(self, int val): * self._append(val) # <<<<<<<<<<<<<< * * cdef void _append(self, int val): */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_append(__pyx_v_self, __pyx_v_val); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_append(__pyx_v_self, __pyx_v_val); __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); @@ -6886,7 +6896,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_27append(struct __pyx_obj_3_sa_IntList * return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":131 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":131 * self._append(val) * * cdef void _append(self, int val): # <<<<<<<<<<<<<< @@ -6894,12 +6904,12 @@ static PyObject *__pyx_pf_3_sa_7IntList_27append(struct __pyx_obj_3_sa_IntList * * self.size = self.size + self.increment */ -static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { +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) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("_append", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":132 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":132 * * cdef void _append(self, int val): * if self.len == self.size: # <<<<<<<<<<<<<< @@ -6909,7 +6919,7 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v __pyx_t_1 = ((__pyx_v_self->len == __pyx_v_self->size) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":133 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":133 * cdef void _append(self, int val): * if self.len == self.size: * self.size = self.size + self.increment # <<<<<<<<<<<<<< @@ -6918,7 +6928,7 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v */ __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->increment); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":134 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":134 * if self.len == self.size: * self.size = self.size + self.increment * self.arr = realloc(self.arr, self.size*sizeof(int)) # <<<<<<<<<<<<<< @@ -6930,7 +6940,7 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":135 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":135 * self.size = self.size + self.increment * self.arr = realloc(self.arr, self.size*sizeof(int)) * self.arr[self.len] = val # <<<<<<<<<<<<<< @@ -6939,7 +6949,7 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v */ (__pyx_v_self->arr[__pyx_v_self->len]) = __pyx_v_val; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":136 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":136 * self.arr = realloc(self.arr, self.size*sizeof(int)) * self.arr[self.len] = val * self.len = self.len + 1 # <<<<<<<<<<<<<< @@ -6952,17 +6962,17 @@ static void __pyx_f_3_sa_7IntList__append(struct __pyx_obj_3_sa_IntList *__pyx_v } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("extend (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7IntList_29extend(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_other)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":138 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":138 * self.len = self.len + 1 * * def extend(self, other): # <<<<<<<<<<<<<< @@ -6970,7 +6980,7 @@ static PyObject *__pyx_pw_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObjec * */ -static PyObject *__pyx_pf_3_sa_7IntList_29extend(struct __pyx_obj_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; @@ -6978,20 +6988,20 @@ static PyObject *__pyx_pf_3_sa_7IntList_29extend(struct __pyx_obj_3_sa_IntList * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extend", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":139 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":139 * * def extend(self, other): * self._extend(other) # <<<<<<<<<<<<<< * * cdef void _extend(self, IntList other): */ - if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_extend(__pyx_v_self, ((struct __pyx_obj_3_sa_IntList *)__pyx_v_other)); + 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)); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.IntList.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6999,7 +7009,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_29extend(struct __pyx_obj_3_sa_IntList * return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":141 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":141 * self._extend(other) * * cdef void _extend(self, IntList other): # <<<<<<<<<<<<<< @@ -7007,23 +7017,23 @@ static PyObject *__pyx_pf_3_sa_7IntList_29extend(struct __pyx_obj_3_sa_IntList * * */ -static void __pyx_f_3_sa_7IntList__extend(struct __pyx_obj_3_sa_IntList *__pyx_v_self, struct __pyx_obj_3_sa_IntList *__pyx_v_other) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_extend", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":142 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":142 * * cdef void _extend(self, IntList other): * self._extend_arr(other.arr, other.len) # <<<<<<<<<<<<<< * * cdef void _extend_arr(self, int* other, int other_len): */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_extend_arr(__pyx_v_self, __pyx_v_other->arr, __pyx_v_other->len); + ((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); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":144 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":144 * self._extend_arr(other.arr, other.len) * * cdef void _extend_arr(self, int* other, int other_len): # <<<<<<<<<<<<<< @@ -7031,12 +7041,12 @@ static void __pyx_f_3_sa_7IntList__extend(struct __pyx_obj_3_sa_IntList *__pyx_v * self.size = self.len + other_len */ -static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__pyx_v_self, int *__pyx_v_other, int __pyx_v_other_len) { +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) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("_extend_arr", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":145 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":145 * * cdef void _extend_arr(self, int* other, int other_len): * if self.size < self.len + other_len: # <<<<<<<<<<<<<< @@ -7046,7 +7056,7 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p __pyx_t_1 = ((__pyx_v_self->size < (__pyx_v_self->len + __pyx_v_other_len)) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":146 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -7055,7 +7065,7 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p */ __pyx_v_self->size = (__pyx_v_self->len + __pyx_v_other_len); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":147 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":147 * if self.size < self.len + other_len: * self.size = self.len + other_len * self.arr = realloc(self.arr, self.size*sizeof(int)) # <<<<<<<<<<<<<< @@ -7067,7 +7077,7 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":148 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":148 * self.size = self.len + other_len * self.arr = realloc(self.arr, self.size*sizeof(int)) * memcpy(self.arr+self.len, other, other_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -7076,7 +7086,7 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p */ memcpy((__pyx_v_self->arr + __pyx_v_self->len), __pyx_v_other, (__pyx_v_other_len * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":149 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":149 * self.arr = realloc(self.arr, self.size*sizeof(int)) * memcpy(self.arr+self.len, other, other_len*sizeof(int)) * self.len = self.len + other_len # <<<<<<<<<<<<<< @@ -7088,7 +7098,7 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":151 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":151 * self.len = self.len + other_len * * cdef void _clear(self): # <<<<<<<<<<<<<< @@ -7096,11 +7106,11 @@ static void __pyx_f_3_sa_7IntList__extend_arr(struct __pyx_obj_3_sa_IntList *__p * self.len = 0 */ -static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_self) { +static void __pyx_f_4cdec_2sa_3_sa_7IntList__clear(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_clear", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":152 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":152 * * cdef void _clear(self): * free(self.arr) # <<<<<<<<<<<<<< @@ -7109,7 +7119,7 @@ static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_ */ free(__pyx_v_self->arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":153 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":153 * cdef void _clear(self): * free(self.arr) * self.len = 0 # <<<<<<<<<<<<<< @@ -7118,7 +7128,7 @@ static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_ */ __pyx_v_self->len = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":154 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":154 * free(self.arr) * self.len = 0 * self.size = 0 # <<<<<<<<<<<<<< @@ -7127,7 +7137,7 @@ static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_ */ __pyx_v_self->size = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":155 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":155 * self.len = 0 * self.size = 0 * self.arr = malloc(0) # <<<<<<<<<<<<<< @@ -7139,7 +7149,7 @@ static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_ __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":157 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":157 * self.arr = malloc(0) * * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -7147,11 +7157,11 @@ static void __pyx_f_3_sa_7IntList__clear(struct __pyx_obj_3_sa_IntList *__pyx_v_ * fwrite(self.arr, sizeof(int), self.len, f) */ -static void __pyx_f_3_sa_7IntList_write_handle(struct __pyx_obj_3_sa_IntList *__pyx_v_self, FILE *__pyx_v_f) { +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) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_handle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":158 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":158 * * cdef void write_handle(self, FILE* f): * fwrite(&(self.len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -7160,7 +7170,7 @@ static void __pyx_f_3_sa_7IntList_write_handle(struct __pyx_obj_3_sa_IntList *__ */ fwrite((&__pyx_v_self->len), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":159 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -7173,8 +7183,8 @@ static void __pyx_f_3_sa_7IntList_write_handle(struct __pyx_obj_3_sa_IntList *__ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -7187,16 +7197,16 @@ static PyObject *__pyx_pw_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.IntList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_7IntList_31write(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_31write(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":161 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":161 * fwrite(self.arr, sizeof(int), self.len, f) * * def write(self, char* filename): # <<<<<<<<<<<<<< @@ -7204,13 +7214,13 @@ static PyObject *__pyx_pw_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_3_sa_7IntList_31write(struct __pyx_obj_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_31write(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":163 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":163 * def write(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -7219,16 +7229,16 @@ static PyObject *__pyx_pf_3_sa_7IntList_31write(struct __pyx_obj_3_sa_IntList *_ */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":164 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":164 * cdef FILE* f * f = fopen(filename, "w") * self.write_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":165 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":165 * f = fopen(filename, "w") * self.write_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -7243,7 +7253,7 @@ static PyObject *__pyx_pf_3_sa_7IntList_31write(struct __pyx_obj_3_sa_IntList *_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":167 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":167 * fclose(f) * * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -7251,12 +7261,12 @@ static PyObject *__pyx_pf_3_sa_7IntList_31write(struct __pyx_obj_3_sa_IntList *_ * fread(&(self.len), sizeof(int), 1, f) */ -static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__pyx_v_self, FILE *__pyx_v_f) { +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) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("read_handle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":168 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":168 * * cdef void read_handle(self, FILE* f): * (self.arr) # <<<<<<<<<<<<<< @@ -7265,7 +7275,7 @@ static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__p */ __pyx_v_self->arr; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":169 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":169 * cdef void read_handle(self, FILE* f): * (self.arr) * fread(&(self.len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -7274,7 +7284,7 @@ static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__p */ fread((&__pyx_v_self->len), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":170 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":170 * (self.arr) * fread(&(self.len), sizeof(int), 1, f) * self.arr = malloc(self.len * sizeof(int)) # <<<<<<<<<<<<<< @@ -7283,7 +7293,7 @@ static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__p */ __pyx_v_self->arr = ((int *)malloc((__pyx_v_self->len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":171 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":171 * fread(&(self.len), sizeof(int), 1, f) * self.arr = malloc(self.len * sizeof(int)) * self.size = self.len # <<<<<<<<<<<<<< @@ -7293,7 +7303,7 @@ static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__p __pyx_t_1 = __pyx_v_self->len; __pyx_v_self->size = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":172 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":172 * self.arr = malloc(self.len * sizeof(int)) * self.size = self.len * fread(self.arr, sizeof(int), self.len, f) # <<<<<<<<<<<<<< @@ -7306,8 +7316,8 @@ static void __pyx_f_3_sa_7IntList_read_handle(struct __pyx_obj_3_sa_IntList *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -7320,16 +7330,16 @@ static PyObject *__pyx_pw_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.IntList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.IntList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_7IntList_33read(((struct __pyx_obj_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_33read(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":174 +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":174 * fread(self.arr, sizeof(int), self.len, f) * * def read(self, char* filename): # <<<<<<<<<<<<<< @@ -7337,13 +7347,13 @@ static PyObject *__pyx_pw_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_3_sa_7IntList_33read(struct __pyx_obj_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_33read(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":176 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":176 * def read(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -7352,15 +7362,15 @@ static PyObject *__pyx_pf_3_sa_7IntList_33read(struct __pyx_obj_3_sa_IntList *__ */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":177 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":177 * cdef FILE* f * f = fopen(filename, "r") * self.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/int_list.pxi":178 + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":178 * f = fopen(filename, "r") * self.read_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -7374,20 +7384,20 @@ static PyObject *__pyx_pf_3_sa_7IntList_33read(struct __pyx_obj_3_sa_IntList *__ } /* Python wrapper */ -static int __pyx_pw_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __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_3_sa_9StringMap___cinit__(((struct __pyx_obj_3_sa_StringMap *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9StringMap___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":13 +/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":13 * cdef int index(self, char *s) * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -7395,12 +7405,12 @@ static int __pyx_pw_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject * */ -static int __pyx_pf_3_sa_9StringMap___cinit__(struct __pyx_obj_3_sa_StringMap *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_9StringMap___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":14 * * def __cinit__(self): * self.vocab = stringmap_new() # <<<<<<<<<<<<<< @@ -7415,15 +7425,15 @@ static int __pyx_pf_3_sa_9StringMap___cinit__(struct __pyx_obj_3_sa_StringMap *_ } /* Python wrapper */ -static void __pyx_pw_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_4cdec_2sa_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3_sa_9StringMap_2__dealloc__(((struct __pyx_obj_3_sa_StringMap *)__pyx_v_self)); + __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":16 +/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":16 * self.vocab = stringmap_new() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -7431,11 +7441,11 @@ static void __pyx_pw_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_3_sa_StringMap *__pyx_v_self) { +static void __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":17 + /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":17 * * def __dealloc__(self): * stringmap_delete(self.vocab) # <<<<<<<<<<<<<< @@ -7447,7 +7457,7 @@ static void __pyx_pf_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_3_sa_StringMa __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":19 +/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":19 * stringmap_delete(self.vocab) * * cdef char *word(self, int i): # <<<<<<<<<<<<<< @@ -7455,12 +7465,12 @@ static void __pyx_pf_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_3_sa_StringMa * */ -static char *__pyx_f_3_sa_9StringMap_word(struct __pyx_obj_3_sa_StringMap *__pyx_v_self, int __pyx_v_i) { +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) { char *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("word", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":20 + /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":20 * * cdef char *word(self, int i): * return stringmap_word(self.vocab, i) # <<<<<<<<<<<<<< @@ -7476,19 +7486,19 @@ static char *__pyx_f_3_sa_9StringMap_word(struct __pyx_obj_3_sa_StringMap *__pyx return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":22 +/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":22 * return stringmap_word(self.vocab, i) * * cdef int index(self, char *s): # <<<<<<<<<<<<<< * return stringmap_index(self.vocab, s) */ -static int __pyx_f_3_sa_9StringMap_index(struct __pyx_obj_3_sa_StringMap *__pyx_v_self, char *__pyx_v_s) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("index", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/str_map.pxi":23 + /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":23 * * cdef int index(self, char *s): * return stringmap_index(self.vocab, s) # <<<<<<<<<<<<<< @@ -7503,8 +7513,8 @@ static int __pyx_f_3_sa_9StringMap_index(struct __pyx_obj_3_sa_StringMap *__pyx_ } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_from_binary = 0; PyObject *__pyx_v_from_text = 0; PyObject *__pyx_v_side = 0; @@ -7519,7 +7529,7 @@ static int __pyx_pw_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__side,&__pyx_n_s__use_sent_id,0}; PyObject* values[4] = {0,0,0,0}; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":17 + /* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -7589,16 +7599,16 @@ static int __pyx_pw_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9DataArray___cinit__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_side, __pyx_v_use_sent_id); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_side, __pyx_v_use_sent_id); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side, int __pyx_v_use_sent_id) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side, int __pyx_v_use_sent_id) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7611,7 +7621,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":18 + /* "/home/mdenkows/cdec/python/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} # <<<<<<<<<<<<<< @@ -7628,7 +7638,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ __pyx_v_self->word2id = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":19 + /* "/home/mdenkows/cdec/python/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"] # <<<<<<<<<<<<<< @@ -7649,52 +7659,52 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ __pyx_v_self->id2word = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":20 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * self.sent_id = IntList(1000,1000) * self.sent_index = IntList(1000,1000) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->data); __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); - __pyx_v_self->data = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_self->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":21 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * self.sent_index = IntList(1000,1000) * self.use_sent_id = use_sent_id */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sent_id); __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_id)); - __pyx_v_self->sent_id = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_self->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":22 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":22 * self.data = IntList(1000,1000) * self.sent_id = IntList(1000,1000) * self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<< * self.use_sent_id = use_sent_id * if from_binary: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_13), 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_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sent_index); __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); - __pyx_v_self->sent_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":23 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -7703,7 +7713,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ */ __pyx_v_self->use_sent_id = __pyx_v_use_sent_id; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":24 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":24 * self.sent_index = IntList(1000,1000) * self.use_sent_id = use_sent_id * if from_binary: # <<<<<<<<<<<<<< @@ -7713,7 +7723,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":25 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":25 * self.use_sent_id = use_sent_id * if from_binary: * self.read_binary(from_binary) # <<<<<<<<<<<<<< @@ -7735,7 +7745,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":26 * if from_binary: * self.read_binary(from_binary) * elif from_text: # <<<<<<<<<<<<<< @@ -7745,7 +7755,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":27 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":27 * self.read_binary(from_binary) * elif from_text: * if side: # <<<<<<<<<<<<<< @@ -7755,7 +7765,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":28 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":28 * elif from_text: * if side: * self.read_bitext(from_text, (0 if side == 'source' else 1)) # <<<<<<<<<<<<<< @@ -7791,7 +7801,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":30 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":30 * self.read_bitext(from_text, (0 if side == 'source' else 1)) * else: * self.read_text(from_text) # <<<<<<<<<<<<<< @@ -7822,7 +7832,7 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -7830,17 +7840,17 @@ static int __pyx_pf_3_sa_9DataArray___cinit__(struct __pyx_obj_3_sa_DataArray *_ } /* Python wrapper */ -static Py_ssize_t __pyx_pw_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_2__len__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":32 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":32 * self.read_text(from_text) * * def __len__(self): # <<<<<<<<<<<<<< @@ -7848,7 +7858,7 @@ static Py_ssize_t __pyx_pw_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_3_sa_9DataArray_2__len__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7858,7 +7868,7 @@ static Py_ssize_t __pyx_pf_3_sa_9DataArray_2__len__(struct __pyx_obj_3_sa_DataAr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__len__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":33 * * def __len__(self): * return len(self.data) # <<<<<<<<<<<<<< @@ -7876,7 +7886,7 @@ static Py_ssize_t __pyx_pf_3_sa_9DataArray_2__len__(struct __pyx_obj_3_sa_DataAr goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.DataArray.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -7884,17 +7894,17 @@ static Py_ssize_t __pyx_pf_3_sa_9DataArray_2__len__(struct __pyx_obj_3_sa_DataAr } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_5get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_5get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_5get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_5get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_sentence_id (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_4get_sentence_id(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":35 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":35 * return len(self.data) * * def get_sentence_id(self, i): # <<<<<<<<<<<<<< @@ -7902,7 +7912,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_5get_sentence_id(PyObject *__pyx_v_sel * */ -static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence_id(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -7912,7 +7922,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence_id(struct __pyx_obj_3_sa int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_sentence_id", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":36 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":36 * * def get_sentence_id(self, i): * return self.sent_id.arr[i] # <<<<<<<<<<<<<< @@ -7931,7 +7941,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence_id(struct __pyx_obj_3_sa goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.DataArray.get_sentence_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_sentence_id", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7940,17 +7950,17 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4get_sentence_id(struct __pyx_obj_3_sa } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_7get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_7get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_sentence (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_6get_sentence(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":38 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":38 * return self.sent_id.arr[i] * * def get_sentence(self, i): # <<<<<<<<<<<<<< @@ -7958,7 +7968,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_7get_sentence(PyObject *__pyx_v_self, * sent = [] */ -static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_v_start; int __pyx_v_stop; PyObject *__pyx_v_sent = NULL; @@ -7975,7 +7985,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence(struct __pyx_obj_3_sa_Da __Pyx_RefNannySetupContext("get_sentence", 0); __Pyx_INCREF(__pyx_v_i); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":40 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":40 * def get_sentence(self, i): * cdef int j, start, stop * sent = [] # <<<<<<<<<<<<<< @@ -7987,7 +7997,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence(struct __pyx_obj_3_sa_Da __pyx_v_sent = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":41 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":41 * cdef int j, start, stop * sent = [] * start = self.sent_index.arr[i] # <<<<<<<<<<<<<< @@ -7997,7 +8007,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence(struct __pyx_obj_3_sa_Da __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]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":42 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":42 * sent = [] * start = self.sent_index.arr[i] * stop = self.sent_index.arr[i+1] # <<<<<<<<<<<<<< @@ -8010,7 +8020,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence(struct __pyx_obj_3_sa_Da __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_stop = (__pyx_v_self->sent_index->arr[__pyx_t_2]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":43 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -8025,7 +8035,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence(struct __pyx_obj_3_sa_Da __pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":44 + /* "/home/mdenkows/cdec/python/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]]) # <<<<<<<<<<<<<< @@ -8040,7 +8050,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence(struct __pyx_obj_3_sa_Da __pyx_t_4 = __Pyx_PyInt_AsInt(__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;} } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":43 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -8053,7 +8063,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence(struct __pyx_obj_3_sa_Da __pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":45 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":45 * for i from start <= i < stop: * sent.append(self.id2word[self.data.arr[i]]) * return sent # <<<<<<<<<<<<<< @@ -8069,7 +8079,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence(struct __pyx_obj_3_sa_Da goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.DataArray.get_sentence", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_sentence", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_sent); @@ -8080,17 +8090,17 @@ static PyObject *__pyx_pf_3_sa_9DataArray_6get_sentence(struct __pyx_obj_3_sa_Da } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_9get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_9get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_9get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_9get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_id (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_8get_id(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_word)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_word)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":47 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":47 * return sent * * def get_id(self, word): # <<<<<<<<<<<<<< @@ -8098,7 +8108,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_9get_id(PyObject *__pyx_v_self, PyObje * self.word2id[word] = len(self.id2word) */ -static PyObject *__pyx_pf_3_sa_9DataArray_8get_id(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -8110,7 +8120,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8get_id(struct __pyx_obj_3_sa_DataArra int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_id", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":48 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":48 * * def get_id(self, word): * if not word in self.word2id: # <<<<<<<<<<<<<< @@ -8121,7 +8131,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8get_id(struct __pyx_obj_3_sa_DataArra __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":49 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":49 * def get_id(self, word): * if not word in self.word2id: * self.word2id[word] = len(self.id2word) # <<<<<<<<<<<<<< @@ -8137,7 +8147,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8get_id(struct __pyx_obj_3_sa_DataArra if (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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":50 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":50 * if not word in self.word2id: * self.word2id[word] = len(self.id2word) * self.id2word.append(word) # <<<<<<<<<<<<<< @@ -8151,7 +8161,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8get_id(struct __pyx_obj_3_sa_DataArra } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":51 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":51 * self.word2id[word] = len(self.id2word) * self.id2word.append(word) * return self.word2id[word] # <<<<<<<<<<<<<< @@ -8169,7 +8179,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8get_id(struct __pyx_obj_3_sa_DataArra goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.DataArray.get_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_id", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8178,17 +8188,17 @@ static PyObject *__pyx_pf_3_sa_9DataArray_8get_id(struct __pyx_obj_3_sa_DataArra } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_10__getitem__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":53 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":53 * return self.word2id[word] * * def __getitem__(self, loc): # <<<<<<<<<<<<<< @@ -8196,7 +8206,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_11__getitem__(PyObject *__pyx_v_self, * */ -static PyObject *__pyx_pf_3_sa_9DataArray_10__getitem__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -8206,7 +8216,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10__getitem__(struct __pyx_obj_3_sa_Da int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":54 * * def __getitem__(self, loc): * return self.id2word[self.data.arr[loc]] # <<<<<<<<<<<<<< @@ -8225,7 +8235,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10__getitem__(struct __pyx_obj_3_sa_Da goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.DataArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8234,17 +8244,17 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10__getitem__(struct __pyx_obj_3_sa_Da } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_13get_sentence_bounds(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_13get_sentence_bounds(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_13get_sentence_bounds(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_13get_sentence_bounds(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_sentence_bounds (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_12get_sentence_bounds(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":56 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":56 * return self.id2word[self.data.arr[loc]] * * def get_sentence_bounds(self, loc): # <<<<<<<<<<<<<< @@ -8252,7 +8262,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_13get_sentence_bounds(PyObject *__pyx_ * return (self.sent_index.arr[sid], self.sent_index.arr[sid+1]) */ -static PyObject *__pyx_pf_3_sa_9DataArray_12get_sentence_bounds(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { int __pyx_v_sid; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8265,7 +8275,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_12get_sentence_bounds(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_sentence_bounds", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":57 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":57 * * def get_sentence_bounds(self, loc): * cdef int sid = self.sent_id.arr[loc] # <<<<<<<<<<<<<< @@ -8275,7 +8285,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_12get_sentence_bounds(struct __pyx_obj __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]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":58 + /* "/home/mdenkows/cdec/python/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]) # <<<<<<<<<<<<<< @@ -8305,7 +8315,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_12get_sentence_bounds(struct __pyx_obj __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.DataArray.get_sentence_bounds", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_sentence_bounds", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8314,8 +8324,8 @@ static PyObject *__pyx_pf_3_sa_9DataArray_12get_sentence_bounds(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -8328,16 +8338,16 @@ static PyObject *__pyx_pw_3_sa_9DataArray_15write_text(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9DataArray_14write_text(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":60 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":60 * return (self.sent_index.arr[sid], self.sent_index.arr[sid+1]) * * def write_text(self, char* filename): # <<<<<<<<<<<<<< @@ -8345,7 +8355,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_15write_text(PyObject *__pyx_v_self, P * for w_id in self.data: */ -static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_w_id = NULL; PyObject *__pyx_r = NULL; @@ -8369,7 +8379,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_Dat int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_text", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -8409,7 +8419,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_Dat __pyx_v_f = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":62 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":62 * def write_text(self, char* filename): * with open(filename, "w") as f: * for w_id in self.data: # <<<<<<<<<<<<<< @@ -8454,7 +8464,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_Dat __pyx_v_w_id = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":63 * with open(filename, "w") as f: * for w_id in self.data: * if w_id > 1: # <<<<<<<<<<<<<< @@ -8466,7 +8476,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_Dat __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":64 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":64 * for w_id in self.data: * if w_id > 1: * f.write("%s " % self.get_word(w_id)) # <<<<<<<<<<<<<< @@ -8503,7 +8513,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_Dat } __pyx_L18:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":65 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":65 * if w_id > 1: * f.write("%s " % self.get_word(w_id)) * if w_id == 1: # <<<<<<<<<<<<<< @@ -8515,7 +8525,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_Dat __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":66 * f.write("%s " % self.get_word(w_id)) * if w_id == 1: * f.write("\n") # <<<<<<<<<<<<<< @@ -8545,7 +8555,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_Dat __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -8553,7 +8563,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_Dat * if w_id > 1: */ /*except:*/ { - __Pyx_AddTraceback("_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_12); @@ -8633,7 +8643,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_Dat __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -8644,8 +8654,8 @@ static PyObject *__pyx_pf_3_sa_9DataArray_14write_text(struct __pyx_obj_3_sa_Dat } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_17read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_17read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_17read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_17read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -8658,16 +8668,16 @@ static PyObject *__pyx_pw_3_sa_9DataArray_17read_text(PyObject *__pyx_v_self, Py } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9DataArray_16read_text(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":68 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":68 * f.write("\n") * * def read_text(self, char* filename): # <<<<<<<<<<<<<< @@ -8675,7 +8685,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_17read_text(PyObject *__pyx_v_self, Py * self.read_text_data(fp) */ -static PyObject *__pyx_pf_3_sa_9DataArray_16read_text(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_fp = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8695,7 +8705,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_16read_text(struct __pyx_obj_3_sa_Data int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_text", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69 * * def read_text(self, char* filename): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -8735,7 +8745,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_16read_text(struct __pyx_obj_3_sa_Data __pyx_v_fp = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":70 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":70 * def read_text(self, char* filename): * with gzip_or_text(filename) as fp: * self.read_text_data(fp) # <<<<<<<<<<<<<< @@ -8764,7 +8774,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_16read_text(struct __pyx_obj_3_sa_Data __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69 * * def read_text(self, char* filename): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -8772,7 +8782,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_16read_text(struct __pyx_obj_3_sa_Data * */ /*except:*/ { - __Pyx_AddTraceback("_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); @@ -8851,7 +8861,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_16read_text(struct __pyx_obj_3_sa_Data __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_fp); @@ -8861,8 +8871,8 @@ static PyObject *__pyx_pf_3_sa_9DataArray_16read_text(struct __pyx_obj_3_sa_Data } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_19read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_19read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_19read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_19read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { char *__pyx_v_filename; int __pyx_v_side; int __pyx_lineno = 0; @@ -8910,17 +8920,17 @@ static PyObject *__pyx_pw_3_sa_9DataArray_19read_bitext(PyObject *__pyx_v_self, __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("read_bitext", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9DataArray_18read_bitext(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), __pyx_v_filename, __pyx_v_side); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), __pyx_v_filename, __pyx_v_side); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_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_2generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":74 +/* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -8928,25 +8938,25 @@ static PyObject *__pyx_gb_3_sa_9DataArray_11read_bitext_2generator6(__pyx_Genera * */ -static PyObject *__pyx_pf_3_sa_9DataArray_11read_bitext_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_11read_bitext_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_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_3_sa___pyx_scope_struct_2_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_2_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_2_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_3_sa___pyx_scope_struct_1_read_bitext *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *) __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_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_2generator6, (PyObject *) __pyx_cur_scope); 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; @@ -8955,7 +8965,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_bitext_genexpr(PyObject *__pyx_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.DataArray.read_bitext.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -8964,9 +8974,9 @@ static PyObject *__pyx_pf_3_sa_9DataArray_11read_bitext_genexpr(PyObject *__pyx_ return __pyx_r; } -static PyObject *__pyx_gb_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_2generator6(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)__pyx_generator->closure); + 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; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -9070,7 +9080,7 @@ static PyObject *__pyx_gb_3_sa_9DataArray_11read_bitext_2generator6(__pyx_Genera return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":72 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":72 * self.read_text_data(fp) * * def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<< @@ -9078,8 +9088,8 @@ static PyObject *__pyx_gb_3_sa_9DataArray_11read_bitext_2generator6(__pyx_Genera * data = (line.split(' ||| ')[side] for line in fp) */ -static PyObject *__pyx_pf_3_sa_9DataArray_18read_bitext(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename, int __pyx_v_side) { - struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename, int __pyx_v_side) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *__pyx_cur_scope; PyObject *__pyx_v_data = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -9098,7 +9108,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_18read_bitext(struct __pyx_obj_3_sa_Da const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_bitext", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)__pyx_tp_new_3_sa___pyx_scope_struct_1_read_bitext(__pyx_ptype_3_sa___pyx_scope_struct_1_read_bitext, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -9106,7 +9116,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_18read_bitext(struct __pyx_obj_3_sa_Da __Pyx_GOTREF(__pyx_cur_scope); __pyx_cur_scope->__pyx_v_side = __pyx_v_side; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73 * * def read_bitext(self, char* filename, int side): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -9147,19 +9157,19 @@ static PyObject *__pyx_pf_3_sa_9DataArray_18read_bitext(struct __pyx_obj_3_sa_Da __pyx_cur_scope->__pyx_v_fp = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":74 + /* "/home/mdenkows/cdec/python/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_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_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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":75 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -9188,7 +9198,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_18read_bitext(struct __pyx_obj_3_sa_Da __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73 * * def read_bitext(self, char* filename, int side): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -9196,7 +9206,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_18read_bitext(struct __pyx_obj_3_sa_Da * self.read_text_data(data) */ /*except:*/ { - __Pyx_AddTraceback("_sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); @@ -9275,7 +9285,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_18read_bitext(struct __pyx_obj_3_sa_Da __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_data); @@ -9286,17 +9296,17 @@ static PyObject *__pyx_pf_3_sa_9DataArray_18read_bitext(struct __pyx_obj_3_sa_Da } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_21read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_21read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_21read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_21read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_text_data (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_20read_text_data(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_data)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_data)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":77 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":77 * self.read_text_data(data) * * def read_text_data(self, data): # <<<<<<<<<<<<<< @@ -9304,7 +9314,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_21read_text_data(PyObject *__pyx_v_sel * for line_num, line in enumerate(data): */ -static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_data) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_data) { int __pyx_v_word_count; PyObject *__pyx_v_line_num = NULL; PyObject *__pyx_v_line = NULL; @@ -9327,7 +9337,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_text_data", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":78 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":78 * * def read_text_data(self, data): * cdef int word_count = 0 # <<<<<<<<<<<<<< @@ -9336,7 +9346,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa */ __pyx_v_word_count = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":79 * def read_text_data(self, data): * cdef int word_count = 0 * for line_num, line in enumerate(data): # <<<<<<<<<<<<<< @@ -9391,7 +9401,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa __pyx_t_1 = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":80 * cdef int word_count = 0 * for line_num, line in enumerate(data): * self.sent_index.append(word_count) # <<<<<<<<<<<<<< @@ -9405,7 +9415,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":81 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":81 * for line_num, line in enumerate(data): * self.sent_index.append(word_count) * for word in line.split(): # <<<<<<<<<<<<<< @@ -9456,7 +9466,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa __pyx_v_word = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":82 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":82 * self.sent_index.append(word_count) * for word in line.split(): * self.data.append(self.get_id(word)) # <<<<<<<<<<<<<< @@ -9479,7 +9489,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":83 * for word in line.split(): * self.data.append(self.get_id(word)) * if self.use_sent_id: # <<<<<<<<<<<<<< @@ -9489,7 +9499,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa __pyx_t_11 = (__pyx_v_self->use_sent_id != 0); if (__pyx_t_11) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":84 * self.data.append(self.get_id(word)) * if self.use_sent_id: * self.sent_id.append(line_num) # <<<<<<<<<<<<<< @@ -9503,7 +9513,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":85 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":85 * if self.use_sent_id: * self.sent_id.append(line_num) * word_count = word_count + 1 # <<<<<<<<<<<<<< @@ -9514,7 +9524,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":86 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":86 * self.sent_id.append(line_num) * word_count = word_count + 1 * self.data.append(1) # <<<<<<<<<<<<<< @@ -9525,7 +9535,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":87 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":87 * word_count = word_count + 1 * self.data.append(1) * if self.use_sent_id: # <<<<<<<<<<<<<< @@ -9535,7 +9545,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa __pyx_t_11 = (__pyx_v_self->use_sent_id != 0); if (__pyx_t_11) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":88 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":88 * self.data.append(1) * if self.use_sent_id: * self.sent_id.append(line_num) # <<<<<<<<<<<<<< @@ -9549,7 +9559,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":89 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":89 * if self.use_sent_id: * self.sent_id.append(line_num) * word_count = word_count + 1 # <<<<<<<<<<<<<< @@ -9561,7 +9571,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":90 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":90 * self.sent_id.append(line_num) * word_count = word_count + 1 * self.data.append(0) # <<<<<<<<<<<<<< @@ -9572,7 +9582,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":91 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":91 * word_count = word_count + 1 * self.data.append(0) * self.sent_index.append(word_count) # <<<<<<<<<<<<<< @@ -9595,7 +9605,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_sa.DataArray.read_text_data", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text_data", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_line_num); @@ -9607,8 +9617,8 @@ static PyObject *__pyx_pf_3_sa_9DataArray_20read_text_data(struct __pyx_obj_3_sa } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_23read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_23read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_23read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_23read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -9621,16 +9631,16 @@ static PyObject *__pyx_pw_3_sa_9DataArray_23read_binary(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9DataArray_22read_binary(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":94 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":94 * * * def read_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -9638,13 +9648,13 @@ static PyObject *__pyx_pw_3_sa_9DataArray_23read_binary(PyObject *__pyx_v_self, * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_3_sa_9DataArray_22read_binary(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_binary", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":96 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":96 * def read_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -9653,16 +9663,16 @@ static PyObject *__pyx_pf_3_sa_9DataArray_22read_binary(struct __pyx_obj_3_sa_Da */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":97 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":97 * cdef FILE* f * f = fopen(filename, "r") * self.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":98 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":98 * f = fopen(filename, "r") * self.read_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -9677,7 +9687,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_22read_binary(struct __pyx_obj_3_sa_Da return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":100 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":100 * fclose(f) * * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -9685,7 +9695,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_22read_binary(struct __pyx_obj_3_sa_Da * cdef unsigned i */ -static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, FILE *__pyx_v_f) { +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) { int __pyx_v_num_words; int __pyx_v_word_len; CYTHON_UNUSED unsigned int __pyx_v_i; @@ -9702,34 +9712,34 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_handle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":105 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":105 * cdef char* word * * self.data.read_handle(f) # <<<<<<<<<<<<<< * self.sent_index.read_handle(f) * self.sent_id.read_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->read_handle(__pyx_v_self->data, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->read_handle(__pyx_v_self->data, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":106 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":106 * * self.data.read_handle(f) * self.sent_index.read_handle(f) # <<<<<<<<<<<<<< * self.sent_id.read_handle(f) * fread(&(num_words), sizeof(int), 1, f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->read_handle(__pyx_v_self->sent_index, __pyx_v_f); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":107 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":107 * self.data.read_handle(f) * self.sent_index.read_handle(f) * self.sent_id.read_handle(f) # <<<<<<<<<<<<<< * fread(&(num_words), sizeof(int), 1, f) * for i in range(num_words): */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_id->__pyx_vtab)->read_handle(__pyx_v_self->sent_id, __pyx_v_f); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":108 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -9738,7 +9748,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ fread((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":109 + /* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -9749,7 +9759,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":110 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -9758,7 +9768,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ fread((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":111 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":111 * for i in range(num_words): * fread(&(word_len), sizeof(int), 1, f) * word = malloc (word_len * sizeof(char)) # <<<<<<<<<<<<<< @@ -9767,7 +9777,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ __pyx_v_word = ((char *)malloc((__pyx_v_word_len * (sizeof(char))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":112 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":112 * fread(&(word_len), sizeof(int), 1, f) * word = malloc (word_len * sizeof(char)) * fread(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< @@ -9776,7 +9786,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray */ fread(__pyx_v_word, (sizeof(char)), __pyx_v_word_len, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":113 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":113 * word = malloc (word_len * sizeof(char)) * fread(word, sizeof(char), word_len, f) * self.word2id[word] = len(self.id2word) # <<<<<<<<<<<<<< @@ -9795,7 +9805,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":114 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":114 * fread(word, sizeof(char), word_len, f) * self.word2id[word] = len(self.id2word) * self.id2word.append(word) # <<<<<<<<<<<<<< @@ -9809,7 +9819,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":115 * self.word2id[word] = len(self.id2word) * self.id2word.append(word) * free(word) # <<<<<<<<<<<<<< @@ -9819,7 +9829,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray free(__pyx_v_word); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":116 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":116 * self.id2word.append(word) * free(word) * if len(self.sent_id) == 0: # <<<<<<<<<<<<<< @@ -9833,7 +9843,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray __pyx_t_6 = ((__pyx_t_4 == 0) != 0); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":117 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":117 * free(word) * if len(self.sent_id) == 0: * self.use_sent_id = False # <<<<<<<<<<<<<< @@ -9845,7 +9855,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":119 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":119 * self.use_sent_id = False * else: * self.use_sent_id = True # <<<<<<<<<<<<<< @@ -9860,12 +9870,12 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_WriteUnraisable("_sa.DataArray.read_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.DataArray.read_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":121 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":121 * self.use_sent_id = True * * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< @@ -9873,7 +9883,7 @@ static void __pyx_f_3_sa_9DataArray_read_handle(struct __pyx_obj_3_sa_DataArray * cdef int num_words */ -static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, FILE *__pyx_v_f) { +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) { int __pyx_v_word_len; int __pyx_v_num_words; PyObject *__pyx_v_word = NULL; @@ -9889,34 +9899,34 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_handle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":125 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":125 * cdef int num_words * * self.data.write_handle(f) # <<<<<<<<<<<<<< * self.sent_index.write_handle(f) * self.sent_id.write_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->write_handle(__pyx_v_self->data, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->write_handle(__pyx_v_self->data, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":126 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":126 * * self.data.write_handle(f) * self.sent_index.write_handle(f) # <<<<<<<<<<<<<< * self.sent_id.write_handle(f) * num_words = len(self.id2word) - 2 */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->write_handle(__pyx_v_self->sent_index, __pyx_v_f); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":127 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":127 * self.data.write_handle(f) * self.sent_index.write_handle(f) * self.sent_id.write_handle(f) # <<<<<<<<<<<<<< * num_words = len(self.id2word) - 2 * fwrite(&(num_words), sizeof(int), 1, f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_id->__pyx_vtab)->write_handle(__pyx_v_self->sent_id, __pyx_v_f); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":128 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":128 * self.sent_index.write_handle(f) * self.sent_id.write_handle(f) * num_words = len(self.id2word) - 2 # <<<<<<<<<<<<<< @@ -9929,7 +9939,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_num_words = (__pyx_t_2 - 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":129 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -9938,7 +9948,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray */ fwrite((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":130 + /* "/home/mdenkows/cdec/python/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:]: # <<<<<<<<<<<<<< @@ -9986,7 +9996,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray __pyx_v_word = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":131 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":131 * fwrite(&(num_words), sizeof(int), 1, f) * for word in self.id2word[2:]: * word_len = len(word) + 1 # <<<<<<<<<<<<<< @@ -9996,7 +10006,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":132 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":132 * for word in self.id2word[2:]: * word_len = len(word) + 1 * fwrite(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -10005,7 +10015,7 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray */ fwrite((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":133 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":133 * word_len = len(word) + 1 * fwrite(&(word_len), sizeof(int), 1, f) * fwrite(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< @@ -10021,15 +10031,15 @@ static void __pyx_f_3_sa_9DataArray_write_handle(struct __pyx_obj_3_sa_DataArray __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("_sa.DataArray.write_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.DataArray.write_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_word); __Pyx_RefNannyFinishContext(); } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_25write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_25write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_25write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_25write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -10042,16 +10052,16 @@ static PyObject *__pyx_pw_3_sa_9DataArray_25write_binary(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9DataArray_24write_binary(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":135 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":135 * fwrite(word, sizeof(char), word_len, f) * * def write_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -10059,13 +10069,13 @@ static PyObject *__pyx_pw_3_sa_9DataArray_25write_binary(PyObject *__pyx_v_self, * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_3_sa_9DataArray_24write_binary(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_binary", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":137 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":137 * def write_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -10074,16 +10084,16 @@ static PyObject *__pyx_pf_3_sa_9DataArray_24write_binary(struct __pyx_obj_3_sa_D */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":138 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":138 * cdef FILE* f * f = fopen(filename, "w") * self.write_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":139 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":139 * f = fopen(filename, "w") * self.write_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -10099,17 +10109,17 @@ static PyObject *__pyx_pf_3_sa_9DataArray_24write_binary(struct __pyx_obj_3_sa_D } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_27write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_27write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_27write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_27write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_enhanced_handle (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_26write_enhanced_handle(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_f)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_f)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":141 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":141 * fclose(f) * * def write_enhanced_handle(self, f): # <<<<<<<<<<<<<< @@ -10117,7 +10127,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_27write_enhanced_handle(PyObject *__py * f.write("%d " %i) */ -static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f) { PyObject *__pyx_v_i = NULL; PyObject *__pyx_v_word = NULL; PyObject *__pyx_r = NULL; @@ -10133,7 +10143,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_enhanced_handle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":142 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":142 * * def write_enhanced_handle(self, f): * for i in self.data: # <<<<<<<<<<<<<< @@ -10178,7 +10188,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o __pyx_v_i = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":143 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":143 * def write_enhanced_handle(self, f): * for i in self.data: * f.write("%d " %i) # <<<<<<<<<<<<<< @@ -10202,7 +10212,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":144 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":144 * for i in self.data: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -10216,7 +10226,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":145 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":145 * f.write("%d " %i) * f.write("\n") * for i in self.sent_index: # <<<<<<<<<<<<<< @@ -10261,7 +10271,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o __pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":146 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":146 * f.write("\n") * for i in self.sent_index: * f.write("%d " %i) # <<<<<<<<<<<<<< @@ -10285,7 +10295,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":147 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":147 * for i in self.sent_index: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -10299,7 +10309,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":148 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":148 * f.write("%d " %i) * f.write("\n") * for i in self.sent_id: # <<<<<<<<<<<<<< @@ -10344,7 +10354,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o __pyx_v_i = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":149 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":149 * f.write("\n") * for i in self.sent_id: * f.write("%d " %i) # <<<<<<<<<<<<<< @@ -10368,7 +10378,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":150 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":150 * for i in self.sent_id: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -10382,7 +10392,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":151 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":151 * f.write("%d " %i) * f.write("\n") * for word in self.id2word: # <<<<<<<<<<<<<< @@ -10427,7 +10437,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o __pyx_v_word = __pyx_t_6; __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":152 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":152 * f.write("\n") * for word in self.id2word: * f.write("%s %d " % (word, self.word2id[word])) # <<<<<<<<<<<<<< @@ -10462,7 +10472,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":153 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":153 * for word in self.id2word: * f.write("%s %d " % (word, self.word2id[word])) * f.write("\n") # <<<<<<<<<<<<<< @@ -10483,7 +10493,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_sa.DataArray.write_enhanced_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_enhanced_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_i); @@ -10494,8 +10504,8 @@ static PyObject *__pyx_pf_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_29write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_29write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_29write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_29write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -10508,16 +10518,16 @@ static PyObject *__pyx_pw_3_sa_9DataArray_29write_enhanced(PyObject *__pyx_v_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9DataArray_28write_enhanced(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":155 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":155 * f.write("\n") * * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< @@ -10525,7 +10535,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_29write_enhanced(PyObject *__pyx_v_sel * self.write_enhanced_handle(self, f) */ -static PyObject *__pyx_pf_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10545,7 +10555,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_3_sa int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_enhanced", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":156 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -10584,7 +10594,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_3_sa __pyx_v_f = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":157 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":157 * def write_enhanced(self, char* filename): * with open(filename, "w") as f: * self.write_enhanced_handle(self, f) # <<<<<<<<<<<<<< @@ -10614,14 +10624,14 @@ static PyObject *__pyx_pf_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_3_sa __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":156 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< * self.write_enhanced_handle(self, f) */ /*except:*/ { - __Pyx_AddTraceback("_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -10700,7 +10710,7 @@ static PyObject *__pyx_pf_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_3_sa __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -10710,17 +10720,17 @@ static PyObject *__pyx_pf_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_3_sa } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_7word2id_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_7word2id_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_7word2id___get__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":10 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":10 * * cdef class DataArray: * cdef public word2id # <<<<<<<<<<<<<< @@ -10728,7 +10738,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_7word2id_1__get__(PyObject *__pyx_v_se * cdef public IntList data */ -static PyObject *__pyx_pf_3_sa_9DataArray_7word2id___get__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -10745,17 +10755,17 @@ static PyObject *__pyx_pf_3_sa_9DataArray_7word2id___get__(struct __pyx_obj_3_sa } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_7word2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_7word2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_7word2id_2__set__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray_7word2id_2__set__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); @@ -10771,17 +10781,17 @@ static int __pyx_pf_3_sa_9DataArray_7word2id_2__set__(struct __pyx_obj_3_sa_Data } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_7word2id_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_7word2id_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_7word2id_4__del__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray_7word2id_4__del__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -10797,17 +10807,17 @@ static int __pyx_pf_3_sa_9DataArray_7word2id_4__del__(struct __pyx_obj_3_sa_Data } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_7id2word_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_7id2word_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_7id2word___get__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":11 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":11 * cdef class DataArray: * cdef public word2id * cdef public id2word # <<<<<<<<<<<<<< @@ -10815,7 +10825,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_7id2word_1__get__(PyObject *__pyx_v_se * cdef public IntList sent_id */ -static PyObject *__pyx_pf_3_sa_9DataArray_7id2word___get__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -10832,17 +10842,17 @@ static PyObject *__pyx_pf_3_sa_9DataArray_7id2word___get__(struct __pyx_obj_3_sa } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_7id2word_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_7id2word_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_7id2word_2__set__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray_7id2word_2__set__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); @@ -10858,17 +10868,17 @@ static int __pyx_pf_3_sa_9DataArray_7id2word_2__set__(struct __pyx_obj_3_sa_Data } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_7id2word_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_7id2word_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_7id2word_4__del__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray_7id2word_4__del__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -10884,17 +10894,17 @@ static int __pyx_pf_3_sa_9DataArray_7id2word_4__del__(struct __pyx_obj_3_sa_Data } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_4data_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_4data_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_4data___get__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":12 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":12 * cdef public word2id * cdef public id2word * cdef public IntList data # <<<<<<<<<<<<<< @@ -10902,7 +10912,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_4data_1__get__(PyObject *__pyx_v_self) * cdef public IntList sent_index */ -static PyObject *__pyx_pf_3_sa_9DataArray_4data___get__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4data___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -10919,34 +10929,34 @@ static PyObject *__pyx_pf_3_sa_9DataArray_4data___get__(struct __pyx_obj_3_sa_Da } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_4data_2__set__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray_4data_2__set__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); __Pyx_GOTREF(__pyx_v_self->data); __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); - __pyx_v_self->data = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_value); + __pyx_v_self->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_value); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.DataArray.data.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.data.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -10954,17 +10964,17 @@ static int __pyx_pf_3_sa_9DataArray_4data_2__set__(struct __pyx_obj_3_sa_DataArr } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_4data_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_4data_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_4data_4__del__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray_4data_4__del__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -10972,7 +10982,7 @@ static int __pyx_pf_3_sa_9DataArray_4data_4__del__(struct __pyx_obj_3_sa_DataArr __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->data); __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); - __pyx_v_self->data = ((struct __pyx_obj_3_sa_IntList *)Py_None); + __pyx_v_self->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -10980,17 +10990,17 @@ static int __pyx_pf_3_sa_9DataArray_4data_4__del__(struct __pyx_obj_3_sa_DataArr } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_7sent_id_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_7sent_id_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_7sent_id___get__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":13 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":13 * cdef public id2word * cdef public IntList data * cdef public IntList sent_id # <<<<<<<<<<<<<< @@ -10998,7 +11008,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_7sent_id_1__get__(PyObject *__pyx_v_se * cdef bint use_sent_id */ -static PyObject *__pyx_pf_3_sa_9DataArray_7sent_id___get__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -11015,34 +11025,34 @@ static PyObject *__pyx_pf_3_sa_9DataArray_7sent_id___get__(struct __pyx_obj_3_sa } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_7sent_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_7sent_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_7sent_id_2__set__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray_7sent_id_2__set__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); __Pyx_GOTREF(__pyx_v_self->sent_id); __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_id)); - __pyx_v_self->sent_id = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_value); + __pyx_v_self->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_value); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.DataArray.sent_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.sent_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -11050,17 +11060,17 @@ static int __pyx_pf_3_sa_9DataArray_7sent_id_2__set__(struct __pyx_obj_3_sa_Data } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_7sent_id_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_7sent_id_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_7sent_id_4__del__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray_7sent_id_4__del__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -11068,7 +11078,7 @@ static int __pyx_pf_3_sa_9DataArray_7sent_id_4__del__(struct __pyx_obj_3_sa_Data __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->sent_id); __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_id)); - __pyx_v_self->sent_id = ((struct __pyx_obj_3_sa_IntList *)Py_None); + __pyx_v_self->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -11076,17 +11086,17 @@ static int __pyx_pf_3_sa_9DataArray_7sent_id_4__del__(struct __pyx_obj_3_sa_Data } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9DataArray_10sent_index_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_9DataArray_10sent_index_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_10sent_index___get__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":14 +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":14 * cdef public IntList data * cdef public IntList sent_id * cdef public IntList sent_index # <<<<<<<<<<<<<< @@ -11094,7 +11104,7 @@ static PyObject *__pyx_pw_3_sa_9DataArray_10sent_index_1__get__(PyObject *__pyx_ * */ -static PyObject *__pyx_pf_3_sa_9DataArray_10sent_index___get__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -11111,34 +11121,34 @@ static PyObject *__pyx_pf_3_sa_9DataArray_10sent_index___get__(struct __pyx_obj_ } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_10sent_index_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_10sent_index_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_10sent_index_2__set__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray_10sent_index_2__set__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); __Pyx_GOTREF(__pyx_v_self->sent_index); __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); - __pyx_v_self->sent_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_value); + __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_value); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.DataArray.sent_index.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.sent_index.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -11146,17 +11156,17 @@ static int __pyx_pf_3_sa_9DataArray_10sent_index_2__set__(struct __pyx_obj_3_sa_ } /* Python wrapper */ -static int __pyx_pw_3_sa_9DataArray_10sent_index_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_3_sa_9DataArray_10sent_index_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9DataArray_10sent_index_4__del__(((struct __pyx_obj_3_sa_DataArray *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9DataArray_10sent_index_4__del__(struct __pyx_obj_3_sa_DataArray *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); @@ -11164,26 +11174,26 @@ static int __pyx_pf_3_sa_9DataArray_10sent_index_4__del__(struct __pyx_obj_3_sa_ __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->sent_index); __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); - __pyx_v_self->sent_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); + __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_f_3_sa_9Alignment_link(CYTHON_UNUSED struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_i, int __pyx_v_j) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("link", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":16 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":16 * cdef int link(self, int i, int j): * """Integerizes an alignment link pair""" * return i * ALIGNMENT_CODE + j # <<<<<<<<<<<<<< * * def unlink(self, link): */ - __pyx_r = ((__pyx_v_i * __pyx_v_3_sa_ALIGNMENT_CODE) + __pyx_v_j); + __pyx_r = ((__pyx_v_i * __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE) + __pyx_v_j); goto __pyx_L0; __pyx_r = 0; @@ -11193,18 +11203,18 @@ static int __pyx_f_3_sa_9Alignment_link(CYTHON_UNUSED struct __pyx_obj_3_sa_Alig } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link); /*proto*/ -static char __pyx_doc_3_sa_9Alignment_unlink[] = "De-integerizes an alignment link pair"; -static PyObject *__pyx_pw_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_9Alignment_unlink[] = "De-integerizes an alignment link pair"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("unlink (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9Alignment_unlink(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_link)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_link)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":18 +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":18 * return i * ALIGNMENT_CODE + j * * def unlink(self, link): # <<<<<<<<<<<<<< @@ -11212,7 +11222,7 @@ static PyObject *__pyx_pw_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObje * return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE) */ -static PyObject *__pyx_pf_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11223,7 +11233,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("unlink", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":20 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":20 * def unlink(self, link): * """De-integerizes an alignment link pair""" * return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE) # <<<<<<<<<<<<<< @@ -11231,12 +11241,12 @@ static PyObject *__pyx_pf_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_ * cdef _unlink(self, int link, int* f, int* e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_link, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyNumber_Remainder(__pyx_v_link, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -11259,7 +11269,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.Alignment.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11267,7 +11277,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":22 +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":22 * return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE) * * cdef _unlink(self, int link, int* f, int* e): # <<<<<<<<<<<<<< @@ -11275,7 +11285,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_ * e[0] = link % ALIGNMENT_CODE */ -static PyObject *__pyx_f_3_sa_9Alignment__unlink(CYTHON_UNUSED struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_link, int *__pyx_v_f, int *__pyx_v_e) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; @@ -11283,14 +11293,14 @@ static PyObject *__pyx_f_3_sa_9Alignment__unlink(CYTHON_UNUSED struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_unlink", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":23 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":23 * * cdef _unlink(self, int link, int* f, int* e): * f[0] = link / ALIGNMENT_CODE # <<<<<<<<<<<<<< * e[0] = link % ALIGNMENT_CODE * */ - if (unlikely(__pyx_v_3_sa_ALIGNMENT_CODE == 0)) { + if (unlikely(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif @@ -11300,7 +11310,7 @@ static PyObject *__pyx_f_3_sa_9Alignment__unlink(CYTHON_UNUSED struct __pyx_obj_ #endif {__pyx_filename = __pyx_f[4]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_3_sa_ALIGNMENT_CODE == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_link))) { + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_link))) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif @@ -11310,16 +11320,16 @@ static PyObject *__pyx_f_3_sa_9Alignment__unlink(CYTHON_UNUSED struct __pyx_obj_ #endif {__pyx_filename = __pyx_f[4]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - (__pyx_v_f[0]) = __Pyx_div_int(__pyx_v_link, __pyx_v_3_sa_ALIGNMENT_CODE); + (__pyx_v_f[0]) = __Pyx_div_int(__pyx_v_link, __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":24 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":24 * cdef _unlink(self, int link, int* f, int* e): * f[0] = link / ALIGNMENT_CODE * e[0] = link % ALIGNMENT_CODE # <<<<<<<<<<<<<< * * def get_sent_links(self, int sent_id): */ - if (unlikely(__pyx_v_3_sa_ALIGNMENT_CODE == 0)) { + if (unlikely(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif @@ -11329,12 +11339,12 @@ static PyObject *__pyx_f_3_sa_9Alignment__unlink(CYTHON_UNUSED struct __pyx_obj_ #endif {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - (__pyx_v_e[0]) = __Pyx_mod_int(__pyx_v_link, __pyx_v_3_sa_ALIGNMENT_CODE); + (__pyx_v_e[0]) = __Pyx_mod_int(__pyx_v_link, __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.Alignment._unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment._unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11343,8 +11353,8 @@ static PyObject *__pyx_f_3_sa_9Alignment__unlink(CYTHON_UNUSED struct __pyx_obj_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id); /*proto*/ -static PyObject *__pyx_pw_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id) { int __pyx_v_sent_id; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -11357,16 +11367,16 @@ static PyObject *__pyx_pw_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9Alignment_2get_sent_links(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((int)__pyx_v_sent_id)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((int)__pyx_v_sent_id)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":26 +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":26 * e[0] = link % ALIGNMENT_CODE * * def get_sent_links(self, int sent_id): # <<<<<<<<<<<<<< @@ -11374,8 +11384,8 @@ static PyObject *__pyx_pw_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self * cdef int* arr */ -static PyObject *__pyx_pf_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id) { - struct __pyx_obj_3_sa_IntList *__pyx_v_sent_links = 0; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id) { + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_sent_links = 0; int *__pyx_v_arr; int __pyx_v_arr_len; PyObject *__pyx_r = NULL; @@ -11386,37 +11396,37 @@ static PyObject *__pyx_pf_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_3_sa_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_sent_links", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":30 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":30 * cdef int* arr * cdef int arr_len * sent_links = IntList() # <<<<<<<<<<<<<< * arr = self._get_sent_links(sent_id, &arr_len) * sent_links._extend_arr(arr, arr_len*2) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_sent_links = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_sent_links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":31 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":31 * cdef int arr_len * sent_links = IntList() * arr = self._get_sent_links(sent_id, &arr_len) # <<<<<<<<<<<<<< * sent_links._extend_arr(arr, arr_len*2) * free(arr) */ - __pyx_v_arr = ((struct __pyx_vtabstruct_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->_get_sent_links(__pyx_v_self, __pyx_v_sent_id, (&__pyx_v_arr_len)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":32 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * free(arr) * return sent_links */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_sent_links->__pyx_vtab)->_extend_arr(__pyx_v_sent_links, __pyx_v_arr, (__pyx_v_arr_len * 2)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":33 * arr = self._get_sent_links(sent_id, &arr_len) * sent_links._extend_arr(arr, arr_len*2) * free(arr) # <<<<<<<<<<<<<< @@ -11425,7 +11435,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_3_sa_ */ free(__pyx_v_arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":34 * sent_links._extend_arr(arr, arr_len*2) * free(arr) * return sent_links # <<<<<<<<<<<<<< @@ -11441,7 +11451,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_3_sa_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_sent_links); @@ -11450,7 +11460,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_3_sa_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":36 +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":36 * return sent_links * * cdef int* _get_sent_links(self, int sent_id, int* num_links): # <<<<<<<<<<<<<< @@ -11458,7 +11468,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_3_sa_ * cdef int i, start, end */ -static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id, int *__pyx_v_num_links) { +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) { int *__pyx_v_sent_links; int __pyx_v_i; int __pyx_v_start; @@ -11472,7 +11482,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_get_sent_links", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":39 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":39 * cdef int* sent_links * cdef int i, start, end * start = self.sent_index.arr[sent_id] # <<<<<<<<<<<<<< @@ -11481,7 +11491,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm */ __pyx_v_start = (__pyx_v_self->sent_index->arr[__pyx_v_sent_id]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":40 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< @@ -11490,7 +11500,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm */ __pyx_v_end = (__pyx_v_self->sent_index->arr[(__pyx_v_sent_id + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":41 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -11499,7 +11509,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm */ (__pyx_v_num_links[0]) = (__pyx_v_end - __pyx_v_start); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":42 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":42 * end = self.sent_index.arr[sent_id+1] * num_links[0] = end - start * sent_links = malloc(2*num_links[0]*sizeof(int)) # <<<<<<<<<<<<<< @@ -11508,7 +11518,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm */ __pyx_v_sent_links = ((int *)malloc(((2 * (__pyx_v_num_links[0])) * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":43 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":43 * num_links[0] = end - start * sent_links = malloc(2*num_links[0]*sizeof(int)) * for i from 0 <= i < num_links[0]: # <<<<<<<<<<<<<< @@ -11518,19 +11528,19 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm __pyx_t_1 = (__pyx_v_num_links[0]); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":44 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":44 * sent_links = 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) # <<<<<<<<<<<<<< * return sent_links * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->_unlink(__pyx_v_self, (__pyx_v_self->links->arr[(__pyx_v_start + __pyx_v_i)]), (__pyx_v_sent_links + (2 * __pyx_v_i)), ((__pyx_v_sent_links + (2 * __pyx_v_i)) + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->_unlink(__pyx_v_self, (__pyx_v_self->links->arr[(__pyx_v_start + __pyx_v_i)]), (__pyx_v_sent_links + (2 * __pyx_v_i)), ((__pyx_v_sent_links + (2 * __pyx_v_i)) + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":45 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -11544,7 +11554,7 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_sa.Alignment._get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.Alignment._get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -11552,8 +11562,8 @@ static int *__pyx_f_3_sa_9Alignment__get_sent_links(struct __pyx_obj_3_sa_Alignm } /* Python wrapper */ -static int __pyx_pw_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_from_binary = 0; PyObject *__pyx_v_from_text = 0; int __pyx_lineno = 0; @@ -11566,7 +11576,7 @@ static int __pyx_pw_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,0}; PyObject* values[2] = {0,0}; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":47 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":47 * return sent_links * * def __cinit__(self, from_binary=None, from_text=None): # <<<<<<<<<<<<<< @@ -11615,16 +11625,16 @@ static int __pyx_pw_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9Alignment_4__cinit__(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9Alignment_4__cinit__(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text) { +static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11636,37 +11646,37 @@ static int __pyx_pf_3_sa_9Alignment_4__cinit__(struct __pyx_obj_3_sa_Alignment * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":48 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":48 * * def __cinit__(self, from_binary=None, from_text=None): * self.links = IntList(1000,1000) # <<<<<<<<<<<<<< * self.sent_index = IntList(1000,1000) * if from_binary: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->links); __Pyx_DECREF(((PyObject *)__pyx_v_self->links)); - __pyx_v_self->links = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_self->links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":49 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * if from_binary: * self.read_binary(from_binary) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sent_index); __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); - __pyx_v_self->sent_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":50 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":50 * self.links = IntList(1000,1000) * self.sent_index = IntList(1000,1000) * if from_binary: # <<<<<<<<<<<<<< @@ -11676,7 +11686,7 @@ static int __pyx_pf_3_sa_9Alignment_4__cinit__(struct __pyx_obj_3_sa_Alignment * __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":51 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":51 * self.sent_index = IntList(1000,1000) * if from_binary: * self.read_binary(from_binary) # <<<<<<<<<<<<<< @@ -11698,7 +11708,7 @@ static int __pyx_pf_3_sa_9Alignment_4__cinit__(struct __pyx_obj_3_sa_Alignment * goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":52 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":52 * if from_binary: * self.read_binary(from_binary) * elif from_text: # <<<<<<<<<<<<<< @@ -11708,7 +11718,7 @@ static int __pyx_pf_3_sa_9Alignment_4__cinit__(struct __pyx_obj_3_sa_Alignment * __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":53 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":53 * self.read_binary(from_binary) * elif from_text: * self.read_text(from_text) # <<<<<<<<<<<<<< @@ -11737,7 +11747,7 @@ static int __pyx_pf_3_sa_9Alignment_4__cinit__(struct __pyx_obj_3_sa_Alignment * __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -11745,8 +11755,8 @@ static int __pyx_pf_3_sa_9Alignment_4__cinit__(struct __pyx_obj_3_sa_Alignment * } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -11759,16 +11769,16 @@ static PyObject *__pyx_pw_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9Alignment_6read_text(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":55 +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":55 * self.read_text(from_text) * * def read_text(self, char* filename): # <<<<<<<<<<<<<< @@ -11776,7 +11786,7 @@ static PyObject *__pyx_pw_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyO * for line in f: */ -static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_line = NULL; PyObject *__pyx_v_pairs = NULL; @@ -11810,7 +11820,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_text", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":56 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56 * * def read_text(self, char* filename): * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -11850,7 +11860,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align __pyx_v_f = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":57 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":57 * def read_text(self, char* filename): * with gzip_or_text(filename) as f: * for line in f: # <<<<<<<<<<<<<< @@ -11895,7 +11905,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align __pyx_v_line = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":58 * with gzip_or_text(filename) as f: * for line in f: * self.sent_index.append(len(self.links)) # <<<<<<<<<<<<<< @@ -11913,7 +11923,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":59 * for line in f: * self.sent_index.append(len(self.links)) * pairs = line.split() # <<<<<<<<<<<<<< @@ -11929,7 +11939,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align __pyx_v_pairs = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":60 * self.sent_index.append(len(self.links)) * pairs = line.split() * for pair in pairs: # <<<<<<<<<<<<<< @@ -11974,7 +11984,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align __pyx_v_pair = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":61 * pairs = line.split() * for pair in pairs: * (i, j) = map(int, pair.split('-')) # <<<<<<<<<<<<<< @@ -12055,7 +12065,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align __pyx_v_j = __pyx_t_13; __pyx_t_13 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":62 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":62 * for pair in pairs: * (i, j) = map(int, pair.split('-')) * self.links.append(self.link(i, j)) # <<<<<<<<<<<<<< @@ -12064,7 +12074,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align */ __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_v_j); 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_12 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->link(__pyx_v_self, __pyx_t_16, __pyx_t_17)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyInt_FromLong(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->link(__pyx_v_self, __pyx_t_16, __pyx_t_17)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_13 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->links), __pyx_t_12); 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); @@ -12075,7 +12085,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":63 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -12105,7 +12115,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":56 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56 * * def read_text(self, char* filename): * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -12113,7 +12123,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align * self.sent_index.append(len(self.links)) */ /*except:*/ { - __Pyx_AddTraceback("_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); @@ -12194,7 +12204,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("_sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -12209,8 +12219,8 @@ static PyObject *__pyx_pf_3_sa_9Alignment_6read_text(struct __pyx_obj_3_sa_Align } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -12223,16 +12233,16 @@ static PyObject *__pyx_pw_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9Alignment_8read_binary(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":65 +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":65 * self.sent_index.append(len(self.links)) * * def read_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -12240,13 +12250,13 @@ static PyObject *__pyx_pw_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, P * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_3_sa_9Alignment_8read_binary(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_binary", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":67 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":67 * def read_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -12255,25 +12265,25 @@ static PyObject *__pyx_pf_3_sa_9Alignment_8read_binary(struct __pyx_obj_3_sa_Ali */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":68 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":68 * cdef FILE* f * f = fopen(filename, "r") * self.links.read_handle(f) # <<<<<<<<<<<<<< * self.sent_index.read_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->read_handle(__pyx_v_self->links, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->read_handle(__pyx_v_self->links, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":69 * f = fopen(filename, "r") * self.links.read_handle(f) * self.sent_index.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->read_handle(__pyx_v_self->sent_index, __pyx_v_f); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":70 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":70 * self.links.read_handle(f) * self.sent_index.read_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -12289,8 +12299,8 @@ static PyObject *__pyx_pf_3_sa_9Alignment_8read_binary(struct __pyx_obj_3_sa_Ali } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -12303,16 +12313,16 @@ static PyObject *__pyx_pw_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9Alignment_10write_text(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":72 +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":72 * fclose(f) * * def write_text(self, char* filename): # <<<<<<<<<<<<<< @@ -12320,7 +12330,7 @@ static PyObject *__pyx_pw_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, P * sent_num = 0 */ -static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_sent_num = NULL; PyObject *__pyx_v_i = NULL; @@ -12347,7 +12357,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_text", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -12387,7 +12397,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali __pyx_v_f = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":74 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":74 * def write_text(self, char* filename): * with open(filename, "w") as f: * sent_num = 0 # <<<<<<<<<<<<<< @@ -12397,7 +12407,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali __Pyx_INCREF(__pyx_int_0); __pyx_v_sent_num = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":75 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":75 * with open(filename, "w") as f: * sent_num = 0 * for i, link in enumerate(self.links): # <<<<<<<<<<<<<< @@ -12452,7 +12462,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali __pyx_t_4 = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":76 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":76 * sent_num = 0 * for i, link in enumerate(self.links): * while i >= self.sent_index[sent_num]: # <<<<<<<<<<<<<< @@ -12468,7 +12478,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (!__pyx_t_11) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":77 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":77 * for i, link in enumerate(self.links): * while i >= self.sent_index[sent_num]: * f.write("\n") # <<<<<<<<<<<<<< @@ -12482,7 +12492,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":78 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":78 * while i >= self.sent_index[sent_num]: * f.write("\n") * sent_num = sent_num + 1 # <<<<<<<<<<<<<< @@ -12496,7 +12506,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali __pyx_t_2 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":79 * f.write("\n") * sent_num = sent_num + 1 * f.write("%d-%d " % self.unlink(link)) # <<<<<<<<<<<<<< @@ -12533,7 +12543,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":80 * sent_num = sent_num + 1 * f.write("%d-%d " % self.unlink(link)) * f.write("\n") # <<<<<<<<<<<<<< @@ -12559,7 +12569,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -12567,7 +12577,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali * for i, link in enumerate(self.links): */ /*except:*/ { - __Pyx_AddTraceback("_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_4); @@ -12648,7 +12658,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("_sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -12661,8 +12671,8 @@ static PyObject *__pyx_pf_3_sa_9Alignment_10write_text(struct __pyx_obj_3_sa_Ali } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -12675,16 +12685,16 @@ static PyObject *__pyx_pw_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9Alignment_12write_binary(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":82 +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":82 * f.write("\n") * * def write_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -12692,13 +12702,13 @@ static PyObject *__pyx_pw_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_3_sa_9Alignment_12write_binary(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_binary", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":84 * def write_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -12707,25 +12717,25 @@ static PyObject *__pyx_pf_3_sa_9Alignment_12write_binary(struct __pyx_obj_3_sa_A */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":85 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":85 * cdef FILE* f * f = fopen(filename, "w") * self.links.write_handle(f) # <<<<<<<<<<<<<< * self.sent_index.write_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->write_handle(__pyx_v_self->links, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->write_handle(__pyx_v_self->links, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":86 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":86 * f = fopen(filename, "w") * self.links.write_handle(f) * self.sent_index.write_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sent_index->__pyx_vtab)->write_handle(__pyx_v_self->sent_index, __pyx_v_f); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":87 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":87 * self.links.write_handle(f) * self.sent_index.write_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -12741,8 +12751,8 @@ static PyObject *__pyx_pf_3_sa_9Alignment_12write_binary(struct __pyx_obj_3_sa_A } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -12755,26 +12765,25 @@ static PyObject *__pyx_pw_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9Alignment_14write_enhanced(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":89 +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":89 * fclose(f) * * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< * with open(filename, "w") as f: - * sent_num = 1 + * for link in self.links: */ -static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; - CYTHON_UNUSED long __pyx_v_sent_num; PyObject *__pyx_v_link = NULL; PyObject *__pyx_v_i = NULL; PyObject *__pyx_r = NULL; @@ -12797,12 +12806,12 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_enhanced", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":90 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * sent_num = 1 * for link in self.links: + * f.write("%d " % link) */ /*with:*/ { __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -12837,18 +12846,9 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa __pyx_v_f = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":91 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":91 * def write_enhanced(self, char* filename): * with open(filename, "w") as f: - * sent_num = 1 # <<<<<<<<<<<<<< - * for link in self.links: - * f.write("%d " % link) - */ - __pyx_v_sent_num = 1; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":92 - * with open(filename, "w") as f: - * sent_num = 1 * for link in self.links: # <<<<<<<<<<<<<< * f.write("%d " % link) * f.write("\n") @@ -12857,7 +12857,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa __pyx_t_4 = ((PyObject *)__pyx_v_self->links); __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; __pyx_t_9 = 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 = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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_GOTREF(__pyx_t_4); __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; } @@ -12865,23 +12865,23 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa 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 = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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 { __pyx_t_1 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } @@ -12891,23 +12891,23 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa __pyx_v_link = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":93 - * sent_num = 1 + /* "/home/mdenkows/cdec/python/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 = 93; __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[4]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_link); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__pyx_t_2)); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; @@ -12915,21 +12915,21 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":94 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":93 * for link in self.links: * f.write("%d " % link) * f.write("\n") # <<<<<<<<<<<<<< * for i in self.sent_index: * f.write("%d " % i) */ - __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 = 94; __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[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_40), 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":95 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":94 * f.write("%d " % link) * f.write("\n") * for i in self.sent_index: # <<<<<<<<<<<<<< @@ -12940,7 +12940,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa __pyx_t_2 = ((PyObject *)__pyx_v_self->sent_index); __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; __pyx_t_9 = 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 = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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; } @@ -12948,23 +12948,23 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa 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 = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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 { __pyx_t_4 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } break; } @@ -12974,23 +12974,23 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa __pyx_v_i = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":96 + /* "/home/mdenkows/cdec/python/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 = 96; __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[4]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__pyx_t_10)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __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, ((PyObject *)__pyx_t_10)); __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -12998,16 +12998,16 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":97 + /* "/home/mdenkows/cdec/python/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 = 97; __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 = 96; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_41), 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; @@ -13022,15 +13022,15 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":90 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * sent_num = 1 * for link in self.links: + * f.write("%d " % link) */ /*except:*/ { - __Pyx_AddTraceback("_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -13109,7 +13109,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -13121,18 +13121,18 @@ static PyObject *__pyx_pf_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_3_sa } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static char __pyx_doc_3_sa_9Alignment_16alignment[] = "Return all (e,f) pairs for sentence i"; -static PyObject *__pyx_pw_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_9Alignment_16alignment[] = "Return all (e,f) pairs for sentence i"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("alignment (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9Alignment_16alignment(((struct __pyx_obj_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":99 +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":98 * f.write("\n") * * def alignment(self, i): # <<<<<<<<<<<<<< @@ -13140,7 +13140,7 @@ static PyObject *__pyx_pw_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, Py * cdef int j, start, end */ -static PyObject *__pyx_pf_3_sa_9Alignment_16alignment(struct __pyx_obj_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_v_j; int __pyx_v_start; int __pyx_v_end; @@ -13158,42 +13158,42 @@ static PyObject *__pyx_pf_3_sa_9Alignment_16alignment(struct __pyx_obj_3_sa_Alig int __pyx_clineno = 0; __Pyx_RefNannySetupContext("alignment", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":102 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":101 * """Return all (e,f) pairs for sentence i""" * cdef int j, start, end * result = [] # <<<<<<<<<<<<<< * start = self.sent_index.arr[i] * end = self.sent_index.arr[i+1] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":103 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":102 * cdef int j, start, end * result = [] * start = self.sent_index.arr[i] # <<<<<<<<<<<<<< * end = self.sent_index.arr[i+1] * for j from start <= j < end: */ - __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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":104 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":103 * result = [] * start = self.sent_index.arr[i] * end = self.sent_index.arr[i+1] # <<<<<<<<<<<<<< * for j from start <= j < end: * result.append(self.unlink(self.links.arr[j])) */ - __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_end = (__pyx_v_self->sent_index->arr[__pyx_t_2]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":105 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":104 * start = self.sent_index.arr[i] * end = self.sent_index.arr[i+1] * for j from start <= j < end: # <<<<<<<<<<<<<< @@ -13203,30 +13203,30 @@ static PyObject *__pyx_pf_3_sa_9Alignment_16alignment(struct __pyx_obj_3_sa_Alig __pyx_t_3 = __pyx_v_end; for (__pyx_v_j = __pyx_v_start; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":106 + /* "/home/mdenkows/cdec/python/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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = PyInt_FromLong((__pyx_v_self->links->arr[__pyx_v_j])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__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_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__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(((PyObject *)__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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":107 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":106 * for j from start <= j < end: * result.append(self.unlink(self.links.arr[j])) * return result # <<<<<<<<<<<<<< @@ -13242,7 +13242,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_16alignment(struct __pyx_obj_3_sa_Alig __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.Alignment.alignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.alignment", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -13251,7 +13251,7 @@ static PyObject *__pyx_pf_3_sa_9Alignment_16alignment(struct __pyx_obj_3_sa_Alig return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":15 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":15 * int val * * cdef _node* new_node(int key): # <<<<<<<<<<<<<< @@ -13259,22 +13259,22 @@ static PyObject *__pyx_pf_3_sa_9Alignment_16alignment(struct __pyx_obj_3_sa_Alig * n = <_node*> malloc(sizeof(_node)) */ -static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { - struct __pyx_t_3_sa__node *__pyx_v_n; - struct __pyx_t_3_sa__node *__pyx_r; +static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int __pyx_v_key) { + struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_v_n; + struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_node", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":17 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":17 * cdef _node* new_node(int key): * cdef _node* n * n = <_node*> malloc(sizeof(_node)) # <<<<<<<<<<<<<< * n.smaller = NULL * n.bigger = NULL */ - __pyx_v_n = ((struct __pyx_t_3_sa__node *)malloc((sizeof(struct __pyx_t_3_sa__node)))); + __pyx_v_n = ((struct __pyx_t_4cdec_2sa_3_sa__node *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__node)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":18 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":18 * cdef _node* n * n = <_node*> malloc(sizeof(_node)) * n.smaller = NULL # <<<<<<<<<<<<<< @@ -13283,7 +13283,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { */ __pyx_v_n->smaller = NULL; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":19 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":19 * n = <_node*> malloc(sizeof(_node)) * n.smaller = NULL * n.bigger = NULL # <<<<<<<<<<<<<< @@ -13292,7 +13292,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { */ __pyx_v_n->bigger = NULL; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":20 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":20 * n.smaller = NULL * n.bigger = NULL * n.key = key # <<<<<<<<<<<<<< @@ -13301,7 +13301,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { */ __pyx_v_n->key = __pyx_v_key; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":21 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":21 * n.bigger = NULL * n.key = key * n.val = 0 # <<<<<<<<<<<<<< @@ -13310,7 +13310,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { */ __pyx_v_n->val = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":22 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":22 * n.key = key * n.val = 0 * return n # <<<<<<<<<<<<<< @@ -13326,7 +13326,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":25 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":25 * * * cdef del_node(_node* n): # <<<<<<<<<<<<<< @@ -13334,7 +13334,7 @@ static struct __pyx_t_3_sa__node *__pyx_f_3_sa_new_node(int __pyx_v_key) { * del_node(n.smaller) */ -static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { +static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_v_n) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -13344,7 +13344,7 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("del_node", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":26 * * cdef del_node(_node* n): * if n.smaller != NULL: # <<<<<<<<<<<<<< @@ -13354,21 +13354,21 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { __pyx_t_1 = ((__pyx_v_n->smaller != NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":27 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":27 * cdef del_node(_node* n): * if n.smaller != NULL: * del_node(n.smaller) # <<<<<<<<<<<<<< * if n.bigger != NULL: * del_node(n.bigger) */ - __pyx_t_2 = __pyx_f_3_sa_del_node(__pyx_v_n->smaller); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_del_node(__pyx_v_n->smaller); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 27; __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:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":28 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":28 * if n.smaller != NULL: * del_node(n.smaller) * if n.bigger != NULL: # <<<<<<<<<<<<<< @@ -13378,21 +13378,21 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { __pyx_t_1 = ((__pyx_v_n->bigger != NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":29 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":29 * del_node(n.smaller) * if n.bigger != NULL: * del_node(n.bigger) # <<<<<<<<<<<<<< * free(n) * */ - __pyx_t_2 = __pyx_f_3_sa_del_node(__pyx_v_n->bigger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_del_node(__pyx_v_n->bigger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 29; __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:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":30 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":30 * if n.bigger != NULL: * del_node(n.bigger) * free(n) # <<<<<<<<<<<<<< @@ -13405,7 +13405,7 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.del_node", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.del_node", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13413,7 +13413,7 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":32 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":32 * free(n) * * cdef int* get_val(_node* n, int key): # <<<<<<<<<<<<<< @@ -13421,13 +13421,13 @@ static PyObject *__pyx_f_3_sa_del_node(struct __pyx_t_3_sa__node *__pyx_v_n) { * return &n.val */ -static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx_v_key) { +static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_v_n, int __pyx_v_key) { int *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_val", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":33 * * cdef int* get_val(_node* n, int key): * if key == n.key: # <<<<<<<<<<<<<< @@ -13437,7 +13437,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx __pyx_t_1 = ((__pyx_v_key == __pyx_v_n->key) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":34 * cdef int* get_val(_node* n, int key): * if key == n.key: * return &n.val # <<<<<<<<<<<<<< @@ -13449,7 +13449,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":35 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":35 * if key == n.key: * return &n.val * elif key < n.key: # <<<<<<<<<<<<<< @@ -13459,7 +13459,7 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx __pyx_t_1 = ((__pyx_v_key < __pyx_v_n->key) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":36 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":36 * return &n.val * elif key < n.key: * if n.smaller == NULL: # <<<<<<<<<<<<<< @@ -13469,16 +13469,16 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx __pyx_t_1 = ((__pyx_v_n->smaller == NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":37 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":37 * elif key < n.key: * if n.smaller == NULL: * n.smaller = new_node(key) # <<<<<<<<<<<<<< * return &(n.smaller.val) * return get_val(n.smaller, key) */ - __pyx_v_n->smaller = __pyx_f_3_sa_new_node(__pyx_v_key); + __pyx_v_n->smaller = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_key); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":38 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":38 * if n.smaller == NULL: * n.smaller = new_node(key) * return &(n.smaller.val) # <<<<<<<<<<<<<< @@ -13491,20 +13491,20 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":39 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":39 * n.smaller = new_node(key) * return &(n.smaller.val) * return get_val(n.smaller, key) # <<<<<<<<<<<<<< * else: * if n.bigger == NULL: */ - __pyx_r = __pyx_f_3_sa_get_val(__pyx_v_n->smaller, __pyx_v_key); + __pyx_r = __pyx_f_4cdec_2sa_3_sa_get_val(__pyx_v_n->smaller, __pyx_v_key); goto __pyx_L0; goto __pyx_L3; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":41 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":41 * return get_val(n.smaller, key) * else: * if n.bigger == NULL: # <<<<<<<<<<<<<< @@ -13514,16 +13514,16 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx __pyx_t_1 = ((__pyx_v_n->bigger == NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":42 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":42 * else: * if n.bigger == NULL: * n.bigger = new_node(key) # <<<<<<<<<<<<<< * return &(n.bigger.val) * return get_val(n.bigger, key) */ - __pyx_v_n->bigger = __pyx_f_3_sa_new_node(__pyx_v_key); + __pyx_v_n->bigger = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_key); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":43 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":43 * if n.bigger == NULL: * n.bigger = new_node(key) * return &(n.bigger.val) # <<<<<<<<<<<<<< @@ -13536,14 +13536,14 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":44 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":44 * n.bigger = new_node(key) * return &(n.bigger.val) * return get_val(n.bigger, key) # <<<<<<<<<<<<<< * * */ - __pyx_r = __pyx_f_3_sa_get_val(__pyx_v_n->bigger, __pyx_v_key); + __pyx_r = __pyx_f_4cdec_2sa_3_sa_get_val(__pyx_v_n->bigger, __pyx_v_key); goto __pyx_L0; } __pyx_L3:; @@ -13555,8 +13555,8 @@ static int *__pyx_f_3_sa_get_val(struct __pyx_t_3_sa__node *__pyx_v_n, int __pyx } /* Python wrapper */ -static int __pyx_pw_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_from_text = 0; PyObject *__pyx_v_from_data = 0; PyObject *__pyx_v_from_binary = 0; @@ -13573,7 +13573,7 @@ static int __pyx_pw_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__p static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_text,&__pyx_n_s__from_data,&__pyx_n_s__from_binary,&__pyx_n_s__earray,&__pyx_n_s__fsarray,&__pyx_n_s__alignment,0}; PyObject* values[6] = {0,0,0,0,0,0}; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54 * cdef id2eword, id2fword, eword2id, fword2id * * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< @@ -13584,7 +13584,7 @@ static int __pyx_pw_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__p values[1] = __pyx_k_43; values[2] = ((PyObject *)Py_None); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":55 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":55 * * def __cinit__(self, from_text=None, from_data=False, from_binary=None, * earray=None, fsarray=None, alignment=None): # <<<<<<<<<<<<<< @@ -13666,16 +13666,16 @@ static int __pyx_pw_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__p __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_5BiLex___cinit__(((struct __pyx_obj_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); + __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); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":54 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54 * cdef id2eword, id2fword, eword2id, fword2id * * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< @@ -13683,7 +13683,7 @@ static int __pyx_pw_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__p * self.id2eword = [] */ -static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_from_text, PyObject *__pyx_v_from_data, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_earray, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_alignment) { +static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_from_text, PyObject *__pyx_v_from_data, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_earray, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_alignment) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -13695,7 +13695,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":56 + /* "/home/mdenkows/cdec/python/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 = [] # <<<<<<<<<<<<<< @@ -13710,7 +13710,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_s __pyx_v_self->id2eword = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":57 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":57 * earray=None, fsarray=None, alignment=None): * self.id2eword = [] * self.id2fword = [] # <<<<<<<<<<<<<< @@ -13725,7 +13725,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_s __pyx_v_self->id2fword = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":58 * self.id2eword = [] * self.id2fword = [] * self.eword2id = {} # <<<<<<<<<<<<<< @@ -13740,7 +13740,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_s __pyx_v_self->eword2id = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":59 * self.id2fword = [] * self.eword2id = {} * self.fword2id = {} # <<<<<<<<<<<<<< @@ -13755,67 +13755,67 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_s __pyx_v_self->fword2id = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":60 * self.eword2id = {} * self.fword2id = {} * self.e_index = IntList() # <<<<<<<<<<<<<< * self.f_index = IntList() * self.col1 = FloatList() */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((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_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->e_index); __Pyx_DECREF(((PyObject *)__pyx_v_self->e_index)); - __pyx_v_self->e_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_self->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":61 * self.fword2id = {} * self.e_index = IntList() * self.f_index = IntList() # <<<<<<<<<<<<<< * self.col1 = FloatList() * self.col2 = FloatList() */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); 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_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->f_index); __Pyx_DECREF(((PyObject *)__pyx_v_self->f_index)); - __pyx_v_self->f_index = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_self->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":62 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":62 * self.e_index = IntList() * self.f_index = IntList() * self.col1 = FloatList() # <<<<<<<<<<<<<< * self.col2 = FloatList() * if from_binary: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), NULL); 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_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->col1); __Pyx_DECREF(((PyObject *)__pyx_v_self->col1)); - __pyx_v_self->col1 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); + __pyx_v_self->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":63 * self.f_index = IntList() * self.col1 = FloatList() * self.col2 = FloatList() # <<<<<<<<<<<<<< * if from_binary: * self.read_binary(from_binary) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__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_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__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_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->col2); __Pyx_DECREF(((PyObject *)__pyx_v_self->col2)); - __pyx_v_self->col2 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); + __pyx_v_self->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":64 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":64 * self.col1 = FloatList() * self.col2 = FloatList() * if from_binary: # <<<<<<<<<<<<<< @@ -13825,7 +13825,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_s __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":65 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":65 * self.col2 = FloatList() * if from_binary: * self.read_binary(from_binary) # <<<<<<<<<<<<<< @@ -13847,7 +13847,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_s goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":66 * if from_binary: * self.read_binary(from_binary) * elif from_data: # <<<<<<<<<<<<<< @@ -13857,24 +13857,24 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_s __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":67 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":67 * self.read_binary(from_binary) * elif from_data: * self.compute_from_data(fsarray, earray, alignment) # <<<<<<<<<<<<<< * else: * self.read_text(from_text) */ - if (!(likely(((__pyx_v_fsarray) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_fsarray, __pyx_ptype_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_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_3_sa_Alignment))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->compute_from_data(__pyx_v_self, ((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_fsarray), ((struct __pyx_obj_3_sa_DataArray *)__pyx_v_earray), ((struct __pyx_obj_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;} + 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; goto __pyx_L3; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":69 * self.compute_from_data(fsarray, earray, alignment) * else: * self.read_text(from_text) # <<<<<<<<<<<<<< @@ -13902,14 +13902,14 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_s __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":72 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":72 * * * cdef compute_from_data(self, SuffixArray fsa, DataArray eda, Alignment aa): # <<<<<<<<<<<<<< @@ -13917,7 +13917,7 @@ static int __pyx_pf_3_sa_5BiLex___cinit__(struct __pyx_obj_3_sa_BiLex *__pyx_v_s * cdef int *fsent, *esent, *alignment, *links, *ealigned, *faligned */ -static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsa, struct __pyx_obj_3_sa_DataArray *__pyx_v_eda, struct __pyx_obj_3_sa_Alignment *__pyx_v_aa) { +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) { int __pyx_v_sent_id; int __pyx_v_num_links; int __pyx_v_l; @@ -13935,7 +13935,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL int *__pyx_v_links; int *__pyx_v_ealigned; int *__pyx_v_faligned; - struct __pyx_t_3_sa__node **__pyx_v_dict; + struct __pyx_t_4cdec_2sa_3_sa__node **__pyx_v_dict; int *__pyx_v_fmargin; int *__pyx_v_emargin; int *__pyx_v_count; @@ -13963,7 +13963,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL int __pyx_clineno = 0; __Pyx_RefNannySetupContext("compute_from_data", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":79 * cdef int null_word * * null_word = 0 # <<<<<<<<<<<<<< @@ -13972,7 +13972,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_null_word = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":80 * * null_word = 0 * for word in fsa.darray.id2word: # I miss list comprehensions # <<<<<<<<<<<<<< @@ -14017,7 +14017,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_v_word = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":81 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":81 * null_word = 0 * for word in fsa.darray.id2word: # I miss list comprehensions * self.id2fword.append(word) # <<<<<<<<<<<<<< @@ -14030,7 +14030,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":82 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":82 * for word in fsa.darray.id2word: # I miss list comprehensions * self.id2fword.append(word) * self.id2fword[null_word] = "NULL" # <<<<<<<<<<<<<< @@ -14039,7 +14039,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ if (__Pyx_SetItemInt(__pyx_v_self->id2fword, __pyx_v_null_word, ((PyObject *)__pyx_n_s__NULL), sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":83 * self.id2fword.append(word) * self.id2fword[null_word] = "NULL" * for id, word in enumerate(self.id2fword): # <<<<<<<<<<<<<< @@ -14094,7 +14094,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_1 = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":84 * self.id2fword[null_word] = "NULL" * for id, word in enumerate(self.id2fword): * self.fword2id[word] = id # <<<<<<<<<<<<<< @@ -14106,7 +14106,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":86 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":86 * self.fword2id[word] = id * * for word in eda.id2word: # <<<<<<<<<<<<<< @@ -14151,7 +14151,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_v_word = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":87 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":87 * * for word in eda.id2word: * self.id2eword.append(word) # <<<<<<<<<<<<<< @@ -14164,7 +14164,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":88 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":88 * for word in eda.id2word: * self.id2eword.append(word) * self.id2eword[null_word] = "NULL" # <<<<<<<<<<<<<< @@ -14173,7 +14173,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ if (__Pyx_SetItemInt(__pyx_v_self->id2eword, __pyx_v_null_word, ((PyObject *)__pyx_n_s__NULL), sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":89 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":89 * self.id2eword.append(word) * self.id2eword[null_word] = "NULL" * for id, word in enumerate(self.id2eword): # <<<<<<<<<<<<<< @@ -14228,7 +14228,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_1 = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":90 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":90 * self.id2eword[null_word] = "NULL" * for id, word in enumerate(self.id2eword): * self.eword2id[word] = id # <<<<<<<<<<<<<< @@ -14240,7 +14240,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":92 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":92 * self.eword2id[word] = id * * num_pairs = 0 # <<<<<<<<<<<<<< @@ -14249,7 +14249,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_num_pairs = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":94 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":94 * num_pairs = 0 * * V_E = len(eda.id2word) # <<<<<<<<<<<<<< @@ -14262,7 +14262,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_V_E = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":95 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":95 * * V_E = len(eda.id2word) * V_F = len(fsa.darray.id2word) # <<<<<<<<<<<<<< @@ -14275,7 +14275,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_V_F = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":96 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":96 * V_E = len(eda.id2word) * V_F = len(fsa.darray.id2word) * fmargin = malloc(V_F*sizeof(int)) # <<<<<<<<<<<<<< @@ -14284,7 +14284,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_fmargin = ((int *)malloc((__pyx_v_V_F * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":97 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":97 * V_F = len(fsa.darray.id2word) * fmargin = malloc(V_F*sizeof(int)) * emargin = malloc(V_E*sizeof(int)) # <<<<<<<<<<<<<< @@ -14293,7 +14293,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_emargin = ((int *)malloc((__pyx_v_V_E * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":98 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":98 * fmargin = malloc(V_F*sizeof(int)) * emargin = malloc(V_E*sizeof(int)) * memset(fmargin, 0, V_F*sizeof(int)) # <<<<<<<<<<<<<< @@ -14302,7 +14302,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ memset(__pyx_v_fmargin, 0, (__pyx_v_V_F * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":99 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":99 * emargin = malloc(V_E*sizeof(int)) * memset(fmargin, 0, V_F*sizeof(int)) * memset(emargin, 0, V_E*sizeof(int)) # <<<<<<<<<<<<<< @@ -14311,25 +14311,25 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ memset(__pyx_v_emargin, 0, (__pyx_v_V_E * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":101 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":101 * memset(emargin, 0, V_E*sizeof(int)) * * dict = <_node**> malloc(V_F*sizeof(_node*)) # <<<<<<<<<<<<<< * memset(dict, 0, V_F*sizeof(_node*)) * */ - __pyx_v_dict = ((struct __pyx_t_3_sa__node **)malloc((__pyx_v_V_F * (sizeof(struct __pyx_t_3_sa__node *))))); + __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 *))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":102 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":102 * * dict = <_node**> malloc(V_F*sizeof(_node*)) * memset(dict, 0, V_F*sizeof(_node*)) # <<<<<<<<<<<<<< * * num_sents = len(fsa.darray.sent_index) */ - memset(__pyx_v_dict, 0, (__pyx_v_V_F * (sizeof(struct __pyx_t_3_sa__node *)))); + memset(__pyx_v_dict, 0, (__pyx_v_V_F * (sizeof(struct __pyx_t_4cdec_2sa_3_sa__node *)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":104 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":104 * memset(dict, 0, V_F*sizeof(_node*)) * * num_sents = len(fsa.darray.sent_index) # <<<<<<<<<<<<<< @@ -14345,7 +14345,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_v_num_sents = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":105 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":105 * * num_sents = len(fsa.darray.sent_index) * for sent_id from 0 <= sent_id < num_sents-1: # <<<<<<<<<<<<<< @@ -14358,7 +14358,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (__pyx_v_sent_id = 0; __pyx_v_sent_id < __pyx_t_6; __pyx_v_sent_id++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":107 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":107 * for sent_id from 0 <= sent_id < num_sents-1: * * fsent = fsa.darray.data.arr + fsa.darray.sent_index.arr[sent_id] # <<<<<<<<<<<<<< @@ -14367,7 +14367,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_fsent = (__pyx_v_fsa->darray->data->arr + (__pyx_v_fsa->darray->sent_index->arr[__pyx_v_sent_id])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":108 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":108 * * 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 # <<<<<<<<<<<<<< @@ -14376,7 +14376,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":109 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":109 * 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 = malloc(I*sizeof(int)) # <<<<<<<<<<<<<< @@ -14385,7 +14385,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_faligned = ((int *)malloc((__pyx_v_I * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":110 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":110 * I = fsa.darray.sent_index.arr[sent_id+1] - fsa.darray.sent_index.arr[sent_id] - 1 * faligned = malloc(I*sizeof(int)) * memset(faligned, 0, I*sizeof(int)) # <<<<<<<<<<<<<< @@ -14394,7 +14394,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ memset(__pyx_v_faligned, 0, (__pyx_v_I * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":112 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":112 * memset(faligned, 0, I*sizeof(int)) * * esent = eda.data.arr + eda.sent_index.arr[sent_id] # <<<<<<<<<<<<<< @@ -14403,7 +14403,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_esent = (__pyx_v_eda->data->arr + (__pyx_v_eda->sent_index->arr[__pyx_v_sent_id])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":113 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":113 * * 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 # <<<<<<<<<<<<<< @@ -14412,7 +14412,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":114 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":114 * 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 = malloc(J*sizeof(int)) # <<<<<<<<<<<<<< @@ -14421,7 +14421,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_ealigned = ((int *)malloc((__pyx_v_J * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":115 * J = eda.sent_index.arr[sent_id+1] - eda.sent_index.arr[sent_id] - 1 * ealigned = malloc(J*sizeof(int)) * memset(ealigned, 0, J*sizeof(int)) # <<<<<<<<<<<<<< @@ -14430,16 +14430,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ memset(__pyx_v_ealigned, 0, (__pyx_v_J * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":117 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":117 * memset(ealigned, 0, J*sizeof(int)) * * links = aa._get_sent_links(sent_id, &num_links) # <<<<<<<<<<<<<< * * for l from 0 <= l < num_links: */ - __pyx_v_links = ((struct __pyx_vtabstruct_3_sa_Alignment *)__pyx_v_aa->__pyx_vtab)->_get_sent_links(__pyx_v_aa, __pyx_v_sent_id, (&__pyx_v_num_links)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":119 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":119 * links = aa._get_sent_links(sent_id, &num_links) * * for l from 0 <= l < num_links: # <<<<<<<<<<<<<< @@ -14449,7 +14449,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_7 = __pyx_v_num_links; for (__pyx_v_l = 0; __pyx_v_l < __pyx_t_7; __pyx_v_l++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":120 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":120 * * for l from 0 <= l < num_links: * i = links[l*2] # <<<<<<<<<<<<<< @@ -14458,7 +14458,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_i = (__pyx_v_links[(__pyx_v_l * 2)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":121 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":121 * for l from 0 <= l < num_links: * i = links[l*2] * j = links[l*2+1] # <<<<<<<<<<<<<< @@ -14467,7 +14467,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_j = (__pyx_v_links[((__pyx_v_l * 2) + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":122 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":122 * i = links[l*2] * j = links[l*2+1] * if i >= I or j >= J: # <<<<<<<<<<<<<< @@ -14483,7 +14483,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":123 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":123 * 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)) # <<<<<<<<<<<<<< @@ -14535,7 +14535,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __pyx_L15:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":124 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":124 * 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] # <<<<<<<<<<<<<< @@ -14544,7 +14544,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_f_i = (__pyx_v_fsent[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":125 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":125 * 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] # <<<<<<<<<<<<<< @@ -14553,7 +14553,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_e_j = (__pyx_v_esent[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":126 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":126 * f_i = fsent[i] * e_j = esent[j] * fmargin[f_i] = fmargin[f_i]+1 # <<<<<<<<<<<<<< @@ -14562,7 +14562,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_fmargin[__pyx_v_f_i]) = ((__pyx_v_fmargin[__pyx_v_f_i]) + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":127 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":127 * e_j = esent[j] * fmargin[f_i] = fmargin[f_i]+1 * emargin[e_j] = emargin[e_j]+1 # <<<<<<<<<<<<<< @@ -14571,7 +14571,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_emargin[__pyx_v_e_j]) = ((__pyx_v_emargin[__pyx_v_e_j]) + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":128 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":128 * fmargin[f_i] = fmargin[f_i]+1 * emargin[e_j] = emargin[e_j]+1 * if dict[f_i] == NULL: # <<<<<<<<<<<<<< @@ -14581,16 +14581,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = (((__pyx_v_dict[__pyx_v_f_i]) == NULL) != 0); if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":129 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":129 * emargin[e_j] = emargin[e_j]+1 * if dict[f_i] == NULL: * dict[f_i] = new_node(e_j) # <<<<<<<<<<<<<< * dict[f_i].val = 1 * num_pairs = num_pairs + 1 */ - (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_3_sa_new_node(__pyx_v_e_j); + (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_e_j); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":130 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":130 * if dict[f_i] == NULL: * dict[f_i] = new_node(e_j) * dict[f_i].val = 1 # <<<<<<<<<<<<<< @@ -14599,7 +14599,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_dict[__pyx_v_f_i])->val = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":131 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":131 * dict[f_i] = new_node(e_j) * dict[f_i].val = 1 * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -14611,16 +14611,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":133 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":133 * num_pairs = num_pairs + 1 * else: * count = get_val(dict[f_i], e_j) # <<<<<<<<<<<<<< * if count[0] == 0: * num_pairs = num_pairs + 1 */ - __pyx_v_count = __pyx_f_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_e_j); + __pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_e_j); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":134 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":134 * else: * count = get_val(dict[f_i], e_j) * if count[0] == 0: # <<<<<<<<<<<<<< @@ -14630,7 +14630,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = (((__pyx_v_count[0]) == 0) != 0); if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":135 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":135 * count = get_val(dict[f_i], e_j) * if count[0] == 0: * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -14642,7 +14642,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __pyx_L17:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":136 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":136 * if count[0] == 0: * num_pairs = num_pairs + 1 * count[0] = count[0] + 1 # <<<<<<<<<<<<<< @@ -14653,7 +14653,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __pyx_L16:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":138 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":138 * count[0] = count[0] + 1 * # add count * faligned[i] = 1 # <<<<<<<<<<<<<< @@ -14662,7 +14662,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_faligned[__pyx_v_i]) = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":139 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":139 * # add count * faligned[i] = 1 * ealigned[j] = 1 # <<<<<<<<<<<<<< @@ -14672,7 +14672,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL (__pyx_v_ealigned[__pyx_v_j]) = 1; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":140 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":140 * faligned[i] = 1 * ealigned[j] = 1 * for i from 0 <= i < I: # <<<<<<<<<<<<<< @@ -14682,7 +14682,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_7 = __pyx_v_I; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":141 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":141 * ealigned[j] = 1 * for i from 0 <= i < I: * if faligned[i] == 0: # <<<<<<<<<<<<<< @@ -14692,7 +14692,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = (((__pyx_v_faligned[__pyx_v_i]) == 0) != 0); if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":142 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":142 * for i from 0 <= i < I: * if faligned[i] == 0: * f_i = fsent[i] # <<<<<<<<<<<<<< @@ -14701,7 +14701,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_f_i = (__pyx_v_fsent[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":143 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":143 * if faligned[i] == 0: * f_i = fsent[i] * fmargin[f_i] = fmargin[f_i] + 1 # <<<<<<<<<<<<<< @@ -14710,7 +14710,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_fmargin[__pyx_v_f_i]) = ((__pyx_v_fmargin[__pyx_v_f_i]) + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":144 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":144 * f_i = fsent[i] * fmargin[f_i] = fmargin[f_i] + 1 * emargin[null_word] = emargin[null_word] + 1 # <<<<<<<<<<<<<< @@ -14719,7 +14719,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_emargin[__pyx_v_null_word]) = ((__pyx_v_emargin[__pyx_v_null_word]) + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":145 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":145 * fmargin[f_i] = fmargin[f_i] + 1 * emargin[null_word] = emargin[null_word] + 1 * if dict[f_i] == NULL: # <<<<<<<<<<<<<< @@ -14729,16 +14729,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = (((__pyx_v_dict[__pyx_v_f_i]) == NULL) != 0); if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":146 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":146 * emargin[null_word] = emargin[null_word] + 1 * if dict[f_i] == NULL: * dict[f_i] = new_node(null_word) # <<<<<<<<<<<<<< * dict[f_i].val = 1 * num_pairs = num_pairs + 1 */ - (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_3_sa_new_node(__pyx_v_null_word); + (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_null_word); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":147 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":147 * if dict[f_i] == NULL: * dict[f_i] = new_node(null_word) * dict[f_i].val = 1 # <<<<<<<<<<<<<< @@ -14747,7 +14747,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_dict[__pyx_v_f_i])->val = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":148 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":148 * dict[f_i] = new_node(null_word) * dict[f_i].val = 1 * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -14759,16 +14759,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":150 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":150 * num_pairs = num_pairs + 1 * else: * count = get_val(dict[f_i], null_word) # <<<<<<<<<<<<<< * if count[0] == 0: * num_pairs = num_pairs + 1 */ - __pyx_v_count = __pyx_f_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_null_word); + __pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_null_word); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":151 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":151 * else: * count = get_val(dict[f_i], null_word) * if count[0] == 0: # <<<<<<<<<<<<<< @@ -14778,7 +14778,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = (((__pyx_v_count[0]) == 0) != 0); if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":152 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":152 * count = get_val(dict[f_i], null_word) * if count[0] == 0: * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -14790,7 +14790,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __pyx_L22:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":153 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":153 * if count[0] == 0: * num_pairs = num_pairs + 1 * count[0] = count[0] + 1 # <<<<<<<<<<<<<< @@ -14805,7 +14805,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_L20:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":154 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":154 * num_pairs = num_pairs + 1 * count[0] = count[0] + 1 * for j from 0 <= j < J: # <<<<<<<<<<<<<< @@ -14815,7 +14815,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_7 = __pyx_v_J; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_7; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":155 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":155 * count[0] = count[0] + 1 * for j from 0 <= j < J: * if ealigned[j] == 0: # <<<<<<<<<<<<<< @@ -14825,7 +14825,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = (((__pyx_v_ealigned[__pyx_v_j]) == 0) != 0); if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":156 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":156 * for j from 0 <= j < J: * if ealigned[j] == 0: * e_j = esent[j] # <<<<<<<<<<<<<< @@ -14834,7 +14834,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_e_j = (__pyx_v_esent[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":157 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":157 * if ealigned[j] == 0: * e_j = esent[j] * fmargin[null_word] = fmargin[null_word] + 1 # <<<<<<<<<<<<<< @@ -14843,7 +14843,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_fmargin[__pyx_v_null_word]) = ((__pyx_v_fmargin[__pyx_v_null_word]) + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":158 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":158 * e_j = esent[j] * fmargin[null_word] = fmargin[null_word] + 1 * emargin[e_j] = emargin[e_j] + 1 # <<<<<<<<<<<<<< @@ -14852,7 +14852,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_emargin[__pyx_v_e_j]) = ((__pyx_v_emargin[__pyx_v_e_j]) + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":159 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":159 * fmargin[null_word] = fmargin[null_word] + 1 * emargin[e_j] = emargin[e_j] + 1 * if dict[null_word] == NULL: # <<<<<<<<<<<<<< @@ -14862,16 +14862,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = (((__pyx_v_dict[__pyx_v_null_word]) == NULL) != 0); if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":160 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":160 * emargin[e_j] = emargin[e_j] + 1 * if dict[null_word] == NULL: * dict[null_word] = new_node(e_j) # <<<<<<<<<<<<<< * dict[null_word].val = 1 * num_pairs = num_pairs + 1 */ - (__pyx_v_dict[__pyx_v_null_word]) = __pyx_f_3_sa_new_node(__pyx_v_e_j); + (__pyx_v_dict[__pyx_v_null_word]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_e_j); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":161 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":161 * if dict[null_word] == NULL: * dict[null_word] = new_node(e_j) * dict[null_word].val = 1 # <<<<<<<<<<<<<< @@ -14880,7 +14880,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ (__pyx_v_dict[__pyx_v_null_word])->val = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":162 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":162 * dict[null_word] = new_node(e_j) * dict[null_word].val = 1 * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -14892,16 +14892,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":164 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":164 * num_pairs = num_pairs + 1 * else: * count = get_val(dict[null_word], e_j) # <<<<<<<<<<<<<< * if count[0] == 0: * num_pairs = num_pairs + 1 */ - __pyx_v_count = __pyx_f_3_sa_get_val((__pyx_v_dict[__pyx_v_null_word]), __pyx_v_e_j); + __pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_null_word]), __pyx_v_e_j); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":165 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":165 * else: * count = get_val(dict[null_word], e_j) * if count[0] == 0: # <<<<<<<<<<<<<< @@ -14911,7 +14911,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = (((__pyx_v_count[0]) == 0) != 0); if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":166 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":166 * count = get_val(dict[null_word], e_j) * if count[0] == 0: * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< @@ -14923,7 +14923,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL } __pyx_L27:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":167 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":167 * if count[0] == 0: * num_pairs = num_pairs + 1 * count[0] = count[0] + 1 # <<<<<<<<<<<<<< @@ -14938,7 +14938,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_L25:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":168 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":168 * num_pairs = num_pairs + 1 * count[0] = count[0] + 1 * free(links) # <<<<<<<<<<<<<< @@ -14947,7 +14947,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ free(__pyx_v_links); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":169 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":169 * count[0] = count[0] + 1 * free(links) * free(faligned) # <<<<<<<<<<<<<< @@ -14956,7 +14956,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ free(__pyx_v_faligned); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":170 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":170 * free(links) * free(faligned) * free(ealigned) # <<<<<<<<<<<<<< @@ -14966,7 +14966,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL free(__pyx_v_ealigned); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":171 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":171 * free(faligned) * free(ealigned) * self.f_index = IntList(initial_len=V_F) # <<<<<<<<<<<<<< @@ -14979,16 +14979,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__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_3_sa_IntList *)__pyx_t_13); + __pyx_v_self->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_13); __pyx_t_13 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":172 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":172 * free(ealigned) * self.f_index = IntList(initial_len=V_F) * self.e_index = IntList(initial_len=num_pairs) # <<<<<<<<<<<<<< @@ -15001,16 +15001,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_GOTREF(__pyx_t_12); if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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_3_sa_IntList *)__pyx_t_12); + __pyx_v_self->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":173 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":173 * self.f_index = IntList(initial_len=V_F) * self.e_index = IntList(initial_len=num_pairs) * self.col1 = FloatList(initial_len=num_pairs) # <<<<<<<<<<<<<< @@ -15023,16 +15023,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__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_3_sa_FloatList *)__pyx_t_13); + __pyx_v_self->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_13); __pyx_t_13 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":174 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":174 * self.e_index = IntList(initial_len=num_pairs) * self.col1 = FloatList(initial_len=num_pairs) * self.col2 = FloatList(initial_len=num_pairs) # <<<<<<<<<<<<<< @@ -15045,16 +15045,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_GOTREF(__pyx_t_12); if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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_3_sa_FloatList *)__pyx_t_12); + __pyx_v_self->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":176 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":176 * self.col2 = FloatList(initial_len=num_pairs) * * num_pairs = 0 # <<<<<<<<<<<<<< @@ -15063,7 +15063,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ __pyx_v_num_pairs = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":177 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":177 * * num_pairs = 0 * for i from 0 <= i < V_F: # <<<<<<<<<<<<<< @@ -15073,16 +15073,16 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_6 = __pyx_v_V_F; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":179 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":179 * for i from 0 <= i < V_F: * #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) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->set(__pyx_v_self->f_index, __pyx_v_i, __pyx_v_num_pairs); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":180 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":180 * #self.f_index[i] = num_pairs * self.f_index.set(i, num_pairs) * if dict[i] != NULL: # <<<<<<<<<<<<<< @@ -15092,25 +15092,25 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_t_10 = (((__pyx_v_dict[__pyx_v_i]) != NULL) != 0); if (__pyx_t_10) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":181 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":181 * 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_12 = ((struct __pyx_vtabstruct_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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":182 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":182 * 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_12 = __pyx_f_3_sa_del_node((__pyx_v_dict[__pyx_v_i])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L30; @@ -15118,7 +15118,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __pyx_L30:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":183 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":183 * self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin) * del_node(dict[i]) * free(fmargin) # <<<<<<<<<<<<<< @@ -15127,7 +15127,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ free(__pyx_v_fmargin); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":184 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":184 * del_node(dict[i]) * free(fmargin) * free(emargin) # <<<<<<<<<<<<<< @@ -15136,7 +15136,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ free(__pyx_v_emargin); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":185 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":185 * free(fmargin) * free(emargin) * free(dict) # <<<<<<<<<<<<<< @@ -15145,7 +15145,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL */ free(__pyx_v_dict); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":186 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":186 * free(emargin) * free(dict) * return # <<<<<<<<<<<<<< @@ -15165,7 +15165,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("_sa.BiLex.compute_from_data", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.compute_from_data", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_word); @@ -15176,7 +15176,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":189 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":189 * * * cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin): # <<<<<<<<<<<<<< @@ -15184,7 +15184,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_compute_from_data(struct __pyx_obj_3_sa_BiL * if n.smaller != NULL: */ -static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, struct __pyx_t_3_sa__node *__pyx_v_n, int *__pyx_v_num_pairs, float __pyx_v_fmargin, int *__pyx_v_emargin) { +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) { int __pyx_v_loc; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15195,7 +15195,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_add_node", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":191 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":191 * cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin): * cdef int loc * if n.smaller != NULL: # <<<<<<<<<<<<<< @@ -15205,21 +15205,21 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py __pyx_t_1 = ((__pyx_v_n->smaller != NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":192 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":192 * 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_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 = 192; __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:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":193 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":193 * if n.smaller != NULL: * self._add_node(n.smaller, num_pairs, fmargin, emargin) * loc = num_pairs[0] # <<<<<<<<<<<<<< @@ -15228,16 +15228,16 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py */ __pyx_v_loc = (__pyx_v_num_pairs[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":194 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":194 * self._add_node(n.smaller, num_pairs, fmargin, emargin) * loc = num_pairs[0] * 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])) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->set(__pyx_v_self->e_index, __pyx_v_loc, __pyx_v_n->key); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":195 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":195 * loc = num_pairs[0] * self.e_index.set(loc, n.key) * self.col1.set(loc, float(n.val)/fmargin) # <<<<<<<<<<<<<< @@ -15254,9 +15254,9 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py #endif {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - ((struct __pyx_vtabstruct_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)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":196 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":196 * 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])) # <<<<<<<<<<<<<< @@ -15273,9 +15273,9 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py #endif {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - ((struct __pyx_vtabstruct_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])))); + ((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])))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":197 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":197 * self.col1.set(loc, float(n.val)/fmargin) * self.col2.set(loc, float(n.val)/float(emargin[n.key])) * num_pairs[0] = loc + 1 # <<<<<<<<<<<<<< @@ -15284,7 +15284,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py */ (__pyx_v_num_pairs[0]) = (__pyx_v_loc + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":198 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":198 * self.col2.set(loc, float(n.val)/float(emargin[n.key])) * num_pairs[0] = loc + 1 * if n.bigger != NULL: # <<<<<<<<<<<<<< @@ -15294,14 +15294,14 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py __pyx_t_1 = ((__pyx_v_n->bigger != NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":199 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":199 * num_pairs[0] = loc + 1 * if n.bigger != NULL: * self._add_node(n.bigger, num_pairs, fmargin, emargin) # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_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 = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L4; @@ -15312,7 +15312,7 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.BiLex._add_node", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex._add_node", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -15321,8 +15321,8 @@ static PyObject *__pyx_f_3_sa_5BiLex__add_node(struct __pyx_obj_3_sa_BiLex *__py } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -15335,16 +15335,16 @@ static PyObject *__pyx_pw_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyOb } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_5BiLex_2write_binary(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":202 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":202 * * * def write_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -15352,7 +15352,7 @@ static PyObject *__pyx_pw_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyOb * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15363,7 +15363,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_binary", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":204 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":204 * def write_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -15372,43 +15372,43 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":205 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":205 * cdef FILE* f * f = fopen(filename, "w") * self.f_index.write_handle(f) # <<<<<<<<<<<<<< * self.e_index.write_handle(f) * self.col1.write_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->write_handle(__pyx_v_self->f_index, __pyx_v_f); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":206 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":206 * f = fopen(filename, "w") * self.f_index.write_handle(f) * self.e_index.write_handle(f) # <<<<<<<<<<<<<< * self.col1.write_handle(f) * self.col2.write_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->write_handle(__pyx_v_self->e_index, __pyx_v_f); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":207 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":207 * self.f_index.write_handle(f) * self.e_index.write_handle(f) * self.col1.write_handle(f) # <<<<<<<<<<<<<< * self.col2.write_handle(f) * self.write_wordlist(self.id2fword, f) */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->write_handle(__pyx_v_self->col1, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->write_handle(__pyx_v_self->col1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":208 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":208 * self.e_index.write_handle(f) * self.col1.write_handle(f) * self.col2.write_handle(f) # <<<<<<<<<<<<<< * self.write_wordlist(self.id2fword, f) * self.write_wordlist(self.id2eword, f) */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->write_handle(__pyx_v_self->col2, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->write_handle(__pyx_v_self->col2, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":209 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":209 * self.col1.write_handle(f) * self.col2.write_handle(f) * self.write_wordlist(self.id2fword, f) # <<<<<<<<<<<<<< @@ -15417,12 +15417,12 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex */ __pyx_t_1 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_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 = 209; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":210 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":210 * self.col2.write_handle(f) * self.write_wordlist(self.id2fword, f) * self.write_wordlist(self.id2eword, f) # <<<<<<<<<<<<<< @@ -15431,12 +15431,12 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex */ __pyx_t_2 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_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 = 210; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":211 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":211 * self.write_wordlist(self.id2fword, f) * self.write_wordlist(self.id2eword, f) * fclose(f) # <<<<<<<<<<<<<< @@ -15450,7 +15450,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -15458,7 +15458,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":214 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":214 * * * cdef write_wordlist(self, wordlist, FILE* f): # <<<<<<<<<<<<<< @@ -15466,7 +15466,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_2write_binary(struct __pyx_obj_3_sa_BiLex * cdef int num_words */ -static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_wordlist, FILE *__pyx_v_f) { +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) { int __pyx_v_word_len; int __pyx_v_num_words; PyObject *__pyx_v_word = NULL; @@ -15483,7 +15483,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_wordlist", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":218 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":218 * cdef int num_words * * num_words = len(wordlist) # <<<<<<<<<<<<<< @@ -15493,7 +15493,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_o __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_v_num_words = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":219 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":219 * * num_words = len(wordlist) * fwrite(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -15502,7 +15502,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_o */ fwrite((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":220 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":220 * num_words = len(wordlist) * fwrite(&(num_words), sizeof(int), 1, f) * for word in wordlist: # <<<<<<<<<<<<<< @@ -15547,7 +15547,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_o __pyx_v_word = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":221 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":221 * fwrite(&(num_words), sizeof(int), 1, f) * for word in wordlist: * word_len = len(word) + 1 # <<<<<<<<<<<<<< @@ -15557,7 +15557,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_o __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_v_word_len = (__pyx_t_5 + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":222 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":222 * for word in wordlist: * word_len = len(word) + 1 * fwrite(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -15566,7 +15566,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_o */ fwrite((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":223 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":223 * word_len = len(word) + 1 * fwrite(&(word_len), sizeof(int), 1, f) * fwrite(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< @@ -15583,7 +15583,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_o __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.BiLex.write_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_word); @@ -15592,7 +15592,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_o return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":226 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":226 * * * cdef read_wordlist(self, word2id, id2word, FILE* f): # <<<<<<<<<<<<<< @@ -15600,7 +15600,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_write_wordlist(CYTHON_UNUSED struct __pyx_o * cdef int word_len */ -static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_word2id, PyObject *__pyx_v_id2word, FILE *__pyx_v_f) { +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) { int __pyx_v_num_words; int __pyx_v_word_len; char *__pyx_v_word; @@ -15616,7 +15616,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_wordlist", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":231 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":231 * cdef char* word * * fread(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -15625,7 +15625,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_ob */ fread((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":232 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":232 * * fread(&(num_words), sizeof(int), 1, f) * for i from 0 <= i < num_words: # <<<<<<<<<<<<<< @@ -15635,7 +15635,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_ob __pyx_t_1 = __pyx_v_num_words; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":233 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":233 * fread(&(num_words), sizeof(int), 1, f) * for i from 0 <= i < num_words: * fread(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -15644,7 +15644,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_ob */ fread((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":234 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":234 * for i from 0 <= i < num_words: * fread(&(word_len), sizeof(int), 1, f) * word = malloc (word_len * sizeof(char)) # <<<<<<<<<<<<<< @@ -15653,7 +15653,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_ob */ __pyx_v_word = ((char *)malloc((__pyx_v_word_len * (sizeof(char))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":235 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":235 * fread(&(word_len), sizeof(int), 1, f) * word = malloc (word_len * sizeof(char)) * fread(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< @@ -15662,7 +15662,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_ob */ fread(__pyx_v_word, (sizeof(char)), __pyx_v_word_len, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":236 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":236 * word = malloc (word_len * sizeof(char)) * fread(word, sizeof(char), word_len, f) * word2id[word] = len(id2word) # <<<<<<<<<<<<<< @@ -15678,7 +15678,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_ob __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":237 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":237 * fread(word, sizeof(char), word_len, f) * word2id[word] = len(id2word) * id2word.append(word) # <<<<<<<<<<<<<< @@ -15692,7 +15692,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_ob __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":238 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":238 * word2id[word] = len(id2word) * id2word.append(word) * free(word) # <<<<<<<<<<<<<< @@ -15707,7 +15707,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_ob __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.BiLex.read_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -15716,8 +15716,8 @@ static PyObject *__pyx_f_3_sa_5BiLex_read_wordlist(CYTHON_UNUSED struct __pyx_ob } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -15730,16 +15730,16 @@ static PyObject *__pyx_pw_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_5BiLex_4read_binary(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":240 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":240 * free(word) * * def read_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -15747,7 +15747,7 @@ static PyObject *__pyx_pw_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObj * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15759,7 +15759,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_binary", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":242 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":242 * def read_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -15768,43 +15768,43 @@ static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex * */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":243 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":243 * cdef FILE* f * f = fopen(filename, "r") * self.f_index.read_handle(f) # <<<<<<<<<<<<<< * self.e_index.read_handle(f) * self.col1.read_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->f_index->__pyx_vtab)->read_handle(__pyx_v_self->f_index, __pyx_v_f); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":244 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":244 * f = fopen(filename, "r") * self.f_index.read_handle(f) * self.e_index.read_handle(f) # <<<<<<<<<<<<<< * self.col1.read_handle(f) * self.col2.read_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->e_index->__pyx_vtab)->read_handle(__pyx_v_self->e_index, __pyx_v_f); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":245 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":245 * self.f_index.read_handle(f) * self.e_index.read_handle(f) * self.col1.read_handle(f) # <<<<<<<<<<<<<< * self.col2.read_handle(f) * self.read_wordlist(self.fword2id, self.id2fword, f) */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->read_handle(__pyx_v_self->col1, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->read_handle(__pyx_v_self->col1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":246 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":246 * self.e_index.read_handle(f) * self.col1.read_handle(f) * self.col2.read_handle(f) # <<<<<<<<<<<<<< * self.read_wordlist(self.fword2id, self.id2fword, f) * self.read_wordlist(self.eword2id, self.id2eword, f) */ - ((struct __pyx_vtabstruct_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->read_handle(__pyx_v_self->col2, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->read_handle(__pyx_v_self->col2, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":247 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":247 * self.col1.read_handle(f) * self.col2.read_handle(f) * self.read_wordlist(self.fword2id, self.id2fword, f) # <<<<<<<<<<<<<< @@ -15815,13 +15815,13 @@ static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex * __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_v_self->id2fword; __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((struct __pyx_vtabstruct_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 = 247; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":248 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":248 * self.col2.read_handle(f) * self.read_wordlist(self.fword2id, self.id2fword, f) * self.read_wordlist(self.eword2id, self.id2eword, f) # <<<<<<<<<<<<<< @@ -15832,13 +15832,13 @@ static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex * __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = __pyx_v_self->id2eword; __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_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 = 248; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":249 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":249 * self.read_wordlist(self.fword2id, self.id2fword, f) * self.read_wordlist(self.eword2id, self.id2eword, f) * fclose(f) # <<<<<<<<<<<<<< @@ -15853,7 +15853,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex * __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -15862,17 +15862,17 @@ static PyObject *__pyx_pf_3_sa_5BiLex_4read_binary(struct __pyx_obj_3_sa_BiLex * } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword); /*proto*/ -static PyObject *__pyx_pw_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_e_id (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_5BiLex_6get_e_id(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_eword)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_eword)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":252 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":252 * * * def get_e_id(self, eword): # <<<<<<<<<<<<<< @@ -15880,7 +15880,7 @@ static PyObject *__pyx_pw_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject * e_id = len(self.id2eword) */ -static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword) { PyObject *__pyx_v_e_id = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15893,7 +15893,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_e_id", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":253 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":253 * * def get_e_id(self, eword): * if eword not in self.eword2id: # <<<<<<<<<<<<<< @@ -15904,7 +15904,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__p __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":254 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":254 * def get_e_id(self, eword): * if eword not in self.eword2id: * e_id = len(self.id2eword) # <<<<<<<<<<<<<< @@ -15920,7 +15920,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__p __pyx_v_e_id = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":255 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":255 * if eword not in self.eword2id: * e_id = len(self.id2eword) * self.id2eword.append(eword) # <<<<<<<<<<<<<< @@ -15931,7 +15931,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__p __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":256 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":256 * e_id = len(self.id2eword) * self.id2eword.append(eword) * self.eword2id[eword] = e_id # <<<<<<<<<<<<<< @@ -15943,7 +15943,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__p } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":257 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":257 * self.id2eword.append(eword) * self.eword2id[eword] = e_id * return self.eword2id[eword] # <<<<<<<<<<<<<< @@ -15961,7 +15961,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.BiLex.get_e_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_e_id", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e_id); @@ -15971,17 +15971,17 @@ static PyObject *__pyx_pf_3_sa_5BiLex_6get_e_id(struct __pyx_obj_3_sa_BiLex *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword); /*proto*/ -static PyObject *__pyx_pw_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_f_id (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_5BiLex_8get_f_id(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_fword)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_fword)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":260 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":260 * * * def get_f_id(self, fword): # <<<<<<<<<<<<<< @@ -15989,7 +15989,7 @@ static PyObject *__pyx_pw_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject * f_id = len(self.id2fword) */ -static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword) { PyObject *__pyx_v_f_id = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -16002,7 +16002,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_f_id", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":261 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":261 * * def get_f_id(self, fword): * if fword not in self.fword2id: # <<<<<<<<<<<<<< @@ -16013,7 +16013,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__p __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":262 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":262 * def get_f_id(self, fword): * if fword not in self.fword2id: * f_id = len(self.id2fword) # <<<<<<<<<<<<<< @@ -16029,7 +16029,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__p __pyx_v_f_id = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":263 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":263 * if fword not in self.fword2id: * f_id = len(self.id2fword) * self.id2fword.append(fword) # <<<<<<<<<<<<<< @@ -16040,7 +16040,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__p __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":264 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":264 * f_id = len(self.id2fword) * self.id2fword.append(fword) * self.fword2id[fword] = f_id # <<<<<<<<<<<<<< @@ -16052,7 +16052,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__p } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":265 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":265 * self.id2fword.append(fword) * self.fword2id[fword] = f_id * return self.fword2id[fword] # <<<<<<<<<<<<<< @@ -16070,7 +16070,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.BiLex.get_f_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_f_id", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f_id); @@ -16080,8 +16080,8 @@ static PyObject *__pyx_pf_3_sa_5BiLex_8get_f_id(struct __pyx_obj_3_sa_BiLex *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -16094,16 +16094,16 @@ static PyObject *__pyx_pw_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_5BiLex_10read_text(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":268 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":268 * * * def read_text(self, char* filename): # <<<<<<<<<<<<<< @@ -16111,14 +16111,14 @@ static PyObject *__pyx_pw_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObje * cdef IntList fcount */ -static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_i = 0; PyObject *__pyx_v_j = 0; PyObject *__pyx_v_e_id = 0; PyObject *__pyx_v_f_id = 0; PyObject *__pyx_v_n_f = 0; PyObject *__pyx_v_N = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_fcount = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_fcount = 0; PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_line = NULL; PyObject *__pyx_v_fword = NULL; @@ -16158,19 +16158,19 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_text", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":272 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":272 * cdef IntList fcount * * fcount = IntList() # <<<<<<<<<<<<<< * with gzip_or_text(filename) as f: * # first loop merely establishes size of array objects */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_fcount = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_fcount = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":273 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273 * * fcount = IntList() * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -16210,7 +16210,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_f = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":275 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":275 * with gzip_or_text(filename) as f: * # first loop merely establishes size of array objects * for line in f: # <<<<<<<<<<<<<< @@ -16255,7 +16255,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_line = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":276 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":276 * # first loop merely establishes size of array objects * for line in f: * (fword, eword, score1, score2) = line.split() # <<<<<<<<<<<<<< @@ -16342,7 +16342,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_score2 = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":277 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":277 * for line in f: * (fword, eword, score1, score2) = line.split() * f_id = self.get_f_id(fword) # <<<<<<<<<<<<<< @@ -16364,7 +16364,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_f_id = __pyx_t_11; __pyx_t_11 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":278 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":278 * (fword, eword, score1, score2) = line.split() * f_id = self.get_f_id(fword) * e_id = self.get_e_id(eword) # <<<<<<<<<<<<<< @@ -16386,7 +16386,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_e_id = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":279 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":279 * f_id = self.get_f_id(fword) * e_id = self.get_e_id(eword) * while f_id >= len(fcount): # <<<<<<<<<<<<<< @@ -16403,7 +16403,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (!__pyx_t_16) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":280 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":280 * e_id = self.get_e_id(eword) * while f_id >= len(fcount): * fcount.append(0) # <<<<<<<<<<<<<< @@ -16415,7 +16415,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":281 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":281 * while f_id >= len(fcount): * fcount.append(0) * fcount.arr[f_id] = fcount.arr[f_id] + 1 # <<<<<<<<<<<<<< @@ -16428,7 +16428,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":284 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":284 * * # Allocate space for dictionary in arrays * N = 0 # <<<<<<<<<<<<<< @@ -16438,7 +16438,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __Pyx_INCREF(__pyx_int_0); __pyx_v_N = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":285 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":285 * # Allocate space for dictionary in arrays * N = 0 * n_f = len(fcount) # <<<<<<<<<<<<<< @@ -16451,7 +16451,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_n_f = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":286 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":286 * N = 0 * n_f = len(fcount) * self.f_index = IntList(initial_len=n_f+1) # <<<<<<<<<<<<<< @@ -16464,16 +16464,16 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __Pyx_GOTREF(__pyx_t_12); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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_3_sa_IntList *)__pyx_t_12); + __pyx_v_self->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":287 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":287 * n_f = len(fcount) * self.f_index = IntList(initial_len=n_f+1) * for i from 0 <= i < n_f: # <<<<<<<<<<<<<< @@ -16488,7 +16488,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_i = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":288 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":288 * self.f_index = IntList(initial_len=n_f+1) * for i from 0 <= i < n_f: * self.f_index.arr[i] = N # <<<<<<<<<<<<<< @@ -16499,7 +16499,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __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 = 288; __pyx_clineno = __LINE__; goto __pyx_L7_error;} (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_20; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":289 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":289 * for i from 0 <= i < n_f: * self.f_index.arr[i] = N * N = N + fcount.arr[i] # <<<<<<<<<<<<<< @@ -16516,7 +16516,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_N = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":290 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":290 * self.f_index.arr[i] = N * N = N + fcount.arr[i] * fcount.arr[i] = 0 # <<<<<<<<<<<<<< @@ -16528,7 +16528,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":287 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":287 * n_f = len(fcount) * self.f_index = IntList(initial_len=n_f+1) * for i from 0 <= i < n_f: # <<<<<<<<<<<<<< @@ -16541,7 +16541,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":291 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":291 * N = N + fcount.arr[i] * fcount.arr[i] = 0 * self.f_index.arr[n_f] = N # <<<<<<<<<<<<<< @@ -16552,7 +16552,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __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 = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;} (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_20; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":292 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":292 * fcount.arr[i] = 0 * self.f_index.arr[n_f] = N * self.e_index = IntList(initial_len=N) # <<<<<<<<<<<<<< @@ -16562,16 +16562,16 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); 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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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_3_sa_IntList *)__pyx_t_12); + __pyx_v_self->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":293 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":293 * self.f_index.arr[n_f] = N * self.e_index = IntList(initial_len=N) * self.col1 = FloatList(initial_len=N) # <<<<<<<<<<<<<< @@ -16581,16 +16581,16 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); 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(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->col1); __Pyx_DECREF(((PyObject *)__pyx_v_self->col1)); - __pyx_v_self->col1 = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_1); + __pyx_v_self->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":294 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":294 * self.e_index = IntList(initial_len=N) * self.col1 = FloatList(initial_len=N) * self.col2 = FloatList(initial_len=N) # <<<<<<<<<<<<<< @@ -16600,16 +16600,16 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __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(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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_3_sa_FloatList *)__pyx_t_12); + __pyx_v_self->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":297 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":297 * * # Re-read file, placing words into buckets * f.seek(0) # <<<<<<<<<<<<<< @@ -16623,7 +16623,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":298 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":298 * # Re-read file, placing words into buckets * f.seek(0) * for line in f: # <<<<<<<<<<<<<< @@ -16668,7 +16668,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_line = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":299 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":299 * f.seek(0) * for line in f: * (fword, eword, score1, score2) = line.split() # <<<<<<<<<<<<<< @@ -16755,7 +16755,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_score2 = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":300 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":300 * for line in f: * (fword, eword, score1, score2) = line.split() * f_id = self.get_f_id(fword) # <<<<<<<<<<<<<< @@ -16777,7 +16777,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_f_id = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":301 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":301 * (fword, eword, score1, score2) = line.split() * f_id = self.get_f_id(fword) * e_id = self.get_e_id(eword) # <<<<<<<<<<<<<< @@ -16799,7 +16799,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_e_id = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":302 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":302 * 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] # <<<<<<<<<<<<<< @@ -16814,7 +16814,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_index = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":303 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":303 * 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 # <<<<<<<<<<<<<< @@ -16825,7 +16825,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __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 = 303; __pyx_clineno = __LINE__; goto __pyx_L7_error;} (__pyx_v_fcount->arr[__pyx_t_15]) = ((__pyx_v_fcount->arr[__pyx_t_17]) + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":304 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":304 * 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) # <<<<<<<<<<<<<< @@ -16845,7 +16845,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} (__pyx_v_self->e_index->arr[__pyx_t_17]) = __pyx_t_20; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":305 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":305 * fcount.arr[f_id] = fcount.arr[f_id] + 1 * self.e_index.arr[index] = int(e_id) * self.col1[index] = float(score1) # <<<<<<<<<<<<<< @@ -16858,7 +16858,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ if (PyObject_SetItem(((PyObject *)__pyx_v_self->col1), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":306 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":306 * self.e_index.arr[index] = int(e_id) * self.col1[index] = float(score1) * self.col2[index] = float(score2) # <<<<<<<<<<<<<< @@ -16886,7 +16886,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":273 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273 * * fcount = IntList() * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -16894,7 +16894,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ * for line in f: */ /*except:*/ { - __Pyx_AddTraceback("_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); @@ -16966,7 +16966,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_L31:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":309 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":309 * * # Sort buckets by eword * for b from 0 <= b < n_f: # <<<<<<<<<<<<<< @@ -16982,7 +16982,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_b = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":310 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":310 * # Sort buckets by eword * for b from 0 <= b < n_f: * i = self.f_index.arr[b] # <<<<<<<<<<<<<< @@ -16996,7 +16996,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_i = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":311 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":311 * for b from 0 <= b < n_f: * i = self.f_index.arr[b] * j = self.f_index.arr[b+1] # <<<<<<<<<<<<<< @@ -17013,7 +17013,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_j = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":312 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":312 * i = self.f_index.arr[b] * j = self.f_index.arr[b+1] * self.qsort(i,j, "") # <<<<<<<<<<<<<< @@ -17022,13 +17022,13 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ */ __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_24 = __Pyx_PyInt_AsInt(__pyx_v_j); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((struct __pyx_vtabstruct_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_20, __pyx_t_24, ((PyObject *)__pyx_kp_s_47)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_20, __pyx_t_24, ((PyObject *)__pyx_kp_s_47)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_b); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":309 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":309 * * # Sort buckets by eword * for b from 0 <= b < n_f: # <<<<<<<<<<<<<< @@ -17051,7 +17051,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("_sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_i); @@ -17074,7 +17074,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":315 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":315 * * * cdef swap(self, int i, int j): # <<<<<<<<<<<<<< @@ -17082,7 +17082,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_10read_text(struct __pyx_obj_3_sa_BiLex *_ * cdef float ftmp */ -static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, int __pyx_v_i, int __pyx_v_j) { +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) { int __pyx_v_itmp; float __pyx_v_ftmp; PyObject *__pyx_r = NULL; @@ -17090,7 +17090,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s int __pyx_t_1; __Pyx_RefNannySetupContext("swap", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":319 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":319 * cdef float ftmp * * if i == j: # <<<<<<<<<<<<<< @@ -17100,7 +17100,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s __pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":320 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":320 * * if i == j: * return # <<<<<<<<<<<<<< @@ -17114,7 +17114,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":322 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":322 * return * * itmp = self.e_index.arr[i] # <<<<<<<<<<<<<< @@ -17123,7 +17123,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ __pyx_v_itmp = (__pyx_v_self->e_index->arr[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":323 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":323 * * itmp = self.e_index.arr[i] * self.e_index.arr[i] = self.e_index.arr[j] # <<<<<<<<<<<<<< @@ -17132,7 +17132,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ (__pyx_v_self->e_index->arr[__pyx_v_i]) = (__pyx_v_self->e_index->arr[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":324 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":324 * itmp = self.e_index.arr[i] * self.e_index.arr[i] = self.e_index.arr[j] * self.e_index.arr[j] = itmp # <<<<<<<<<<<<<< @@ -17141,7 +17141,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ (__pyx_v_self->e_index->arr[__pyx_v_j]) = __pyx_v_itmp; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":326 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":326 * self.e_index.arr[j] = itmp * * ftmp = self.col1.arr[i] # <<<<<<<<<<<<<< @@ -17150,7 +17150,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ __pyx_v_ftmp = (__pyx_v_self->col1->arr[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":327 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":327 * * ftmp = self.col1.arr[i] * self.col1.arr[i] = self.col1.arr[j] # <<<<<<<<<<<<<< @@ -17159,7 +17159,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ (__pyx_v_self->col1->arr[__pyx_v_i]) = (__pyx_v_self->col1->arr[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":328 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":328 * ftmp = self.col1.arr[i] * self.col1.arr[i] = self.col1.arr[j] * self.col1.arr[j] = ftmp # <<<<<<<<<<<<<< @@ -17168,7 +17168,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ (__pyx_v_self->col1->arr[__pyx_v_j]) = __pyx_v_ftmp; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":330 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":330 * self.col1.arr[j] = ftmp * * ftmp = self.col2.arr[i] # <<<<<<<<<<<<<< @@ -17177,7 +17177,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ __pyx_v_ftmp = (__pyx_v_self->col2->arr[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":331 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":331 * * ftmp = self.col2.arr[i] * self.col2.arr[i] = self.col2.arr[j] # <<<<<<<<<<<<<< @@ -17186,7 +17186,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s */ (__pyx_v_self->col2->arr[__pyx_v_i]) = (__pyx_v_self->col2->arr[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":332 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":332 * ftmp = self.col2.arr[i] * self.col2.arr[i] = self.col2.arr[j] * self.col2.arr[j] = ftmp # <<<<<<<<<<<<<< @@ -17202,7 +17202,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":335 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":335 * * * cdef qsort(self, int i, int j, pad): # <<<<<<<<<<<<<< @@ -17210,7 +17210,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_swap(struct __pyx_obj_3_sa_BiLex *__pyx_v_s * */ -static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, PyObject *__pyx_v_pad) { +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) { int __pyx_v_pval; int __pyx_v_p; long __pyx_v_k; @@ -17225,7 +17225,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("qsort", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":338 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":338 * cdef int pval, p * * if i > j: # <<<<<<<<<<<<<< @@ -17235,7 +17235,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_t_1 = ((__pyx_v_i > __pyx_v_j) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":339 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":339 * * if i > j: * raise Exception("Sort error in CLex") # <<<<<<<<<<<<<< @@ -17251,7 +17251,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":340 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":340 * if i > j: * raise Exception("Sort error in CLex") * if i == j: #empty interval # <<<<<<<<<<<<<< @@ -17261,7 +17261,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":341 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":341 * raise Exception("Sort error in CLex") * if i == j: #empty interval * return # <<<<<<<<<<<<<< @@ -17275,7 +17275,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":342 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":342 * if i == j: #empty interval * return * if i == j-1: # singleton interval # <<<<<<<<<<<<<< @@ -17285,7 +17285,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_t_1 = ((__pyx_v_i == (__pyx_v_j - 1)) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":343 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":343 * return * if i == j-1: # singleton interval * return # <<<<<<<<<<<<<< @@ -17299,7 +17299,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":345 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":345 * return * * p = (i+j)/2 # <<<<<<<<<<<<<< @@ -17308,7 +17308,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ */ __pyx_v_p = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":346 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":346 * * p = (i+j)/2 * pval = self.e_index.arr[p] # <<<<<<<<<<<<<< @@ -17317,18 +17317,18 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ */ __pyx_v_pval = (__pyx_v_self->e_index->arr[__pyx_v_p]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":347 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":347 * 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_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 = 347; __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 = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":348 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":348 * pval = self.e_index.arr[p] * self.swap(i, p) * p = i # <<<<<<<<<<<<<< @@ -17337,7 +17337,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ */ __pyx_v_p = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":349 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":349 * self.swap(i, p) * p = i * for k from i+1 <= k < j: # <<<<<<<<<<<<<< @@ -17347,7 +17347,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_t_3 = __pyx_v_j; for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":350 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":350 * p = i * for k from i+1 <= k < j: * if pval >= self.e_index.arr[k]: # <<<<<<<<<<<<<< @@ -17357,29 +17357,29 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_t_1 = ((__pyx_v_pval >= (__pyx_v_self->e_index->arr[__pyx_v_k])) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":351 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":351 * 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_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 = 351; __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 = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":352 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":352 * 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_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 = 352; __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 = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":353 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":353 * self.swap(p+1, k) * self.swap(p, p+1) * p = p + 1 # <<<<<<<<<<<<<< @@ -17392,7 +17392,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_L8:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":354 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":354 * self.swap(p, p+1) * p = p + 1 * self.qsort(i,p, pad+" ") # <<<<<<<<<<<<<< @@ -17401,12 +17401,12 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ */ __pyx_t_2 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_50)); 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_t_4 = ((struct __pyx_vtabstruct_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 = 354; __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 = 354; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":355 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":355 * p = p + 1 * self.qsort(i,p, pad+" ") * self.qsort(p+1,j, pad+" ") # <<<<<<<<<<<<<< @@ -17415,7 +17415,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ */ __pyx_t_4 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = ((struct __pyx_vtabstruct_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 = 355; __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 = 355; __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; @@ -17425,7 +17425,7 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.BiLex.qsort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.qsort", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -17434,8 +17434,8 @@ static PyObject *__pyx_f_3_sa_5BiLex_qsort(struct __pyx_obj_3_sa_BiLex *__pyx_v_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -17448,16 +17448,16 @@ static PyObject *__pyx_pw_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_5BiLex_12write_enhanced(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":358 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":358 * * * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< @@ -17465,7 +17465,7 @@ static PyObject *__pyx_pw_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, P * for i in self.f_index: */ -static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_i = NULL; PyObject *__pyx_v_s1 = NULL; @@ -17494,7 +17494,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_enhanced", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":359 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -17534,7 +17534,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __pyx_v_f = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":360 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":360 * def write_enhanced(self, char* filename): * with open(filename, "w") as f: * for i in self.f_index: # <<<<<<<<<<<<<< @@ -17579,7 +17579,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __pyx_v_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":361 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":361 * with open(filename, "w") as f: * for i in self.f_index: * f.write("%d " % i) # <<<<<<<<<<<<<< @@ -17603,7 +17603,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":362 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":362 * for i in self.f_index: * f.write("%d " % i) * f.write("\n") # <<<<<<<<<<<<<< @@ -17617,7 +17617,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":363 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":363 * f.write("%d " % i) * f.write("\n") * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): # <<<<<<<<<<<<<< @@ -17741,7 +17741,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __pyx_v_s2 = __pyx_t_11; __pyx_t_11 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":364 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":364 * f.write("\n") * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): * f.write("%d %f %f " % (i, s1, s2)) # <<<<<<<<<<<<<< @@ -17777,7 +17777,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":365 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":365 * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): * f.write("%d %f %f " % (i, s1, s2)) * f.write("\n") # <<<<<<<<<<<<<< @@ -17791,7 +17791,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":366 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":366 * f.write("%d %f %f " % (i, s1, s2)) * f.write("\n") * for i, w in enumerate(self.id2fword): # <<<<<<<<<<<<<< @@ -17846,7 +17846,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __pyx_t_1 = __pyx_t_11; __pyx_t_11 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":367 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":367 * f.write("\n") * for i, w in enumerate(self.id2fword): * f.write("%d %s " % (i, w)) # <<<<<<<<<<<<<< @@ -17880,7 +17880,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":368 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":368 * for i, w in enumerate(self.id2fword): * f.write("%d %s " % (i, w)) * f.write("\n") # <<<<<<<<<<<<<< @@ -17894,7 +17894,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":369 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":369 * f.write("%d %s " % (i, w)) * f.write("\n") * for i, w in enumerate(self.id2eword): # <<<<<<<<<<<<<< @@ -17949,7 +17949,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __pyx_t_2 = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":370 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":370 * f.write("\n") * for i, w in enumerate(self.id2eword): * f.write("%d %s " % (i, w)) # <<<<<<<<<<<<<< @@ -17983,7 +17983,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":371 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":371 * for i, w in enumerate(self.id2eword): * f.write("%d %s " % (i, w)) * f.write("\n") # <<<<<<<<<<<<<< @@ -18009,7 +18009,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":359 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -18017,7 +18017,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL * f.write("%d " % i) */ /*except:*/ { - __Pyx_AddTraceback("_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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 = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); @@ -18098,7 +18098,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -18112,8 +18112,8 @@ static PyObject *__pyx_pf_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_3_sa_BiL } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fword = 0; PyObject *__pyx_v_eword = 0; PyObject *__pyx_v_col = 0; @@ -18170,16 +18170,16 @@ static PyObject *__pyx_pw_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObje __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_score", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_5BiLex_14get_score(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), __pyx_v_fword, __pyx_v_eword, __pyx_v_col); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), __pyx_v_fword, __pyx_v_eword, __pyx_v_col); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":374 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":374 * * * def get_score(self, fword, eword, col): # <<<<<<<<<<<<<< @@ -18187,7 +18187,7 @@ static PyObject *__pyx_pw_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObje * */ -static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col) { PyObject *__pyx_v_e_id = 0; PyObject *__pyx_v_f_id = 0; PyObject *__pyx_v_low = 0; @@ -18206,7 +18206,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_score", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":377 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":377 * cdef e_id, f_id, low, high, midpoint, val * * if eword not in self.eword2id: # <<<<<<<<<<<<<< @@ -18217,7 +18217,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":378 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":378 * * if eword not in self.eword2id: * return None # <<<<<<<<<<<<<< @@ -18232,7 +18232,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":379 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":379 * if eword not in self.eword2id: * return None * if fword not in self.fword2id: # <<<<<<<<<<<<<< @@ -18243,7 +18243,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":380 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":380 * return None * if fword not in self.fword2id: * return None # <<<<<<<<<<<<<< @@ -18258,7 +18258,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":381 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":381 * if fword not in self.fword2id: * return None * f_id = self.fword2id[fword] # <<<<<<<<<<<<<< @@ -18270,7 +18270,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_f_id = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":382 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":382 * return None * f_id = self.fword2id[fword] * e_id = self.eword2id[eword] # <<<<<<<<<<<<<< @@ -18282,7 +18282,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_e_id = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":383 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":383 * f_id = self.fword2id[fword] * e_id = self.eword2id[eword] * low = self.f_index.arr[f_id] # <<<<<<<<<<<<<< @@ -18295,7 +18295,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_low = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":384 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":384 * e_id = self.eword2id[eword] * low = self.f_index.arr[f_id] * high = self.f_index.arr[f_id+1] # <<<<<<<<<<<<<< @@ -18311,7 +18311,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_high = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":385 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":385 * low = self.f_index.arr[f_id] * high = self.f_index.arr[f_id+1] * while high - low > 0: # <<<<<<<<<<<<<< @@ -18327,7 +18327,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (!__pyx_t_1) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":386 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":386 * high = self.f_index.arr[f_id+1] * while high - low > 0: * midpoint = (low+high)/2 # <<<<<<<<<<<<<< @@ -18343,7 +18343,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_midpoint = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":387 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":387 * while high - low > 0: * midpoint = (low+high)/2 * val = self.e_index.arr[midpoint] # <<<<<<<<<<<<<< @@ -18357,7 +18357,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __pyx_v_val = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":388 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":388 * midpoint = (low+high)/2 * val = self.e_index.arr[midpoint] * if val == e_id: # <<<<<<<<<<<<<< @@ -18369,7 +18369,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":389 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":389 * val = self.e_index.arr[midpoint] * if val == e_id: * if col == 0: # <<<<<<<<<<<<<< @@ -18381,7 +18381,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":390 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":390 * if val == e_id: * if col == 0: * return self.col1.arr[midpoint] # <<<<<<<<<<<<<< @@ -18399,7 +18399,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":391 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":391 * if col == 0: * return self.col1.arr[midpoint] * if col == 1: # <<<<<<<<<<<<<< @@ -18411,7 +18411,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":392 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":392 * return self.col1.arr[midpoint] * if col == 1: * return self.col2.arr[midpoint] # <<<<<<<<<<<<<< @@ -18432,7 +18432,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":393 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":393 * if col == 1: * return self.col2.arr[midpoint] * if val > e_id: # <<<<<<<<<<<<<< @@ -18444,7 +18444,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":394 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":394 * return self.col2.arr[midpoint] * if val > e_id: * high = midpoint # <<<<<<<<<<<<<< @@ -18458,7 +18458,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ } __pyx_L10:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":395 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":395 * if val > e_id: * high = midpoint * if val < e_id: # <<<<<<<<<<<<<< @@ -18470,7 +18470,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":396 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":396 * high = midpoint * if val < e_id: * low = midpoint + 1 # <<<<<<<<<<<<<< @@ -18487,7 +18487,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __pyx_L11:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":397 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":397 * if val < e_id: * low = midpoint + 1 * return None # <<<<<<<<<<<<<< @@ -18504,7 +18504,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e_id); @@ -18519,9 +18519,9 @@ static PyObject *__pyx_pf_3_sa_5BiLex_14get_score(struct __pyx_obj_3_sa_BiLex *_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static char __pyx_doc_3_sa_5BiLex_16write_text[] = "Note: does not guarantee writing the dictionary in the original order"; -static PyObject *__pyx_pw_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_5BiLex_16write_text[] = "Note: does not guarantee writing the dictionary in the original order"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -18534,16 +18534,16 @@ static PyObject *__pyx_pw_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_5BiLex_16write_text(((struct __pyx_obj_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":400 +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":400 * * * def write_text(self, char* filename): # <<<<<<<<<<<<<< @@ -18551,7 +18551,7 @@ static PyObject *__pyx_pw_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObj * cdef i, N, e_id, f_id */ -static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_v_i = 0; PyObject *__pyx_v_N = 0; PyObject *__pyx_v_e_id = 0; @@ -18580,7 +18580,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_text", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":404 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404 * cdef i, N, e_id, f_id * * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -18620,7 +18620,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __pyx_v_f = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":405 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":405 * * with open(filename, "w") as f: * N = len(self.e_index) # <<<<<<<<<<<<<< @@ -18636,7 +18636,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __pyx_v_N = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":406 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":406 * with open(filename, "w") as f: * N = len(self.e_index) * f_id = 0 # <<<<<<<<<<<<<< @@ -18646,7 +18646,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __Pyx_INCREF(__pyx_int_0); __pyx_v_f_id = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":407 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":407 * N = len(self.e_index) * f_id = 0 * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -18661,7 +18661,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __pyx_v_i = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":408 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":408 * f_id = 0 * for i from 0 <= i < N: * while self.f_index.arr[f_id+1] == i: # <<<<<<<<<<<<<< @@ -18681,7 +18681,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_11) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":409 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":409 * for i from 0 <= i < N: * while self.f_index.arr[f_id+1] == i: * f_id = f_id + 1 # <<<<<<<<<<<<<< @@ -18695,7 +18695,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":410 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":410 * while self.f_index.arr[f_id+1] == i: * f_id = f_id + 1 * e_id = self.e_index.arr[i] # <<<<<<<<<<<<<< @@ -18709,7 +18709,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __pyx_v_e_id = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":411 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":411 * f_id = f_id + 1 * e_id = self.e_index.arr[i] * score1 = self.col1.arr[i] # <<<<<<<<<<<<<< @@ -18723,7 +18723,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __pyx_v_score1 = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":412 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":412 * e_id = self.e_index.arr[i] * score1 = self.col1.arr[i] * score2 = self.col2.arr[i] # <<<<<<<<<<<<<< @@ -18736,7 +18736,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __pyx_v_score2 = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":413 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":413 * 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)) # <<<<<<<<<<<<<< @@ -18777,7 +18777,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":407 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":407 * N = len(self.e_index) * f_id = 0 * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -18800,7 +18800,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":404 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404 * cdef i, N, e_id, f_id * * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -18808,7 +18808,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * * f_id = 0 */ /*except:*/ { - __Pyx_AddTraceback("_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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 = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_12); @@ -18887,7 +18887,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_i); @@ -18902,7 +18902,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":21 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":21 * cdef int LOWER_MASK[32] * * cdef void _init_lower_mask(): # <<<<<<<<<<<<<< @@ -18910,7 +18910,7 @@ static PyObject *__pyx_pf_3_sa_5BiLex_16write_text(struct __pyx_obj_3_sa_BiLex * * cdef int mask = 0 */ -static void __pyx_f_3_sa__init_lower_mask(void) { +static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void) { unsigned int __pyx_v_i; int __pyx_v_mask; __Pyx_RefNannyDeclarations @@ -18918,7 +18918,7 @@ static void __pyx_f_3_sa__init_lower_mask(void) { unsigned int __pyx_t_2; __Pyx_RefNannySetupContext("_init_lower_mask", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":23 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":23 * cdef void _init_lower_mask(): * cdef unsigned i * cdef int mask = 0 # <<<<<<<<<<<<<< @@ -18927,18 +18927,18 @@ static void __pyx_f_3_sa__init_lower_mask(void) { */ __pyx_v_mask = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":24 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":24 * cdef unsigned i * cdef int mask = 0 * for i in range(MIN_BOTTOM_SIZE): # <<<<<<<<<<<<<< * mask = (mask << 1) + 1 * LOWER_MASK[i] = mask */ - __pyx_t_1 = __pyx_v_3_sa_MIN_BOTTOM_SIZE; + __pyx_t_1 = __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":25 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":25 * cdef int mask = 0 * for i in range(MIN_BOTTOM_SIZE): * mask = (mask << 1) + 1 # <<<<<<<<<<<<<< @@ -18947,20 +18947,20 @@ static void __pyx_f_3_sa__init_lower_mask(void) { */ __pyx_v_mask = ((__pyx_v_mask << 1) + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":26 * for i in range(MIN_BOTTOM_SIZE): * mask = (mask << 1) + 1 * LOWER_MASK[i] = mask # <<<<<<<<<<<<<< * * _init_lower_mask() */ - (__pyx_v_3_sa_LOWER_MASK[__pyx_v_i]) = __pyx_v_mask; + (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[__pyx_v_i]) = __pyx_v_mask; } __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":37 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":37 * * * cdef _BitSet* new_BitSet(): # <<<<<<<<<<<<<< @@ -18968,22 +18968,22 @@ static void __pyx_f_3_sa__init_lower_mask(void) { * */ -static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { - struct __pyx_t_3_sa__BitSet *__pyx_v_b; - struct __pyx_t_3_sa__BitSet *__pyx_r; +static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(void) { + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b; + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_BitSet", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":40 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":40 * cdef _BitSet* b * * b = <_BitSet*> malloc(sizeof(_BitSet)) # <<<<<<<<<<<<<< * b.bitset = 0 * b.min_val = -1 */ - __pyx_v_b = ((struct __pyx_t_3_sa__BitSet *)malloc((sizeof(struct __pyx_t_3_sa__BitSet)))); + __pyx_v_b = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__BitSet)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":41 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":41 * * b = <_BitSet*> malloc(sizeof(_BitSet)) * b.bitset = 0 # <<<<<<<<<<<<<< @@ -18992,7 +18992,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { */ __pyx_v_b->bitset = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":42 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":42 * b = <_BitSet*> malloc(sizeof(_BitSet)) * b.bitset = 0 * b.min_val = -1 # <<<<<<<<<<<<<< @@ -19001,7 +19001,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { */ __pyx_v_b->min_val = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":43 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":43 * b.bitset = 0 * b.min_val = -1 * b.max_val = -1 # <<<<<<<<<<<<<< @@ -19010,7 +19010,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { */ __pyx_v_b->max_val = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":44 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":44 * b.min_val = -1 * b.max_val = -1 * b.size = 0 # <<<<<<<<<<<<<< @@ -19019,7 +19019,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { */ __pyx_v_b->size = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":45 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":45 * b.max_val = -1 * b.size = 0 * return b # <<<<<<<<<<<<<< @@ -19035,7 +19035,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":48 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":48 * * * cdef int bitset_findsucc(_BitSet* b, int i): # <<<<<<<<<<<<<< @@ -19043,7 +19043,7 @@ static struct __pyx_t_3_sa__BitSet *__pyx_f_3_sa_new_BitSet(void) { * cdef int low, high, mid */ -static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { +static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { int __pyx_v_bitset; int __pyx_v_mask; int __pyx_v_low; @@ -19056,7 +19056,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, int __pyx_t_3; __Pyx_RefNannySetupContext("bitset_findsucc", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":52 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":52 * cdef int low, high, mid * * if b.max_val == -1 or i >= b.max_val: # <<<<<<<<<<<<<< @@ -19072,7 +19072,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":53 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":53 * * if b.max_val == -1 or i >= b.max_val: * return -1 # <<<<<<<<<<<<<< @@ -19085,7 +19085,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":54 * if b.max_val == -1 or i >= b.max_val: * return -1 * if i < b.min_val: # <<<<<<<<<<<<<< @@ -19095,7 +19095,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, __pyx_t_3 = ((__pyx_v_i < __pyx_v_b->min_val) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":55 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":55 * return -1 * if i < b.min_val: * return b.min_val # <<<<<<<<<<<<<< @@ -19108,16 +19108,16 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":57 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":57 * return b.min_val * * bitset = b.bitset & ~LOWER_MASK[i] # <<<<<<<<<<<<<< * low = i+1 * high = b.max_val+1 */ - __pyx_v_bitset = (__pyx_v_b->bitset & (~(__pyx_v_3_sa_LOWER_MASK[__pyx_v_i]))); + __pyx_v_bitset = (__pyx_v_b->bitset & (~(__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[__pyx_v_i]))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":58 * * bitset = b.bitset & ~LOWER_MASK[i] * low = i+1 # <<<<<<<<<<<<<< @@ -19126,7 +19126,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_low = (__pyx_v_i + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":59 * bitset = b.bitset & ~LOWER_MASK[i] * low = i+1 * high = b.max_val+1 # <<<<<<<<<<<<<< @@ -19135,7 +19135,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_high = (__pyx_v_b->max_val + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":60 * low = i+1 * high = b.max_val+1 * while low < high-1: # <<<<<<<<<<<<<< @@ -19146,7 +19146,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, __pyx_t_3 = ((__pyx_v_low < (__pyx_v_high - 1)) != 0); if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":61 * high = b.max_val+1 * while low < high-1: * mid = (high + low)/2 # <<<<<<<<<<<<<< @@ -19155,16 +19155,16 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_mid = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":62 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":62 * while low < high-1: * mid = (high + low)/2 * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) # <<<<<<<<<<<<<< * if bitset & mask == 0: * low = mid */ - __pyx_v_mask = (~((__pyx_v_3_sa_LOWER_MASK[(__pyx_v_high - 1)]) ^ (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_mid - 1)]))); + __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)]))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":63 * mid = (high + low)/2 * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) * if bitset & mask == 0: # <<<<<<<<<<<<<< @@ -19174,7 +19174,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, __pyx_t_3 = (((__pyx_v_bitset & __pyx_v_mask) == 0) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":64 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":64 * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) * if bitset & mask == 0: * low = mid # <<<<<<<<<<<<<< @@ -19186,7 +19186,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":66 * low = mid * else: * bitset = bitset & mask # <<<<<<<<<<<<<< @@ -19195,7 +19195,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_bitset = (__pyx_v_bitset & __pyx_v_mask); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":67 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":67 * else: * bitset = bitset & mask * high = mid # <<<<<<<<<<<<<< @@ -19207,7 +19207,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, __pyx_L7:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":68 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":68 * bitset = bitset & mask * high = mid * return low # <<<<<<<<<<<<<< @@ -19223,7 +19223,7 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":71 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":71 * * * cdef int bitset_insert(_BitSet* b, int i): # <<<<<<<<<<<<<< @@ -19231,14 +19231,14 @@ static int __pyx_f_3_sa_bitset_findsucc(struct __pyx_t_3_sa__BitSet *__pyx_v_b, * */ -static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { +static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { int __pyx_v_val; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("bitset_insert", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":74 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":74 * cdef int val * * val = 1 << i # <<<<<<<<<<<<<< @@ -19247,7 +19247,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in */ __pyx_v_val = (1 << __pyx_v_i); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":75 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":75 * * val = 1 << i * if b.bitset & val == 0: # <<<<<<<<<<<<<< @@ -19257,7 +19257,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in __pyx_t_1 = (((__pyx_v_b->bitset & __pyx_v_val) == 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":76 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":76 * val = 1 << i * if b.bitset & val == 0: * b.bitset = b.bitset | val # <<<<<<<<<<<<<< @@ -19266,7 +19266,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in */ __pyx_v_b->bitset = (__pyx_v_b->bitset | __pyx_v_val); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":77 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":77 * if b.bitset & val == 0: * b.bitset = b.bitset | val * if b.size == 0: # <<<<<<<<<<<<<< @@ -19276,7 +19276,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in __pyx_t_1 = ((__pyx_v_b->size == 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":78 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":78 * b.bitset = b.bitset | val * if b.size == 0: * b.min_val = i # <<<<<<<<<<<<<< @@ -19285,7 +19285,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in */ __pyx_v_b->min_val = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":79 * if b.size == 0: * b.min_val = i * b.max_val = i # <<<<<<<<<<<<<< @@ -19297,7 +19297,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":81 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":81 * b.max_val = i * else: * if i < b.min_val: # <<<<<<<<<<<<<< @@ -19307,7 +19307,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in __pyx_t_1 = ((__pyx_v_i < __pyx_v_b->min_val) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":82 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":82 * else: * if i < b.min_val: * b.min_val = i # <<<<<<<<<<<<<< @@ -19319,7 +19319,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":83 * if i < b.min_val: * b.min_val = i * if i > b.max_val: # <<<<<<<<<<<<<< @@ -19329,7 +19329,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in __pyx_t_1 = ((__pyx_v_i > __pyx_v_b->max_val) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":84 * b.min_val = i * if i > b.max_val: * b.max_val = i # <<<<<<<<<<<<<< @@ -19343,7 +19343,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":85 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":85 * if i > b.max_val: * b.max_val = i * b.size = b.size + 1 # <<<<<<<<<<<<<< @@ -19352,7 +19352,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in */ __pyx_v_b->size = (__pyx_v_b->size + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":86 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":86 * b.max_val = i * b.size = b.size + 1 * return 1 # <<<<<<<<<<<<<< @@ -19365,7 +19365,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":87 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":87 * b.size = b.size + 1 * return 1 * return 0 # <<<<<<<<<<<<<< @@ -19381,7 +19381,7 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":90 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":90 * * * cdef int bitset_contains(_BitSet* b, int i): # <<<<<<<<<<<<<< @@ -19389,14 +19389,14 @@ static int __pyx_f_3_sa_bitset_insert(struct __pyx_t_3_sa__BitSet *__pyx_v_b, in * */ -static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { +static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { int __pyx_v_val; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("bitset_contains", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":93 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":93 * cdef int val * * val = 1 << i # <<<<<<<<<<<<<< @@ -19405,7 +19405,7 @@ static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, */ __pyx_v_val = (1 << __pyx_v_i); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":94 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":94 * * val = 1 << i * if b.bitset & val == 0: # <<<<<<<<<<<<<< @@ -19415,7 +19415,7 @@ static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, __pyx_t_1 = (((__pyx_v_b->bitset & __pyx_v_val) == 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":95 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":95 * val = 1 << i * if b.bitset & val == 0: * return 0 # <<<<<<<<<<<<<< @@ -19428,7 +19428,7 @@ static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":97 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":97 * return 0 * else: * return 1 # <<<<<<<<<<<<<< @@ -19447,17 +19447,17 @@ static int __pyx_f_3_sa_bitset_contains(struct __pyx_t_3_sa__BitSet *__pyx_v_b, } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_14BitSetIterator___next__(((struct __pyx_obj_3_sa_BitSetIterator *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":104 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":104 * cdef int next_val * * def __next__(self): # <<<<<<<<<<<<<< @@ -19465,7 +19465,7 @@ static PyObject *__pyx_pw_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self * */ -static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_BitSetIterator *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *__pyx_v_self) { int __pyx_v_ret_val; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -19477,7 +19477,7 @@ static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_B int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__next__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":107 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":107 * cdef int ret_val * * if self.next_val == -1: # <<<<<<<<<<<<<< @@ -19487,7 +19487,7 @@ static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_B __pyx_t_1 = ((__pyx_v_self->next_val == -1) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":108 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":108 * * if self.next_val == -1: * raise StopIteration() # <<<<<<<<<<<<<< @@ -19503,7 +19503,7 @@ static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_B } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":109 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":109 * if self.next_val == -1: * raise StopIteration() * ret_val = self.next_val # <<<<<<<<<<<<<< @@ -19513,16 +19513,16 @@ static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_B __pyx_t_3 = __pyx_v_self->next_val; __pyx_v_ret_val = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":110 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":110 * raise StopIteration() * ret_val = self.next_val * self.next_val = bitset_findsucc(self.b, ret_val) # <<<<<<<<<<<<<< * return ret_val * */ - __pyx_v_self->next_val = __pyx_f_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_v_ret_val); + __pyx_v_self->next_val = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_v_ret_val); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":111 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":111 * ret_val = self.next_val * self.next_val = bitset_findsucc(self.b, ret_val) * return ret_val # <<<<<<<<<<<<<< @@ -19540,7 +19540,7 @@ static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_B goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.BitSetIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BitSetIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19549,20 +19549,20 @@ static PyObject *__pyx_pf_3_sa_14BitSetIterator___next__(struct __pyx_obj_3_sa_B } /* Python wrapper */ -static int __pyx_pw_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __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_3_sa_6BitSet___cinit__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":122 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":122 * cdef _BitSet* b * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -19570,19 +19570,19 @@ static int __pyx_pw_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__ * */ -static int __pyx_pf_3_sa_6BitSet___cinit__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_6BitSet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":123 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":123 * * def __cinit__(self): * self.b = new_BitSet() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __pyx_v_self->b = __pyx_f_3_sa_new_BitSet(); + __pyx_v_self->b = __pyx_f_4cdec_2sa_3_sa_new_BitSet(); __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -19590,15 +19590,15 @@ static int __pyx_pf_3_sa_6BitSet___cinit__(struct __pyx_obj_3_sa_BitSet *__pyx_v } /* Python wrapper */ -static void __pyx_pw_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_4cdec_2sa_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3_sa_6BitSet_2__dealloc__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":125 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":125 * self.b = new_BitSet() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -19606,11 +19606,11 @@ static void __pyx_pw_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { +static void __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":126 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":126 * * def __dealloc__(self): * free(self.b) # <<<<<<<<<<<<<< @@ -19623,17 +19623,17 @@ static void __pyx_pf_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_3_sa_BitSet *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6BitSet_4__iter__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":128 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":128 * free(self.b) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -19641,31 +19641,31 @@ static PyObject *__pyx_pw_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self) { * it = BitSetIterator() */ -static PyObject *__pyx_pf_3_sa_6BitSet_4__iter__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { - struct __pyx_obj_3_sa_BitSetIterator *__pyx_v_it = 0; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { + struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *__pyx_v_it = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - struct __pyx_t_3_sa__BitSet *__pyx_t_2; + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_t_2; int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":130 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":130 * def __iter__(self): * cdef BitSetIterator it * it = BitSetIterator() # <<<<<<<<<<<<<< * it.b = self.b * it.next_val = self.b.min_val */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_BitSetIterator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_BitSetIterator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_it = ((struct __pyx_obj_3_sa_BitSetIterator *)__pyx_t_1); + __pyx_v_it = ((struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":131 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":131 * cdef BitSetIterator it * it = BitSetIterator() * it.b = self.b # <<<<<<<<<<<<<< @@ -19675,7 +19675,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_4__iter__(struct __pyx_obj_3_sa_BitSet *_ __pyx_t_2 = __pyx_v_self->b; __pyx_v_it->b = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":132 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":132 * it = BitSetIterator() * it.b = self.b * it.next_val = self.b.min_val # <<<<<<<<<<<<<< @@ -19685,7 +19685,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_4__iter__(struct __pyx_obj_3_sa_BitSet *_ __pyx_t_3 = __pyx_v_self->b->min_val; __pyx_v_it->next_val = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":133 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":133 * it.b = self.b * it.next_val = self.b.min_val * return it # <<<<<<<<<<<<<< @@ -19701,7 +19701,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_4__iter__(struct __pyx_obj_3_sa_BitSet *_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.BitSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_it); @@ -19711,17 +19711,17 @@ static PyObject *__pyx_pf_3_sa_6BitSet_4__iter__(struct __pyx_obj_3_sa_BitSet *_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("insert (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6BitSet_6insert(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":135 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":135 * return it * * def insert(self, i): # <<<<<<<<<<<<<< @@ -19729,7 +19729,7 @@ static PyObject *__pyx_pw_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject * */ -static PyObject *__pyx_pf_3_sa_6BitSet_6insert(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -19739,7 +19739,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_6insert(struct __pyx_obj_3_sa_BitSet *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("insert", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":136 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":136 * * def insert(self, i): * return bitset_insert(self.b, i) # <<<<<<<<<<<<<< @@ -19748,7 +19748,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_6insert(struct __pyx_obj_3_sa_BitSet *__p */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_bitset_insert(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_bitset_insert(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -19758,7 +19758,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_6insert(struct __pyx_obj_3_sa_BitSet *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.BitSet.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19767,17 +19767,17 @@ static PyObject *__pyx_pf_3_sa_6BitSet_6insert(struct __pyx_obj_3_sa_BitSet *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("findsucc (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6BitSet_8findsucc(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":138 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":138 * return bitset_insert(self.b, i) * * def findsucc(self, i): # <<<<<<<<<<<<<< @@ -19785,7 +19785,7 @@ static PyObject *__pyx_pw_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObjec * */ -static PyObject *__pyx_pf_3_sa_6BitSet_8findsucc(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -19795,7 +19795,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_8findsucc(struct __pyx_obj_3_sa_BitSet *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("findsucc", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":139 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":139 * * def findsucc(self, i): * return bitset_findsucc(self.b, i) # <<<<<<<<<<<<<< @@ -19804,7 +19804,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_8findsucc(struct __pyx_obj_3_sa_BitSet *_ */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -19814,7 +19814,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_8findsucc(struct __pyx_obj_3_sa_BitSet *_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.BitSet.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19823,17 +19823,17 @@ static PyObject *__pyx_pf_3_sa_6BitSet_8findsucc(struct __pyx_obj_3_sa_BitSet *_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6BitSet_10__str__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":141 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":141 * return bitset_findsucc(self.b, i) * * def __str__(self): # <<<<<<<<<<<<<< @@ -19841,7 +19841,7 @@ static PyObject *__pyx_pw_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_3_sa_6BitSet_10__str__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -19852,7 +19852,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_10__str__(struct __pyx_obj_3_sa_BitSet *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":142 + /* "/home/mdenkows/cdec/python/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)+")" # <<<<<<<<<<<<<< @@ -19860,7 +19860,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_10__str__(struct __pyx_obj_3_sa_BitSet *_ * def min(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_3_sa_dec2bin(__pyx_v_self->b->bitset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_2sa_3_sa_dec2bin(__pyx_v_self->b->bitset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); @@ -19926,7 +19926,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_10__str__(struct __pyx_obj_3_sa_BitSet *_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.BitSet.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19935,17 +19935,17 @@ static PyObject *__pyx_pf_3_sa_6BitSet_10__str__(struct __pyx_obj_3_sa_BitSet *_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("min (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6BitSet_12min(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":144 +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -19953,7 +19953,7 @@ static PyObject *__pyx_pw_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUS * */ -static PyObject *__pyx_pf_3_sa_6BitSet_12min(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -19962,7 +19962,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_12min(struct __pyx_obj_3_sa_BitSet *__pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("min", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":145 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":145 * * def min(self): * return self.b.min_val # <<<<<<<<<<<<<< @@ -19980,7 +19980,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_12min(struct __pyx_obj_3_sa_BitSet *__pyx goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.BitSet.min", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.min", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19989,17 +19989,17 @@ static PyObject *__pyx_pf_3_sa_6BitSet_12min(struct __pyx_obj_3_sa_BitSet *__pyx } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("max (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6BitSet_14max(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":147 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":147 * return self.b.min_val * * def max(self): # <<<<<<<<<<<<<< @@ -20007,7 +20007,7 @@ static PyObject *__pyx_pw_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUS * */ -static PyObject *__pyx_pf_3_sa_6BitSet_14max(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -20016,7 +20016,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_14max(struct __pyx_obj_3_sa_BitSet *__pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("max", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":148 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":148 * * def max(self): * return self.b.max_val # <<<<<<<<<<<<<< @@ -20034,7 +20034,7 @@ static PyObject *__pyx_pf_3_sa_6BitSet_14max(struct __pyx_obj_3_sa_BitSet *__pyx goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.BitSet.max", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.max", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20043,17 +20043,17 @@ static PyObject *__pyx_pf_3_sa_6BitSet_14max(struct __pyx_obj_3_sa_BitSet *__pyx } /* Python wrapper */ -static Py_ssize_t __pyx_pw_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6BitSet_16__len__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":150 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":150 * return self.b.max_val * * def __len__(self): # <<<<<<<<<<<<<< @@ -20061,12 +20061,12 @@ static Py_ssize_t __pyx_pw_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_3_sa_6BitSet_16__len__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self) { +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":151 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":151 * * def __len__(self): * return self.b.size # <<<<<<<<<<<<<< @@ -20083,17 +20083,17 @@ static Py_ssize_t __pyx_pf_3_sa_6BitSet_16__len__(struct __pyx_obj_3_sa_BitSet * } /* Python wrapper */ -static int __pyx_pw_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static int __pyx_pw_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6BitSet_18__contains__(((struct __pyx_obj_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":153 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":153 * return self.b.size * * def __contains__(self, i): # <<<<<<<<<<<<<< @@ -20101,7 +20101,7 @@ static int __pyx_pw_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject * */ -static int __pyx_pf_3_sa_6BitSet_18__contains__(struct __pyx_obj_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { +static int __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -20112,7 +20112,7 @@ static int __pyx_pf_3_sa_6BitSet_18__contains__(struct __pyx_obj_3_sa_BitSet *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__contains__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":154 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":154 * * def __contains__(self, i): * return bool(bitset_contains(self.b, i)) # <<<<<<<<<<<<<< @@ -20120,7 +20120,7 @@ static int __pyx_pf_3_sa_6BitSet_18__contains__(struct __pyx_obj_3_sa_BitSet *__ * */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_bitset_contains(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_bitset_contains(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -20131,14 +20131,14 @@ static int __pyx_pf_3_sa_6BitSet_18__contains__(struct __pyx_obj_3_sa_BitSet *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.BitSet.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":157 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":157 * * * cdef str dec2bin(long i): # <<<<<<<<<<<<<< @@ -20146,7 +20146,7 @@ static int __pyx_pf_3_sa_6BitSet_18__contains__(struct __pyx_obj_3_sa_BitSet *__ * cdef unsigned d */ -static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { +static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) { PyObject *__pyx_v_result = 0; CYTHON_UNUSED unsigned int __pyx_v_d; PyObject *__pyx_r = NULL; @@ -20160,7 +20160,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dec2bin", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":158 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":158 * * cdef str dec2bin(long i): * cdef str result = "" # <<<<<<<<<<<<<< @@ -20170,28 +20170,28 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { __Pyx_INCREF(((PyObject *)__pyx_kp_s_47)); __pyx_v_result = __pyx_kp_s_47; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":160 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":160 * cdef str result = "" * cdef unsigned d * for d in range(MIN_BOTTOM_SIZE): # <<<<<<<<<<<<<< * if i & LOWER_MASK[0] == 0: * result = "0"+result */ - __pyx_t_1 = __pyx_v_3_sa_MIN_BOTTOM_SIZE; + __pyx_t_1 = __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_d = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":161 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":161 * cdef unsigned d * for d in range(MIN_BOTTOM_SIZE): * if i & LOWER_MASK[0] == 0: # <<<<<<<<<<<<<< * result = "0"+result * else: */ - __pyx_t_3 = (((__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[0])) == 0) != 0); + __pyx_t_3 = (((__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[0])) == 0) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":162 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":162 * for d in range(MIN_BOTTOM_SIZE): * if i & LOWER_MASK[0] == 0: * result = "0"+result # <<<<<<<<<<<<<< @@ -20207,7 +20207,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":164 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":164 * result = "0"+result * else: * result = "1"+result # <<<<<<<<<<<<<< @@ -20222,7 +20222,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":165 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":165 * else: * result = "1"+result * i = i >> 1 # <<<<<<<<<<<<<< @@ -20232,7 +20232,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { __pyx_v_i = (__pyx_v_i >> 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":166 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":166 * result = "1"+result * i = i >> 1 * return result # <<<<<<<<<<<<<< @@ -20248,7 +20248,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.dec2bin", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.dec2bin", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -20257,7 +20257,7 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":177 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":177 * void** bottom * * cdef _VEB* new_VEB(int n): # <<<<<<<<<<<<<< @@ -20265,10 +20265,10 @@ static PyObject *__pyx_f_3_sa_dec2bin(long __pyx_v_i) { * cdef int num_bits, num_top_bits, i */ -static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { - struct __pyx_t_3_sa__VEB *__pyx_v_veb; +static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __pyx_v_n) { + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb; int __pyx_v_num_bits; - struct __pyx_t_3_sa__VEB *__pyx_r; + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_r; __Pyx_RefNannyDeclarations double __pyx_t_1; double __pyx_t_2; @@ -20278,16 +20278,16 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("new_VEB", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":181 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":181 * cdef int num_bits, num_top_bits, i * * veb = <_VEB*> malloc(sizeof(_VEB)) # <<<<<<<<<<<<<< * * num_bits = int(ceil(log(n) / log(2))) */ - __pyx_v_veb = ((struct __pyx_t_3_sa__VEB *)malloc((sizeof(struct __pyx_t_3_sa__VEB)))); + __pyx_v_veb = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__VEB)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":183 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":183 * veb = <_VEB*> malloc(sizeof(_VEB)) * * num_bits = int(ceil(log(n) / log(2))) # <<<<<<<<<<<<<< @@ -20308,7 +20308,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { } __pyx_v_num_bits = ((int)ceil((__pyx_t_1 / __pyx_t_2))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":184 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":184 * * num_bits = int(ceil(log(n) / log(2))) * veb.num_bottom_bits = num_bits/2 # <<<<<<<<<<<<<< @@ -20317,29 +20317,29 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->num_bottom_bits = __Pyx_div_long(__pyx_v_num_bits, 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":185 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< * veb.num_bottom_bits = MIN_BOTTOM_BITS * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 */ - __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits < __pyx_v_3_sa_MIN_BOTTOM_BITS) != 0); + __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits < __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":186 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 * */ - __pyx_v_veb->num_bottom_bits = __pyx_v_3_sa_MIN_BOTTOM_BITS; + __pyx_v_veb->num_bottom_bits = __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS; goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":187 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -20348,7 +20348,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->top_universe_size = ((__pyx_v_n >> __pyx_v_veb->num_bottom_bits) + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":189 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":189 * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 * * veb.bottom = malloc(veb.top_universe_size * sizeof(void*)) # <<<<<<<<<<<<<< @@ -20357,7 +20357,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->bottom = ((void **)malloc((__pyx_v_veb->top_universe_size * (sizeof(void *))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":190 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":190 * * veb.bottom = malloc(veb.top_universe_size * sizeof(void*)) * memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) # <<<<<<<<<<<<<< @@ -20366,40 +20366,40 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ memset(__pyx_v_veb->bottom, 0, (__pyx_v_veb->top_universe_size * (sizeof(void *)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":192 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":192 * memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) * * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< * veb.top = new_VEB(veb.top_universe_size) * else: */ - __pyx_t_3 = ((__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE) != 0); + __pyx_t_3 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":193 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":193 * * if veb.top_universe_size > MIN_BOTTOM_SIZE: * veb.top = new_VEB(veb.top_universe_size) # <<<<<<<<<<<<<< * else: * veb.top = new_BitSet() */ - __pyx_v_veb->top = __pyx_f_3_sa_new_VEB(__pyx_v_veb->top_universe_size); + __pyx_v_veb->top = __pyx_f_4cdec_2sa_3_sa_new_VEB(__pyx_v_veb->top_universe_size); goto __pyx_L4; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":195 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":195 * veb.top = new_VEB(veb.top_universe_size) * else: * veb.top = new_BitSet() # <<<<<<<<<<<<<< * * veb.max_val = -1 */ - __pyx_v_veb->top = __pyx_f_3_sa_new_BitSet(); + __pyx_v_veb->top = __pyx_f_4cdec_2sa_3_sa_new_BitSet(); } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":197 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":197 * veb.top = new_BitSet() * * veb.max_val = -1 # <<<<<<<<<<<<<< @@ -20408,7 +20408,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->max_val = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":198 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":198 * * veb.max_val = -1 * veb.min_val = -1 # <<<<<<<<<<<<<< @@ -20417,7 +20417,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->min_val = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":199 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":199 * veb.max_val = -1 * veb.min_val = -1 * veb.size = 0 # <<<<<<<<<<<<<< @@ -20426,7 +20426,7 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { */ __pyx_v_veb->size = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":200 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":200 * veb.min_val = -1 * veb.size = 0 * return veb # <<<<<<<<<<<<<< @@ -20439,14 +20439,14 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("_sa.new_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.new_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":203 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":203 * * * cdef int VEB_insert(_VEB* veb, int i): # <<<<<<<<<<<<<< @@ -20454,9 +20454,9 @@ static struct __pyx_t_3_sa__VEB *__pyx_f_3_sa_new_VEB(int __pyx_v_n) { * cdef _BitSet* subb */ -static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { - struct __pyx_t_3_sa__VEB *__pyx_v_subv; - struct __pyx_t_3_sa__BitSet *__pyx_v_subb; +static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_subv; + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_subb; int __pyx_v_a; int __pyx_v_b; int __pyx_v_tmp; @@ -20468,7 +20468,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ int __pyx_t_4; __Pyx_RefNannySetupContext("VEB_insert", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":208 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":208 * cdef int a, b, tmp * * if veb.size == 0: # <<<<<<<<<<<<<< @@ -20478,7 +20478,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_1 = ((__pyx_v_veb->size == 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":209 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":209 * * if veb.size == 0: * veb.min_val = i # <<<<<<<<<<<<<< @@ -20487,7 +20487,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_veb->min_val = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":210 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":210 * if veb.size == 0: * veb.min_val = i * veb.max_val = i # <<<<<<<<<<<<<< @@ -20498,7 +20498,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":211 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":211 * veb.min_val = i * veb.max_val = i * elif i == veb.min_val or i == veb.max_val: # <<<<<<<<<<<<<< @@ -20514,7 +20514,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":212 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":212 * veb.max_val = i * elif i == veb.min_val or i == veb.max_val: * return 0 # <<<<<<<<<<<<<< @@ -20527,7 +20527,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":214 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":214 * return 0 * else: * if i < veb.min_val: # <<<<<<<<<<<<<< @@ -20537,7 +20537,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = ((__pyx_v_i < __pyx_v_veb->min_val) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":215 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":215 * else: * if i < veb.min_val: * tmp = i # <<<<<<<<<<<<<< @@ -20546,7 +20546,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_tmp = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":216 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":216 * if i < veb.min_val: * tmp = i * i = veb.min_val # <<<<<<<<<<<<<< @@ -20556,7 +20556,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_4 = __pyx_v_veb->min_val; __pyx_v_i = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":217 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":217 * tmp = i * i = veb.min_val * veb.min_val = tmp # <<<<<<<<<<<<<< @@ -20568,7 +20568,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":218 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":218 * i = veb.min_val * veb.min_val = tmp * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< @@ -20577,16 +20577,16 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":219 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":219 * veb.min_val = tmp * 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: */ - __pyx_v_b = (__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); + __pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":220 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -20596,123 +20596,123 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = (((__pyx_v_veb->bottom[__pyx_v_a]) == NULL) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":221 + /* "/home/mdenkows/cdec/python/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_3_sa_MIN_BOTTOM_SIZE) != 0); + __pyx_t_3 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":222 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":222 * if veb.bottom[a] == NULL: * if veb.top_universe_size > MIN_BOTTOM_SIZE: * subv = <_VEB*> veb.top # <<<<<<<<<<<<<< * VEB_insert(subv, a) * else: */ - __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top); + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":223 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":223 * if veb.top_universe_size > MIN_BOTTOM_SIZE: * subv = <_VEB*> veb.top * VEB_insert(subv, a) # <<<<<<<<<<<<<< * else: * subb = <_BitSet*> veb.top */ - __pyx_f_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_a); + __pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_a); goto __pyx_L6; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":225 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":225 * VEB_insert(subv, a) * else: * subb = <_BitSet*> veb.top # <<<<<<<<<<<<<< * bitset_insert(subb, a) * if veb.num_bottom_bits > MIN_BOTTOM_BITS: */ - __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top); + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":226 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":226 * else: * 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) */ - __pyx_f_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_a); + __pyx_f_4cdec_2sa_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_a); } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":227 + /* "/home/mdenkows/cdec/python/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_3_sa_MIN_BOTTOM_BITS) != 0); + __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":228 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * else: * veb.bottom[a] = new_BitSet() */ - (__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_3_sa_new_VEB((1 << __pyx_v_veb->num_bottom_bits)); + (__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; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":230 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":230 * veb.bottom[a] = new_VEB(1 << veb.num_bottom_bits) * else: * veb.bottom[a] = new_BitSet() # <<<<<<<<<<<<<< * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] */ - (__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_3_sa_new_BitSet(); + (__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_4cdec_2sa_3_sa_new_BitSet(); } __pyx_L7:; goto __pyx_L5; } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":231 + /* "/home/mdenkows/cdec/python/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_3_sa_MIN_BOTTOM_BITS) != 0); + __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":232 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":232 * veb.bottom[a] = new_BitSet() * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<< * if VEB_insert(subv, b) == 0: * return 0 */ - __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":233 + /* "/home/mdenkows/cdec/python/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_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_b) == 0) != 0); + __pyx_t_3 = ((__pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_b) == 0) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":234 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":234 * subv = <_VEB*> veb.bottom[a] * if VEB_insert(subv, b) == 0: * return 0 # <<<<<<<<<<<<<< @@ -20728,26 +20728,26 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":236 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":236 * return 0 * else: * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< * if bitset_insert(subb, b) == 0: * return 0 */ - __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":237 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":237 * else: * subb = <_BitSet*> veb.bottom[a] * if bitset_insert(subb, b) == 0: # <<<<<<<<<<<<<< * return 0 * */ - __pyx_t_3 = ((__pyx_f_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_b) == 0) != 0); + __pyx_t_3 = ((__pyx_f_4cdec_2sa_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_b) == 0) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":238 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":238 * subb = <_BitSet*> veb.bottom[a] * if bitset_insert(subb, b) == 0: * return 0 # <<<<<<<<<<<<<< @@ -20762,7 +20762,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":240 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":240 * return 0 * * if i > veb.max_val: # <<<<<<<<<<<<<< @@ -20772,7 +20772,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ __pyx_t_3 = ((__pyx_v_i > __pyx_v_veb->max_val) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":241 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":241 * * if i > veb.max_val: * veb.max_val = i # <<<<<<<<<<<<<< @@ -20786,7 +20786,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":242 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":242 * if i > veb.max_val: * veb.max_val = i * veb.size = veb.size + 1 # <<<<<<<<<<<<<< @@ -20795,7 +20795,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ */ __pyx_v_veb->size = (__pyx_v_veb->size + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":243 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":243 * veb.max_val = i * veb.size = veb.size + 1 * return 1 # <<<<<<<<<<<<<< @@ -20811,7 +20811,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":246 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":246 * * * cdef del_VEB(_VEB* veb): # <<<<<<<<<<<<<< @@ -20819,7 +20819,7 @@ static int __pyx_f_3_sa_VEB_insert(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __ * */ -static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { +static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb) { int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -20831,42 +20831,42 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("del_VEB", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":249 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":249 * cdef int i * * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< * i = (<_VEB*> veb.top).min_val * else: */ - __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE) != 0); + __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":250 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":250 * * if veb.top_universe_size > MIN_BOTTOM_SIZE: * i = (<_VEB*> veb.top).min_val # <<<<<<<<<<<<<< * else: * i = (<_BitSet*> veb.top).min_val */ - __pyx_t_2 = ((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top)->min_val; + __pyx_t_2 = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top)->min_val; __pyx_v_i = __pyx_t_2; goto __pyx_L3; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":252 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":252 * i = (<_VEB*> veb.top).min_val * else: * i = (<_BitSet*> veb.top).min_val # <<<<<<<<<<<<<< * * while i != -1: */ - __pyx_t_2 = ((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top)->min_val; + __pyx_t_2 = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top)->min_val; __pyx_v_i = __pyx_t_2; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":254 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":254 * i = (<_BitSet*> veb.top).min_val * * while i != -1: # <<<<<<<<<<<<<< @@ -20877,111 +20877,111 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { __pyx_t_1 = ((__pyx_v_i != -1) != 0); if (!__pyx_t_1) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":255 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":255 * * while i != -1: * if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<< * del_VEB(<_VEB*> veb.bottom[i]) * else: */ - __pyx_t_1 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_3_sa_MIN_BOTTOM_BITS) != 0); + __pyx_t_1 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":256 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":256 * while i != -1: * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * del_VEB(<_VEB*> veb.bottom[i]) # <<<<<<<<<<<<<< * else: * free(<_BitSet*> veb.bottom[i]) */ - __pyx_t_3 = __pyx_f_3_sa_del_VEB(((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_i]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_del_VEB(((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_i]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L6; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":258 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":258 * del_VEB(<_VEB*> veb.bottom[i]) * else: * free(<_BitSet*> veb.bottom[i]) # <<<<<<<<<<<<<< * * if veb.top_universe_size > MIN_BOTTOM_SIZE: */ - free(((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_i]))); + free(((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_i]))); } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":260 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":260 * free(<_BitSet*> veb.bottom[i]) * * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< * i = VEB_findsucc(<_VEB*> veb.top, i) * else: */ - __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE) != 0); + __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":261 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":261 * * if veb.top_universe_size > MIN_BOTTOM_SIZE: * i = VEB_findsucc(<_VEB*> veb.top, i) # <<<<<<<<<<<<<< * else: * i = bitset_findsucc(<_BitSet*> veb.top, i) */ - __pyx_v_i = __pyx_f_3_sa_VEB_findsucc(((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top), __pyx_v_i); + __pyx_v_i = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top), __pyx_v_i); goto __pyx_L7; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":263 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":263 * i = VEB_findsucc(<_VEB*> veb.top, i) * else: * i = bitset_findsucc(<_BitSet*> veb.top, i) # <<<<<<<<<<<<<< * * if veb.top_universe_size > MIN_BOTTOM_SIZE: */ - __pyx_v_i = __pyx_f_3_sa_bitset_findsucc(((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top), __pyx_v_i); + __pyx_v_i = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top), __pyx_v_i); } __pyx_L7:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":265 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":265 * i = bitset_findsucc(<_BitSet*> veb.top, i) * * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< * del_VEB(<_VEB*> veb.top) * else: */ - __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_3_sa_MIN_BOTTOM_SIZE) != 0); + __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":266 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":266 * * if veb.top_universe_size > MIN_BOTTOM_SIZE: * del_VEB(<_VEB*> veb.top) # <<<<<<<<<<<<<< * else: * free(<_BitSet*> veb.top) */ - __pyx_t_3 = __pyx_f_3_sa_del_VEB(((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_del_VEB(((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":268 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":268 * del_VEB(<_VEB*> veb.top) * else: * free(<_BitSet*> veb.top) # <<<<<<<<<<<<<< * free(veb.bottom) * free(veb) */ - free(((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top)); + free(((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top)); } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":269 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":269 * else: * free(<_BitSet*> veb.top) * free(veb.bottom) # <<<<<<<<<<<<<< @@ -20990,7 +20990,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { */ free(__pyx_v_veb->bottom); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":270 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":270 * free(<_BitSet*> veb.top) * free(veb.bottom) * free(veb) # <<<<<<<<<<<<<< @@ -21003,7 +21003,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.del_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.del_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -21011,7 +21011,7 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":273 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":273 * * * cdef int VEB_findsucc(_VEB* veb, int i): # <<<<<<<<<<<<<< @@ -21019,9 +21019,9 @@ static PyObject *__pyx_f_3_sa_del_VEB(struct __pyx_t_3_sa__VEB *__pyx_v_veb) { * cdef _BitSet* subb */ -static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { - struct __pyx_t_3_sa__VEB *__pyx_v_subv; - struct __pyx_t_3_sa__BitSet *__pyx_v_subb; +static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_subv; + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_subb; int __pyx_v_a; int __pyx_v_b; int __pyx_v_j; @@ -21034,7 +21034,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int int __pyx_t_3; __Pyx_RefNannySetupContext("VEB_findsucc", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":278 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":278 * cdef int a, b, j, c, found * * if veb.max_val == -1 or i>=veb.max_val: # <<<<<<<<<<<<<< @@ -21050,7 +21050,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":279 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":279 * * if veb.max_val == -1 or i>=veb.max_val: * return -1 # <<<<<<<<<<<<<< @@ -21063,7 +21063,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":280 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":280 * if veb.max_val == -1 or i>=veb.max_val: * return -1 * if i < veb.min_val: # <<<<<<<<<<<<<< @@ -21073,7 +21073,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = ((__pyx_v_i < __pyx_v_veb->min_val) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":281 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":281 * return -1 * if i < veb.min_val: * return veb.min_val # <<<<<<<<<<<<<< @@ -21086,7 +21086,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":283 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":283 * return veb.min_val * * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< @@ -21095,16 +21095,16 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":284 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":284 * * a = i >> veb.num_bottom_bits * b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<< * found = 0 * if veb.bottom[a] != NULL: */ - __pyx_v_b = (__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); + __pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":285 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":285 * a = i >> veb.num_bottom_bits * b = i & LOWER_MASK[veb.num_bottom_bits-1] * found = 0 # <<<<<<<<<<<<<< @@ -21113,7 +21113,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_found = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":286 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":286 * b = i & LOWER_MASK[veb.num_bottom_bits-1] * found = 0 * if veb.bottom[a] != NULL: # <<<<<<<<<<<<<< @@ -21123,26 +21123,26 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = (((__pyx_v_veb->bottom[__pyx_v_a]) != NULL) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":287 + /* "/home/mdenkows/cdec/python/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_3_sa_MIN_BOTTOM_BITS) != 0); + __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":288 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":288 * if veb.bottom[a] != NULL: * 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) */ - __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":289 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":289 * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] * if subv.max_val > b: # <<<<<<<<<<<<<< @@ -21152,16 +21152,16 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = ((__pyx_v_subv->max_val > __pyx_v_b) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":290 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * found = 1 * else: */ - __pyx_v_j = ((__pyx_v_a << __pyx_v_veb->num_bottom_bits) + __pyx_f_3_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_b)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":291 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":291 * if subv.max_val > b: * j = (a << veb.num_bottom_bits) + VEB_findsucc(subv, b) * found = 1 # <<<<<<<<<<<<<< @@ -21176,16 +21176,16 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":293 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":293 * found = 1 * else: * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< * if subb.max_val > b: * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) */ - __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":294 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":294 * else: * subb = <_BitSet*> veb.bottom[a] * if subb.max_val > b: # <<<<<<<<<<<<<< @@ -21195,16 +21195,16 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = ((__pyx_v_subb->max_val > __pyx_v_b) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":295 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * found = 1 * if found==0: */ - __pyx_v_j = ((__pyx_v_a << __pyx_v_veb->num_bottom_bits) + __pyx_f_3_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_b)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":296 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":296 * if subb.max_val > b: * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) * found = 1 # <<<<<<<<<<<<<< @@ -21221,7 +21221,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":297 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":297 * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) * found = 1 * if found==0: # <<<<<<<<<<<<<< @@ -21231,77 +21231,77 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_3 = ((__pyx_v_found == 0) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":298 + /* "/home/mdenkows/cdec/python/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_3_sa_MIN_BOTTOM_SIZE) != 0); + __pyx_t_3 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":299 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":299 * if found==0: * if veb.top_universe_size > MIN_BOTTOM_SIZE: * subv = <_VEB*> veb.top # <<<<<<<<<<<<<< * c = VEB_findsucc(subv, a) * else: */ - __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)__pyx_v_veb->top); + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":300 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":300 * if veb.top_universe_size > MIN_BOTTOM_SIZE: * subv = <_VEB*> veb.top * c = VEB_findsucc(subv, a) # <<<<<<<<<<<<<< * else: * subb = <_BitSet*> veb.top */ - __pyx_v_c = __pyx_f_3_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_a); + __pyx_v_c = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_a); goto __pyx_L10; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":302 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":302 * c = VEB_findsucc(subv, a) * else: * subb = <_BitSet*> veb.top # <<<<<<<<<<<<<< * c = bitset_findsucc(subb, a) * if veb.num_bottom_bits > MIN_BOTTOM_BITS: */ - __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)__pyx_v_veb->top); + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":303 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":303 * else: * subb = <_BitSet*> veb.top * c = bitset_findsucc(subb, a) # <<<<<<<<<<<<<< * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[c] */ - __pyx_v_c = __pyx_f_3_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_a); + __pyx_v_c = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_a); } __pyx_L10:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":304 + /* "/home/mdenkows/cdec/python/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_3_sa_MIN_BOTTOM_BITS) != 0); + __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":305 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":305 * 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 * else: */ - __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_c])); + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_c])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":306 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -21313,16 +21313,16 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":308 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":308 * j = (c << veb.num_bottom_bits) + subv.min_val * else: * subb = <_BitSet*> veb.bottom[c] # <<<<<<<<<<<<<< * j = (c << veb.num_bottom_bits) + subb.min_val * return j */ - __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_c])); + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_c])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":309 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":309 * else: * subb = <_BitSet*> veb.bottom[c] * j = (c << veb.num_bottom_bits) + subb.min_val # <<<<<<<<<<<<<< @@ -21336,7 +21336,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L9:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":310 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":310 * subb = <_BitSet*> veb.bottom[c] * j = (c << veb.num_bottom_bits) + subb.min_val * return j # <<<<<<<<<<<<<< @@ -21352,7 +21352,7 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":313 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":313 * * * cdef int VEB_contains(_VEB* veb, int i): # <<<<<<<<<<<<<< @@ -21360,9 +21360,9 @@ static int __pyx_f_3_sa_VEB_findsucc(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int * cdef _BitSet* subb */ -static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { - struct __pyx_t_3_sa__VEB *__pyx_v_subv; - struct __pyx_t_3_sa__BitSet *__pyx_v_subb; +static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_subv; + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_subb; int __pyx_v_a; int __pyx_v_b; int __pyx_r; @@ -21373,7 +21373,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int int __pyx_t_4; __Pyx_RefNannySetupContext("VEB_contains", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":318 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":318 * cdef int a, b * * if veb.size == 0 or i < veb.min_val or i > veb.max_val: # <<<<<<<<<<<<<< @@ -21395,7 +21395,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":319 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":319 * * if veb.size == 0 or i < veb.min_val or i > veb.max_val: * return 0 # <<<<<<<<<<<<<< @@ -21408,7 +21408,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":321 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":321 * return 0 * * if veb.min_val == i: # <<<<<<<<<<<<<< @@ -21418,7 +21418,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_2 = ((__pyx_v_veb->min_val == __pyx_v_i) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":322 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":322 * * if veb.min_val == i: * return 1 # <<<<<<<<<<<<<< @@ -21431,7 +21431,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":324 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":324 * return 1 * else: * if veb.size == 1: # <<<<<<<<<<<<<< @@ -21441,7 +21441,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_2 = ((__pyx_v_veb->size == 1) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":325 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":325 * else: * if veb.size == 1: * return 0 # <<<<<<<<<<<<<< @@ -21456,7 +21456,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":327 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":327 * return 0 * * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< @@ -21465,16 +21465,16 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int */ __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":328 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":328 * * a = i >> veb.num_bottom_bits * b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<< * if veb.bottom[a] == NULL: * return 0 */ - __pyx_v_b = (__pyx_v_i & (__pyx_v_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); + __pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":329 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -21484,7 +21484,7 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int __pyx_t_2 = (((__pyx_v_veb->bottom[__pyx_v_a]) == NULL) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":330 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":330 * b = i & LOWER_MASK[veb.num_bottom_bits-1] * if veb.bottom[a] == NULL: * return 0 # <<<<<<<<<<<<<< @@ -21497,55 +21497,55 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":332 + /* "/home/mdenkows/cdec/python/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_3_sa_MIN_BOTTOM_BITS) != 0); + __pyx_t_2 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":333 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":333 * else: * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<< * return VEB_contains(subv, b) * else: */ - __pyx_v_subv = ((struct __pyx_t_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":334 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":334 * if veb.num_bottom_bits > MIN_BOTTOM_BITS: * subv = <_VEB*> veb.bottom[a] * return VEB_contains(subv, b) # <<<<<<<<<<<<<< * else: * subb = <_BitSet*> veb.bottom[a] */ - __pyx_r = __pyx_f_3_sa_VEB_contains(__pyx_v_subv, __pyx_v_b); + __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_contains(__pyx_v_subv, __pyx_v_b); goto __pyx_L0; goto __pyx_L7; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":336 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":336 * return VEB_contains(subv, b) * else: * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< * return bitset_contains(subb, b) * */ - __pyx_v_subb = ((struct __pyx_t_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":337 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":337 * else: * subb = <_BitSet*> veb.bottom[a] * return bitset_contains(subb, b) # <<<<<<<<<<<<<< * * */ - __pyx_r = __pyx_f_3_sa_bitset_contains(__pyx_v_subb, __pyx_v_b); + __pyx_r = __pyx_f_4cdec_2sa_3_sa_bitset_contains(__pyx_v_subb, __pyx_v_b); goto __pyx_L0; } __pyx_L7:; @@ -21559,17 +21559,17 @@ static int __pyx_f_3_sa_VEB_contains(struct __pyx_t_3_sa__VEB *__pyx_v_veb, int } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_11VEBIterator___next__(((struct __pyx_obj_3_sa_VEBIterator *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(((struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":344 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":344 * cdef int next_val * * def __next__(self): # <<<<<<<<<<<<<< @@ -21577,7 +21577,7 @@ static PyObject *__pyx_pw_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBIterator *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *__pyx_v_self) { int __pyx_v_ret_val; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -21589,7 +21589,7 @@ static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBI int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__next__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":347 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":347 * cdef int ret_val * * if self.next_val == -1: # <<<<<<<<<<<<<< @@ -21599,7 +21599,7 @@ static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBI __pyx_t_1 = ((__pyx_v_self->next_val == -1) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":348 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":348 * * if self.next_val == -1: * raise StopIteration() # <<<<<<<<<<<<<< @@ -21615,7 +21615,7 @@ static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBI } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":349 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":349 * if self.next_val == -1: * raise StopIteration() * ret_val = self.next_val # <<<<<<<<<<<<<< @@ -21625,16 +21625,16 @@ static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBI __pyx_t_3 = __pyx_v_self->next_val; __pyx_v_ret_val = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":350 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":350 * raise StopIteration() * ret_val = self.next_val * self.next_val = VEB_findsucc(self.v, ret_val) # <<<<<<<<<<<<<< * return ret_val * */ - __pyx_v_self->next_val = __pyx_f_3_sa_VEB_findsucc(__pyx_v_self->v, __pyx_v_ret_val); + __pyx_v_self->next_val = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->v, __pyx_v_ret_val); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":351 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":351 * ret_val = self.next_val * self.next_val = VEB_findsucc(self.v, ret_val) * return ret_val # <<<<<<<<<<<<<< @@ -21652,7 +21652,7 @@ static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBI goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.VEBIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.VEBIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -21661,8 +21661,8 @@ static PyObject *__pyx_pf_3_sa_11VEBIterator___next__(struct __pyx_obj_3_sa_VEBI } /* Python wrapper */ -static int __pyx_pw_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_size; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -21701,16 +21701,16 @@ static int __pyx_pw_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.VEB.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.VEB.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_3VEB___cinit__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), __pyx_v_size); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), __pyx_v_size); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":360 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":360 * cdef int _first(self) * * def __cinit__(self, int size): # <<<<<<<<<<<<<< @@ -21718,19 +21718,19 @@ static int __pyx_pw_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx * */ -static int __pyx_pf_3_sa_3VEB___cinit__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_size) { +static int __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, int __pyx_v_size) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":361 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":361 * * def __cinit__(self, int size): * self.veb = new_VEB(size) # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __pyx_v_self->veb = __pyx_f_3_sa_new_VEB(__pyx_v_size); + __pyx_v_self->veb = __pyx_f_4cdec_2sa_3_sa_new_VEB(__pyx_v_size); __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -21738,15 +21738,15 @@ static int __pyx_pf_3_sa_3VEB___cinit__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, } /* Python wrapper */ -static void __pyx_pw_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_4cdec_2sa_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3_sa_3VEB_2__dealloc__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)); + __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":363 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":363 * self.veb = new_VEB(size) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -21754,7 +21754,7 @@ static void __pyx_pw_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_3_sa_3VEB_2__dealloc__(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { +static void __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; @@ -21762,37 +21762,37 @@ static void __pyx_pf_3_sa_3VEB_2__dealloc__(struct __pyx_obj_3_sa_VEB *__pyx_v_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":364 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":364 * * def __dealloc__(self): * del_VEB(self.veb) # <<<<<<<<<<<<<< * * def __iter__(self): */ - __pyx_t_1 = __pyx_f_3_sa_del_VEB(__pyx_v_self->veb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_4cdec_2sa_3_sa_del_VEB(__pyx_v_self->veb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.VEB.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.VEB.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_3VEB_4__iter__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":366 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":366 * del_VEB(self.veb) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -21800,31 +21800,31 @@ static PyObject *__pyx_pw_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self) { * it = VEBIterator() */ -static PyObject *__pyx_pf_3_sa_3VEB_4__iter__(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { - struct __pyx_obj_3_sa_VEBIterator *__pyx_v_it = 0; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { + struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *__pyx_v_it = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - struct __pyx_t_3_sa__VEB *__pyx_t_2; + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_t_2; int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":368 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":368 * def __iter__(self): * cdef VEBIterator it * it = VEBIterator() # <<<<<<<<<<<<<< * it.v = self.veb * it.next_val = self.veb.min_val */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_VEBIterator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_VEBIterator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_it = ((struct __pyx_obj_3_sa_VEBIterator *)__pyx_t_1); + __pyx_v_it = ((struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":369 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":369 * cdef VEBIterator it * it = VEBIterator() * it.v = self.veb # <<<<<<<<<<<<<< @@ -21834,7 +21834,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_4__iter__(struct __pyx_obj_3_sa_VEB *__pyx_v __pyx_t_2 = __pyx_v_self->veb; __pyx_v_it->v = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":370 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":370 * it = VEBIterator() * it.v = self.veb * it.next_val = self.veb.min_val # <<<<<<<<<<<<<< @@ -21844,7 +21844,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_4__iter__(struct __pyx_obj_3_sa_VEB *__pyx_v __pyx_t_3 = __pyx_v_self->veb->min_val; __pyx_v_it->next_val = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":371 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":371 * it.v = self.veb * it.next_val = self.veb.min_val * return it # <<<<<<<<<<<<<< @@ -21860,7 +21860,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_4__iter__(struct __pyx_obj_3_sa_VEB *__pyx_v goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.VEB.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.VEB.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_it); @@ -21870,17 +21870,17 @@ static PyObject *__pyx_pf_3_sa_3VEB_4__iter__(struct __pyx_obj_3_sa_VEB *__pyx_v } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("insert (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_3VEB_6insert(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":373 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":373 * return it * * def insert(self, i): # <<<<<<<<<<<<<< @@ -21888,7 +21888,7 @@ static PyObject *__pyx_pw_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__ * */ -static PyObject *__pyx_pf_3_sa_3VEB_6insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -21898,7 +21898,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_6insert(struct __pyx_obj_3_sa_VEB *__pyx_v_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("insert", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":374 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":374 * * def insert(self, i): * return VEB_insert(self.veb, i) # <<<<<<<<<<<<<< @@ -21907,7 +21907,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_6insert(struct __pyx_obj_3_sa_VEB *__pyx_v_s */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -21917,7 +21917,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_6insert(struct __pyx_obj_3_sa_VEB *__pyx_v_s goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.VEB.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.VEB.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -21925,7 +21925,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_6insert(struct __pyx_obj_3_sa_VEB *__pyx_v_s return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":376 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":376 * return VEB_insert(self.veb, i) * * cdef int _insert(self, int i): # <<<<<<<<<<<<<< @@ -21933,19 +21933,19 @@ static PyObject *__pyx_pf_3_sa_3VEB_6insert(struct __pyx_obj_3_sa_VEB *__pyx_v_s * */ -static int __pyx_f_3_sa_3VEB__insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_i) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_insert", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":377 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":377 * * cdef int _insert(self, int i): * return VEB_insert(self.veb, i) # <<<<<<<<<<<<<< * * def findsucc(self, i): */ - __pyx_r = __pyx_f_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_v_i); + __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_v_i); goto __pyx_L0; __pyx_r = 0; @@ -21955,17 +21955,17 @@ static int __pyx_f_3_sa_3VEB__insert(struct __pyx_obj_3_sa_VEB *__pyx_v_self, in } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("findsucc (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_3VEB_8findsucc(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":379 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":379 * return VEB_insert(self.veb, i) * * def findsucc(self, i): # <<<<<<<<<<<<<< @@ -21973,7 +21973,7 @@ static PyObject *__pyx_pw_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject * * */ -static PyObject *__pyx_pf_3_sa_3VEB_8findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -21983,7 +21983,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_8findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v int __pyx_clineno = 0; __Pyx_RefNannySetupContext("findsucc", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":380 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":380 * * def findsucc(self, i): * return VEB_findsucc(self.veb, i) # <<<<<<<<<<<<<< @@ -21992,7 +21992,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_8findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -22002,7 +22002,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_8findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.VEB.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.VEB.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -22010,7 +22010,7 @@ static PyObject *__pyx_pf_3_sa_3VEB_8findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":382 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":382 * return VEB_findsucc(self.veb, i) * * cdef int _first(self): # <<<<<<<<<<<<<< @@ -22018,12 +22018,12 @@ static PyObject *__pyx_pf_3_sa_3VEB_8findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v * */ -static int __pyx_f_3_sa_3VEB__first(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { +static int __pyx_f_4cdec_2sa_3_sa_3VEB__first(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_first", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":383 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":383 * * cdef int _first(self): * return self.veb.min_val # <<<<<<<<<<<<<< @@ -22039,7 +22039,7 @@ static int __pyx_f_3_sa_3VEB__first(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":385 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":385 * return self.veb.min_val * * cdef int _findsucc(self, int i): # <<<<<<<<<<<<<< @@ -22047,19 +22047,19 @@ static int __pyx_f_3_sa_3VEB__first(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { * */ -static int __pyx_f_3_sa_3VEB__findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, int __pyx_v_i) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_findsucc", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":386 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":386 * * cdef int _findsucc(self, int i): * return VEB_findsucc(self.veb, i) # <<<<<<<<<<<<<< * * def __len__(self): */ - __pyx_r = __pyx_f_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_v_i); + __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_v_i); goto __pyx_L0; __pyx_r = 0; @@ -22069,17 +22069,17 @@ static int __pyx_f_3_sa_3VEB__findsucc(struct __pyx_obj_3_sa_VEB *__pyx_v_self, } /* Python wrapper */ -static Py_ssize_t __pyx_pw_3_sa_3VEB_11__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_3_sa_3VEB_11__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_3VEB_10__len__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":388 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":388 * return VEB_findsucc(self.veb, i) * * def __len__(self): # <<<<<<<<<<<<<< @@ -22087,12 +22087,12 @@ static Py_ssize_t __pyx_pw_3_sa_3VEB_11__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_3_sa_3VEB_10__len__(struct __pyx_obj_3_sa_VEB *__pyx_v_self) { +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":389 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":389 * * def __len__(self): * return self.veb.size # <<<<<<<<<<<<<< @@ -22109,24 +22109,24 @@ static Py_ssize_t __pyx_pf_3_sa_3VEB_10__len__(struct __pyx_obj_3_sa_VEB *__pyx_ } /* Python wrapper */ -static int __pyx_pw_3_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static int __pyx_pw_3_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static int __pyx_pw_4cdec_2sa_3_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_3VEB_12__contains__(((struct __pyx_obj_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":391 +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":391 * return self.veb.size * * def __contains__(self, i): # <<<<<<<<<<<<<< * return VEB_contains(self.veb, i) */ -static int __pyx_pf_3_sa_3VEB_12__contains__(struct __pyx_obj_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { +static int __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -22135,19 +22135,19 @@ static int __pyx_pf_3_sa_3VEB_12__contains__(struct __pyx_obj_3_sa_VEB *__pyx_v_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__contains__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":392 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":392 * * def __contains__(self, i): * return VEB_contains(self.veb, i) # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_f_3_sa_VEB_contains(__pyx_v_self->veb, __pyx_t_1); + __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_contains(__pyx_v_self->veb, __pyx_t_1); goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.VEB.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.VEB.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -22155,9 +22155,9 @@ static int __pyx_pf_3_sa_3VEB_12__contains__(struct __pyx_obj_3_sa_VEB *__pyx_v_ } /* Python wrapper */ -static int __pyx_pw_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sa = 0; +static int __pyx_pw_4cdec_2sa_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sa = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -22189,18 +22189,18 @@ static int __pyx_pw_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_sa = ((struct __pyx_obj_3_sa_SuffixArray *)values[0]); + __pyx_v_sa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[0]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.LCP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.LCP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sa), __pyx_ptype_3_sa_SuffixArray, 1, "sa", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3_sa_3LCP___cinit__(((struct __pyx_obj_3_sa_LCP *)__pyx_v_self), __pyx_v_sa); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sa), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "sa", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_LCP *)__pyx_v_self), __pyx_v_sa); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -22209,7 +22209,7 @@ static int __pyx_pw_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":9 +/* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":9 * cdef IntList lcp * * def __cinit__(self, SuffixArray sa): # <<<<<<<<<<<<<< @@ -22217,13 +22217,13 @@ static int __pyx_pw_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx * cdef IntList rank */ -static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sa) { +static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_LCP *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sa) { int __pyx_v_i; int __pyx_v_k; int __pyx_v_j; int __pyx_v_h; int __pyx_v_n; - struct __pyx_obj_3_sa_IntList *__pyx_v_rank = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_rank = 0; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -22238,7 +22238,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":13 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":13 * cdef IntList rank * * logger.info("Constructing LCP array") # <<<<<<<<<<<<<< @@ -22255,7 +22255,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":14 * * logger.info("Constructing LCP array") * self.sa = sa # <<<<<<<<<<<<<< @@ -22268,7 +22268,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); __pyx_v_self->sa = __pyx_v_sa; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":15 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":15 * logger.info("Constructing LCP array") * self.sa = sa * n = self.sa.sa.len # <<<<<<<<<<<<<< @@ -22278,7 +22278,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __pyx_t_3 = __pyx_v_self->sa->sa->len; __pyx_v_n = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":16 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":16 * self.sa = sa * n = self.sa.sa.len * self.lcp = IntList(initial_len=n) # <<<<<<<<<<<<<< @@ -22291,16 +22291,16 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->lcp); __Pyx_DECREF(((PyObject *)__pyx_v_self->lcp)); - __pyx_v_self->lcp = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __pyx_v_self->lcp = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":18 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":18 * self.lcp = IntList(initial_len=n) * * rank = IntList(initial_len=n) # <<<<<<<<<<<<<< @@ -22313,13 +22313,13 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_rank = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":19 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":19 * * rank = IntList(initial_len=n) * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -22329,7 +22329,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __pyx_t_3 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":20 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":20 * rank = IntList(initial_len=n) * for i from 0 <= i < n: * rank.arr[sa.sa.arr[i]] = i # <<<<<<<<<<<<<< @@ -22339,7 +22339,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, (__pyx_v_rank->arr[(__pyx_v_sa->sa->arr[__pyx_v_i])]) = __pyx_v_i; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":22 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":22 * rank.arr[sa.sa.arr[i]] = i * * h = 0 # <<<<<<<<<<<<<< @@ -22348,7 +22348,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, */ __pyx_v_h = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":23 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":23 * * h = 0 * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -22358,7 +22358,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __pyx_t_3 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":24 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":24 * h = 0 * for i from 0 <= i < n: * k = rank.arr[i] # <<<<<<<<<<<<<< @@ -22367,7 +22367,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, */ __pyx_v_k = (__pyx_v_rank->arr[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":25 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":25 * for i from 0 <= i < n: * k = rank.arr[i] * if k == 0: # <<<<<<<<<<<<<< @@ -22377,7 +22377,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __pyx_t_4 = ((__pyx_v_k == 0) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":26 * k = rank.arr[i] * if k == 0: * self.lcp.arr[k] = -1 # <<<<<<<<<<<<<< @@ -22389,7 +22389,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":28 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":28 * self.lcp.arr[k] = -1 * else: * j = sa.sa.arr[k-1] # <<<<<<<<<<<<<< @@ -22398,7 +22398,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, */ __pyx_v_j = (__pyx_v_sa->sa->arr[(__pyx_v_k - 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":29 + /* "/home/mdenkows/cdec/python/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]: # <<<<<<<<<<<<<< @@ -22421,7 +22421,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, } if (!__pyx_t_5) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":30 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -22431,7 +22431,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __pyx_v_h = (__pyx_v_h + 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":31 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -22442,7 +22442,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":32 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":32 * h = h+1 * self.lcp.arr[k] = h * if h > 0: # <<<<<<<<<<<<<< @@ -22452,7 +22452,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __pyx_t_5 = ((__pyx_v_h > 0) != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":33 * self.lcp.arr[k] = h * if h > 0: * h = h-1 # <<<<<<<<<<<<<< @@ -22465,7 +22465,7 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __pyx_L10:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":34 * if h > 0: * h = h-1 * logger.info("LCP array completed") # <<<<<<<<<<<<<< @@ -22487,19 +22487,19 @@ static int __pyx_pf_3_sa_3LCP___cinit__(struct __pyx_obj_3_sa_LCP *__pyx_v_self, __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.LCP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.LCP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_rank); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n); /*proto*/ -static char __pyx_doc_3_sa_3LCP_2compute_stats[] = "Note: the output of this function is not exact. In\n particular, the frequency associated with each word is \n not guaranteed to be correct. This is due to a bit of\n laxness in the design; the function is intended only to\n obtain a list of the most frequent words; for this \n purpose it is perfectly fine"; -static PyObject *__pyx_pw_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_3LCP_2compute_stats[] = "Note: the output of this function is not exact. In\n particular, the frequency associated with each word is \n not guaranteed to be correct. This is due to a bit of\n laxness in the design; the function is intended only to\n obtain a list of the most frequent words; for this \n purpose it is perfectly fine"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n) { int __pyx_v_max_n; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -22512,16 +22512,16 @@ static PyObject *__pyx_pw_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_3LCP_2compute_stats(((struct __pyx_obj_3_sa_LCP *)__pyx_v_self), ((int)__pyx_v_max_n)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3LCP_2compute_stats(((struct __pyx_obj_4cdec_2sa_3_sa_LCP *)__pyx_v_self), ((int)__pyx_v_max_n)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":36 +/* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":36 * logger.info("LCP array completed") * * def compute_stats(self, int max_n): # <<<<<<<<<<<<<< @@ -22529,15 +22529,15 @@ static PyObject *__pyx_pw_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObj * particular, the frequency associated with each word is */ -static PyObject *__pyx_pf_3_sa_3LCP_2compute_stats(struct __pyx_obj_3_sa_LCP *__pyx_v_self, int __pyx_v_max_n) { - struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3LCP_2compute_stats(struct __pyx_obj_4cdec_2sa_3_sa_LCP *__pyx_v_self, int __pyx_v_max_n) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("compute_stats", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)__pyx_tp_new_3_sa___pyx_scope_struct_3_compute_stats(__pyx_ptype_3_sa___pyx_scope_struct_3_compute_stats, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -22548,7 +22548,7 @@ static PyObject *__pyx_pf_3_sa_3LCP_2compute_stats(struct __pyx_obj_3_sa_LCP *__ __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_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); 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; @@ -22557,7 +22557,7 @@ static PyObject *__pyx_pf_3_sa_3LCP_2compute_stats(struct __pyx_obj_3_sa_LCP *__ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -22566,9 +22566,9 @@ static PyObject *__pyx_pf_3_sa_3LCP_2compute_stats(struct __pyx_obj_3_sa_LCP *__ return __pyx_r; } -static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)__pyx_generator->closure); + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)__pyx_generator->closure); PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -22595,7 +22595,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":48 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":48 * cdef VEB veb * * N = self.sa.sa.len # <<<<<<<<<<<<<< @@ -22605,7 +22605,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->sa->sa->len; __pyx_cur_scope->__pyx_v_N = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":50 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":50 * N = self.sa.sa.len * * ngram_starts = [] # <<<<<<<<<<<<<< @@ -22618,7 +22618,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_cur_scope->__pyx_v_ngram_starts = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":51 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":51 * * ngram_starts = [] * for n from 0 <= n < max_n: # <<<<<<<<<<<<<< @@ -22628,7 +22628,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":52 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":52 * ngram_starts = [] * for n from 0 <= n < max_n: * ngram_starts.append(IntList(initial_len=N)) # <<<<<<<<<<<<<< @@ -22641,14 +22641,14 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_ngram_starts, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":54 * ngram_starts.append(IntList(initial_len=N)) * * run_start = IntList(initial_len=max_n) # <<<<<<<<<<<<<< @@ -22661,14 +22661,14 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_run_start = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __pyx_cur_scope->__pyx_v_run_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":55 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":55 * * run_start = IntList(initial_len=max_n) * veb = VEB(N) # <<<<<<<<<<<<<< @@ -22682,14 +22682,14 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen 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_3_sa_VEB)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_VEB)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_veb = ((struct __pyx_obj_3_sa_VEB *)__pyx_t_2); + __pyx_cur_scope->__pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":57 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":57 * veb = VEB(N) * * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -22699,7 +22699,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":58 * * for i from 0 <= i < N: * h = self.lcp.arr[i] # <<<<<<<<<<<<<< @@ -22708,7 +22708,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ __pyx_cur_scope->__pyx_v_h = (__pyx_cur_scope->__pyx_v_self->lcp->arr[__pyx_cur_scope->__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":59 * for i from 0 <= i < N: * h = self.lcp.arr[i] * if h < 0: # <<<<<<<<<<<<<< @@ -22718,7 +22718,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_h < 0) != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":60 * h = self.lcp.arr[i] * if h < 0: * h = 0 # <<<<<<<<<<<<<< @@ -22730,7 +22730,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":61 * if h < 0: * h = 0 * for n from h <= n < max_n: # <<<<<<<<<<<<<< @@ -22740,7 +22740,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":62 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":62 * h = 0 * for n from h <= n < max_n: * rs = run_start.arr[n] # <<<<<<<<<<<<<< @@ -22749,7 +22749,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ __pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_run_start->arr[__pyx_cur_scope->__pyx_v_n]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":63 * for n from h <= n < max_n: * rs = run_start.arr[n] * run_start.arr[n] = i # <<<<<<<<<<<<<< @@ -22758,7 +22758,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ (__pyx_cur_scope->__pyx_v_run_start->arr[__pyx_cur_scope->__pyx_v_n]) = __pyx_cur_scope->__pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":64 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":64 * rs = run_start.arr[n] * run_start.arr[n] = i * freq = i - rs # <<<<<<<<<<<<<< @@ -22767,7 +22767,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ __pyx_cur_scope->__pyx_v_freq = (__pyx_cur_scope->__pyx_v_i - __pyx_cur_scope->__pyx_v_rs); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":65 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":65 * run_start.arr[n] = i * freq = i - rs * if freq > 1000: # arbitrary, but see note below # <<<<<<<<<<<<<< @@ -22777,16 +22777,16 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_freq > 1000) != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":66 * freq = i - rs * if freq > 1000: # arbitrary, but see note below * veb._insert(freq) # <<<<<<<<<<<<<< * ngram_start = ngram_starts[n] * while ngram_start.arr[freq] > 0: */ - ((struct __pyx_vtabstruct_3_sa_VEB *)__pyx_cur_scope->__pyx_v_veb->__pyx_vtab)->_insert(__pyx_cur_scope->__pyx_v_veb, __pyx_cur_scope->__pyx_v_freq); + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":67 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":67 * if freq > 1000: # arbitrary, but see note below * veb._insert(freq) * ngram_start = ngram_starts[n] # <<<<<<<<<<<<<< @@ -22795,14 +22795,14 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_starts), __pyx_cur_scope->__pyx_v_n, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":68 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":68 * veb._insert(freq) * ngram_start = ngram_starts[n] * while ngram_start.arr[freq] > 0: # <<<<<<<<<<<<<< @@ -22813,7 +22813,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_t_5 = (((__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_freq]) > 0) != 0); if (!__pyx_t_5) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":69 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -22823,7 +22823,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_cur_scope->__pyx_v_freq = (__pyx_cur_scope->__pyx_v_freq + 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":70 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -22837,7 +22837,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen } } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":71 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -22847,7 +22847,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_t_1 = __pyx_cur_scope->__pyx_v_veb->veb->min_val; __pyx_cur_scope->__pyx_v_i = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":72 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":72 * ngram_start.arr[freq] = rs * i = veb.veb.min_val * while i != -1: # <<<<<<<<<<<<<< @@ -22858,16 +22858,16 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_i != -1) != 0); if (!__pyx_t_5) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":73 * i = veb.veb.min_val * while i != -1: * ii = veb._findsucc(i) # <<<<<<<<<<<<<< * for n from 0 <= n < max_n: * ngram_start = ngram_starts[n] */ - __pyx_cur_scope->__pyx_v_ii = ((struct __pyx_vtabstruct_3_sa_VEB *)__pyx_cur_scope->__pyx_v_veb->__pyx_vtab)->_findsucc(__pyx_cur_scope->__pyx_v_veb, __pyx_cur_scope->__pyx_v_i); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":74 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":74 * while i != -1: * ii = veb._findsucc(i) * for n from 0 <= n < max_n: # <<<<<<<<<<<<<< @@ -22877,7 +22877,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":75 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":75 * ii = veb._findsucc(i) * for n from 0 <= n < max_n: * ngram_start = ngram_starts[n] # <<<<<<<<<<<<<< @@ -22886,14 +22886,14 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_starts), __pyx_cur_scope->__pyx_v_n, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":76 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":76 * for n from 0 <= n < max_n: * ngram_start = ngram_starts[n] * iii = i # <<<<<<<<<<<<<< @@ -22902,7 +22902,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ __pyx_cur_scope->__pyx_v_iii = __pyx_cur_scope->__pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":77 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":77 * ngram_start = ngram_starts[n] * iii = i * rs = ngram_start.arr[iii] # <<<<<<<<<<<<<< @@ -22911,7 +22911,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ __pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_iii]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":78 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":78 * iii = i * rs = ngram_start.arr[iii] * while (ii==-1 or iii < ii) and rs != 0: # <<<<<<<<<<<<<< @@ -22934,7 +22934,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen } if (!__pyx_t_7) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":79 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< @@ -22943,7 +22943,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ __pyx_cur_scope->__pyx_v_j = (__pyx_cur_scope->__pyx_v_self->sa->sa->arr[__pyx_cur_scope->__pyx_v_rs]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":80 * while (ii==-1 or iii < ii) and rs != 0: * j = self.sa.sa.arr[rs] * valid = 1 # <<<<<<<<<<<<<< @@ -22952,7 +22952,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ __pyx_cur_scope->__pyx_v_valid = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":81 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":81 * j = self.sa.sa.arr[rs] * valid = 1 * for k from 0 <= k < n+1: # <<<<<<<<<<<<<< @@ -22962,7 +22962,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":82 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":82 * valid = 1 * for k from 0 <= k < n+1: * if self.sa.darray.data.arr[j+k] < 2: # <<<<<<<<<<<<<< @@ -22972,7 +22972,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":83 * for k from 0 <= k < n+1: * if self.sa.darray.data.arr[j+k] < 2: * valid = 0 # <<<<<<<<<<<<<< @@ -22985,7 +22985,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_L22:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":84 * if self.sa.darray.data.arr[j+k] < 2: * valid = 0 * if valid: # <<<<<<<<<<<<<< @@ -22995,7 +22995,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_t_7 = (__pyx_cur_scope->__pyx_v_valid != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":85 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":85 * valid = 0 * if valid: * ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)]) # <<<<<<<<<<<<<< @@ -23021,7 +23021,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen __pyx_cur_scope->__pyx_v_ngram = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":86 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -23058,7 +23058,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen } __pyx_L23:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":87 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -23067,7 +23067,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen */ __pyx_cur_scope->__pyx_v_iii = (__pyx_cur_scope->__pyx_v_iii + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":88 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":88 * yield i, n+1, ngram * iii = iii + 1 * rs = ngram_start.arr[iii] # <<<<<<<<<<<<<< @@ -23077,7 +23077,7 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen } } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":89 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":89 * iii = iii + 1 * rs = ngram_start.arr[iii] * i = ii # <<<<<<<<<<<<<< @@ -23100,20 +23100,20 @@ static PyObject *__pyx_gb_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_gen } /* Python wrapper */ -static int __pyx_pw_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __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_3_sa_8Alphabet___cinit__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":12 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":12 * cdef dict id2sym * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -23121,7 +23121,7 @@ static int __pyx_pw_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject * * self.nonterminals = StringMap() */ -static int __pyx_pf_3_sa_8Alphabet___cinit__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -23130,37 +23130,37 @@ static int __pyx_pf_3_sa_8Alphabet___cinit__(struct __pyx_obj_3_sa_Alphabet *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":13 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":13 * * def __cinit__(self): * self.terminals = StringMap() # <<<<<<<<<<<<<< * self.nonterminals = StringMap() * self.id2sym = {} */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->terminals); __Pyx_DECREF(((PyObject *)__pyx_v_self->terminals)); - __pyx_v_self->terminals = ((struct __pyx_obj_3_sa_StringMap *)__pyx_t_1); + __pyx_v_self->terminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":14 * def __cinit__(self): * self.terminals = StringMap() * self.nonterminals = StringMap() # <<<<<<<<<<<<<< * self.id2sym = {} * self.first_nonterminal = -1 */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->nonterminals); __Pyx_DECREF(((PyObject *)__pyx_v_self->nonterminals)); - __pyx_v_self->nonterminals = ((struct __pyx_obj_3_sa_StringMap *)__pyx_t_1); + __pyx_v_self->nonterminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":15 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":15 * self.terminals = StringMap() * self.nonterminals = StringMap() * self.id2sym = {} # <<<<<<<<<<<<<< @@ -23175,7 +23175,7 @@ static int __pyx_pf_3_sa_8Alphabet___cinit__(struct __pyx_obj_3_sa_Alphabet *__p __pyx_v_self->id2sym = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":16 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":16 * self.nonterminals = StringMap() * self.id2sym = {} * self.first_nonterminal = -1 # <<<<<<<<<<<<<< @@ -23188,7 +23188,7 @@ static int __pyx_pf_3_sa_8Alphabet___cinit__(struct __pyx_obj_3_sa_Alphabet *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.Alphabet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Alphabet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -23196,15 +23196,15 @@ static int __pyx_pf_3_sa_8Alphabet___cinit__(struct __pyx_obj_3_sa_Alphabet *__p } /* Python wrapper */ -static void __pyx_pw_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_4cdec_2sa_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3_sa_8Alphabet_2__dealloc__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); + __pyx_pf_4cdec_2sa_3_sa_8Alphabet_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":18 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":18 * self.first_nonterminal = -1 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -23212,14 +23212,14 @@ static void __pyx_pw_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self) { * */ -static void __pyx_pf_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { +static void __pyx_pf_4cdec_2sa_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":21 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":21 * pass * * cdef int isvar(self, int sym): # <<<<<<<<<<<<<< @@ -23227,12 +23227,12 @@ static void __pyx_pf_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_ * */ -static int __pyx_f_3_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isvar", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":22 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":22 * * cdef int isvar(self, int sym): * return sym < 0 # <<<<<<<<<<<<<< @@ -23248,7 +23248,7 @@ static int __pyx_f_3_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj_3_sa_Alph return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":24 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":24 * return sym < 0 * * cdef int isword(self, int sym): # <<<<<<<<<<<<<< @@ -23256,12 +23256,12 @@ static int __pyx_f_3_sa_8Alphabet_isvar(CYTHON_UNUSED struct __pyx_obj_3_sa_Alph * */ -static int __pyx_f_3_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isword", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":25 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":25 * * cdef int isword(self, int sym): * return sym >= 0 # <<<<<<<<<<<<<< @@ -23277,7 +23277,7 @@ static int __pyx_f_3_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_obj_3_sa_Alp return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":27 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":27 * return sym >= 0 * * cdef int getindex(self, int sym): # <<<<<<<<<<<<<< @@ -23285,19 +23285,19 @@ static int __pyx_f_3_sa_8Alphabet_isword(CYTHON_UNUSED struct __pyx_obj_3_sa_Alp * */ -static int __pyx_f_3_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getindex", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":28 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":28 * * cdef int getindex(self, int sym): * return -sym & INDEX_MASK # <<<<<<<<<<<<<< * * cdef int setindex(self, int sym, int ind): */ - __pyx_r = ((-__pyx_v_sym) & __pyx_v_3_sa_INDEX_MASK); + __pyx_r = ((-__pyx_v_sym) & __pyx_v_4cdec_2sa_3_sa_INDEX_MASK); goto __pyx_L0; __pyx_r = 0; @@ -23306,7 +23306,7 @@ static int __pyx_f_3_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_obj_3_sa_A return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":30 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":30 * return -sym & INDEX_MASK * * cdef int setindex(self, int sym, int ind): # <<<<<<<<<<<<<< @@ -23314,19 +23314,19 @@ static int __pyx_f_3_sa_8Alphabet_getindex(CYTHON_UNUSED struct __pyx_obj_3_sa_A * */ -static int __pyx_f_3_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym, int __pyx_v_ind) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("setindex", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":31 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":31 * * cdef int setindex(self, int sym, int ind): * return -(-sym & ~INDEX_MASK | ind) # <<<<<<<<<<<<<< * * cdef int clearindex(self, int sym): */ - __pyx_r = (-(((-__pyx_v_sym) & (~__pyx_v_3_sa_INDEX_MASK)) | __pyx_v_ind)); + __pyx_r = (-(((-__pyx_v_sym) & (~__pyx_v_4cdec_2sa_3_sa_INDEX_MASK)) | __pyx_v_ind)); goto __pyx_L0; __pyx_r = 0; @@ -23335,7 +23335,7 @@ static int __pyx_f_3_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_obj_3_sa_A return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":33 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":33 * return -(-sym & ~INDEX_MASK | ind) * * cdef int clearindex(self, int sym): # <<<<<<<<<<<<<< @@ -23343,19 +23343,19 @@ static int __pyx_f_3_sa_8Alphabet_setindex(CYTHON_UNUSED struct __pyx_obj_3_sa_A * */ -static int __pyx_f_3_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clearindex", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":34 * * cdef int clearindex(self, int sym): * return -(-sym& ~INDEX_MASK) # <<<<<<<<<<<<<< * * cdef int match(self, int sym1, int sym2): */ - __pyx_r = (-((-__pyx_v_sym) & (~__pyx_v_3_sa_INDEX_MASK))); + __pyx_r = (-((-__pyx_v_sym) & (~__pyx_v_4cdec_2sa_3_sa_INDEX_MASK))); goto __pyx_L0; __pyx_r = 0; @@ -23364,7 +23364,7 @@ static int __pyx_f_3_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __pyx_obj_3_sa return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":36 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":36 * return -(-sym& ~INDEX_MASK) * * cdef int match(self, int sym1, int sym2): # <<<<<<<<<<<<<< @@ -23372,19 +23372,19 @@ static int __pyx_f_3_sa_8Alphabet_clearindex(CYTHON_UNUSED struct __pyx_obj_3_sa * */ -static int __pyx_f_3_sa_8Alphabet_match(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym1, int __pyx_v_sym2) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("match", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":37 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":37 * * cdef int match(self, int sym1, int sym2): * return self.clearindex(sym1) == self.clearindex(sym2); # <<<<<<<<<<<<<< * * cdef char* tocat(self, int sym): */ - __pyx_r = (((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->clearindex(__pyx_v_self, __pyx_v_sym1) == ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->clearindex(__pyx_v_self, __pyx_v_sym2)); + __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; __pyx_r = 0; @@ -23393,7 +23393,7 @@ static int __pyx_f_3_sa_8Alphabet_match(struct __pyx_obj_3_sa_Alphabet *__pyx_v_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":39 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":39 * return self.clearindex(sym1) == self.clearindex(sym2); * * cdef char* tocat(self, int sym): # <<<<<<<<<<<<<< @@ -23401,19 +23401,19 @@ static int __pyx_f_3_sa_8Alphabet_match(struct __pyx_obj_3_sa_Alphabet *__pyx_v_ * */ -static char *__pyx_f_3_sa_8Alphabet_tocat(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +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) { char *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("tocat", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":40 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":40 * * cdef char* tocat(self, int sym): * return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) # <<<<<<<<<<<<<< * * cdef int fromcat(self, char *s): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_self->nonterminals->__pyx_vtab)->word(__pyx_v_self->nonterminals, (((-__pyx_v_sym) >> __pyx_v_3_sa_INDEX_SHIFT) - 1)); + __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; __pyx_r = 0; @@ -23422,7 +23422,7 @@ static char *__pyx_f_3_sa_8Alphabet_tocat(struct __pyx_obj_3_sa_Alphabet *__pyx_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":42 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":42 * return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) * * cdef int fromcat(self, char *s): # <<<<<<<<<<<<<< @@ -23430,23 +23430,23 @@ static char *__pyx_f_3_sa_8Alphabet_tocat(struct __pyx_obj_3_sa_Alphabet *__pyx_ * i = self.nonterminals.index(s) */ -static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, char *__pyx_v_s) { +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) { int __pyx_v_i; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("fromcat", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":44 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":44 * cdef int fromcat(self, char *s): * cdef int i * i = self.nonterminals.index(s) # <<<<<<<<<<<<<< * if self.first_nonterminal == -1: * self.first_nonterminal = i */ - __pyx_v_i = ((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_self->nonterminals->__pyx_vtab)->index(__pyx_v_self->nonterminals, __pyx_v_s); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":45 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":45 * cdef int i * i = self.nonterminals.index(s) * if self.first_nonterminal == -1: # <<<<<<<<<<<<<< @@ -23456,7 +23456,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ __pyx_t_1 = ((__pyx_v_self->first_nonterminal == -1) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":46 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":46 * i = self.nonterminals.index(s) * if self.first_nonterminal == -1: * self.first_nonterminal = i # <<<<<<<<<<<<<< @@ -23468,7 +23468,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":47 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":47 * if self.first_nonterminal == -1: * self.first_nonterminal = i * if i > self.last_nonterminal: # <<<<<<<<<<<<<< @@ -23478,7 +23478,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ __pyx_t_1 = ((__pyx_v_i > __pyx_v_self->last_nonterminal) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":48 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":48 * self.first_nonterminal = i * if i > self.last_nonterminal: * self.last_nonterminal = i # <<<<<<<<<<<<<< @@ -23490,14 +23490,14 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":49 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":49 * if i > self.last_nonterminal: * self.last_nonterminal = i * return -(i+1 << INDEX_SHIFT) # <<<<<<<<<<<<<< * * cdef char* tostring(self, int sym): */ - __pyx_r = (-((__pyx_v_i + 1) << __pyx_v_3_sa_INDEX_SHIFT)); + __pyx_r = (-((__pyx_v_i + 1) << __pyx_v_4cdec_2sa_3_sa_INDEX_SHIFT)); goto __pyx_L0; __pyx_r = 0; @@ -23506,7 +23506,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":51 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":51 * return -(i+1 << INDEX_SHIFT) * * cdef char* tostring(self, int sym): # <<<<<<<<<<<<<< @@ -23514,7 +23514,7 @@ static int __pyx_f_3_sa_8Alphabet_fromcat(struct __pyx_obj_3_sa_Alphabet *__pyx_ * if self.isvar(sym): */ -static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, int __pyx_v_sym) { +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) { int __pyx_v_ind; char *__pyx_r; __Pyx_RefNannyDeclarations @@ -23529,17 +23529,17 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("tostring", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":53 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":53 * cdef char* tostring(self, int sym): * cdef int ind * if self.isvar(sym): # <<<<<<<<<<<<<< * if sym in self.id2sym: * return self.id2sym[sym] */ - __pyx_t_1 = (((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->isvar(__pyx_v_self, __pyx_v_sym) != 0); + __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":54 * cdef int ind * if self.isvar(sym): * if sym in self.id2sym: # <<<<<<<<<<<<<< @@ -23557,7 +23557,7 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_3 = (__pyx_t_1 != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":55 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":55 * if self.isvar(sym): * if sym in self.id2sym: * return self.id2sym[sym] # <<<<<<<<<<<<<< @@ -23578,16 +23578,16 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":56 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":56 * if sym in self.id2sym: * return self.id2sym[sym] * ind = self.getindex(sym) # <<<<<<<<<<<<<< * if ind > 0: * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) */ - __pyx_v_ind = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->getindex(__pyx_v_self, __pyx_v_sym); + __pyx_v_ind = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->getindex(__pyx_v_self, __pyx_v_sym); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":57 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":57 * return self.id2sym[sym] * ind = self.getindex(sym) * if ind > 0: # <<<<<<<<<<<<<< @@ -23597,14 +23597,14 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_3 = ((__pyx_v_ind > 0) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":58 * ind = self.getindex(sym) * if ind > 0: * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) # <<<<<<<<<<<<<< * else: * self.id2sym[sym] = "[%s]" % self.tocat(sym) */ - __pyx_t_2 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->tocat(__pyx_v_self, __pyx_v_sym)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->tocat(__pyx_v_self, __pyx_v_sym)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_5 = PyInt_FromLong(__pyx_v_ind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); @@ -23629,14 +23629,14 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":60 * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) * else: * self.id2sym[sym] = "[%s]" % self.tocat(sym) # <<<<<<<<<<<<<< * return self.id2sym[sym] * else: */ - __pyx_t_5 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->tocat(__pyx_v_self, __pyx_v_sym)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->tocat(__pyx_v_self, __pyx_v_sym)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); @@ -23650,7 +23650,7 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":61 * else: * self.id2sym[sym] = "[%s]" % self.tocat(sym) * return self.id2sym[sym] # <<<<<<<<<<<<<< @@ -23671,14 +23671,14 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":63 * return self.id2sym[sym] * else: * return self.terminals.word(sym) # <<<<<<<<<<<<<< * * cdef int fromstring(self, char *s, bint terminal): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->word(__pyx_v_self->terminals, __pyx_v_sym); + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->word(__pyx_v_self->terminals, __pyx_v_sym); goto __pyx_L0; } __pyx_L3:; @@ -23689,14 +23689,14 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("_sa.Alphabet.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.Alphabet.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":65 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":65 * return self.terminals.word(sym) * * cdef int fromstring(self, char *s, bint terminal): # <<<<<<<<<<<<<< @@ -23704,7 +23704,7 @@ static char *__pyx_f_3_sa_8Alphabet_tostring(struct __pyx_obj_3_sa_Alphabet *__p * cdef char *comma */ -static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self, char *__pyx_v_s, int __pyx_v_terminal) { +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) { char *__pyx_v_comma; int __pyx_v_n; char *__pyx_v_sep; @@ -23724,7 +23724,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fromstring", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":69 * cdef char *comma * cdef int n * n = strlen(s) # <<<<<<<<<<<<<< @@ -23733,7 +23733,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ __pyx_v_n = strlen(__pyx_v_s); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":71 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":71 * n = strlen(s) * cdef char *sep * sep = strstr(s,"_SEP_") # <<<<<<<<<<<<<< @@ -23742,7 +23742,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ __pyx_v_sep = strstr(__pyx_v_s, __pyx_k___SEP_); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":72 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -23770,7 +23770,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p } if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":73 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -23780,7 +23780,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_2 = (__pyx_v_terminal != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":74 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":74 * if n >= 3 and s[0] == c'[' and s[n-1] == c']' and sep == NULL: * if terminal: * s1 = "\\"+s # <<<<<<<<<<<<<< @@ -23795,7 +23795,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_v_s1 = __pyx_t_7; __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":75 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":75 * if terminal: * s1 = "\\"+s * return self.terminals.index(s1) # <<<<<<<<<<<<<< @@ -23803,13 +23803,13 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p * 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_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_t_8); + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_t_8); goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":76 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":76 * s1 = "\\"+s * return self.terminals.index(s1) * s[n-1] = c'\0' # <<<<<<<<<<<<<< @@ -23818,7 +23818,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ (__pyx_v_s[(__pyx_v_n - 1)]) = '\x00'; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":77 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":77 * return self.terminals.index(s1) * s[n-1] = c'\0' * s = s + 1 # <<<<<<<<<<<<<< @@ -23827,7 +23827,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ __pyx_v_s = (__pyx_v_s + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":78 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":78 * s[n-1] = c'\0' * s = s + 1 * comma = strrchr(s, c',') # <<<<<<<<<<<<<< @@ -23836,7 +23836,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ __pyx_v_comma = strrchr(__pyx_v_s, ','); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":79 * s = s + 1 * comma = strrchr(s, c',') * if comma != NULL: # <<<<<<<<<<<<<< @@ -23846,7 +23846,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_t_2 = ((__pyx_v_comma != NULL) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":80 * comma = strrchr(s, c',') * if comma != NULL: * comma[0] = c'\0' # <<<<<<<<<<<<<< @@ -23855,27 +23855,27 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p */ (__pyx_v_comma[0]) = '\x00'; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":81 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":81 * if comma != NULL: * comma[0] = c'\0' * return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) # <<<<<<<<<<<<<< * else: * return self.fromcat(s) */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->setindex(__pyx_v_self, ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->fromcat(__pyx_v_self, __pyx_v_s), strtol((__pyx_v_comma + 1), NULL, 10)); + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->setindex(__pyx_v_self, ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->fromcat(__pyx_v_self, __pyx_v_s), strtol((__pyx_v_comma + 1), NULL, 10)); goto __pyx_L0; goto __pyx_L5; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":83 * return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) * else: * return self.fromcat(s) # <<<<<<<<<<<<<< * else: * return self.terminals.index(s) */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->fromcat(__pyx_v_self, __pyx_v_s); + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->fromcat(__pyx_v_self, __pyx_v_s); goto __pyx_L0; } __pyx_L5:; @@ -23883,14 +23883,14 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":85 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":85 * return self.fromcat(s) * else: * return self.terminals.index(s) # <<<<<<<<<<<<<< * * cdef Alphabet ALPHABET = Alphabet() */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_v_s); + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_v_s); goto __pyx_L0; } __pyx_L3:; @@ -23900,7 +23900,7 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("_sa.Alphabet.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.Alphabet.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_s1); @@ -23909,17 +23909,17 @@ static int __pyx_f_3_sa_8Alphabet_fromstring(struct __pyx_obj_3_sa_Alphabet *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_8Alphabet_9terminals___get__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8Alphabet_9terminals___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":8 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":8 * * cdef class Alphabet: * cdef readonly StringMap terminals, nonterminals # <<<<<<<<<<<<<< @@ -23927,7 +23927,7 @@ static PyObject *__pyx_pw_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_s * cdef dict id2sym */ -static PyObject *__pyx_pf_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -23944,17 +23944,17 @@ static PyObject *__pyx_pf_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_3_s } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_8Alphabet_12nonterminals___get__(((struct __pyx_obj_3_sa_Alphabet *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8Alphabet_12nonterminals___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_3_sa_Alphabet *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -23970,7 +23970,7 @@ static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":89 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":89 * cdef Alphabet ALPHABET = Alphabet() * * cdef char* sym_tostring(int sym): # <<<<<<<<<<<<<< @@ -23978,19 +23978,19 @@ static PyObject *__pyx_pf_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj * */ -static char *__pyx_f_3_sa_sym_tostring(int __pyx_v_sym) { +static char *__pyx_f_4cdec_2sa_3_sa_sym_tostring(int __pyx_v_sym) { char *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("sym_tostring", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":90 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":90 * * cdef char* sym_tostring(int sym): * return ALPHABET.tostring(sym) # <<<<<<<<<<<<<< * * cdef char* sym_tocat(int sym): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->tostring(__pyx_v_3_sa_ALPHABET, __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; __pyx_r = 0; @@ -23999,7 +23999,7 @@ static char *__pyx_f_3_sa_sym_tostring(int __pyx_v_sym) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":92 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":92 * return ALPHABET.tostring(sym) * * cdef char* sym_tocat(int sym): # <<<<<<<<<<<<<< @@ -24007,19 +24007,19 @@ static char *__pyx_f_3_sa_sym_tostring(int __pyx_v_sym) { * */ -static char *__pyx_f_3_sa_sym_tocat(int __pyx_v_sym) { +static char *__pyx_f_4cdec_2sa_3_sa_sym_tocat(int __pyx_v_sym) { char *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("sym_tocat", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":93 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":93 * * cdef char* sym_tocat(int sym): * return ALPHABET.tocat(sym) # <<<<<<<<<<<<<< * * cdef int sym_isvar(int sym): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->tocat(__pyx_v_3_sa_ALPHABET, __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; __pyx_r = 0; @@ -24028,7 +24028,7 @@ static char *__pyx_f_3_sa_sym_tocat(int __pyx_v_sym) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":95 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":95 * return ALPHABET.tocat(sym) * * cdef int sym_isvar(int sym): # <<<<<<<<<<<<<< @@ -24036,19 +24036,19 @@ static char *__pyx_f_3_sa_sym_tocat(int __pyx_v_sym) { * */ -static int __pyx_f_3_sa_sym_isvar(int __pyx_v_sym) { +static int __pyx_f_4cdec_2sa_3_sa_sym_isvar(int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("sym_isvar", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":96 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":96 * * cdef int sym_isvar(int sym): * return ALPHABET.isvar(sym) # <<<<<<<<<<<<<< * * cdef int sym_getindex(int sym): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->isvar(__pyx_v_3_sa_ALPHABET, __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; __pyx_r = 0; @@ -24057,7 +24057,7 @@ static int __pyx_f_3_sa_sym_isvar(int __pyx_v_sym) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":98 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":98 * return ALPHABET.isvar(sym) * * cdef int sym_getindex(int sym): # <<<<<<<<<<<<<< @@ -24065,19 +24065,19 @@ static int __pyx_f_3_sa_sym_isvar(int __pyx_v_sym) { * */ -static int __pyx_f_3_sa_sym_getindex(int __pyx_v_sym) { +static int __pyx_f_4cdec_2sa_3_sa_sym_getindex(int __pyx_v_sym) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("sym_getindex", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":99 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":99 * * cdef int sym_getindex(int sym): * return ALPHABET.getindex(sym) # <<<<<<<<<<<<<< * * cdef int sym_setindex(int sym, int id): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->getindex(__pyx_v_3_sa_ALPHABET, __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; __pyx_r = 0; @@ -24086,7 +24086,7 @@ static int __pyx_f_3_sa_sym_getindex(int __pyx_v_sym) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":101 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":101 * return ALPHABET.getindex(sym) * * cdef int sym_setindex(int sym, int id): # <<<<<<<<<<<<<< @@ -24094,19 +24094,19 @@ static int __pyx_f_3_sa_sym_getindex(int __pyx_v_sym) { * */ -static int __pyx_f_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id) { +static int __pyx_f_4cdec_2sa_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("sym_setindex", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":102 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":102 * * cdef int sym_setindex(int sym, int id): * return ALPHABET.setindex(sym, id) # <<<<<<<<<<<<<< * * cdef int sym_fromstring(char* string, bint terminal): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->setindex(__pyx_v_3_sa_ALPHABET, __pyx_v_sym, __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; __pyx_r = 0; @@ -24115,7 +24115,7 @@ static int __pyx_f_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":104 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":104 * return ALPHABET.setindex(sym, id) * * cdef int sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<< @@ -24123,19 +24123,19 @@ static int __pyx_f_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id) { * */ -static int __pyx_f_3_sa_sym_fromstring(char *__pyx_v_string, int __pyx_v_terminal) { +static int __pyx_f_4cdec_2sa_3_sa_sym_fromstring(char *__pyx_v_string, int __pyx_v_terminal) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("sym_fromstring", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":105 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":105 * * cdef int sym_fromstring(char* string, bint terminal): * return ALPHABET.fromstring(string, terminal) # <<<<<<<<<<<<<< * * def isvar(sym): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_Alphabet *)__pyx_v_3_sa_ALPHABET->__pyx_vtab)->fromstring(__pyx_v_3_sa_ALPHABET, __pyx_v_string, __pyx_v_terminal); + __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; __pyx_r = 0; @@ -24145,18 +24145,18 @@ static int __pyx_f_3_sa_sym_fromstring(char *__pyx_v_string, int __pyx_v_termina } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_5isvar(PyObject *__pyx_self, PyObject *__pyx_v_sym); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_5isvar = {__Pyx_NAMESTR("isvar"), (PyCFunction)__pyx_pw_3_sa_5isvar, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_5isvar(PyObject *__pyx_self, PyObject *__pyx_v_sym) { +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 PyObject *__pyx_pw_4cdec_2sa_3_sa_5isvar(PyObject *__pyx_self, PyObject *__pyx_v_sym) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isvar (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_4isvar(__pyx_self, ((PyObject *)__pyx_v_sym)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4isvar(__pyx_self, ((PyObject *)__pyx_v_sym)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":107 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107 * return ALPHABET.fromstring(string, terminal) * * def isvar(sym): # <<<<<<<<<<<<<< @@ -24164,7 +24164,7 @@ static PyObject *__pyx_pw_3_sa_5isvar(PyObject *__pyx_self, PyObject *__pyx_v_sy * */ -static PyObject *__pyx_pf_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sym) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sym) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -24174,7 +24174,7 @@ static PyObject *__pyx_pf_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_self, PyObje int __pyx_clineno = 0; __Pyx_RefNannySetupContext("isvar", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":108 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":108 * * def isvar(sym): * return sym_isvar(sym) # <<<<<<<<<<<<<< @@ -24183,7 +24183,7 @@ static PyObject *__pyx_pf_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_self, PyObje */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_sym); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_3_sa_sym_isvar(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -24193,7 +24193,7 @@ static PyObject *__pyx_pf_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_self, PyObje goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.isvar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.isvar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -24202,19 +24202,19 @@ static PyObject *__pyx_pf_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_self, PyObje } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7make_lattice(PyObject *__pyx_self, PyObject *__pyx_v_words); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_7make_lattice = {__Pyx_NAMESTR("make_lattice"), (PyCFunction)__pyx_pw_3_sa_7make_lattice, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_7make_lattice(PyObject *__pyx_self, PyObject *__pyx_v_words) { +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 PyObject *__pyx_pw_4cdec_2sa_3_sa_7make_lattice(PyObject *__pyx_self, PyObject *__pyx_v_words) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("make_lattice (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6make_lattice(__pyx_self, ((PyObject *)__pyx_v_words)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6make_lattice(__pyx_self, ((PyObject *)__pyx_v_words)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_12make_lattice_2generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_2generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":111 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111 * * def make_lattice(words): * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< @@ -24222,25 +24222,25 @@ static PyObject *__pyx_gb_3_sa_12make_lattice_2generator7(__pyx_GeneratorObject * */ -static PyObject *__pyx_pf_3_sa_12make_lattice_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_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_3_sa___pyx_scope_struct_5_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_5_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_5_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_3_sa___pyx_scope_struct_4_make_lattice *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *) __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_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_2generator7, (PyObject *) __pyx_cur_scope); 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; @@ -24249,7 +24249,7 @@ static PyObject *__pyx_pf_3_sa_12make_lattice_genexpr(PyObject *__pyx_self) { __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.make_lattice.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -24258,9 +24258,9 @@ static PyObject *__pyx_pf_3_sa_12make_lattice_genexpr(PyObject *__pyx_self) { return __pyx_r; } -static PyObject *__pyx_gb_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_2generator7(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)__pyx_generator->closure); + 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; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -24322,7 +24322,7 @@ static PyObject *__pyx_gb_3_sa_12make_lattice_2generator7(__pyx_GeneratorObject __pyx_cur_scope->__pyx_v_word = __pyx_t_4; __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_cur_scope->__pyx_v_word); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -24357,9 +24357,9 @@ static PyObject *__pyx_gb_3_sa_12make_lattice_2generator7(__pyx_GeneratorObject __Pyx_RefNannyFinishContext(); return NULL; } -static PyObject *__pyx_gb_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":112 +/* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -24367,25 +24367,25 @@ static PyObject *__pyx_gb_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject * def decode_lattice(lattice): */ -static PyObject *__pyx_pf_3_sa_12make_lattice_3genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_3genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_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_3_sa___pyx_scope_struct_6_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_6_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_6_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_6_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_3_sa___pyx_scope_struct_4_make_lattice *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *) __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_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_5generator8, (PyObject *) __pyx_cur_scope); 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; @@ -24394,7 +24394,7 @@ static PyObject *__pyx_pf_3_sa_12make_lattice_3genexpr(PyObject *__pyx_self) { __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.make_lattice.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -24403,9 +24403,9 @@ static PyObject *__pyx_pf_3_sa_12make_lattice_3genexpr(PyObject *__pyx_self) { return __pyx_r; } -static PyObject *__pyx_gb_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_5generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)__pyx_generator->closure); + 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; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -24517,7 +24517,7 @@ static PyObject *__pyx_gb_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":110 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110 * return sym_isvar(sym) * * def make_lattice(words): # <<<<<<<<<<<<<< @@ -24525,8 +24525,8 @@ static PyObject *__pyx_gb_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject * return tuple(((word, None, 1), ) for word in word_ids) */ -static PyObject *__pyx_pf_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words) { - struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -24535,7 +24535,7 @@ static PyObject *__pyx_pf_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_lattice", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)__pyx_tp_new_3_sa___pyx_scope_struct_4_make_lattice(__pyx_ptype_3_sa___pyx_scope_struct_4_make_lattice, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -24545,20 +24545,20 @@ static PyObject *__pyx_pf_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_INCREF(__pyx_cur_scope->__pyx_v_words); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_words); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":111 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111 * * def make_lattice(words): * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< * return tuple(((word, None, 1), ) for word in word_ids) * */ - __pyx_t_1 = __pyx_pf_3_sa_12make_lattice_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12make_lattice_genexpr(((PyObject*)__pyx_cur_scope)); 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_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_word_ids = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":112 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -24566,7 +24566,7 @@ static PyObject *__pyx_pf_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, * def decode_lattice(lattice): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_3_sa_12make_lattice_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12make_lattice_3genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -24585,7 +24585,7 @@ static PyObject *__pyx_pf_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.make_lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.make_lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -24595,19 +24595,19 @@ static PyObject *__pyx_pf_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9decode_lattice(PyObject *__pyx_self, PyObject *__pyx_v_lattice); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_9decode_lattice = {__Pyx_NAMESTR("decode_lattice"), (PyCFunction)__pyx_pw_3_sa_9decode_lattice, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_9decode_lattice(PyObject *__pyx_self, PyObject *__pyx_v_lattice) { +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 PyObject *__pyx_pw_4cdec_2sa_3_sa_9decode_lattice(PyObject *__pyx_self, PyObject *__pyx_v_lattice) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("decode_lattice (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_8decode_lattice(__pyx_self, ((PyObject *)__pyx_v_lattice)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8decode_lattice(__pyx_self, ((PyObject *)__pyx_v_lattice)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":115 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":115 * * def decode_lattice(lattice): * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<< @@ -24615,25 +24615,25 @@ static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObjec * */ -static PyObject *__pyx_pf_3_sa_14decode_lattice_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_lattice_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_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_3_sa___pyx_scope_struct_8_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_8_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_8_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_8_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_3_sa___pyx_scope_struct_7_decode_lattice *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *) __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_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_2generator9, (PyObject *) __pyx_cur_scope); 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; @@ -24642,7 +24642,7 @@ static PyObject *__pyx_pf_3_sa_14decode_lattice_genexpr(PyObject *__pyx_self) { __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.decode_lattice.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -24651,9 +24651,9 @@ static PyObject *__pyx_pf_3_sa_14decode_lattice_genexpr(PyObject *__pyx_self) { return __pyx_r; } -static PyObject *__pyx_gb_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_2generator9(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)__pyx_generator->closure); + 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; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -24684,7 +24684,7 @@ static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObjec __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":116 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -24702,7 +24702,7 @@ static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObjec } for (;;) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":115 * * def decode_lattice(lattice): * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<< @@ -24808,7 +24808,7 @@ static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObjec __pyx_cur_scope->__pyx_v_dist = __pyx_t_7; __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":116 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -24896,7 +24896,7 @@ static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObjec __pyx_cur_scope->__pyx_v_node = __pyx_t_6; __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":115 * * def decode_lattice(lattice): * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<< @@ -24904,7 +24904,7 @@ static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObjec * */ __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_14)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_14)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); @@ -24977,7 +24977,7 @@ static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObjec return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":114 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114 * return tuple(((word, None, 1), ) for word in word_ids) * * def decode_lattice(lattice): # <<<<<<<<<<<<<< @@ -24985,8 +24985,8 @@ static PyObject *__pyx_gb_3_sa_14decode_lattice_2generator9(__pyx_GeneratorObjec * for arc in node for node in lattice) */ -static PyObject *__pyx_pf_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice) { - struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -24995,7 +24995,7 @@ static PyObject *__pyx_pf_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_sel const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_lattice", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)__pyx_tp_new_3_sa___pyx_scope_struct_7_decode_lattice(__pyx_ptype_3_sa___pyx_scope_struct_7_decode_lattice, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -25005,7 +25005,7 @@ static PyObject *__pyx_pf_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lattice); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lattice); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":115 * * def decode_lattice(lattice): * return tuple((sym_tostring(sym), weight, dist) for (sym, weight, dist) in arc # <<<<<<<<<<<<<< @@ -25013,7 +25013,7 @@ static PyObject *__pyx_pf_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_sel * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_3_sa_14decode_lattice_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_14decode_lattice_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -25032,7 +25032,7 @@ static PyObject *__pyx_pf_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_sel __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.decode_lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.decode_lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -25042,19 +25042,19 @@ static PyObject *__pyx_pf_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_sel } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_11decode_sentence(PyObject *__pyx_self, PyObject *__pyx_v_lattice); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_11decode_sentence = {__Pyx_NAMESTR("decode_sentence"), (PyCFunction)__pyx_pw_3_sa_11decode_sentence, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_11decode_sentence(PyObject *__pyx_self, PyObject *__pyx_v_lattice) { +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 PyObject *__pyx_pw_4cdec_2sa_3_sa_11decode_sentence(PyObject *__pyx_self, PyObject *__pyx_v_lattice) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("decode_sentence (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_10decode_sentence(__pyx_self, ((PyObject *)__pyx_v_lattice)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_10decode_sentence(__pyx_self, ((PyObject *)__pyx_v_lattice)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_15decode_sentence_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_15decode_sentence_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":119 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119 * * def decode_sentence(lattice): * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< @@ -25062,25 +25062,25 @@ static PyObject *__pyx_gb_3_sa_15decode_sentence_2generator10(__pyx_GeneratorObj * def encode_words(words): */ -static PyObject *__pyx_pf_3_sa_15decode_sentence_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_15decode_sentence_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_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_3_sa___pyx_scope_struct_10_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_10_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_10_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_10_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_3_sa___pyx_scope_struct_9_decode_sentence *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *) __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_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_2generator10, (PyObject *) __pyx_cur_scope); 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; @@ -25089,7 +25089,7 @@ static PyObject *__pyx_pf_3_sa_15decode_sentence_genexpr(PyObject *__pyx_self) { __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.decode_sentence.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -25098,9 +25098,9 @@ static PyObject *__pyx_pf_3_sa_15decode_sentence_genexpr(PyObject *__pyx_self) { return __pyx_r; } -static PyObject *__pyx_gb_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_2generator10(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)__pyx_generator->closure); + 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; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -25280,7 +25280,7 @@ static PyObject *__pyx_gb_3_sa_15decode_sentence_2generator10(__pyx_GeneratorObj __pyx_cur_scope->__pyx_v__ = __pyx_t_9; __pyx_t_9 = 0; __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_11)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_11)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; @@ -25321,7 +25321,7 @@ static PyObject *__pyx_gb_3_sa_15decode_sentence_2generator10(__pyx_GeneratorObj return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":118 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118 * for arc in node for node in lattice) * * def decode_sentence(lattice): # <<<<<<<<<<<<<< @@ -25329,8 +25329,8 @@ static PyObject *__pyx_gb_3_sa_15decode_sentence_2generator10(__pyx_GeneratorObj * */ -static PyObject *__pyx_pf_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice) { - struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -25339,7 +25339,7 @@ static PyObject *__pyx_pf_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_s const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_sentence", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)__pyx_tp_new_3_sa___pyx_scope_struct_9_decode_sentence(__pyx_ptype_3_sa___pyx_scope_struct_9_decode_sentence, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -25349,7 +25349,7 @@ static PyObject *__pyx_pf_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_s __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lattice); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lattice); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":119 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119 * * def decode_sentence(lattice): * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< @@ -25357,7 +25357,7 @@ static PyObject *__pyx_pf_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_s * def encode_words(words): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_3_sa_15decode_sentence_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_15decode_sentence_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -25376,7 +25376,7 @@ static PyObject *__pyx_pf_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_s __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.decode_sentence", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.decode_sentence", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -25386,19 +25386,19 @@ static PyObject *__pyx_pf_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_s } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_13encode_words(PyObject *__pyx_self, PyObject *__pyx_v_words); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_13encode_words = {__Pyx_NAMESTR("encode_words"), (PyCFunction)__pyx_pw_3_sa_13encode_words, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_13encode_words(PyObject *__pyx_self, PyObject *__pyx_v_words) { +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 PyObject *__pyx_pw_4cdec_2sa_3_sa_13encode_words(PyObject *__pyx_self, PyObject *__pyx_v_words) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("encode_words (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_12encode_words(__pyx_self, ((PyObject *)__pyx_v_words)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_12encode_words(__pyx_self, ((PyObject *)__pyx_v_words)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_12encode_words_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_12encode_words_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":122 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122 * * def encode_words(words): * return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< @@ -25406,25 +25406,25 @@ static PyObject *__pyx_gb_3_sa_12encode_words_2generator11(__pyx_GeneratorObject * def decode_words(syms): */ -static PyObject *__pyx_pf_3_sa_12encode_words_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_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_3_sa___pyx_scope_struct_12_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_12_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_12_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_12_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_3_sa___pyx_scope_struct_11_encode_words *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *) __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_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_2generator11, (PyObject *) __pyx_cur_scope); 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; @@ -25433,7 +25433,7 @@ static PyObject *__pyx_pf_3_sa_12encode_words_genexpr(PyObject *__pyx_self) { __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.encode_words.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -25442,9 +25442,9 @@ static PyObject *__pyx_pf_3_sa_12encode_words_genexpr(PyObject *__pyx_self) { return __pyx_r; } -static PyObject *__pyx_gb_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_2generator11(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *)__pyx_generator->closure); + 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; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -25506,7 +25506,7 @@ static PyObject *__pyx_gb_3_sa_12encode_words_2generator11(__pyx_GeneratorObject __pyx_cur_scope->__pyx_v_word = __pyx_t_4; __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_cur_scope->__pyx_v_word); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -25542,7 +25542,7 @@ static PyObject *__pyx_gb_3_sa_12encode_words_2generator11(__pyx_GeneratorObject return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":121 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121 * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) * * def encode_words(words): # <<<<<<<<<<<<<< @@ -25550,8 +25550,8 @@ static PyObject *__pyx_gb_3_sa_12encode_words_2generator11(__pyx_GeneratorObject * */ -static PyObject *__pyx_pf_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words) { - struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -25560,7 +25560,7 @@ static PyObject *__pyx_pf_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_words", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *)__pyx_tp_new_3_sa___pyx_scope_struct_11_encode_words(__pyx_ptype_3_sa___pyx_scope_struct_11_encode_words, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -25570,7 +25570,7 @@ static PyObject *__pyx_pf_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self __Pyx_INCREF(__pyx_cur_scope->__pyx_v_words); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_words); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":122 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122 * * def encode_words(words): * return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< @@ -25578,7 +25578,7 @@ static PyObject *__pyx_pf_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self * def decode_words(syms): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_3_sa_12encode_words_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12encode_words_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -25597,7 +25597,7 @@ static PyObject *__pyx_pf_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.encode_words", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.encode_words", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -25607,43 +25607,43 @@ static PyObject *__pyx_pf_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_15decode_words(PyObject *__pyx_self, PyObject *__pyx_v_syms); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_15decode_words = {__Pyx_NAMESTR("decode_words"), (PyCFunction)__pyx_pw_3_sa_15decode_words, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_15decode_words(PyObject *__pyx_self, PyObject *__pyx_v_syms) { +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 PyObject *__pyx_pw_4cdec_2sa_3_sa_15decode_words(PyObject *__pyx_self, PyObject *__pyx_v_syms) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("decode_words (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_14decode_words(__pyx_self, ((PyObject *)__pyx_v_syms)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14decode_words(__pyx_self, ((PyObject *)__pyx_v_syms)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_12decode_words_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_12decode_words_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":125 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":125 * * def decode_words(syms): * return tuple(sym_tostring(sym) for sym in syms) # <<<<<<<<<<<<<< */ -static PyObject *__pyx_pf_3_sa_12decode_words_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12decode_words_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_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_3_sa___pyx_scope_struct_14_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_14_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_14_genexpr, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_14_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_3_sa___pyx_scope_struct_13_decode_words *) __pyx_self; + __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *) __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_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_2generator12, (PyObject *) __pyx_cur_scope); 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; @@ -25652,7 +25652,7 @@ static PyObject *__pyx_pf_3_sa_12decode_words_genexpr(PyObject *__pyx_self) { __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.decode_words.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -25661,9 +25661,9 @@ static PyObject *__pyx_pf_3_sa_12decode_words_genexpr(PyObject *__pyx_self) { return __pyx_r; } -static PyObject *__pyx_gb_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_2generator12(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *)__pyx_generator->closure); + 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; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -25725,7 +25725,7 @@ static PyObject *__pyx_gb_3_sa_12decode_words_2generator12(__pyx_GeneratorObject __pyx_cur_scope->__pyx_v_sym = __pyx_t_4; __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; @@ -25761,15 +25761,15 @@ static PyObject *__pyx_gb_3_sa_12decode_words_2generator12(__pyx_GeneratorObject return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":124 +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124 * return tuple(sym_fromstring(word, True) for word in words) * * def decode_words(syms): # <<<<<<<<<<<<<< * return tuple(sym_tostring(sym) for sym in syms) */ -static PyObject *__pyx_pf_3_sa_14decode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_syms) { - struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_syms) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -25778,7 +25778,7 @@ static PyObject *__pyx_pf_3_sa_14decode_words(CYTHON_UNUSED PyObject *__pyx_self const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_words", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *)__pyx_tp_new_3_sa___pyx_scope_struct_13_decode_words(__pyx_ptype_3_sa___pyx_scope_struct_13_decode_words, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -25788,13 +25788,13 @@ static PyObject *__pyx_pf_3_sa_14decode_words(CYTHON_UNUSED PyObject *__pyx_self __Pyx_INCREF(__pyx_cur_scope->__pyx_v_syms); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_syms); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":125 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":125 * * def decode_words(syms): * return tuple(sym_tostring(sym) for sym in syms) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_3_sa_12decode_words_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12decode_words_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -25813,7 +25813,7 @@ static PyObject *__pyx_pf_3_sa_14decode_words(CYTHON_UNUSED PyObject *__pyx_self __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.decode_words", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.decode_words", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -25823,8 +25823,8 @@ static PyObject *__pyx_pf_3_sa_14decode_words(CYTHON_UNUSED PyObject *__pyx_self } /* Python wrapper */ -static int __pyx_pw_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_words = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -25863,16 +25863,16 @@ static int __pyx_pw_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_6Phrase___cinit__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), __pyx_v_words); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), __pyx_v_words); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":6 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":6 * cdef class Phrase: * * def __cinit__(self, words): # <<<<<<<<<<<<<< @@ -25880,7 +25880,7 @@ static int __pyx_pw_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__ * n_vars = 0 */ -static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words) { +static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_n; @@ -25897,7 +25897,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":8 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":8 * def __cinit__(self, words): * cdef int i, j, n, n_vars * n_vars = 0 # <<<<<<<<<<<<<< @@ -25906,7 +25906,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v */ __pyx_v_n_vars = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":9 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":9 * cdef int i, j, n, n_vars * n_vars = 0 * n = len(words) # <<<<<<<<<<<<<< @@ -25916,7 +25916,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":10 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":10 * n_vars = 0 * n = len(words) * self.syms = malloc(n*sizeof(int)) # <<<<<<<<<<<<<< @@ -25925,7 +25925,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v */ __pyx_v_self->syms = ((int *)malloc((__pyx_v_n * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":11 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":11 * n = len(words) * self.syms = malloc(n*sizeof(int)) * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -25935,7 +25935,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":12 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":12 * self.syms = malloc(n*sizeof(int)) * for i from 0 <= i < n: * self.syms[i] = words[i] # <<<<<<<<<<<<<< @@ -25948,17 +25948,17 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_self->syms[__pyx_v_i]) = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":13 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":13 * for i from 0 <= i < n: * self.syms[i] = words[i] * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< * n_vars += 1 * self.n = n */ - __pyx_t_5 = (__pyx_f_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); + __pyx_t_5 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":14 * self.syms[i] = words[i] * if sym_isvar(self.syms[i]): * n_vars += 1 # <<<<<<<<<<<<<< @@ -25971,7 +25971,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":15 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":15 * if sym_isvar(self.syms[i]): * n_vars += 1 * self.n = n # <<<<<<<<<<<<<< @@ -25980,7 +25980,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v */ __pyx_v_self->n = __pyx_v_n; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":16 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":16 * n_vars += 1 * self.n = n * self.n_vars = n_vars # <<<<<<<<<<<<<< @@ -25989,7 +25989,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v */ __pyx_v_self->n_vars = __pyx_v_n_vars; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":17 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":17 * self.n = n * self.n_vars = n_vars * self.varpos = malloc(n_vars*sizeof(int)) # <<<<<<<<<<<<<< @@ -25998,7 +25998,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v */ __pyx_v_self->varpos = ((int *)malloc((__pyx_v_n_vars * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":18 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":18 * self.n_vars = n_vars * self.varpos = malloc(n_vars*sizeof(int)) * j = 0 # <<<<<<<<<<<<<< @@ -26007,7 +26007,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v */ __pyx_v_j = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":19 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":19 * self.varpos = malloc(n_vars*sizeof(int)) * j = 0 * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -26017,17 +26017,17 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":20 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":20 * j = 0 * for i from 0 <= i < n: * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< * self.varpos[j] = i * j = j + 1 */ - __pyx_t_5 = (__pyx_f_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); + __pyx_t_5 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":21 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":21 * for i from 0 <= i < n: * if sym_isvar(self.syms[i]): * self.varpos[j] = i # <<<<<<<<<<<<<< @@ -26036,7 +26036,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v */ (__pyx_v_self->varpos[__pyx_v_j]) = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":22 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":22 * if sym_isvar(self.syms[i]): * self.varpos[j] = i * j = j + 1 # <<<<<<<<<<<<<< @@ -26053,7 +26053,7 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -26061,15 +26061,15 @@ static int __pyx_pf_3_sa_6Phrase___cinit__(struct __pyx_obj_3_sa_Phrase *__pyx_v } /* Python wrapper */ -static void __pyx_pw_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_4cdec_2sa_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3_sa_6Phrase_2__dealloc__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":24 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":24 * j = j + 1 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -26077,11 +26077,11 @@ static void __pyx_pw_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self) { * free(self.varpos) */ -static void __pyx_pf_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { +static void __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":25 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":25 * * def __dealloc__(self): * free(self.syms) # <<<<<<<<<<<<<< @@ -26090,7 +26090,7 @@ static void __pyx_pf_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_3_sa_Phrase *__p */ free(__pyx_v_self->syms); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":26 * def __dealloc__(self): * free(self.syms) * free(self.varpos) # <<<<<<<<<<<<<< @@ -26103,17 +26103,17 @@ static void __pyx_pf_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_3_sa_Phrase *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_4__str__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":28 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":28 * free(self.varpos) * * def __str__(self): # <<<<<<<<<<<<<< @@ -26121,7 +26121,7 @@ static PyObject *__pyx_pw_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self) { * cdef int i, s */ -static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_v_strs = NULL; int __pyx_v_i; int __pyx_v_s; @@ -26137,7 +26137,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":29 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":29 * * def __str__(self): * strs = [] # <<<<<<<<<<<<<< @@ -26149,7 +26149,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__ __pyx_v_strs = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":31 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":31 * strs = [] * cdef int i, s * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< @@ -26159,7 +26159,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__ __pyx_t_2 = __pyx_v_self->n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":32 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":32 * cdef int i, s * for i from 0 <= i < self.n: * s = self.syms[i] # <<<<<<<<<<<<<< @@ -26168,20 +26168,20 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__ */ __pyx_v_s = (__pyx_v_self->syms[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":33 * for i from 0 <= i < self.n: * s = self.syms[i] * strs.append(sym_tostring(s)) # <<<<<<<<<<<<<< * return ' '.join(strs) * */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_strs, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":34 * s = self.syms[i] * strs.append(sym_tostring(s)) * return ' '.join(strs) # <<<<<<<<<<<<<< @@ -26210,7 +26210,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.Phrase.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_strs); @@ -26220,18 +26220,18 @@ static PyObject *__pyx_pf_3_sa_6Phrase_4__str__(struct __pyx_obj_3_sa_Phrase *__ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_3_sa_6Phrase_6handle[] = "return a hashable representation that normalizes the ordering\n of the nonterminal indices"; -static PyObject *__pyx_pw_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_6Phrase_6handle[] = "return a hashable representation that normalizes the ordering\n of the nonterminal indices"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("handle (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_6handle(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":36 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":36 * return ' '.join(strs) * * def handle(self): # <<<<<<<<<<<<<< @@ -26239,7 +26239,7 @@ static PyObject *__pyx_pw_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UN * of the nonterminal indices""" */ -static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_v_norm = NULL; int __pyx_v_i; int __pyx_v_j; @@ -26255,7 +26255,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("handle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":39 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":39 * """return a hashable representation that normalizes the ordering * of the nonterminal indices""" * norm = [] # <<<<<<<<<<<<<< @@ -26267,7 +26267,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__p __pyx_v_norm = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":41 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":41 * norm = [] * cdef int i, j, s * i = 1 # <<<<<<<<<<<<<< @@ -26276,7 +26276,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__p */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":42 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":42 * cdef int i, j, s * i = 1 * j = 0 # <<<<<<<<<<<<<< @@ -26285,7 +26285,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__p */ __pyx_v_j = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":43 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":43 * i = 1 * j = 0 * for j from 0 <= j < self.n: # <<<<<<<<<<<<<< @@ -26295,7 +26295,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__p __pyx_t_2 = __pyx_v_self->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":44 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":44 * j = 0 * for j from 0 <= j < self.n: * s = self.syms[j] # <<<<<<<<<<<<<< @@ -26304,26 +26304,26 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__p */ __pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":45 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":45 * for j from 0 <= j < self.n: * s = self.syms[j] * if sym_isvar(s): # <<<<<<<<<<<<<< * s = sym_setindex(s,i) * i = i + 1 */ - __pyx_t_3 = (__pyx_f_3_sa_sym_isvar(__pyx_v_s) != 0); + __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_s) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":46 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":46 * s = self.syms[j] * if sym_isvar(s): * s = sym_setindex(s,i) # <<<<<<<<<<<<<< * i = i + 1 * norm.append(s) */ - __pyx_v_s = __pyx_f_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); + __pyx_v_s = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":47 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":47 * if sym_isvar(s): * s = sym_setindex(s,i) * i = i + 1 # <<<<<<<<<<<<<< @@ -26335,7 +26335,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__p } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":48 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":48 * s = sym_setindex(s,i) * i = i + 1 * norm.append(s) # <<<<<<<<<<<<<< @@ -26348,7 +26348,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__p __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":49 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":49 * i = i + 1 * norm.append(s) * return tuple(norm) # <<<<<<<<<<<<<< @@ -26366,7 +26366,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.Phrase.handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.handle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_norm); @@ -26376,26 +26376,25 @@ static PyObject *__pyx_pf_3_sa_6Phrase_6handle(struct __pyx_obj_3_sa_Phrase *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("strhandle (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_8strhandle(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":51 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":51 * return tuple(norm) * * def strhandle(self): # <<<<<<<<<<<<<< - * strs = [] * norm = [] + * cdef int i, j, s */ -static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { - CYTHON_UNUSED PyObject *__pyx_v_strs = NULL; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_v_norm = NULL; int __pyx_v_i; int __pyx_v_j; @@ -26413,31 +26412,19 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("strhandle", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":52 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":52 * * def strhandle(self): - * strs = [] # <<<<<<<<<<<<<< - * norm = [] - * cdef int i, j, s - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_strs = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":53 - * def strhandle(self): - * strs = [] * norm = [] # <<<<<<<<<<<<<< * cdef int i, j, s * i = 1 */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_norm = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":55 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":54 * norm = [] * cdef int i, j, s * i = 1 # <<<<<<<<<<<<<< @@ -26446,7 +26433,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase * */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":56 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":55 * cdef int i, j, s * i = 1 * j = 0 # <<<<<<<<<<<<<< @@ -26455,7 +26442,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase * */ __pyx_v_j = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":57 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":56 * i = 1 * j = 0 * for j from 0 <= j < self.n: # <<<<<<<<<<<<<< @@ -26465,7 +26452,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase * __pyx_t_2 = __pyx_v_self->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":57 * j = 0 * for j from 0 <= j < self.n: * s = self.syms[j] # <<<<<<<<<<<<<< @@ -26474,26 +26461,26 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase * */ __pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":58 * for j from 0 <= j < self.n: * s = self.syms[j] * if sym_isvar(s): # <<<<<<<<<<<<<< * s = sym_setindex(s,i) * i = i + 1 */ - __pyx_t_3 = (__pyx_f_3_sa_sym_isvar(__pyx_v_s) != 0); + __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_s) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":59 * s = self.syms[j] * if sym_isvar(s): * s = sym_setindex(s,i) # <<<<<<<<<<<<<< * i = i + 1 * norm.append(sym_tostring(s)) */ - __pyx_v_s = __pyx_f_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); + __pyx_v_s = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":60 * if sym_isvar(s): * s = sym_setindex(s,i) * i = i + 1 # <<<<<<<<<<<<<< @@ -26505,20 +26492,20 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase * } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":62 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":61 * s = sym_setindex(s,i) * i = i + 1 * norm.append(sym_tostring(s)) # <<<<<<<<<<<<<< * return ' '.join(norm) * */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_norm, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_norm, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":63 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":62 * i = i + 1 * norm.append(sym_tostring(s)) * return ' '.join(norm) # <<<<<<<<<<<<<< @@ -26526,14 +26513,14 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase * * def arity(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __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[7]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_norm)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_norm)); __Pyx_GIVEREF(((PyObject *)__pyx_v_norm)); - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -26547,10 +26534,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase * __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_sa.Phrase.strhandle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.strhandle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_strs); __Pyx_XDECREF(__pyx_v_norm); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -26558,17 +26544,17 @@ static PyObject *__pyx_pf_3_sa_6Phrase_8strhandle(struct __pyx_obj_3_sa_Phrase * } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("arity (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_10arity(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_10arity(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":65 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":64 * return ' '.join(norm) * * def arity(self): # <<<<<<<<<<<<<< @@ -26576,7 +26562,7 @@ static PyObject *__pyx_pw_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UN * */ -static PyObject *__pyx_pf_3_sa_6Phrase_10arity(struct __pyx_obj_3_sa_Phrase *__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; @@ -26585,7 +26571,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_10arity(struct __pyx_obj_3_sa_Phrase *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("arity", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":65 * * def arity(self): * return self.n_vars # <<<<<<<<<<<<<< @@ -26593,7 +26579,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_10arity(struct __pyx_obj_3_sa_Phrase *__p * def getvarpos(self, i): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->n_vars); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__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; @@ -26603,7 +26589,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_10arity(struct __pyx_obj_3_sa_Phrase *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.Phrase.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -26612,17 +26598,17 @@ static PyObject *__pyx_pf_3_sa_6Phrase_10arity(struct __pyx_obj_3_sa_Phrase *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getvarpos (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_12getvarpos(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":68 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":67 * return self.n_vars * * def getvarpos(self, i): # <<<<<<<<<<<<<< @@ -26630,7 +26616,7 @@ static PyObject *__pyx_pw_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObj * return self.varpos[i] */ -static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -26642,26 +26628,26 @@ static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getvarpos", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":68 * * def getvarpos(self, i): * if 0 <= i < self.n_vars: # <<<<<<<<<<<<<< * return self.varpos[i] * else: */ - __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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = PyInt_FromLong(__pyx_v_self->n_vars); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 69; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":70 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":69 * def getvarpos(self, i): * if 0 <= i < self.n_vars: * return self.varpos[i] # <<<<<<<<<<<<<< @@ -26669,8 +26655,8 @@ static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase * 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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromLong((__pyx_v_self->varpos[__pyx_t_4])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = PyInt_FromLong((__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_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -26679,7 +26665,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":72 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":71 * return self.varpos[i] * else: * raise IndexError # <<<<<<<<<<<<<< @@ -26687,7 +26673,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase * def getvar(self, i): */ __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -26696,7 +26682,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.Phrase.getvarpos", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.getvarpos", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -26705,17 +26691,17 @@ static PyObject *__pyx_pf_3_sa_6Phrase_12getvarpos(struct __pyx_obj_3_sa_Phrase } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getvar (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_14getvar(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":74 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":73 * raise IndexError * * def getvar(self, i): # <<<<<<<<<<<<<< @@ -26723,7 +26709,7 @@ static PyObject *__pyx_pw_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject * return self.syms[self.varpos[i]] */ -static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -26735,26 +26721,26 @@ static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getvar", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":75 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":74 * * def getvar(self, i): * if 0 <= i < self.n_vars: # <<<<<<<<<<<<<< * return self.syms[self.varpos[i]] * else: */ - __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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = PyInt_FromLong(__pyx_v_self->n_vars); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 75; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":76 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":75 * def getvar(self, i): * if 0 <= i < self.n_vars: * return self.syms[self.varpos[i]] # <<<<<<<<<<<<<< @@ -26762,8 +26748,8 @@ static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__ * 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 = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromLong((__pyx_v_self->syms[(__pyx_v_self->varpos[__pyx_t_4])])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = PyInt_FromLong((__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_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -26772,7 +26758,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":78 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":77 * return self.syms[self.varpos[i]] * else: * raise IndexError # <<<<<<<<<<<<<< @@ -26780,7 +26766,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__ * cdef int chunkpos(self, int k): */ __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -26789,7 +26775,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.Phrase.getvar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.getvar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -26797,7 +26783,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":80 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":79 * raise IndexError * * cdef int chunkpos(self, int k): # <<<<<<<<<<<<<< @@ -26805,13 +26791,13 @@ static PyObject *__pyx_pf_3_sa_6Phrase_14getvar(struct __pyx_obj_3_sa_Phrase *__ * return 0 */ -int __pyx_f_3_sa_6Phrase_chunkpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, int __pyx_v_k) { +int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, int __pyx_v_k) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("chunkpos", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":81 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":80 * * cdef int chunkpos(self, int k): * if k == 0: # <<<<<<<<<<<<<< @@ -26821,7 +26807,7 @@ int __pyx_f_3_sa_6Phrase_chunkpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in __pyx_t_1 = ((__pyx_v_k == 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":82 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":81 * cdef int chunkpos(self, int k): * if k == 0: * return 0 # <<<<<<<<<<<<<< @@ -26834,7 +26820,7 @@ int __pyx_f_3_sa_6Phrase_chunkpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":83 * return 0 * else: * return self.varpos[k-1]+1 # <<<<<<<<<<<<<< @@ -26852,7 +26838,7 @@ int __pyx_f_3_sa_6Phrase_chunkpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":86 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":85 * return self.varpos[k-1]+1 * * cdef int chunklen(self, int k): # <<<<<<<<<<<<<< @@ -26860,13 +26846,13 @@ int __pyx_f_3_sa_6Phrase_chunkpos(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in * return self.n */ -int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, int __pyx_v_k) { +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; __Pyx_RefNannySetupContext("chunklen", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":87 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":86 * * cdef int chunklen(self, int k): * if self.n_vars == 0: # <<<<<<<<<<<<<< @@ -26876,7 +26862,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in __pyx_t_1 = ((__pyx_v_self->n_vars == 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":88 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":87 * cdef int chunklen(self, int k): * if self.n_vars == 0: * return self.n # <<<<<<<<<<<<<< @@ -26888,7 +26874,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":89 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":88 * if self.n_vars == 0: * return self.n * elif k == 0: # <<<<<<<<<<<<<< @@ -26898,7 +26884,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in __pyx_t_1 = ((__pyx_v_k == 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":90 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":89 * return self.n * elif k == 0: * return self.varpos[0] # <<<<<<<<<<<<<< @@ -26910,7 +26896,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":91 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":90 * elif k == 0: * return self.varpos[0] * elif k == self.n_vars: # <<<<<<<<<<<<<< @@ -26920,7 +26906,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in __pyx_t_1 = ((__pyx_v_k == __pyx_v_self->n_vars) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":92 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":91 * return self.varpos[0] * elif k == self.n_vars: * return self.n-self.varpos[k-1]-1 # <<<<<<<<<<<<<< @@ -26933,7 +26919,7 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":94 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":93 * return self.n-self.varpos[k-1]-1 * else: * return self.varpos[k]-self.varpos[k-1]-1 # <<<<<<<<<<<<<< @@ -26952,17 +26938,17 @@ int __pyx_f_3_sa_6Phrase_chunklen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, in } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clen (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_16clen(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_k)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_k)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":96 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":95 * return self.varpos[k]-self.varpos[k-1]-1 * * def clen(self, k): # <<<<<<<<<<<<<< @@ -26970,7 +26956,7 @@ static PyObject *__pyx_pw_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject * * */ -static PyObject *__pyx_pf_3_sa_6Phrase_16clen(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -26980,7 +26966,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_16clen(struct __pyx_obj_3_sa_Phrase *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("clen", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":97 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":96 * * def clen(self, k): * return self.chunklen(k) # <<<<<<<<<<<<<< @@ -26988,8 +26974,8 @@ static PyObject *__pyx_pf_3_sa_6Phrase_16clen(struct __pyx_obj_3_sa_Phrase *__py * def getchunk(self, ci): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_k); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunklen(__pyx_v_self, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_k); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunklen(__pyx_v_self, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -26999,7 +26985,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_16clen(struct __pyx_obj_3_sa_Phrase *__py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.Phrase.clen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.clen", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -27008,17 +26994,17 @@ static PyObject *__pyx_pf_3_sa_6Phrase_16clen(struct __pyx_obj_3_sa_Phrase *__py } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getchunk (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_18getchunk(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_ci)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_ci)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":99 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":98 * return self.chunklen(k) * * def getchunk(self, ci): # <<<<<<<<<<<<<< @@ -27026,7 +27012,7 @@ static PyObject *__pyx_pw_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObje * start = self.chunkpos(ci) */ -static PyObject *__pyx_pf_3_sa_6Phrase_18getchunk(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci) { int __pyx_v_start; int __pyx_v_stop; PyObject *__pyx_v_chunk = NULL; @@ -27041,39 +27027,39 @@ static PyObject *__pyx_pf_3_sa_6Phrase_18getchunk(struct __pyx_obj_3_sa_Phrase * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getchunk", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":101 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":100 * def getchunk(self, ci): * cdef int start, stop * start = self.chunkpos(ci) # <<<<<<<<<<<<<< * stop = start+self.chunklen(ci) * chunk = [] */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__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_start = ((struct __pyx_vtabstruct_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunkpos(__pyx_v_self, __pyx_t_1); + __pyx_t_1 = __Pyx_PyInt_AsInt(__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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":102 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":101 * cdef int start, stop * start = self.chunkpos(ci) * stop = start+self.chunklen(ci) # <<<<<<<<<<<<<< * chunk = [] * for i from start <= i < stop: */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_ci); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_stop = (__pyx_v_start + ((struct __pyx_vtabstruct_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunklen(__pyx_v_self, __pyx_t_1)); + __pyx_t_1 = __Pyx_PyInt_AsInt(__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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":103 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":102 * start = self.chunkpos(ci) * stop = start+self.chunklen(ci) * chunk = [] # <<<<<<<<<<<<<< * for i from start <= i < stop: * chunk.append(self.syms[i]) */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_chunk = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":104 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":103 * stop = start+self.chunklen(ci) * chunk = [] * for i from start <= i < stop: # <<<<<<<<<<<<<< @@ -27083,20 +27069,20 @@ static PyObject *__pyx_pf_3_sa_6Phrase_18getchunk(struct __pyx_obj_3_sa_Phrase * __pyx_t_1 = __pyx_v_stop; for (__pyx_v_i = __pyx_v_start; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":105 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":104 * chunk = [] * for i from start <= i < stop: * chunk.append(self.syms[i]) # <<<<<<<<<<<<<< * return chunk * */ - __pyx_t_2 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_chunk, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_chunk, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":106 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":105 * for i from start <= i < stop: * chunk.append(self.syms[i]) * return chunk # <<<<<<<<<<<<<< @@ -27112,7 +27098,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_18getchunk(struct __pyx_obj_3_sa_Phrase * goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.Phrase.getchunk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.getchunk", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_chunk); @@ -27123,18 +27109,18 @@ static PyObject *__pyx_pf_3_sa_6Phrase_18getchunk(struct __pyx_obj_3_sa_Phrase * /* Python wrapper */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pw_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static int __pyx_pw_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cmp__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_20__cmp__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_other)); __Pyx_RefNannyFinishContext(); return __pyx_r; } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":108 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":107 * return chunk * * def __cmp__(self, other): # <<<<<<<<<<<<<< @@ -27143,8 +27129,8 @@ static int __pyx_pw_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__p */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other) { - struct __pyx_obj_3_sa_Phrase *__pyx_v_otherp = 0; +static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other) { + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_otherp = 0; int __pyx_v_i; int __pyx_r; __Pyx_RefNannyDeclarations @@ -27157,18 +27143,18 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cmp__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":111 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":110 * cdef Phrase otherp * cdef int i * otherp = other # <<<<<<<<<<<<<< * for i from 0 <= i < min(self.n, otherp.n): * if self.syms[i] < otherp.syms[i]: */ - if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_3_sa_Phrase))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_4cdec_2sa_3_sa_Phrase))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_other); - __pyx_v_otherp = ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_other); + __pyx_v_otherp = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_other); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":112 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":111 * cdef int i * otherp = other * for i from 0 <= i < min(self.n, otherp.n): # <<<<<<<<<<<<<< @@ -27185,7 +27171,7 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v __pyx_t_1 = __pyx_t_3; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":113 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":112 * otherp = other * for i from 0 <= i < min(self.n, otherp.n): * if self.syms[i] < otherp.syms[i]: # <<<<<<<<<<<<<< @@ -27195,7 +27181,7 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v __pyx_t_4 = (((__pyx_v_self->syms[__pyx_v_i]) < (__pyx_v_otherp->syms[__pyx_v_i])) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":114 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":113 * for i from 0 <= i < min(self.n, otherp.n): * if self.syms[i] < otherp.syms[i]: * return -1 # <<<<<<<<<<<<<< @@ -27207,7 +27193,7 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v goto __pyx_L5; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":114 * if self.syms[i] < otherp.syms[i]: * return -1 * elif self.syms[i] > otherp.syms[i]: # <<<<<<<<<<<<<< @@ -27217,7 +27203,7 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v __pyx_t_4 = (((__pyx_v_self->syms[__pyx_v_i]) > (__pyx_v_otherp->syms[__pyx_v_i])) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":116 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":115 * return -1 * elif self.syms[i] > otherp.syms[i]: * return 1 # <<<<<<<<<<<<<< @@ -27231,7 +27217,7 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":117 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":116 * elif self.syms[i] > otherp.syms[i]: * return 1 * if self.n < otherp.n: # <<<<<<<<<<<<<< @@ -27241,7 +27227,7 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v __pyx_t_4 = ((__pyx_v_self->n < __pyx_v_otherp->n) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":118 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":117 * return 1 * if self.n < otherp.n: * return -1 # <<<<<<<<<<<<<< @@ -27253,7 +27239,7 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v goto __pyx_L6; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":119 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":118 * if self.n < otherp.n: * return -1 * elif self.n > otherp.n: # <<<<<<<<<<<<<< @@ -27263,7 +27249,7 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v __pyx_t_4 = ((__pyx_v_self->n > __pyx_v_otherp->n) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":120 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":119 * return -1 * elif self.n > otherp.n: * return 1 # <<<<<<<<<<<<<< @@ -27276,7 +27262,7 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":122 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":121 * return 1 * else: * return 0 # <<<<<<<<<<<<<< @@ -27291,7 +27277,7 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.Phrase.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_otherp); @@ -27301,17 +27287,17 @@ static int __pyx_pf_3_sa_6Phrase_20__cmp__(struct __pyx_obj_3_sa_Phrase *__pyx_v #endif /*!(#if PY_MAJOR_VERSION < 3)*/ /* Python wrapper */ -static Py_hash_t __pyx_pw_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self); /*proto*/ -static Py_hash_t __pyx_pw_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self) { +static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self); /*proto*/ +static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_22__hash__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":124 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":123 * return 0 * * def __hash__(self): # <<<<<<<<<<<<<< @@ -27319,7 +27305,7 @@ static Py_hash_t __pyx_pw_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self) { * cdef unsigned h */ -static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { +static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { int __pyx_v_i; unsigned int __pyx_v_h; Py_hash_t __pyx_r; @@ -27328,7 +27314,7 @@ static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase * int __pyx_t_2; __Pyx_RefNannySetupContext("__hash__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":127 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":126 * cdef int i * cdef unsigned h * h = 0 # <<<<<<<<<<<<<< @@ -27337,7 +27323,7 @@ static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase * */ __pyx_v_h = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":128 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":127 * cdef unsigned h * h = 0 * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< @@ -27347,7 +27333,7 @@ static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase * __pyx_t_1 = __pyx_v_self->n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":129 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":128 * h = 0 * for i from 0 <= i < self.n: * if self.syms[i] > 0: # <<<<<<<<<<<<<< @@ -27357,7 +27343,7 @@ static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase * __pyx_t_2 = (((__pyx_v_self->syms[__pyx_v_i]) > 0) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":130 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":129 * for i from 0 <= i < self.n: * if self.syms[i] > 0: * h = (h << 1) + self.syms[i] # <<<<<<<<<<<<<< @@ -27369,7 +27355,7 @@ static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase * } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":132 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":131 * h = (h << 1) + self.syms[i] * else: * h = (h << 1) + -self.syms[i] # <<<<<<<<<<<<<< @@ -27381,7 +27367,7 @@ static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase * __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":133 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":132 * else: * h = (h << 1) + -self.syms[i] * return h # <<<<<<<<<<<<<< @@ -27399,17 +27385,17 @@ static Py_hash_t __pyx_pf_3_sa_6Phrase_22__hash__(struct __pyx_obj_3_sa_Phrase * } /* Python wrapper */ -static Py_ssize_t __pyx_pw_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_24__len__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":135 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":134 * return h * * def __len__(self): # <<<<<<<<<<<<<< @@ -27417,12 +27403,12 @@ static Py_ssize_t __pyx_pw_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_3_sa_6Phrase_24__len__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":136 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":135 * * def __len__(self): * return self.n # <<<<<<<<<<<<<< @@ -27439,17 +27425,17 @@ static Py_ssize_t __pyx_pf_3_sa_6Phrase_24__len__(struct __pyx_obj_3_sa_Phrase * } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_26__getitem__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":138 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":137 * return self.n * * def __getitem__(self, i): # <<<<<<<<<<<<<< @@ -27457,7 +27443,7 @@ static PyObject *__pyx_pw_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyO * */ -static PyObject *__pyx_pf_3_sa_6Phrase_26__getitem__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -27467,7 +27453,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_26__getitem__(struct __pyx_obj_3_sa_Phras int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":139 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":138 * * def __getitem__(self, i): * return self.syms[i] # <<<<<<<<<<<<<< @@ -27475,8 +27461,8 @@ static PyObject *__pyx_pf_3_sa_6Phrase_26__getitem__(struct __pyx_obj_3_sa_Phras * def __iter__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((__pyx_v_self->syms[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->syms[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -27486,27 +27472,27 @@ static PyObject *__pyx_pf_3_sa_6Phrase_26__getitem__(struct __pyx_obj_3_sa_Phras goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.Phrase.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_28__iter__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_28__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":141 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":140 * return self.syms[i] * * def __iter__(self): # <<<<<<<<<<<<<< @@ -27514,15 +27500,15 @@ static PyObject *__pyx_pw_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self) { * for i from 0 <= i < self.n: */ -static PyObject *__pyx_pf_3_sa_6Phrase_28__iter__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *__pyx_cur_scope; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_28__iter__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *)__pyx_tp_new_3_sa___pyx_scope_struct_15___iter__(__pyx_ptype_3_sa___pyx_scope_struct_15___iter__, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -27532,7 +27518,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_28__iter__(struct __pyx_obj_3_sa_Phrase * __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_3_sa_6Phrase_30generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __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); 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; @@ -27541,7 +27527,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_28__iter__(struct __pyx_obj_3_sa_Phrase * __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.Phrase.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -27550,9 +27536,9 @@ static PyObject *__pyx_pf_3_sa_6Phrase_28__iter__(struct __pyx_obj_3_sa_Phrase * return __pyx_r; } -static PyObject *__pyx_gb_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *)__pyx_generator->closure); + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -27569,9 +27555,9 @@ static PyObject *__pyx_gb_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":143 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":142 * def __iter__(self): * cdef int i * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< @@ -27581,14 +27567,14 @@ static PyObject *__pyx_gb_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":144 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":143 * cdef int i * for i from 0 <= i < self.n: * yield self.syms[i] # <<<<<<<<<<<<<< * * def subst(self, start, children): */ - __pyx_t_2 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_self->syms[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_self->syms[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -27600,7 +27586,7 @@ static PyObject *__pyx_gb_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; @@ -27616,8 +27602,8 @@ static PyObject *__pyx_gb_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_children = 0; int __pyx_lineno = 0; @@ -27646,11 +27632,11 @@ static PyObject *__pyx_pw_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__children)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subst") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subst") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -27663,18 +27649,18 @@ static PyObject *__pyx_pw_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_6Phrase_31subst(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self), __pyx_v_start, __pyx_v_children); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), __pyx_v_start, __pyx_v_children); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":146 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":145 * yield self.syms[i] * * def subst(self, start, children): # <<<<<<<<<<<<<< @@ -27682,7 +27668,7 @@ static PyObject *__pyx_pw_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject * for i from 0 <= i < self.n: */ -static PyObject *__pyx_pf_3_sa_6Phrase_31subst(struct __pyx_obj_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_children) { +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) { int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -27697,7 +27683,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_31subst(struct __pyx_obj_3_sa_Phrase *__p __Pyx_RefNannySetupContext("subst", 0); __Pyx_INCREF(__pyx_v_start); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":148 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":147 * def subst(self, start, children): * cdef int i * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< @@ -27707,27 +27693,27 @@ static PyObject *__pyx_pf_3_sa_6Phrase_31subst(struct __pyx_obj_3_sa_Phrase *__p __pyx_t_1 = __pyx_v_self->n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":149 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":148 * cdef int i * for i from 0 <= i < self.n: * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< * start = start + children[sym_getindex(self.syms[i])-1] * else: */ - __pyx_t_2 = (__pyx_f_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); + __pyx_t_2 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":150 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< * else: * start = start + (self.syms[i],) */ - __pyx_t_3 = (__pyx_f_3_sa_sym_getindex((__pyx_v_self->syms[__pyx_v_i])) - 1); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_children, __pyx_t_3, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_getindex((__pyx_v_self->syms[__pyx_v_i])) - 1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_children, __pyx_t_3, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_start); @@ -27737,21 +27723,21 @@ static PyObject *__pyx_pf_3_sa_6Phrase_31subst(struct __pyx_obj_3_sa_Phrase *__p } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":152 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":151 * start = start + children[sym_getindex(self.syms[i])-1] * else: * start = start + (self.syms[i],) # <<<<<<<<<<<<<< * return start * */ - __pyx_t_5 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 151; __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[7]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 151; __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 = PyNumber_Add(__pyx_v_start, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(__pyx_v_start, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_start); @@ -27761,7 +27747,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_31subst(struct __pyx_obj_3_sa_Phrase *__p __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":153 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":152 * else: * start = start + (self.syms[i],) * return start # <<<<<<<<<<<<<< @@ -27778,7 +27764,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_31subst(struct __pyx_obj_3_sa_Phrase *__p __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_start); @@ -27788,17 +27774,17 @@ static PyObject *__pyx_pf_3_sa_6Phrase_31subst(struct __pyx_obj_3_sa_Phrase *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_6Phrase_5words___get__(((struct __pyx_obj_3_sa_Phrase *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":156 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":155 * * property words: * def __get__(self): # <<<<<<<<<<<<<< @@ -27806,7 +27792,7 @@ static PyObject *__pyx_pw_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_3_sa_Phrase *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { PyObject *__pyx_v_w = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -27822,7 +27808,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_3_sa_Phra int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":157 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":156 * property words: * def __get__(self): * return [sym_tostring(w) for w in self if not sym_isvar(w)] # <<<<<<<<<<<<<< @@ -27830,13 +27816,13 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_3_sa_Phra * cdef class Rule: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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))) { __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 = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; } @@ -27844,23 +27830,23 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_3_sa_Phra 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 = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -27869,13 +27855,13 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_3_sa_Phra __Pyx_XDECREF(__pyx_v_w); __pyx_v_w = __pyx_t_5; __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((!(__pyx_f_3_sa_sym_isvar(__pyx_t_6) != 0)) != 0); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_6) != 0)) != 0); if (__pyx_t_7) { - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; goto __pyx_L5; } @@ -27892,7 +27878,7 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_3_sa_Phra __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.Phrase.words.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.words.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_w); @@ -27902,11 +27888,11 @@ static PyObject *__pyx_pf_3_sa_6Phrase_5words___get__(struct __pyx_obj_3_sa_Phra } /* Python wrapper */ -static int __pyx_pw_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_lhs; - struct __pyx_obj_3_sa_Phrase *__pyx_v_f = 0; - struct __pyx_obj_3_sa_Phrase *__pyx_v_e = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_f = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_e = 0; PyObject *__pyx_v_scores = 0; PyObject *__pyx_v_word_alignments = 0; int __pyx_lineno = 0; @@ -27919,7 +27905,7 @@ static int __pyx_pw_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__py static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__lhs,&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__scores,&__pyx_n_s__word_alignments,0}; PyObject* values[5] = {0,0,0,0,0}; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":161 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":160 * cdef class Rule: * * def __cinit__(self, int lhs, Phrase f, Phrase e, scores=None, word_alignments=None): # <<<<<<<<<<<<<< @@ -27948,12 +27934,12 @@ static int __pyx_pw_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__py 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 = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __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 = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { @@ -27967,7 +27953,7 @@ static int __pyx_pw_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__py } } 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 = 161; __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 = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -27980,23 +27966,23 @@ static int __pyx_pw_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__py default: goto __pyx_L5_argtuple_error; } } - __pyx_v_lhs = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_lhs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_f = ((struct __pyx_obj_3_sa_Phrase *)values[1]); - __pyx_v_e = ((struct __pyx_obj_3_sa_Phrase *)values[2]); + __pyx_v_lhs = __Pyx_PyInt_AsInt(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_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]; __pyx_v_word_alignments = values[4]; } 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 = 161; __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 = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Rule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_3_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_e), __pyx_ptype_3_sa_Phrase, 1, "e", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3_sa_4Rule___cinit__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), __pyx_v_lhs, __pyx_v_f, __pyx_v_e, __pyx_v_scores, __pyx_v_word_alignments); + 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;} + __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); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -28005,7 +27991,7 @@ static int __pyx_pw_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__py return __pyx_r; } -static int __pyx_pf_3_sa_4Rule___cinit__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, int __pyx_v_lhs, struct __pyx_obj_3_sa_Phrase *__pyx_v_f, struct __pyx_obj_3_sa_Phrase *__pyx_v_e, PyObject *__pyx_v_scores, PyObject *__pyx_v_word_alignments) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -28016,36 +28002,36 @@ static int __pyx_pf_3_sa_4Rule___cinit__(struct __pyx_obj_3_sa_Rule *__pyx_v_sel int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":162 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":161 * * 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 * self.f = f */ - __pyx_t_1 = ((!(__pyx_f_3_sa_sym_isvar(__pyx_v_lhs) != 0)) != 0); + __pyx_t_1 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_lhs) != 0)) != 0); if (__pyx_t_1) { - __pyx_t_2 = PyInt_FromLong(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__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 = 162; __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 = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__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_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__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 = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":163 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":162 * 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 # <<<<<<<<<<<<<< @@ -28054,7 +28040,7 @@ static int __pyx_pf_3_sa_4Rule___cinit__(struct __pyx_obj_3_sa_Rule *__pyx_v_sel */ __pyx_v_self->lhs = __pyx_v_lhs; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":164 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":163 * if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs) * self.lhs = lhs * self.f = f # <<<<<<<<<<<<<< @@ -28067,7 +28053,7 @@ static int __pyx_pf_3_sa_4Rule___cinit__(struct __pyx_obj_3_sa_Rule *__pyx_v_sel __Pyx_DECREF(((PyObject *)__pyx_v_self->f)); __pyx_v_self->f = __pyx_v_f; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":165 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":164 * self.lhs = lhs * self.f = f * self.e = e # <<<<<<<<<<<<<< @@ -28080,7 +28066,7 @@ static int __pyx_pf_3_sa_4Rule___cinit__(struct __pyx_obj_3_sa_Rule *__pyx_v_sel __Pyx_DECREF(((PyObject *)__pyx_v_self->e)); __pyx_v_self->e = __pyx_v_e; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":166 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":165 * self.f = f * self.e = e * self.word_alignments = word_alignments # <<<<<<<<<<<<<< @@ -28093,26 +28079,26 @@ static int __pyx_pf_3_sa_4Rule___cinit__(struct __pyx_obj_3_sa_Rule *__pyx_v_sel __Pyx_DECREF(__pyx_v_self->word_alignments); __pyx_v_self->word_alignments = __pyx_v_word_alignments; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":167 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":166 * 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_3_sa_FeatureVector))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 167; __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 = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_scores); __Pyx_GIVEREF(__pyx_v_scores); __Pyx_GOTREF(__pyx_v_self->scores); __Pyx_DECREF(((PyObject *)__pyx_v_self->scores)); - __pyx_v_self->scores = ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_scores); + __pyx_v_self->scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_scores); __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.Rule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Rule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -28120,17 +28106,17 @@ static int __pyx_pf_3_sa_4Rule___cinit__(struct __pyx_obj_3_sa_Rule *__pyx_v_sel } /* Python wrapper */ -static Py_hash_t __pyx_pw_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self); /*proto*/ -static Py_hash_t __pyx_pw_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self) { +static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self); /*proto*/ +static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_4Rule_2__hash__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_2__hash__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":169 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":168 * self.scores = scores * * def __hash__(self): # <<<<<<<<<<<<<< @@ -28138,7 +28124,7 @@ static Py_hash_t __pyx_pw_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self) { * */ -static Py_hash_t __pyx_pf_3_sa_4Rule_2__hash__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { +static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_4Rule_2__hash__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -28149,16 +28135,16 @@ static Py_hash_t __pyx_pf_3_sa_4Rule_2__hash__(struct __pyx_obj_3_sa_Rule *__pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__hash__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":170 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":169 * * def __hash__(self): * return hash((self.lhs, self.f, self.e)) # <<<<<<<<<<<<<< * * def __cmp__(self, Rule other): */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__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_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __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 = 169; __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); @@ -28169,7 +28155,7 @@ static Py_hash_t __pyx_pf_3_sa_4Rule_2__hash__(struct __pyx_obj_3_sa_Rule *__pyx 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(((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Hash(((PyObject *)__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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; goto __pyx_L0; @@ -28179,7 +28165,7 @@ static Py_hash_t __pyx_pf_3_sa_4Rule_2__hash__(struct __pyx_obj_3_sa_Rule *__pyx __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.Rule.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Rule.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; @@ -28189,16 +28175,16 @@ static Py_hash_t __pyx_pf_3_sa_4Rule_2__hash__(struct __pyx_obj_3_sa_Rule *__pyx /* Python wrapper */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pw_3_sa_4Rule_5__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static int __pyx_pw_3_sa_4Rule_5__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static int __pyx_pw_4cdec_2sa_3_sa_4Rule_5__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_4Rule_5__cmp__(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; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cmp__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_3_sa_Rule, 1, "other", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3_sa_4Rule_4__cmp__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_3_sa_Rule *)__pyx_v_other)); + 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;} + __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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -28208,7 +28194,7 @@ static int __pyx_pw_3_sa_4Rule_5__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_ } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":172 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":171 * return hash((self.lhs, self.f, self.e)) * * def __cmp__(self, Rule other): # <<<<<<<<<<<<<< @@ -28217,7 +28203,7 @@ static int __pyx_pw_3_sa_4Rule_5__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_ */ #if PY_MAJOR_VERSION < 3 -static int __pyx_pf_3_sa_4Rule_4__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Rule *__pyx_v_other) { +static int __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) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -28229,16 +28215,16 @@ static int __pyx_pf_3_sa_4Rule_4__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cmp__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":173 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":172 * * 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 = PyInt_FromLong(__pyx_v_self->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__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_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __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 = 172; __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); @@ -28253,16 +28239,16 @@ static int __pyx_pf_3_sa_4Rule_4__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self __Pyx_GIVEREF(__pyx_v_self->word_alignments); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":174 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":173 * 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 = PyInt_FromLong(__pyx_v_other->lhs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__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_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 174; __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 = 173; __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); @@ -28276,7 +28262,7 @@ static int __pyx_pf_3_sa_4Rule_4__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_self->word_alignments); __Pyx_GIVEREF(__pyx_v_self->word_alignments); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __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 = 172; __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)); @@ -28284,10 +28270,10 @@ static int __pyx_pf_3_sa_4Rule_4__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__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_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0; @@ -28298,7 +28284,7 @@ static int __pyx_pf_3_sa_4Rule_4__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.Rule.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Rule.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -28307,16 +28293,16 @@ static int __pyx_pf_3_sa_4Rule_4__cmp__(struct __pyx_obj_3_sa_Rule *__pyx_v_self #endif /*!(#if PY_MAJOR_VERSION < 3)*/ /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ -static PyObject *__pyx_pw_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { 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("fmerge (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_3_sa_Phrase, 1, "f", 0))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3_sa_4Rule_6fmerge(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self), ((struct __pyx_obj_3_sa_Phrase *)__pyx_v_f)); + 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;} + __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)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -28325,7 +28311,7 @@ static PyObject *__pyx_pw_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":176 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":175 * (other.lhs, other.f, other.e, self.word_alignments)) * * def fmerge(self, Phrase f): # <<<<<<<<<<<<<< @@ -28333,7 +28319,7 @@ static PyObject *__pyx_pw_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *_ * self.f = f */ -static PyObject *__pyx_pf_3_sa_4Rule_6fmerge(struct __pyx_obj_3_sa_Rule *__pyx_v_self, struct __pyx_obj_3_sa_Phrase *__pyx_v_f) { +static PyObject *__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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -28343,19 +28329,19 @@ static PyObject *__pyx_pf_3_sa_4Rule_6fmerge(struct __pyx_obj_3_sa_Rule *__pyx_v int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fmerge", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":177 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":176 * * 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 = 177; __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 = 177; __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 = 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":178 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":177 * def fmerge(self, Phrase f): * if self.f == f: * self.f = f # <<<<<<<<<<<<<< @@ -28375,7 +28361,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_6fmerge(struct __pyx_obj_3_sa_Rule *__pyx_v goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.Rule.fmerge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Rule.fmerge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -28384,17 +28370,17 @@ static PyObject *__pyx_pf_3_sa_4Rule_6fmerge(struct __pyx_obj_3_sa_Rule *__pyx_v } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("arity (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_4Rule_8arity(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":180 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":179 * self.f = f * * def arity(self): # <<<<<<<<<<<<<< @@ -28402,7 +28388,7 @@ static PyObject *__pyx_pw_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSE * */ -static PyObject *__pyx_pf_3_sa_4Rule_8arity(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -28412,7 +28398,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_8arity(struct __pyx_obj_3_sa_Rule *__pyx_v_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("arity", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":181 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":180 * * def arity(self): * return self.f.arity() # <<<<<<<<<<<<<< @@ -28420,9 +28406,9 @@ static PyObject *__pyx_pf_3_sa_4Rule_8arity(struct __pyx_obj_3_sa_Rule *__pyx_v_ * 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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 180; __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; @@ -28434,7 +28420,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_8arity(struct __pyx_obj_3_sa_Rule *__pyx_v_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.Rule.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Rule.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -28443,18 +28429,18 @@ static PyObject *__pyx_pf_3_sa_4Rule_8arity(struct __pyx_obj_3_sa_Rule *__pyx_v_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_4Rule_11__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_4Rule_11__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_11__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_4Rule_10__str__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_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___2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":187 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186 * 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())) # <<<<<<<<<<<<<< @@ -28462,25 +28448,25 @@ static PyObject *__pyx_gb_3_sa_4Rule_7__str___2generator13(__pyx_GeneratorObject * */ -static PyObject *__pyx_pf_3_sa_4Rule_7__str___genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *__pyx_cur_scope; +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; 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_3_sa___pyx_scope_struct_17_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_17_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_17_genexpr, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_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_16___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_3_sa_4Rule_7__str___2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __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___2generator13, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -28489,7 +28475,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_7__str___genexpr(PyObject *__pyx_self) { __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.Rule.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -28498,9 +28484,9 @@ static PyObject *__pyx_pf_3_sa_4Rule_7__str___genexpr(PyObject *__pyx_self) { return __pyx_r; } -static PyObject *__pyx_gb_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___2generator13(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *)__pyx_generator->closure); + 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); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -28519,18 +28505,18 @@ static PyObject *__pyx_gb_3_sa_4Rule_7__str___2generator13(__pyx_GeneratorObject return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __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 = 187; __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 = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[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; } @@ -28539,23 +28525,23 @@ static PyObject *__pyx_gb_3_sa_4Rule_7__str___2generator13(__pyx_GeneratorObject 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 = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[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 = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_2 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -28566,7 +28552,7 @@ static PyObject *__pyx_gb_3_sa_4Rule_7__str___2generator13(__pyx_GeneratorObject __Pyx_GIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_v_a = __pyx_t_2; __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_71), __pyx_cur_scope->__pyx_v_a); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_71), __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(((PyObject *)__pyx_t_2)); __pyx_r = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; @@ -28585,7 +28571,7 @@ static PyObject *__pyx_gb_3_sa_4Rule_7__str___2generator13(__pyx_GeneratorObject __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 = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyErr_SetNone(PyExc_StopIteration); @@ -28602,7 +28588,7 @@ static PyObject *__pyx_gb_3_sa_4Rule_7__str___2generator13(__pyx_GeneratorObject return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":183 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":182 * return self.f.arity() * * def __str__(self): # <<<<<<<<<<<<<< @@ -28610,8 +28596,8 @@ static PyObject *__pyx_gb_3_sa_4Rule_7__str___2generator13(__pyx_GeneratorObject * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] */ -static PyObject *__pyx_pf_3_sa_4Rule_10__str__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *__pyx_cur_scope; +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; PyObject *__pyx_v_fields = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -28627,7 +28613,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_10__str__(struct __pyx_obj_3_sa_Rule *__pyx const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *)__pyx_tp_new_3_sa___pyx_scope_struct_16___str__(__pyx_ptype_3_sa___pyx_scope_struct_16___str__, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -28637,40 +28623,40 @@ static PyObject *__pyx_pf_3_sa_4Rule_10__str__(struct __pyx_obj_3_sa_Rule *__pyx __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":185 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":184 * 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_3_sa_sym_tostring(__pyx_cur_scope->__pyx_v_self->lhs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __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 = 184; __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[7]; __pyx_lineno = 185; __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 = 184; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__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_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__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 = 185; __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 = 184; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__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_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__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 = 185; __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 = 184; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__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_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__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 = 185; __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 = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -28687,7 +28673,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_10__str__(struct __pyx_obj_3_sa_Rule *__pyx __pyx_v_fields = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":186 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":185 * cdef unsigned i * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] * if self.word_alignments is not None: # <<<<<<<<<<<<<< @@ -28698,33 +28684,33 @@ static PyObject *__pyx_pf_3_sa_4Rule_10__str__(struct __pyx_obj_3_sa_Rule *__pyx __pyx_t_7 = (__pyx_t_6 != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":187 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186 * 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_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); 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_t_5 = __pyx_pf_3_sa_4Rule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_pf_4cdec_2sa_3_sa_4Rule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __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[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __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_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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 = 187; __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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":188 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":187 * if self.word_alignments is not None: * fields.append(' '.join('%d-%d' % a for a in self.alignments())) * return ' ||| '.join(fields) # <<<<<<<<<<<<<< @@ -28732,14 +28718,14 @@ static PyObject *__pyx_pf_3_sa_4Rule_10__str__(struct __pyx_obj_3_sa_Rule *__pyx * def alignments(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_19), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_19), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __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[7]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_fields)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fields)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fields)); - __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -28755,7 +28741,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_10__str__(struct __pyx_obj_3_sa_Rule *__pyx __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.Rule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Rule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_fields); @@ -28764,20 +28750,20 @@ static PyObject *__pyx_pf_3_sa_4Rule_10__str__(struct __pyx_obj_3_sa_Rule *__pyx __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("alignments (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_4Rule_12alignments(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_12alignments(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":190 +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":189 * return ' ||| '.join(fields) * * def alignments(self): # <<<<<<<<<<<<<< @@ -28785,15 +28771,15 @@ static PyObject *__pyx_pw_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON * yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE */ -static PyObject *__pyx_pf_3_sa_4Rule_12alignments(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *__pyx_cur_scope; +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; 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_3_sa___pyx_scope_struct_18_alignments *)__pyx_tp_new_3_sa___pyx_scope_struct_18_alignments(__pyx_ptype_3_sa___pyx_scope_struct_18_alignments, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -28803,7 +28789,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_12alignments(struct __pyx_obj_3_sa_Rule *__ __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_3_sa_4Rule_14generator3, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -28812,7 +28798,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_12alignments(struct __pyx_obj_3_sa_Rule *__ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.Rule.alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Rule.alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -28821,9 +28807,9 @@ static PyObject *__pyx_pf_3_sa_4Rule_12alignments(struct __pyx_obj_3_sa_Rule *__ return __pyx_r; } -static PyObject *__pyx_gb_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *)__pyx_generator->closure); + 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); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -28844,9 +28830,9 @@ static PyObject *__pyx_gb_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_g return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":191 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":190 * * def alignments(self): * for point in self.word_alignments: # <<<<<<<<<<<<<< @@ -28856,7 +28842,7 @@ static PyObject *__pyx_gb_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_g __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 = 191; __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 = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -28864,23 +28850,23 @@ static PyObject *__pyx_gb_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_g 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 = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -28892,22 +28878,22 @@ static PyObject *__pyx_gb_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_g __pyx_cur_scope->__pyx_v_point = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rule.pxi":192 + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":191 * def alignments(self): * for point in self.word_alignments: * yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE # <<<<<<<<<<<<<< */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__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_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 = 192; __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 = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__pyx_v_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__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_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 = 192; __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 = 191; __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 = 192; __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 = 191; __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); @@ -28932,7 +28918,7 @@ static PyObject *__pyx_gb_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_g __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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyErr_SetNone(PyExc_StopIteration); @@ -28952,17 +28938,17 @@ static PyObject *__pyx_gb_3_sa_4Rule_14generator3(__pyx_GeneratorObject *__pyx_g } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_4Rule_1f___get__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_1f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_sa.pxd":37 +/* "cdec/sa/_sa.pxd":37 * cdef class Rule: * cdef int lhs * cdef readonly Phrase f, e # <<<<<<<<<<<<<< @@ -28970,7 +28956,7 @@ static PyObject *__pyx_pw_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self) { * cdef int n_scores */ -static PyObject *__pyx_pf_3_sa_4Rule_1f___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1f___get__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -28987,17 +28973,17 @@ static PyObject *__pyx_pf_3_sa_4Rule_1f___get__(struct __pyx_obj_3_sa_Rule *__py } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_4Rule_1e___get__(((struct __pyx_obj_3_sa_Rule *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_1e___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_3_sa_4Rule_1e___get__(struct __pyx_obj_3_sa_Rule *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1e___get__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); @@ -29013,7 +28999,7 @@ static PyObject *__pyx_pf_3_sa_4Rule_1e___get__(struct __pyx_obj_3_sa_Rule *__py return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":21 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":21 * int arr_len * * cdef _Trie_Node* new_trie_node(): # <<<<<<<<<<<<<< @@ -29021,22 +29007,22 @@ static PyObject *__pyx_pf_3_sa_4Rule_1e___get__(struct __pyx_obj_3_sa_Rule *__py * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) */ -static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { - struct __pyx_t_3_sa__Trie_Node *__pyx_v_node; - struct __pyx_t_3_sa__Trie_Node *__pyx_r; +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie_node(void) { + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_trie_node", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":23 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":23 * cdef _Trie_Node* new_trie_node(): * cdef _Trie_Node* node * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) # <<<<<<<<<<<<<< * node.root = NULL * node.arr_len = 0 */ - __pyx_v_node = ((struct __pyx_t_3_sa__Trie_Node *)malloc((sizeof(struct __pyx_t_3_sa__Trie_Node)))); + __pyx_v_node = ((struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":24 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":24 * cdef _Trie_Node* node * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) * node.root = NULL # <<<<<<<<<<<<<< @@ -29045,7 +29031,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { */ __pyx_v_node->root = NULL; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":25 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":25 * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) * node.root = NULL * node.arr_len = 0 # <<<<<<<<<<<<<< @@ -29054,7 +29040,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { */ __pyx_v_node->arr_len = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":26 * node.root = NULL * node.arr_len = 0 * node.arr = malloc(sizeof(0*sizeof(int))) # <<<<<<<<<<<<<< @@ -29063,7 +29049,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { */ __pyx_v_node->arr = ((int *)malloc((sizeof((0 * (sizeof(int))))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":27 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":27 * node.arr_len = 0 * node.arr = malloc(sizeof(0*sizeof(int))) * return node # <<<<<<<<<<<<<< @@ -29079,7 +29065,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":29 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":29 * return node * * cdef _Trie_Edge* new_trie_edge(int val): # <<<<<<<<<<<<<< @@ -29087,31 +29073,31 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_new_trie_node(void) { * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) */ -static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_val) { - struct __pyx_t_3_sa__Trie_Edge *__pyx_v_edge; - struct __pyx_t_3_sa__Trie_Edge *__pyx_r; +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie_edge(int __pyx_v_val) { + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_edge; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_trie_edge", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":31 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":31 * cdef _Trie_Edge* new_trie_edge(int val): * cdef _Trie_Edge* edge * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) # <<<<<<<<<<<<<< * edge.node = new_trie_node() * edge.bigger = NULL */ - __pyx_v_edge = ((struct __pyx_t_3_sa__Trie_Edge *)malloc((sizeof(struct __pyx_t_3_sa__Trie_Edge)))); + __pyx_v_edge = ((struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":32 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":32 * cdef _Trie_Edge* edge * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) * edge.node = new_trie_node() # <<<<<<<<<<<<<< * edge.bigger = NULL * edge.smaller = NULL */ - __pyx_v_edge->node = __pyx_f_3_sa_new_trie_node(); + __pyx_v_edge->node = __pyx_f_4cdec_2sa_3_sa_new_trie_node(); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":33 * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) * edge.node = new_trie_node() * edge.bigger = NULL # <<<<<<<<<<<<<< @@ -29120,7 +29106,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va */ __pyx_v_edge->bigger = NULL; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":34 * edge.node = new_trie_node() * edge.bigger = NULL * edge.smaller = NULL # <<<<<<<<<<<<<< @@ -29129,7 +29115,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va */ __pyx_v_edge->smaller = NULL; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":35 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":35 * edge.bigger = NULL * edge.smaller = NULL * edge.val = val # <<<<<<<<<<<<<< @@ -29138,7 +29124,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va */ __pyx_v_edge->val = __pyx_v_val; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":36 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":36 * edge.smaller = NULL * edge.val = val * return edge # <<<<<<<<<<<<<< @@ -29154,7 +29140,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":38 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":38 * return edge * * cdef free_trie_node(_Trie_Node* node): # <<<<<<<<<<<<<< @@ -29162,7 +29148,7 @@ static struct __pyx_t_3_sa__Trie_Edge *__pyx_f_3_sa_new_trie_edge(int __pyx_v_va * free_trie_edge(node.root) */ -static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__pyx_v_node) { +static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_node(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -29172,7 +29158,7 @@ static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("free_trie_node", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":39 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":39 * * cdef free_trie_node(_Trie_Node* node): * if node != NULL: # <<<<<<<<<<<<<< @@ -29182,18 +29168,18 @@ static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__p __pyx_t_1 = ((__pyx_v_node != NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":40 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":40 * cdef free_trie_node(_Trie_Node* node): * if node != NULL: * free_trie_edge(node.root) # <<<<<<<<<<<<<< * free(node.arr) * */ - __pyx_t_2 = __pyx_f_3_sa_free_trie_edge(__pyx_v_node->root); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_edge(__pyx_v_node->root); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":41 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":41 * if node != NULL: * free_trie_edge(node.root) * free(node.arr) # <<<<<<<<<<<<<< @@ -29209,7 +29195,7 @@ static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.free_trie_node", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.free_trie_node", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -29217,7 +29203,7 @@ static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__p return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":43 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":43 * free(node.arr) * * cdef free_trie_edge(_Trie_Edge* edge): # <<<<<<<<<<<<<< @@ -29225,7 +29211,7 @@ static PyObject *__pyx_f_3_sa_free_trie_node(struct __pyx_t_3_sa__Trie_Node *__p * free_trie_node(edge.node) */ -static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__pyx_v_edge) { +static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_edge) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -29235,7 +29221,7 @@ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("free_trie_edge", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":44 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":44 * * cdef free_trie_edge(_Trie_Edge* edge): * if edge != NULL: # <<<<<<<<<<<<<< @@ -29245,36 +29231,36 @@ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__p __pyx_t_1 = ((__pyx_v_edge != NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":45 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":45 * cdef free_trie_edge(_Trie_Edge* edge): * if edge != NULL: * free_trie_node(edge.node) # <<<<<<<<<<<<<< * free_trie_edge(edge.bigger) * free_trie_edge(edge.smaller) */ - __pyx_t_2 = __pyx_f_3_sa_free_trie_node(__pyx_v_edge->node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_node(__pyx_v_edge->node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":46 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":46 * if edge != NULL: * free_trie_node(edge.node) * free_trie_edge(edge.bigger) # <<<<<<<<<<<<<< * free_trie_edge(edge.smaller) * */ - __pyx_t_2 = __pyx_f_3_sa_free_trie_edge(__pyx_v_edge->bigger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_edge(__pyx_v_edge->bigger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":47 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":47 * free_trie_node(edge.node) * free_trie_edge(edge.bigger) * free_trie_edge(edge.smaller) # <<<<<<<<<<<<<< * * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): */ - __pyx_t_2 = __pyx_f_3_sa_free_trie_edge(__pyx_v_edge->smaller); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_edge(__pyx_v_edge->smaller); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; @@ -29285,7 +29271,7 @@ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.free_trie_edge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.free_trie_edge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -29293,7 +29279,7 @@ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__p return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":49 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":49 * free_trie_edge(edge.smaller) * * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): # <<<<<<<<<<<<<< @@ -29301,17 +29287,17 @@ static PyObject *__pyx_f_3_sa_free_trie_edge(struct __pyx_t_3_sa__Trie_Edge *__p * cur = node.root */ -static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { - struct __pyx_t_3_sa__Trie_Edge *__pyx_v_cur; - struct __pyx_t_3_sa__Trie_Node *__pyx_r; +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_find(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_cur; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; __Pyx_RefNannyDeclarations - struct __pyx_t_3_sa__Trie_Edge *__pyx_t_1; + 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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":51 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":51 * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): * cdef _Trie_Edge* cur * cur = node.root # <<<<<<<<<<<<<< @@ -29321,7 +29307,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s __pyx_t_1 = __pyx_v_node->root; __pyx_v_cur = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":52 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":52 * cdef _Trie_Edge* cur * cur = node.root * while cur != NULL and cur.val != val: # <<<<<<<<<<<<<< @@ -29338,7 +29324,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s } if (!__pyx_t_4) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":53 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":53 * cur = node.root * while cur != NULL and cur.val != val: * if val > cur.val: # <<<<<<<<<<<<<< @@ -29348,7 +29334,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s __pyx_t_4 = ((__pyx_v_val > __pyx_v_cur->val) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":54 * while cur != NULL and cur.val != val: * if val > cur.val: * cur = cur.bigger # <<<<<<<<<<<<<< @@ -29360,7 +29346,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s goto __pyx_L5; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":55 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":55 * if val > cur.val: * cur = cur.bigger * elif val < cur.val: # <<<<<<<<<<<<<< @@ -29370,7 +29356,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s __pyx_t_4 = ((__pyx_v_val < __pyx_v_cur->val) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":56 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":56 * cur = cur.bigger * elif val < cur.val: * cur = cur.smaller # <<<<<<<<<<<<<< @@ -29384,7 +29370,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":57 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":57 * elif val < cur.val: * cur = cur.smaller * if cur == NULL: # <<<<<<<<<<<<<< @@ -29394,7 +29380,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s __pyx_t_4 = ((__pyx_v_cur == NULL) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":58 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":58 * cur = cur.smaller * if cur == NULL: * return NULL # <<<<<<<<<<<<<< @@ -29407,7 +29393,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":60 * return NULL * else: * return cur.node # <<<<<<<<<<<<<< @@ -29425,7 +29411,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":62 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":62 * return cur.node * * cdef trie_node_data_append(_Trie_Node* node, int val): # <<<<<<<<<<<<<< @@ -29433,13 +29419,13 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_find(struct __pyx_t_3_s * new_len = node.arr_len + 1 */ -static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { int __pyx_v_new_len; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trie_node_data_append", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":64 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -29448,7 +29434,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_No */ __pyx_v_new_len = (__pyx_v_node->arr_len + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":65 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":65 * cdef int new_len * new_len = node.arr_len + 1 * node.arr = realloc(node.arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -29457,7 +29443,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_No */ __pyx_v_node->arr = ((int *)realloc(__pyx_v_node->arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":66 * new_len = node.arr_len + 1 * node.arr = realloc(node.arr, new_len*sizeof(int)) * node.arr[node.arr_len] = val # <<<<<<<<<<<<<< @@ -29466,7 +29452,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_No */ (__pyx_v_node->arr[__pyx_v_node->arr_len]) = __pyx_v_val; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":67 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":67 * node.arr = realloc(node.arr, new_len*sizeof(int)) * node.arr[node.arr_len] = val * node.arr_len = new_len # <<<<<<<<<<<<<< @@ -29481,7 +29467,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_No return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":69 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":69 * node.arr_len = new_len * * cdef trie_node_data_extend(_Trie_Node* node, int* vals, int num_vals): # <<<<<<<<<<<<<< @@ -29489,13 +29475,13 @@ static PyObject *__pyx_f_3_sa_trie_node_data_append(struct __pyx_t_3_sa__Trie_No * new_len = node.arr_len + num_vals */ -static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_Node *__pyx_v_node, int *__pyx_v_vals, int __pyx_v_num_vals) { +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_extend(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int *__pyx_v_vals, int __pyx_v_num_vals) { int __pyx_v_new_len; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trie_node_data_extend", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":71 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -29504,7 +29490,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_No */ __pyx_v_new_len = (__pyx_v_node->arr_len + __pyx_v_num_vals); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":72 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":72 * cdef int new_len * new_len = node.arr_len + num_vals * node.arr = realloc(node.arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -29513,7 +29499,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_No */ __pyx_v_node->arr = ((int *)realloc(__pyx_v_node->arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":73 * new_len = node.arr_len + num_vals * node.arr = realloc(node.arr, new_len*sizeof(int)) * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) # <<<<<<<<<<<<<< @@ -29522,7 +29508,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_No */ memcpy((__pyx_v_node->arr + __pyx_v_node->arr_len), __pyx_v_vals, (__pyx_v_num_vals * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":74 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":74 * node.arr = realloc(node.arr, new_len*sizeof(int)) * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) * node.arr_len = new_len # <<<<<<<<<<<<<< @@ -29537,7 +29523,7 @@ static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_No return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":77 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":77 * * * cdef _Trie_Node* trie_insert(_Trie_Node* node, int val): # <<<<<<<<<<<<<< @@ -29545,16 +29531,16 @@ static PyObject *__pyx_f_3_sa_trie_node_data_extend(struct __pyx_t_3_sa__Trie_No * cur = &node.root */ -static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { - struct __pyx_t_3_sa__Trie_Edge **__pyx_v_cur; - struct __pyx_t_3_sa__Trie_Node *__pyx_r; +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_insert(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge **__pyx_v_cur; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; __Pyx_RefNannySetupContext("trie_insert", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":79 * cdef _Trie_Node* trie_insert(_Trie_Node* node, int val): * cdef _Trie_Edge** cur * cur = &node.root # <<<<<<<<<<<<<< @@ -29563,7 +29549,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 */ __pyx_v_cur = (&__pyx_v_node->root); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":80 * cdef _Trie_Edge** cur * cur = &node.root * while cur[0] != NULL and cur[0].val != val: # <<<<<<<<<<<<<< @@ -29580,7 +29566,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 } if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":81 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":81 * cur = &node.root * while cur[0] != NULL and cur[0].val != val: * if val > cur[0].val: # <<<<<<<<<<<<<< @@ -29590,7 +29576,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 __pyx_t_3 = ((__pyx_v_val > (__pyx_v_cur[0])->val) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":82 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":82 * while cur[0] != NULL and cur[0].val != val: * if val > cur[0].val: * cur = &cur[0].bigger # <<<<<<<<<<<<<< @@ -29601,7 +29587,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 goto __pyx_L5; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":83 * if val > cur[0].val: * cur = &cur[0].bigger * elif val < cur[0].val: # <<<<<<<<<<<<<< @@ -29611,7 +29597,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 __pyx_t_3 = ((__pyx_v_val < (__pyx_v_cur[0])->val) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":84 * cur = &cur[0].bigger * elif val < cur[0].val: * cur = &cur[0].smaller # <<<<<<<<<<<<<< @@ -29624,7 +29610,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":85 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":85 * elif val < cur[0].val: * cur = &cur[0].smaller * if cur[0] == NULL: # <<<<<<<<<<<<<< @@ -29634,19 +29620,19 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 __pyx_t_3 = (((__pyx_v_cur[0]) == NULL) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":86 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":86 * cur = &cur[0].smaller * if cur[0] == NULL: * cur[0] = new_trie_edge(val) # <<<<<<<<<<<<<< * return cur[0].node * */ - (__pyx_v_cur[0]) = __pyx_f_3_sa_new_trie_edge(__pyx_v_val); + (__pyx_v_cur[0]) = __pyx_f_4cdec_2sa_3_sa_new_trie_edge(__pyx_v_val); goto __pyx_L6; } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":87 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":87 * if cur[0] == NULL: * cur[0] = new_trie_edge(val) * return cur[0].node # <<<<<<<<<<<<<< @@ -29662,7 +29648,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":89 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":89 * return cur[0].node * * cdef trie_node_to_map(_Trie_Node* node, result, prefix, int include_zeros): # <<<<<<<<<<<<<< @@ -29670,8 +29656,8 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_trie_insert(struct __pyx_t_3 * */ -static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *__pyx_v_node, PyObject *__pyx_v_result, PyObject *__pyx_v_prefix, int __pyx_v_include_zeros) { - struct __pyx_obj_3_sa_IntList *__pyx_v_arr = 0; +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, PyObject *__pyx_v_result, PyObject *__pyx_v_prefix, int __pyx_v_include_zeros) { + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -29683,7 +29669,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("trie_node_to_map", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":92 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":92 * cdef IntList arr * * if include_zeros or node.arr_len > 0: # <<<<<<<<<<<<<< @@ -29698,19 +29684,19 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ } if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":93 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":93 * * if include_zeros or node.arr_len > 0: * arr = IntList() # <<<<<<<<<<<<<< * free(arr.arr) * arr.arr = malloc(node.arr_len * sizeof(int)) */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_v_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); + __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":94 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":94 * if include_zeros or node.arr_len > 0: * arr = IntList() * free(arr.arr) # <<<<<<<<<<<<<< @@ -29719,7 +29705,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ */ free(__pyx_v_arr->arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":95 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":95 * arr = IntList() * free(arr.arr) * arr.arr = malloc(node.arr_len * sizeof(int)) # <<<<<<<<<<<<<< @@ -29728,7 +29714,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ */ __pyx_v_arr->arr = ((int *)malloc((__pyx_v_node->arr_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":96 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":96 * free(arr.arr) * arr.arr = malloc(node.arr_len * sizeof(int)) * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) # <<<<<<<<<<<<<< @@ -29737,7 +29723,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ */ memcpy(__pyx_v_arr->arr, __pyx_v_node->arr, (__pyx_v_node->arr_len * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":97 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":97 * arr.arr = malloc(node.arr_len * sizeof(int)) * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) * arr.len = node.arr_len # <<<<<<<<<<<<<< @@ -29747,7 +29733,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ __pyx_t_4 = __pyx_v_node->arr_len; __pyx_v_arr->len = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":98 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -29757,7 +29743,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ __pyx_t_4 = __pyx_v_node->arr_len; __pyx_v_arr->size = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":99 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":99 * arr.len = node.arr_len * arr.size = node.arr_len * result[prefix] = arr # <<<<<<<<<<<<<< @@ -29769,14 +29755,14 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":100 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":100 * arr.size = node.arr_len * result[prefix] = arr * trie_edge_to_map(node.root, result, prefix, include_zeros) # <<<<<<<<<<<<<< * * cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros): */ - __pyx_t_3 = __pyx_f_3_sa_trie_edge_to_map(__pyx_v_node->root, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(__pyx_v_node->root, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -29784,7 +29770,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.trie_node_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.trie_node_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_arr); @@ -29793,7 +29779,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":102 +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -29801,7 +29787,7 @@ static PyObject *__pyx_f_3_sa_trie_node_to_map(struct __pyx_t_3_sa__Trie_Node *_ * trie_edge_to_map(edge.smaller, result, prefix, include_zeros) */ -static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *__pyx_v_edge, PyObject *__pyx_v_result, PyObject *__pyx_v_prefix, int __pyx_v_include_zeros) { +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_edge, PyObject *__pyx_v_result, PyObject *__pyx_v_prefix, int __pyx_v_include_zeros) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -29813,7 +29799,7 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ __Pyx_RefNannySetupContext("trie_edge_to_map", 0); __Pyx_INCREF(__pyx_v_prefix); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":103 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":103 * * cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros): * if edge != NULL: # <<<<<<<<<<<<<< @@ -29823,29 +29809,29 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ __pyx_t_1 = ((__pyx_v_edge != NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":104 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * trie_edge_to_map(edge.bigger, result, prefix, include_zeros) * prefix = prefix + (edge.val,) */ - __pyx_t_2 = __pyx_f_3_sa_trie_edge_to_map(__pyx_v_edge->smaller, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(__pyx_v_edge->smaller, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":105 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * prefix = prefix + (edge.val,) * trie_node_to_map(edge.node, result, prefix, include_zeros) */ - __pyx_t_2 = __pyx_f_3_sa_trie_edge_to_map(__pyx_v_edge->bigger, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(__pyx_v_edge->bigger, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":106 + /* "/home/mdenkows/cdec/python/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,) # <<<<<<<<<<<<<< @@ -29866,14 +29852,14 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ __pyx_v_prefix = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":107 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * * cdef class TrieMap: */ - __pyx_t_2 = __pyx_f_3_sa_trie_node_to_map(__pyx_v_edge->node, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_node_to_map(__pyx_v_edge->node, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; @@ -29885,7 +29871,7 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.trie_edge_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.trie_edge_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_prefix); @@ -29895,8 +29881,8 @@ static PyObject *__pyx_f_3_sa_trie_edge_to_map(struct __pyx_t_3_sa__Trie_Edge *_ } /* Python wrapper */ -static int __pyx_pw_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_alphabet_size; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -29935,16 +29921,16 @@ static int __pyx_pw_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *_ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.TrieMap.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.TrieMap.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_7TrieMap___cinit__(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), __pyx_v_alphabet_size); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), __pyx_v_alphabet_size); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":114 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":114 * cdef int V * * def __cinit__(self, int alphabet_size): # <<<<<<<<<<<<<< @@ -29952,12 +29938,12 @@ static int __pyx_pw_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *_ * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) */ -static int __pyx_pf_3_sa_7TrieMap___cinit__(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size) { +static int __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":115 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":115 * * def __cinit__(self, int alphabet_size): * self.V = alphabet_size # <<<<<<<<<<<<<< @@ -29966,23 +29952,23 @@ static int __pyx_pf_3_sa_7TrieMap___cinit__(struct __pyx_obj_3_sa_TrieMap *__pyx */ __pyx_v_self->V = __pyx_v_alphabet_size; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":116 + /* "/home/mdenkows/cdec/python/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*)) # <<<<<<<<<<<<<< * memset(self.root, 0, self.V * sizeof(_Trie_Node*)) * */ - __pyx_v_self->root = ((struct __pyx_t_3_sa__Trie_Node **)malloc((__pyx_v_self->V * (sizeof(struct __pyx_t_3_sa__Trie_Node *))))); + __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 *))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":117 + /* "/home/mdenkows/cdec/python/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*)) # <<<<<<<<<<<<<< * * */ - memset(__pyx_v_self->root, 0, (__pyx_v_self->V * (sizeof(struct __pyx_t_3_sa__Trie_Node *)))); + memset(__pyx_v_self->root, 0, (__pyx_v_self->V * (sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *)))); __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -29990,15 +29976,15 @@ static int __pyx_pf_3_sa_7TrieMap___cinit__(struct __pyx_obj_3_sa_TrieMap *__pyx } /* Python wrapper */ -static void __pyx_pw_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pw_4cdec_2sa_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_3_sa_7TrieMap_2__dealloc__(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self)); + __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":120 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":120 * * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -30006,7 +29992,7 @@ static void __pyx_pw_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self) { * for i from 0 <= i < self.V: */ -static void __pyx_pf_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self) { +static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self) { int __pyx_v_i; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -30017,7 +30003,7 @@ static void __pyx_pf_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_3_sa_TrieMap *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":122 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":122 * def __dealloc__(self): * cdef int i * for i from 0 <= i < self.V: # <<<<<<<<<<<<<< @@ -30027,7 +30013,7 @@ static void __pyx_pf_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_3_sa_TrieMap *_ __pyx_t_1 = __pyx_v_self->V; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":123 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":123 * cdef int i * for i from 0 <= i < self.V: * if self.root[i] != NULL: # <<<<<<<<<<<<<< @@ -30037,14 +30023,14 @@ static void __pyx_pf_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_3_sa_TrieMap *_ __pyx_t_2 = (((__pyx_v_self->root[__pyx_v_i]) != NULL) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":124 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":124 * for i from 0 <= i < self.V: * if self.root[i] != NULL: * free_trie_node(self.root[i]) # <<<<<<<<<<<<<< * free(self.root) * */ - __pyx_t_3 = __pyx_f_3_sa_free_trie_node((__pyx_v_self->root[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_free_trie_node((__pyx_v_self->root[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L5; @@ -30052,7 +30038,7 @@ static void __pyx_pf_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_3_sa_TrieMap *_ __pyx_L5:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":125 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":125 * if self.root[i] != NULL: * free_trie_node(self.root[i]) * free(self.root) # <<<<<<<<<<<<<< @@ -30064,23 +30050,23 @@ static void __pyx_pf_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_3_sa_TrieMap *_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.TrieMap.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.TrieMap.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("insert (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7TrieMap_4insert(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":128 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":128 * * * def insert(self, pattern): # <<<<<<<<<<<<<< @@ -30088,7 +30074,7 @@ static PyObject *__pyx_pw_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject * cdef int i, l */ -static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { int *__pyx_v_p; int __pyx_v_i; int __pyx_v_l; @@ -30103,7 +30089,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("insert", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":131 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":131 * cdef int* p * cdef int i, l * l = len(pattern) # <<<<<<<<<<<<<< @@ -30113,7 +30099,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *_ __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":132 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":132 * cdef int i, l * l = len(pattern) * p = malloc(l*sizeof(int)) # <<<<<<<<<<<<<< @@ -30122,7 +30108,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *_ */ __pyx_v_p = ((int *)malloc((__pyx_v_l * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":133 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":133 * l = len(pattern) * p = malloc(l*sizeof(int)) * for i from 0 <= i < l: # <<<<<<<<<<<<<< @@ -30132,7 +30118,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *_ __pyx_t_2 = __pyx_v_l; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":134 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":134 * p = malloc(l*sizeof(int)) * for i from 0 <= i < l: * p[i] = pattern[i] # <<<<<<<<<<<<<< @@ -30146,16 +30132,16 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *_ (__pyx_v_p[__pyx_v_i]) = __pyx_t_4; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":135 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":135 * for i from 0 <= i < l: * p[i] = pattern[i] * self._insert(p,l) # <<<<<<<<<<<<<< * free(p) * */ - ((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_insert(__pyx_v_self, __pyx_v_p, __pyx_v_l); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_insert(__pyx_v_self, __pyx_v_p, __pyx_v_l); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":136 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":136 * p[i] = pattern[i] * self._insert(p,l) * free(p) # <<<<<<<<<<<<<< @@ -30168,7 +30154,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.TrieMap.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.TrieMap.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -30176,7 +30162,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":139 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":139 * * * cdef _Trie_Node* _insert(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<< @@ -30184,16 +30170,16 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_4insert(struct __pyx_obj_3_sa_TrieMap *_ * cdef _Trie_Node* node */ -static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, int *__pyx_v_pattern, int __pyx_v_pattern_len) { +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) { int __pyx_v_i; - struct __pyx_t_3_sa__Trie_Node *__pyx_v_node; - struct __pyx_t_3_sa__Trie_Node *__pyx_r; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("_insert", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":142 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":142 * cdef int i * cdef _Trie_Node* node * if self.root[pattern[0]] == NULL: # <<<<<<<<<<<<<< @@ -30203,19 +30189,19 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py __pyx_t_1 = (((__pyx_v_self->root[(__pyx_v_pattern[0])]) == NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":143 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":143 * cdef _Trie_Node* node * if self.root[pattern[0]] == NULL: * self.root[pattern[0]] = new_trie_node() # <<<<<<<<<<<<<< * node = self.root[pattern[0]] * for i from 1 <= i < pattern_len: */ - (__pyx_v_self->root[(__pyx_v_pattern[0])]) = __pyx_f_3_sa_new_trie_node(); + (__pyx_v_self->root[(__pyx_v_pattern[0])]) = __pyx_f_4cdec_2sa_3_sa_new_trie_node(); goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":144 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":144 * if self.root[pattern[0]] == NULL: * self.root[pattern[0]] = new_trie_node() * node = self.root[pattern[0]] # <<<<<<<<<<<<<< @@ -30224,7 +30210,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py */ __pyx_v_node = (__pyx_v_self->root[(__pyx_v_pattern[0])]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":145 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":145 * self.root[pattern[0]] = new_trie_node() * node = self.root[pattern[0]] * for i from 1 <= i < pattern_len: # <<<<<<<<<<<<<< @@ -30234,17 +30220,17 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py __pyx_t_2 = __pyx_v_pattern_len; for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":146 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":146 * node = self.root[pattern[0]] * for i from 1 <= i < pattern_len: * node = trie_insert(node, pattern[i]) # <<<<<<<<<<<<<< * return node * */ - __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":147 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":147 * for i from 1 <= i < pattern_len: * node = trie_insert(node, pattern[i]) * return node # <<<<<<<<<<<<<< @@ -30261,17 +30247,17 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__insert(struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("contains (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7TrieMap_6contains(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":149 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":149 * return node * * def contains(self, pattern): # <<<<<<<<<<<<<< @@ -30279,11 +30265,11 @@ static PyObject *__pyx_pw_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObje * cdef int i, l */ -static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { int *__pyx_v_p; int __pyx_v_i; int __pyx_v_l; - struct __pyx_t_3_sa__Trie_Node *__pyx_v_node; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -30296,7 +30282,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap int __pyx_clineno = 0; __Pyx_RefNannySetupContext("contains", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":153 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":153 * cdef int i, l * cdef _Trie_Node* node * l = len(pattern) # <<<<<<<<<<<<<< @@ -30306,7 +30292,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":154 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":154 * cdef _Trie_Node* node * l = len(pattern) * p = malloc(l*sizeof(int)) # <<<<<<<<<<<<<< @@ -30315,7 +30301,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap */ __pyx_v_p = ((int *)malloc((__pyx_v_l * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":155 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":155 * l = len(pattern) * p = malloc(l*sizeof(int)) * for i from 0 <= i < l: # <<<<<<<<<<<<<< @@ -30325,7 +30311,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap __pyx_t_2 = __pyx_v_l; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":156 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":156 * p = malloc(l*sizeof(int)) * for i from 0 <= i < l: * p[i] = pattern[i] # <<<<<<<<<<<<<< @@ -30339,16 +30325,16 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap (__pyx_v_p[__pyx_v_i]) = __pyx_t_4; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":157 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":157 * for i from 0 <= i < l: * p[i] = pattern[i] * node = self._contains(p,l) # <<<<<<<<<<<<<< * free(p) * if node == NULL: */ - __pyx_v_node = ((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_contains(__pyx_v_self, __pyx_v_p, __pyx_v_l); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":158 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":158 * p[i] = pattern[i] * node = self._contains(p,l) * free(p) # <<<<<<<<<<<<<< @@ -30357,7 +30343,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap */ free(__pyx_v_p); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":159 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":159 * node = self._contains(p,l) * free(p) * if node == NULL: # <<<<<<<<<<<<<< @@ -30367,7 +30353,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap __pyx_t_5 = ((__pyx_v_node == NULL) != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":160 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":160 * free(p) * if node == NULL: * return False # <<<<<<<<<<<<<< @@ -30384,7 +30370,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":162 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":162 * return False * else: * return True # <<<<<<<<<<<<<< @@ -30404,7 +30390,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.TrieMap.contains", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.TrieMap.contains", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -30412,7 +30398,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":164 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":164 * return True * * cdef _Trie_Node* _contains(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<< @@ -30420,17 +30406,17 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_6contains(struct __pyx_obj_3_sa_TrieMap * cdef _Trie_Node* node */ -static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, int *__pyx_v_pattern, int __pyx_v_pattern_len) { +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) { int __pyx_v_i; - struct __pyx_t_3_sa__Trie_Node *__pyx_v_node; - struct __pyx_t_3_sa__Trie_Node *__pyx_r; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; __Pyx_RefNannySetupContext("_contains", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":167 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":167 * cdef int i * cdef _Trie_Node* node * node = self.root[pattern[0]] # <<<<<<<<<<<<<< @@ -30439,7 +30425,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ */ __pyx_v_node = (__pyx_v_self->root[(__pyx_v_pattern[0])]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":168 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":168 * cdef _Trie_Node* node * node = self.root[pattern[0]] * i = 1 # <<<<<<<<<<<<<< @@ -30448,7 +30434,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":169 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":169 * node = self.root[pattern[0]] * i = 1 * while node != NULL and i < pattern_len: # <<<<<<<<<<<<<< @@ -30465,16 +30451,16 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ } if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":170 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":170 * i = 1 * while node != NULL and i < pattern_len: * node = trie_find(node, pattern[i]) # <<<<<<<<<<<<<< * i = i+1 * return node */ - __pyx_v_node = __pyx_f_3_sa_trie_find(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_find(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":171 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":171 * while node != NULL and i < pattern_len: * node = trie_find(node, pattern[i]) * i = i+1 # <<<<<<<<<<<<<< @@ -30484,7 +30470,7 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ __pyx_v_i = (__pyx_v_i + 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":172 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":172 * node = trie_find(node, pattern[i]) * i = i+1 * return node # <<<<<<<<<<<<<< @@ -30501,17 +30487,17 @@ static struct __pyx_t_3_sa__Trie_Node *__pyx_f_3_sa_7TrieMap__contains(struct __ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/ -static PyObject *__pyx_pw_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("toMap (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_7TrieMap_8toMap(((struct __pyx_obj_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_flag)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_flag)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":174 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":174 * return node * * def toMap(self, flag): # <<<<<<<<<<<<<< @@ -30519,7 +30505,7 @@ static PyObject *__pyx_pw_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject * */ -static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag) { int __pyx_v_i; int __pyx_v_include_zeros; PyObject *__pyx_v_result = NULL; @@ -30534,7 +30520,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("toMap", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":177 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":177 * cdef int i, include_zeros * * if flag: # <<<<<<<<<<<<<< @@ -30544,7 +30530,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":178 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":178 * * if flag: * include_zeros=1 # <<<<<<<<<<<<<< @@ -30556,7 +30542,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":180 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":180 * include_zeros=1 * else: * include_zeros=0 # <<<<<<<<<<<<<< @@ -30567,7 +30553,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":181 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":181 * else: * include_zeros=0 * result = {} # <<<<<<<<<<<<<< @@ -30579,7 +30565,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ __pyx_v_result = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":182 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":182 * include_zeros=0 * result = {} * for i from 0 <= i < self.V: # <<<<<<<<<<<<<< @@ -30589,7 +30575,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ __pyx_t_3 = __pyx_v_self->V; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":183 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":183 * result = {} * for i from 0 <= i < self.V: * if self.root[i] != NULL: # <<<<<<<<<<<<<< @@ -30599,7 +30585,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ __pyx_t_1 = (((__pyx_v_self->root[__pyx_v_i]) != NULL) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":184 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -30613,7 +30599,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_f_3_sa_trie_node_to_map((__pyx_v_self->root[__pyx_v_i]), ((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_4), __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_node_to_map((__pyx_v_self->root[__pyx_v_i]), ((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_4), __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -30622,7 +30608,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ __pyx_L6:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":185 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":185 * if self.root[i] != NULL: * trie_node_to_map(self.root[i], result, (i,), include_zeros) * return result # <<<<<<<<<<<<<< @@ -30639,7 +30625,7 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.TrieMap.toMap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.TrieMap.toMap", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -30649,8 +30635,8 @@ static PyObject *__pyx_pf_3_sa_7TrieMap_8toMap(struct __pyx_obj_3_sa_TrieMap *__ } /* Python wrapper */ -static int __pyx_pw_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fsarray = 0; PyObject *__pyx_v_from_stats = 0; PyObject *__pyx_v_from_binary = 0; @@ -30670,7 +30656,7 @@ static int __pyx_pw_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyO static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__from_stats,&__pyx_n_s__from_binary,&__pyx_n_s__precompute_rank,&__pyx_n_s_72,&__pyx_n_s__max_length,&__pyx_n_s__max_nonterminals,&__pyx_n_s_73,&__pyx_n_s__train_min_gap_size,0}; PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":200 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":200 * cdef write_map(self, m, FILE* f) * * def __cinit__(self, fsarray=None, from_stats=None, from_binary=None, # <<<<<<<<<<<<<< @@ -30782,16 +30768,16 @@ static int __pyx_pw_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyO __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_14Precomputation___cinit__(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_from_stats, __pyx_v_from_binary, __pyx_v_precompute_rank, __pyx_v_precompute_secondary_rank, __pyx_v_max_length, __pyx_v_max_nonterminals, __pyx_v_train_max_initial_size, __pyx_v_train_min_gap_size); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_from_stats, __pyx_v_from_binary, __pyx_v_precompute_rank, __pyx_v_precompute_secondary_rank, __pyx_v_max_length, __pyx_v_max_nonterminals, __pyx_v_train_max_initial_size, __pyx_v_train_min_gap_size); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_from_stats, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_precompute_rank, PyObject *__pyx_v_precompute_secondary_rank, PyObject *__pyx_v_max_length, PyObject *__pyx_v_max_nonterminals, PyObject *__pyx_v_train_max_initial_size, PyObject *__pyx_v_train_min_gap_size) { +static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_from_stats, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_precompute_rank, PyObject *__pyx_v_precompute_secondary_rank, PyObject *__pyx_v_max_length, PyObject *__pyx_v_max_nonterminals, PyObject *__pyx_v_train_max_initial_size, PyObject *__pyx_v_train_min_gap_size) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -30804,7 +30790,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":204 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -30814,7 +30800,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":205 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -30824,7 +30810,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":206 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":206 * self.precompute_rank = precompute_rank * self.precompute_secondary_rank = precompute_secondary_rank * self.max_length = max_length # <<<<<<<<<<<<<< @@ -30834,7 +30820,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":207 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":207 * self.precompute_secondary_rank = precompute_secondary_rank * self.max_length = max_length * self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<< @@ -30844,7 +30830,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":208 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":208 * self.max_length = max_length * self.max_nonterminals = max_nonterminals * self.train_max_initial_size = train_max_initial_size # <<<<<<<<<<<<<< @@ -30854,7 +30840,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":209 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -30864,7 +30850,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":210 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -30874,7 +30860,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":211 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":211 * self.train_min_gap_size = train_min_gap_size * if from_binary: * self.read_binary(from_binary) # <<<<<<<<<<<<<< @@ -30896,7 +30882,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":212 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":212 * if from_binary: * self.read_binary(from_binary) * elif from_stats: # <<<<<<<<<<<<<< @@ -30906,7 +30892,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":213 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":213 * self.read_binary(from_binary) * elif from_stats: * self.precompute(from_stats, fsarray) # <<<<<<<<<<<<<< @@ -30938,7 +30924,7 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -30946,8 +30932,8 @@ static int __pyx_pf_3_sa_14Precomputation___cinit__(struct __pyx_obj_3_sa_Precom } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -30960,16 +30946,16 @@ static PyObject *__pyx_pw_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_s } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_14Precomputation_2read_binary(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":216 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":216 * * * def read_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -30977,7 +30963,7 @@ static PyObject *__pyx_pw_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_s * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -30987,7 +30973,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_binary", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":218 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":218 * def read_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -30996,7 +30982,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":219 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":219 * cdef FILE* f * f = fopen(filename, "r") * fread(&(self.precompute_rank), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -31005,7 +30991,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ */ fread((&__pyx_v_self->precompute_rank), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":220 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31014,7 +31000,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ */ fread((&__pyx_v_self->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":221 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31023,7 +31009,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ */ fread((&__pyx_v_self->max_length), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":222 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31032,7 +31018,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ */ fread((&__pyx_v_self->max_nonterminals), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":223 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31041,7 +31027,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ */ fread((&__pyx_v_self->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":224 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31050,14 +31036,14 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ */ fread((&__pyx_v_self->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":225 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * self.precomputed_collocations = self.read_map(f) * fclose(f) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->read_map(__pyx_v_self, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->read_map(__pyx_v_self, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->precomputed_index); @@ -31065,14 +31051,14 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ __pyx_v_self->precomputed_index = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":226 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * fclose(f) * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->read_map(__pyx_v_self, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->read_map(__pyx_v_self, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->precomputed_collocations); @@ -31080,7 +31066,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ __pyx_v_self->precomputed_collocations = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":227 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":227 * self.precomputed_index = self.read_map(f) * self.precomputed_collocations = self.read_map(f) * fclose(f) # <<<<<<<<<<<<<< @@ -31093,7 +31079,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -31102,8 +31088,8 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_2read_binary(struct __pyx_obj_3_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -31116,16 +31102,16 @@ static PyObject *__pyx_pw_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_ } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_14Precomputation_4write_binary(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":230 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":230 * * * def write_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -31133,7 +31119,7 @@ static PyObject *__pyx_pw_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_ * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -31144,7 +31130,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_binary", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":232 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":232 * def write_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -31153,7 +31139,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":233 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":233 * cdef FILE* f * f = fopen(filename, "w") * fwrite(&(self.precompute_rank), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -31162,7 +31148,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 */ fwrite((&__pyx_v_self->precompute_rank), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":234 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31171,7 +31157,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 */ fwrite((&__pyx_v_self->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":235 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31180,7 +31166,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 */ fwrite((&__pyx_v_self->max_length), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":236 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31189,7 +31175,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 */ fwrite((&__pyx_v_self->max_nonterminals), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":237 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31198,7 +31184,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 */ fwrite((&__pyx_v_self->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":238 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31207,7 +31193,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 */ fwrite((&__pyx_v_self->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":239 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31216,12 +31202,12 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 */ __pyx_t_1 = __pyx_v_self->precomputed_index; __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->write_map(__pyx_v_self, __pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->write_map(__pyx_v_self, __pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 239; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":240 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -31230,12 +31216,12 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 */ __pyx_t_2 = __pyx_v_self->precomputed_collocations; __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->write_map(__pyx_v_self, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->write_map(__pyx_v_self, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 240; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":241 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":241 * self.write_map(self.precomputed_index, f) * self.write_map(self.precomputed_collocations, f) * fclose(f) # <<<<<<<<<<<<<< @@ -31249,7 +31235,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -31257,7 +31243,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":244 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":244 * * * cdef write_map(self, m, FILE* f): # <<<<<<<<<<<<<< @@ -31265,10 +31251,10 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_4write_binary(struct __pyx_obj_3 * cdef IntList arr */ -static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_m, FILE *__pyx_v_f) { +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) { int __pyx_v_i; int __pyx_v_N; - struct __pyx_obj_3_sa_IntList *__pyx_v_arr = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr = 0; PyObject *__pyx_v_pattern = NULL; PyObject *__pyx_v_val = NULL; PyObject *__pyx_v_word_id = NULL; @@ -31288,7 +31274,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_map", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":248 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":248 * cdef IntList arr * * N = len(m) # <<<<<<<<<<<<<< @@ -31298,7 +31284,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":249 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":249 * * N = len(m) * fwrite(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -31307,7 +31293,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ */ fwrite((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":250 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":250 * N = len(m) * fwrite(&(N), sizeof(int), 1, f) * for pattern, val in m.iteritems(): # <<<<<<<<<<<<<< @@ -31337,7 +31323,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ __pyx_v_val = __pyx_t_6; __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":251 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":251 * fwrite(&(N), sizeof(int), 1, f) * for pattern, val in m.iteritems(): * N = len(pattern) # <<<<<<<<<<<<<< @@ -31347,7 +31333,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":252 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":252 * for pattern, val in m.iteritems(): * N = len(pattern) * fwrite(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -31356,7 +31342,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ */ fwrite((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":253 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":253 * N = len(pattern) * fwrite(&(N), sizeof(int), 1, f) * for word_id in pattern: # <<<<<<<<<<<<<< @@ -31401,7 +31387,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ __pyx_v_word_id = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":254 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":254 * fwrite(&(N), sizeof(int), 1, f) * for word_id in pattern: * i = word_id # <<<<<<<<<<<<<< @@ -31411,7 +31397,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ __pyx_t_7 = __Pyx_PyInt_AsInt(__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":255 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":255 * for word_id in pattern: * i = word_id * fwrite(&(i), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -31422,26 +31408,26 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":256 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":256 * i = word_id * fwrite(&(i), sizeof(int), 1, f) * arr = val # <<<<<<<<<<<<<< * arr.write_handle(f) * */ - if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_val); __Pyx_XDECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_val); + __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_val); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":257 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":257 * fwrite(&(i), sizeof(int), 1, f) * arr = val * arr.write_handle(f) # <<<<<<<<<<<<<< * * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_arr->__pyx_vtab)->write_handle(__pyx_v_arr, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_arr->__pyx_vtab)->write_handle(__pyx_v_arr, __pyx_v_f); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -31451,7 +31437,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_sa.Precomputation.write_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.write_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_arr); @@ -31463,7 +31449,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":260 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":260 * * * cdef read_map(self, FILE* f): # <<<<<<<<<<<<<< @@ -31471,13 +31457,13 @@ static PyObject *__pyx_f_3_sa_14Precomputation_write_map(CYTHON_UNUSED struct __ * cdef IntList arr */ -static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, FILE *__pyx_v_f) { +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) { int __pyx_v_i; CYTHON_UNUSED int __pyx_v_j; CYTHON_UNUSED int __pyx_v_k; int __pyx_v_word_id; int __pyx_v_N; - struct __pyx_obj_3_sa_IntList *__pyx_v_arr = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr = 0; PyObject *__pyx_v_m = NULL; PyObject *__pyx_v_key = NULL; PyObject *__pyx_r = NULL; @@ -31491,7 +31477,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_map", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":264 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":264 * cdef IntList arr * * m = {} # <<<<<<<<<<<<<< @@ -31503,7 +31489,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p __pyx_v_m = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":265 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":265 * * m = {} * fread(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -31512,7 +31498,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p */ fread((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":266 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":266 * m = {} * fread(&(N), sizeof(int), 1, f) * for j from 0 <= j < N: # <<<<<<<<<<<<<< @@ -31522,7 +31508,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p __pyx_t_2 = __pyx_v_N; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":267 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":267 * fread(&(N), sizeof(int), 1, f) * for j from 0 <= j < N: * fread(&(i), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -31531,7 +31517,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p */ fread((&__pyx_v_i), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":268 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":268 * for j from 0 <= j < N: * fread(&(i), sizeof(int), 1, f) * key = () # <<<<<<<<<<<<<< @@ -31542,7 +31528,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p __Pyx_XDECREF(((PyObject *)__pyx_v_key)); __pyx_v_key = __pyx_empty_tuple; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":269 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":269 * fread(&(i), sizeof(int), 1, f) * key = () * for k from 0 <= k < i: # <<<<<<<<<<<<<< @@ -31552,7 +31538,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p __pyx_t_3 = __pyx_v_i; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":270 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":270 * key = () * for k from 0 <= k < i: * fread(&(word_id), sizeof(int), 1, f) # <<<<<<<<<<<<<< @@ -31561,7 +31547,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p */ fread((&__pyx_v_word_id), (sizeof(int)), 1, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":271 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":271 * for k from 0 <= k < i: * fread(&(word_id), sizeof(int), 1, f) * key = key + (word_id,) # <<<<<<<<<<<<<< @@ -31583,29 +31569,29 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":272 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":272 * fread(&(word_id), sizeof(int), 1, f) * key = key + (word_id,) * arr = IntList() # <<<<<<<<<<<<<< * arr.read_handle(f) * m[key] = arr */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":273 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":273 * key = key + (word_id,) * arr = IntList() * arr.read_handle(f) # <<<<<<<<<<<<<< * m[key] = arr * return m */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_arr->__pyx_vtab)->read_handle(__pyx_v_arr, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_arr->__pyx_vtab)->read_handle(__pyx_v_arr, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":274 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":274 * arr = IntList() * arr.read_handle(f) * m[key] = arr # <<<<<<<<<<<<<< @@ -31615,7 +31601,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p if (PyDict_SetItem(((PyObject *)__pyx_v_m), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":275 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":275 * arr.read_handle(f) * m[key] = arr * return m # <<<<<<<<<<<<<< @@ -31632,7 +31618,7 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.Precomputation.read_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.read_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_arr); @@ -31644,10 +31630,10 @@ static PyObject *__pyx_f_3_sa_14Precomputation_read_map(CYTHON_UNUSED struct __p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_stats = 0; - struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sarray = 0; + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sarray = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -31687,18 +31673,18 @@ static PyObject *__pyx_pw_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_se values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_stats = values[0]; - __pyx_v_sarray = ((struct __pyx_obj_3_sa_SuffixArray *)values[1]); + __pyx_v_sarray = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("precompute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sarray), __pyx_ptype_3_sa_SuffixArray, 1, "sarray", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3_sa_14Precomputation_6precompute(((struct __pyx_obj_3_sa_Precomputation *)__pyx_v_self), __pyx_v_stats, __pyx_v_sarray); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sarray), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "sarray", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), __pyx_v_stats, __pyx_v_sarray); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -31707,7 +31693,7 @@ static PyObject *__pyx_pw_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_se return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":278 +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":278 * * * def precompute(self, stats, SuffixArray sarray): # <<<<<<<<<<<<<< @@ -31715,7 +31701,7 @@ static PyObject *__pyx_pw_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_se * cdef DataArray darray = sarray.darray */ -static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_stats, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_sarray) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_stats, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sarray) { int __pyx_v_i; int __pyx_v_l; int __pyx_v_N; @@ -31732,15 +31718,15 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s int __pyx_v_is_super; int __pyx_v_sent_count; int __pyx_v_max_rank; - struct __pyx_obj_3_sa_DataArray *__pyx_v_darray = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_data = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_queue = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_cost_by_rank = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_count_by_rank = 0; - struct __pyx_obj_3_sa_TrieMap *__pyx_v_frequent_patterns = 0; - struct __pyx_obj_3_sa_TrieMap *__pyx_v_super_frequent_patterns = 0; - struct __pyx_obj_3_sa_TrieMap *__pyx_v_collocations = 0; - struct __pyx_t_3_sa__Trie_Node *__pyx_v_node; + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_darray = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_data = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_queue = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_cost_by_rank = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_count_by_rank = 0; + struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_frequent_patterns = 0; + struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_super_frequent_patterns = 0; + struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_collocations = 0; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; PyObject *__pyx_v_I_set = NULL; PyObject *__pyx_v_J_set = NULL; PyObject *__pyx_v_J2_set = NULL; @@ -31793,7 +31779,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("precompute", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":280 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -31802,10 +31788,10 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_t_1 = ((PyObject *)__pyx_v_sarray->darray); __Pyx_INCREF(__pyx_t_1); - __pyx_v_darray = ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_1); + __pyx_v_darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":285 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":285 * cdef _Trie_Node* node * * data = darray.data # <<<<<<<<<<<<<< @@ -31814,10 +31800,10 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_t_1 = ((PyObject *)__pyx_v_darray->data); __Pyx_INCREF(__pyx_t_1); - __pyx_v_data = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":287 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":287 * data = darray.data * * frequent_patterns = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< @@ -31835,13 +31821,13 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_frequent_patterns = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_t_1); + __pyx_v_frequent_patterns = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":288 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":288 * * frequent_patterns = TrieMap(len(darray.id2word)) * super_frequent_patterns = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< @@ -31859,13 +31845,13 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_super_frequent_patterns = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_t_1); + __pyx_v_super_frequent_patterns = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":289 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":289 * frequent_patterns = TrieMap(len(darray.id2word)) * super_frequent_patterns = TrieMap(len(darray.id2word)) * collocations = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< @@ -31883,13 +31869,13 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_collocations = ((struct __pyx_obj_3_sa_TrieMap *)__pyx_t_1); + __pyx_v_collocations = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":291 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":291 * collocations = TrieMap(len(darray.id2word)) * * I_set = set() # <<<<<<<<<<<<<< @@ -31901,7 +31887,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_I_set = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":292 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":292 * * I_set = set() * J_set = set() # <<<<<<<<<<<<<< @@ -31913,7 +31899,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_J_set = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":293 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":293 * I_set = set() * J_set = set() * J2_set = set() # <<<<<<<<<<<<<< @@ -31925,7 +31911,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_J2_set = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":294 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":294 * J_set = set() * J2_set = set() * IJ_set = set() # <<<<<<<<<<<<<< @@ -31937,7 +31923,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_IJ_set = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":295 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":295 * J2_set = set() * IJ_set = set() * pattern_rank = {} # <<<<<<<<<<<<<< @@ -31949,7 +31935,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_pattern_rank = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":297 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":297 * pattern_rank = {} * * logger.info("Precomputing frequent intersections") # <<<<<<<<<<<<<< @@ -31966,7 +31952,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":298 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":298 * * logger.info("Precomputing frequent intersections") * cdef float start_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -31982,7 +31968,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_start_time = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":300 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":300 * cdef float start_time = monitor_cpu() * * max_pattern_len = 0 # <<<<<<<<<<<<<< @@ -31991,7 +31977,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_max_pattern_len = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":301 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":301 * * max_pattern_len = 0 * for rank, (_, _, phrase) in enumerate(stats): # <<<<<<<<<<<<<< @@ -32110,7 +32096,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_3 = __pyx_t_6; __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":302 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":302 * max_pattern_len = 0 * for rank, (_, _, phrase) in enumerate(stats): * if rank >= self.precompute_rank: # <<<<<<<<<<<<<< @@ -32125,7 +32111,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":303 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":303 * for rank, (_, _, phrase) in enumerate(stats): * if rank >= self.precompute_rank: * break # <<<<<<<<<<<<<< @@ -32137,7 +32123,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":304 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":304 * if rank >= self.precompute_rank: * break * max_pattern_len = max(max_pattern_len, len(phrase)) # <<<<<<<<<<<<<< @@ -32153,7 +32139,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __pyx_v_max_pattern_len = __pyx_t_15; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":305 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":305 * break * max_pattern_len = max(max_pattern_len, len(phrase)) * frequent_patterns.insert(phrase) # <<<<<<<<<<<<<< @@ -32173,7 +32159,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":306 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":306 * max_pattern_len = max(max_pattern_len, len(phrase)) * frequent_patterns.insert(phrase) * I_set.add(phrase) # <<<<<<<<<<<<<< @@ -32182,7 +32168,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __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;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":307 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":307 * frequent_patterns.insert(phrase) * I_set.add(phrase) * pattern_rank[phrase] = rank # <<<<<<<<<<<<<< @@ -32191,7 +32177,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ if (PyDict_SetItem(((PyObject *)__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;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":308 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":308 * I_set.add(phrase) * pattern_rank[phrase] = rank * if rank < self.precompute_secondary_rank: # <<<<<<<<<<<<<< @@ -32206,7 +32192,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":309 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":309 * pattern_rank[phrase] = rank * if rank < self.precompute_secondary_rank: * super_frequent_patterns.insert(phrase) # <<<<<<<<<<<<<< @@ -32226,7 +32212,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":310 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":310 * if rank < self.precompute_secondary_rank: * super_frequent_patterns.insert(phrase) * J_set.add(phrase) # <<<<<<<<<<<<<< @@ -32242,7 +32228,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":312 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":312 * J_set.add(phrase) * * queue = IntList(increment=1000) # <<<<<<<<<<<<<< @@ -32252,13 +32238,13 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __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(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_queue = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_queue = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":314 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":314 * queue = IntList(increment=1000) * * logger.info(" Computing inverted indexes...") # <<<<<<<<<<<<<< @@ -32275,7 +32261,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":315 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":315 * * logger.info(" Computing inverted indexes...") * N = len(data) # <<<<<<<<<<<<<< @@ -32285,7 +32271,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":316 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":316 * logger.info(" Computing inverted indexes...") * N = len(data) * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -32295,7 +32281,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_14 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_14; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":317 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":317 * N = len(data) * for i from 0 <= i < N: * sa_word_id = data.arr[i] # <<<<<<<<<<<<<< @@ -32304,7 +32290,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_sa_word_id = (__pyx_v_data->arr[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":318 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":318 * for i from 0 <= i < N: * sa_word_id = data.arr[i] * if sa_word_id == 1: # <<<<<<<<<<<<<< @@ -32314,19 +32300,19 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_12 = ((__pyx_v_sa_word_id == 1) != 0); if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":319 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":319 * sa_word_id = data.arr[i] * if sa_word_id == 1: * queue._append(-1) # <<<<<<<<<<<<<< * else: * for l from 1 <= l <= max_pattern_len: */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, -1); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, -1); goto __pyx_L11; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":321 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":321 * queue._append(-1) * else: * for l from 1 <= l <= max_pattern_len: # <<<<<<<<<<<<<< @@ -32336,16 +32322,16 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_17 = __pyx_v_max_pattern_len; for (__pyx_v_l = 1; __pyx_v_l <= __pyx_t_17; __pyx_v_l++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":322 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":322 * else: * for l from 1 <= l <= max_pattern_len: * node = frequent_patterns._contains(data.arr+i, l) # <<<<<<<<<<<<<< * if node == NULL: * break */ - __pyx_v_node = ((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_frequent_patterns->__pyx_vtab)->_contains(__pyx_v_frequent_patterns, (__pyx_v_data->arr + __pyx_v_i), __pyx_v_l); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":323 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":323 * for l from 1 <= l <= max_pattern_len: * node = frequent_patterns._contains(data.arr+i, l) * if node == NULL: # <<<<<<<<<<<<<< @@ -32355,7 +32341,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_12 = ((__pyx_v_node == NULL) != 0); if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":324 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":324 * node = frequent_patterns._contains(data.arr+i, l) * if node == NULL: * break # <<<<<<<<<<<<<< @@ -32367,32 +32353,32 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __pyx_L14:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":325 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":325 * if node == NULL: * break * queue._append(i) # <<<<<<<<<<<<<< * queue._append(l) * trie_node_data_append(node, i) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_i); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_i); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":326 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":326 * break * queue._append(i) * queue._append(l) # <<<<<<<<<<<<<< * trie_node_data_append(node, i) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_l); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_l); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":327 + /* "/home/mdenkows/cdec/python/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_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_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; } @@ -32401,7 +32387,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_L11:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":329 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":329 * trie_node_data_append(node, i) * * logger.info(" Computing collocations...") # <<<<<<<<<<<<<< @@ -32418,7 +32404,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":330 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":330 * * logger.info(" Computing collocations...") * N = len(queue) # <<<<<<<<<<<<<< @@ -32428,7 +32414,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":331 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":331 * logger.info(" Computing collocations...") * N = len(queue) * ptr1 = 0 # <<<<<<<<<<<<<< @@ -32437,7 +32423,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_ptr1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":332 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":332 * N = len(queue) * ptr1 = 0 * sent_count = 0 # <<<<<<<<<<<<<< @@ -32446,7 +32432,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_sent_count = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":333 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":333 * ptr1 = 0 * sent_count = 0 * while ptr1 < N: # main loop # <<<<<<<<<<<<<< @@ -32457,7 +32443,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_12 = ((__pyx_v_ptr1 < __pyx_v_N) != 0); if (!__pyx_t_12) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":334 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":334 * sent_count = 0 * while ptr1 < N: # main loop * i1 = queue.arr[ptr1] # <<<<<<<<<<<<<< @@ -32466,7 +32452,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_i1 = (__pyx_v_queue->arr[__pyx_v_ptr1]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":335 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":335 * while ptr1 < N: # main loop * i1 = queue.arr[ptr1] * if i1 > -1: # <<<<<<<<<<<<<< @@ -32476,7 +32462,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_12 = ((__pyx_v_i1 > -1) != 0); if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":336 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":336 * i1 = queue.arr[ptr1] * if i1 > -1: * l1 = queue.arr[ptr1+1] # <<<<<<<<<<<<<< @@ -32485,7 +32471,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_l1 = (__pyx_v_queue->arr[(__pyx_v_ptr1 + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":337 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":337 * if i1 > -1: * l1 = queue.arr[ptr1+1] * ptr2 = ptr1 + 2 # <<<<<<<<<<<<<< @@ -32494,7 +32480,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_ptr2 = (__pyx_v_ptr1 + 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":338 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":338 * l1 = queue.arr[ptr1+1] * ptr2 = ptr1 + 2 * while ptr2 < N: # <<<<<<<<<<<<<< @@ -32505,7 +32491,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_12 = ((__pyx_v_ptr2 < __pyx_v_N) != 0); if (!__pyx_t_12) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":339 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":339 * ptr2 = ptr1 + 2 * while ptr2 < N: * i2 = queue.arr[ptr2] # <<<<<<<<<<<<<< @@ -32514,7 +32500,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_i2 = (__pyx_v_queue->arr[__pyx_v_ptr2]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":340 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":340 * while ptr2 < N: * i2 = queue.arr[ptr2] * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: # <<<<<<<<<<<<<< @@ -32530,7 +32516,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } if (__pyx_t_19) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":341 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":341 * i2 = queue.arr[ptr2] * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: * break # <<<<<<<<<<<<<< @@ -32542,7 +32528,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __pyx_L20:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":342 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":342 * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: * break * l2 = queue.arr[ptr2+1] # <<<<<<<<<<<<<< @@ -32551,7 +32537,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_l2 = (__pyx_v_queue->arr[(__pyx_v_ptr2 + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":343 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":343 * break * l2 = queue.arr[ptr2+1] * if (i2 - i1 - l1 >= self.train_min_gap_size and # <<<<<<<<<<<<<< @@ -32561,7 +32547,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_19 = ((((__pyx_v_i2 - __pyx_v_i1) - __pyx_v_l1) >= __pyx_v_self->train_min_gap_size) != 0); if (__pyx_t_19) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":344 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -32571,7 +32557,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_12 = ((((__pyx_v_i2 + __pyx_v_l2) - __pyx_v_i1) <= __pyx_v_self->train_max_initial_size) != 0); if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":345 + /* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -32589,25 +32575,25 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":346 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: */ - __pyx_v_node = ((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_collocations->__pyx_vtab)->_insert(__pyx_v_collocations, (__pyx_v_data->arr + __pyx_v_i1), __pyx_v_l1); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":347 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":347 * l1+l2+1 <= self.max_length): * node = collocations._insert(data.arr+i1, l1) * node = trie_insert(node, -1) # <<<<<<<<<<<<<< * for i from i2 <= i < i2+l2: * node = trie_insert(node, data.arr[i]) */ - __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, -1); + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":348 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":348 * node = collocations._insert(data.arr+i1, l1) * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: # <<<<<<<<<<<<<< @@ -32617,59 +32603,59 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":349 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":349 * node = trie_insert(node, -1) * 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) */ - __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":350 + /* "/home/mdenkows/cdec/python/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_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_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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":351 + /* "/home/mdenkows/cdec/python/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_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_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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":352 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< * if super_frequent_patterns._contains(data.arr+i1, l1) != NULL: * is_super = 1 */ - __pyx_t_12 = ((((struct __pyx_vtabstruct_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); + __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":353 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< * is_super = 1 * else: */ - __pyx_t_12 = ((((struct __pyx_vtabstruct_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); + __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":354 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -32681,7 +32667,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":356 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":356 * is_super = 1 * else: * is_super = 0 # <<<<<<<<<<<<<< @@ -32692,7 +32678,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __pyx_L25:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":357 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":357 * else: * is_super = 0 * ptr3 = ptr2 + 2 # <<<<<<<<<<<<<< @@ -32701,7 +32687,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_ptr3 = (__pyx_v_ptr2 + 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":358 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":358 * is_super = 0 * ptr3 = ptr2 + 2 * while ptr3 < N: # <<<<<<<<<<<<<< @@ -32712,7 +32698,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_12 = ((__pyx_v_ptr3 < __pyx_v_N) != 0); if (!__pyx_t_12) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":359 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":359 * ptr3 = ptr2 + 2 * while ptr3 < N: * i3 = queue.arr[ptr3] # <<<<<<<<<<<<<< @@ -32721,7 +32707,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_i3 = (__pyx_v_queue->arr[__pyx_v_ptr3]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":360 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":360 * while ptr3 < N: * i3 = queue.arr[ptr3] * if i3 == -1 or i3 - i1 >= self.train_max_initial_size: # <<<<<<<<<<<<<< @@ -32737,7 +32723,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } if (__pyx_t_20) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":361 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":361 * i3 = queue.arr[ptr3] * if i3 == -1 or i3 - i1 >= self.train_max_initial_size: * break # <<<<<<<<<<<<<< @@ -32749,7 +32735,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __pyx_L28:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":362 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":362 * if i3 == -1 or i3 - i1 >= self.train_max_initial_size: * break * l3 = queue.arr[ptr3+1] # <<<<<<<<<<<<<< @@ -32758,7 +32744,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_l3 = (__pyx_v_queue->arr[(__pyx_v_ptr3 + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":363 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":363 * break * l3 = queue.arr[ptr3+1] * if (i3 - i2 - l2 >= self.train_min_gap_size and # <<<<<<<<<<<<<< @@ -32768,7 +32754,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_20 = ((((__pyx_v_i3 - __pyx_v_i2) - __pyx_v_l2) >= __pyx_v_self->train_min_gap_size) != 0); if (__pyx_t_20) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":364 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -32778,7 +32764,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_12 = ((((__pyx_v_i3 + __pyx_v_l3) - __pyx_v_i1) <= __pyx_v_self->train_max_initial_size) != 0); if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":365 + /* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -32796,7 +32782,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":366 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -32804,32 +32790,32 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s * node = trie_insert(node, -1) */ if (!(__pyx_v_is_super != 0)) { - __pyx_t_12 = (((struct __pyx_vtabstruct_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_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; } else { __pyx_t_20 = (__pyx_v_is_super != 0); } if (__pyx_t_20) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":367 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: */ - __pyx_v_node = ((struct __pyx_vtabstruct_3_sa_TrieMap *)__pyx_v_collocations->__pyx_vtab)->_insert(__pyx_v_collocations, (__pyx_v_data->arr + __pyx_v_i1), __pyx_v_l1); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":368 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * for i from i2 <= i < i2+l2: * node = trie_insert(node, data.arr[i]) */ - __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, -1); + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":369 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":369 * node = collocations._insert(data.arr+i1, l1) * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: # <<<<<<<<<<<<<< @@ -32839,26 +32825,26 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":370 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":370 * node = trie_insert(node, -1) * for i from i2 <= i < i2+l2: * node = trie_insert(node, data.arr[i]) # <<<<<<<<<<<<<< * node = trie_insert(node, -1) * for i from i3 <= i < i3+l3: */ - __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":371 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":371 * for i from i2 <= i < i2+l2: * node = trie_insert(node, data.arr[i]) * node = trie_insert(node, -1) # <<<<<<<<<<<<<< * for i from i3 <= i < i3+l3: * node = trie_insert(node, data.arr[i]) */ - __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, -1); + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":372 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":372 * node = trie_insert(node, data.arr[i]) * node = trie_insert(node, -1) * for i from i3 <= i < i3+l3: # <<<<<<<<<<<<<< @@ -32868,46 +32854,46 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":373 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":373 * node = trie_insert(node, -1) * 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) */ - __pyx_v_node = __pyx_f_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":374 + /* "/home/mdenkows/cdec/python/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_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_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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":375 + /* "/home/mdenkows/cdec/python/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_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_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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":376 + /* "/home/mdenkows/cdec/python/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_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_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; @@ -32917,7 +32903,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __pyx_L29:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":377 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":377 * trie_node_data_append(node, i2) * trie_node_data_append(node, i3) * ptr3 = ptr3 + 2 # <<<<<<<<<<<<<< @@ -32934,7 +32920,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __pyx_L21:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":378 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":378 * trie_node_data_append(node, i3) * ptr3 = ptr3 + 2 * ptr2 = ptr2 + 2 # <<<<<<<<<<<<<< @@ -32945,7 +32931,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __pyx_L19_break:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":379 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":379 * ptr3 = ptr3 + 2 * ptr2 = ptr2 + 2 * ptr1 = ptr1 + 2 # <<<<<<<<<<<<<< @@ -32957,7 +32943,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":381 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":381 * ptr1 = ptr1 + 2 * else: * sent_count = sent_count + 1 # <<<<<<<<<<<<<< @@ -32966,7 +32952,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_sent_count = (__pyx_v_sent_count + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":382 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":382 * else: * sent_count = sent_count + 1 * if sent_count % 10000 == 0: # <<<<<<<<<<<<<< @@ -32976,7 +32962,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_20 = ((__Pyx_mod_long(__pyx_v_sent_count, 10000) == 0) != 0); if (__pyx_t_20) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":383 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":383 * sent_count = sent_count + 1 * if sent_count % 10000 == 0: * logger.debug(" %d sentences", sent_count) # <<<<<<<<<<<<<< @@ -33007,7 +32993,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __pyx_L35:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":384 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":384 * if sent_count % 10000 == 0: * logger.debug(" %d sentences", sent_count) * ptr1 = ptr1 + 1 # <<<<<<<<<<<<<< @@ -33019,7 +33005,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_L17:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":386 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":386 * ptr1 = ptr1 + 1 * * self.precomputed_collocations = collocations.toMap(False) # <<<<<<<<<<<<<< @@ -33045,7 +33031,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_self->precomputed_collocations = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":387 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":387 * * self.precomputed_collocations = collocations.toMap(False) * self.precomputed_index = frequent_patterns.toMap(True) # <<<<<<<<<<<<<< @@ -33071,7 +33057,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_self->precomputed_index = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":389 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":389 * self.precomputed_index = frequent_patterns.toMap(True) * * x = 0 # <<<<<<<<<<<<<< @@ -33081,7 +33067,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_INCREF(__pyx_int_0); __pyx_v_x = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":390 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":390 * * x = 0 * for pattern1 in J_set: # <<<<<<<<<<<<<< @@ -33107,7 +33093,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_pattern1 = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":391 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":391 * x = 0 * for pattern1 in J_set: * for pattern2 in J_set: # <<<<<<<<<<<<<< @@ -33133,7 +33119,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_pattern2 = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":392 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":392 * for pattern1 in J_set: * for pattern2 in J_set: * if len(pattern1) + len(pattern2) + 1 < self.max_length: # <<<<<<<<<<<<<< @@ -33145,7 +33131,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_20 = ((((__pyx_t_2 + __pyx_t_15) + 1) < __pyx_v_self->max_length) != 0); if (__pyx_t_20) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":393 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":393 * for pattern2 in J_set: * if len(pattern1) + len(pattern2) + 1 < self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -33161,7 +33147,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_combined_pattern = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":394 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":394 * if len(pattern1) + len(pattern2) + 1 < self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 * J2_set.add(combined_pattern) # <<<<<<<<<<<<<< @@ -33177,7 +33163,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":396 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":396 * J2_set.add(combined_pattern) * * for pattern1 in I_set: # <<<<<<<<<<<<<< @@ -33203,7 +33189,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_pattern1 = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":397 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":397 * * for pattern1 in I_set: * for pattern2 in I_set: # <<<<<<<<<<<<<< @@ -33229,7 +33215,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_pattern2 = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":398 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":398 * for pattern1 in I_set: * for pattern2 in I_set: * x = x+1 # <<<<<<<<<<<<<< @@ -33242,7 +33228,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_x = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":399 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":399 * for pattern2 in I_set: * x = x+1 * if len(pattern1) + len(pattern2) + 1 <= self.max_length: # <<<<<<<<<<<<<< @@ -33254,7 +33240,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_20 = ((((__pyx_t_15 + __pyx_t_2) + 1) <= __pyx_v_self->max_length) != 0); if (__pyx_t_20) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":400 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":400 * x = x+1 * if len(pattern1) + len(pattern2) + 1 <= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -33270,7 +33256,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_combined_pattern = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":401 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":401 * if len(pattern1) + len(pattern2) + 1 <= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< @@ -33286,7 +33272,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":403 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":403 * IJ_set.add(combined_pattern) * * for pattern1 in I_set: # <<<<<<<<<<<<<< @@ -33312,7 +33298,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_pattern1 = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":404 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":404 * * for pattern1 in I_set: * for pattern2 in J2_set: # <<<<<<<<<<<<<< @@ -33338,7 +33324,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_pattern2 = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":405 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":405 * for pattern1 in I_set: * for pattern2 in J2_set: * x = x+2 # <<<<<<<<<<<<<< @@ -33351,7 +33337,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_x = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":406 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":406 * for pattern2 in J2_set: * x = x+2 * if len(pattern1) + len(pattern2) + 1<= self.max_length: # <<<<<<<<<<<<<< @@ -33363,7 +33349,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_20 = ((((__pyx_t_2 + __pyx_t_15) + 1) <= __pyx_v_self->max_length) != 0); if (__pyx_t_20) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":407 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":407 * x = x+2 * if len(pattern1) + len(pattern2) + 1<= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -33379,7 +33365,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_combined_pattern = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":408 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":408 * if len(pattern1) + len(pattern2) + 1<= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< @@ -33388,7 +33374,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __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;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":409 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":409 * combined_pattern = pattern1 + (-1,) + pattern2 * IJ_set.add(combined_pattern) * combined_pattern = pattern2 + (-1,) + pattern1 # <<<<<<<<<<<<<< @@ -33404,7 +33390,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_combined_pattern = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":410 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":410 * IJ_set.add(combined_pattern) * combined_pattern = pattern2 + (-1,) + pattern1 * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< @@ -33420,7 +33406,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":412 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":412 * IJ_set.add(combined_pattern) * * N = len(pattern_rank) # <<<<<<<<<<<<<< @@ -33430,7 +33416,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_15 = PyDict_Size(((PyObject *)__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":413 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":413 * * N = len(pattern_rank) * cost_by_rank = IntList(initial_len=N) # <<<<<<<<<<<<<< @@ -33443,13 +33429,13 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_cost_by_rank = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_cost_by_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":414 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":414 * N = len(pattern_rank) * cost_by_rank = IntList(initial_len=N) * count_by_rank = IntList(initial_len=N) # <<<<<<<<<<<<<< @@ -33462,13 +33448,13 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); 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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_count_by_rank = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); + __pyx_v_count_by_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":415 + /* "/home/mdenkows/cdec/python/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(): # <<<<<<<<<<<<<< @@ -33498,7 +33484,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_arr = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":416 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -33509,7 +33495,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_12 = (__pyx_t_20 != 0); if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":417 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":417 * for pattern, arr in self.precomputed_collocations.iteritems(): * if pattern not in IJ_set: * s = "" # <<<<<<<<<<<<<< @@ -33520,7 +33506,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_XDECREF(__pyx_v_s); __pyx_v_s = ((PyObject *)__pyx_kp_s_47); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":418 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":418 * if pattern not in IJ_set: * s = "" * for word_id in pattern: # <<<<<<<<<<<<<< @@ -33565,7 +33551,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_word_id = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":419 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":419 * s = "" * for word_id in pattern: * if word_id == -1: # <<<<<<<<<<<<<< @@ -33577,7 +33563,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":420 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":420 * for word_id in pattern: * if word_id == -1: * s = s + "X " # <<<<<<<<<<<<<< @@ -33593,7 +33579,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":422 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":422 * s = s + "X " * else: * s = s + darray.id2word[word_id] + " " # <<<<<<<<<<<<<< @@ -33616,7 +33602,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":423 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":423 * else: * s = s + darray.id2word[word_id] + " " * logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s) # <<<<<<<<<<<<<< @@ -33645,7 +33631,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":425 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":425 * logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s) * else: * chunk = () # <<<<<<<<<<<<<< @@ -33656,7 +33642,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_XDECREF(((PyObject *)__pyx_v_chunk)); __pyx_v_chunk = __pyx_empty_tuple; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":426 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":426 * else: * chunk = () * max_rank = 0 # <<<<<<<<<<<<<< @@ -33665,7 +33651,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s */ __pyx_v_max_rank = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":427 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":427 * chunk = () * max_rank = 0 * arity = 0 # <<<<<<<<<<<<<< @@ -33676,7 +33662,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_XDECREF(__pyx_v_arity); __pyx_v_arity = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":428 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":428 * max_rank = 0 * arity = 0 * for word_id in pattern: # <<<<<<<<<<<<<< @@ -33721,7 +33707,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_word_id = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":429 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":429 * arity = 0 * for word_id in pattern: * if word_id == -1: # <<<<<<<<<<<<<< @@ -33733,7 +33719,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":430 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":430 * for word_id in pattern: * if word_id == -1: * max_rank = max(max_rank, pattern_rank[chunk]) # <<<<<<<<<<<<<< @@ -33763,7 +33749,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_max_rank = __pyx_t_17; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":431 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":431 * if word_id == -1: * max_rank = max(max_rank, pattern_rank[chunk]) * arity = arity + 1 # <<<<<<<<<<<<<< @@ -33776,7 +33762,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_arity = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":432 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":432 * max_rank = max(max_rank, pattern_rank[chunk]) * arity = arity + 1 * chunk = () # <<<<<<<<<<<<<< @@ -33790,7 +33776,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":434 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":434 * chunk = () * else: * chunk = chunk + (word_id,) # <<<<<<<<<<<<<< @@ -33813,7 +33799,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":435 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":435 * else: * chunk = chunk + (word_id,) * max_rank = max(max_rank, pattern_rank[chunk]) # <<<<<<<<<<<<<< @@ -33843,7 +33829,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_max_rank = __pyx_t_17; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":436 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -33853,7 +33839,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":437 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -33883,7 +33869,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":439 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":439 * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) * * cumul_cost = 0 # <<<<<<<<<<<<<< @@ -33893,7 +33879,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_INCREF(__pyx_int_0); __pyx_v_cumul_cost = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":440 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":440 * * cumul_cost = 0 * cumul_count = 0 # <<<<<<<<<<<<<< @@ -33903,7 +33889,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_INCREF(__pyx_int_0); __pyx_v_cumul_count = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":441 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":441 * cumul_cost = 0 * cumul_count = 0 * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -33913,7 +33899,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_14 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_14; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":442 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":442 * cumul_count = 0 * for i from 0 <= i < N: * cumul_cost = cumul_cost + cost_by_rank.arr[i] # <<<<<<<<<<<<<< @@ -33929,7 +33915,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_cumul_cost = __pyx_t_7; __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":443 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< @@ -33945,7 +33931,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_cumul_count = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":444 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -33990,7 +33976,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":446 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -34006,7 +33992,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_num_found_patterns = __pyx_t_9; __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":447 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":447 * * num_found_patterns = len(self.precomputed_collocations) * for pattern in IJ_set: # <<<<<<<<<<<<<< @@ -34032,7 +34018,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_v_pattern = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":448 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":448 * num_found_patterns = len(self.precomputed_collocations) * for pattern in IJ_set: * if pattern not in self.precomputed_collocations: # <<<<<<<<<<<<<< @@ -34043,14 +34029,14 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __pyx_t_20 = (__pyx_t_12 != 0); if (__pyx_t_20) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":449 + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__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_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__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 (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; @@ -34060,7 +34046,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":451 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":451 * self.precomputed_collocations[pattern] = IntList() * * cdef float stop_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -34076,7 +34062,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_stop_time = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":452 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -34114,7 +34100,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":453 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -34145,7 +34131,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":454 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -34181,7 +34167,7 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_darray); @@ -34219,8 +34205,8 @@ static PyObject *__pyx_pf_3_sa_14Precomputation_6precompute(struct __pyx_obj_3_s } /* Python wrapper */ -static int __pyx_pw_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_from_binary = 0; PyObject *__pyx_v_from_text = 0; PyObject *__pyx_v_side = 0; @@ -34234,7 +34220,7 @@ static int __pyx_pw_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObje static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__side,0}; PyObject* values[3] = {0,0,0}; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":11 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":11 * cdef IntList ha * * def __cinit__(self, from_binary=None, from_text=None, side=None): # <<<<<<<<<<<<<< @@ -34292,16 +34278,16 @@ static int __pyx_pw_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObje __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_11SuffixArray___cinit__(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_side); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_side); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_11SuffixArray___cinit__(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side) { +static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -34313,52 +34299,52 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(struct __pyx_obj_3_sa_SuffixArr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":12 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":12 * * def __cinit__(self, from_binary=None, from_text=None, side=None): * self.darray = DataArray() # <<<<<<<<<<<<<< * self.sa = IntList() * self.ha = IntList() */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->darray); __Pyx_DECREF(((PyObject *)__pyx_v_self->darray)); - __pyx_v_self->darray = ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_1); + __pyx_v_self->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":13 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":13 * def __cinit__(self, from_binary=None, from_text=None, side=None): * self.darray = DataArray() * self.sa = IntList() # <<<<<<<<<<<<<< * self.ha = IntList() * if from_binary: */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sa); __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); - __pyx_v_self->sa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":14 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":14 * self.darray = DataArray() * self.sa = IntList() * self.ha = IntList() # <<<<<<<<<<<<<< * if from_binary: * self.read_binary(from_binary) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->ha); __Pyx_DECREF(((PyObject *)__pyx_v_self->ha)); - __pyx_v_self->ha = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_self->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":15 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":15 * self.sa = IntList() * self.ha = IntList() * if from_binary: # <<<<<<<<<<<<<< @@ -34368,7 +34354,7 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(struct __pyx_obj_3_sa_SuffixArr __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":16 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":16 * self.ha = IntList() * if from_binary: * self.read_binary(from_binary) # <<<<<<<<<<<<<< @@ -34390,7 +34376,7 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(struct __pyx_obj_3_sa_SuffixArr goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":17 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":17 * if from_binary: * self.read_binary(from_binary) * elif from_text: # <<<<<<<<<<<<<< @@ -34400,7 +34386,7 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(struct __pyx_obj_3_sa_SuffixArr __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":18 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":18 * self.read_binary(from_binary) * elif from_text: * self.read_text(from_text, side) # <<<<<<<<<<<<<< @@ -34432,7 +34418,7 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(struct __pyx_obj_3_sa_SuffixArr __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -34440,17 +34426,17 @@ static int __pyx_pf_3_sa_11SuffixArray___cinit__(struct __pyx_obj_3_sa_SuffixArr } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_11SuffixArray_2__getitem__(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":20 +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":20 * self.read_text(from_text, side) * * def __getitem__(self, i): # <<<<<<<<<<<<<< @@ -34458,7 +34444,7 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self * */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; @@ -34468,7 +34454,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_3_sa_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":21 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":21 * * def __getitem__(self, i): * return self.sa.arr[i] # <<<<<<<<<<<<<< @@ -34487,7 +34473,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_3_sa_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.SuffixArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -34496,9 +34482,9 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_3_sa_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3_sa_11SuffixArray_4read_text[] = "Constructs suffix array using the algorithm\n of Larsson & Sadahkane (1999)"; -static PyObject *__pyx_pw_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_11SuffixArray_4read_text[] = "Constructs suffix array using the algorithm\n of Larsson & Sadahkane (1999)"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_filename = 0; PyObject *__pyx_v_side = 0; int __pyx_lineno = 0; @@ -34546,16 +34532,16 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("read_text", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_11SuffixArray_4read_text(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_filename, __pyx_v_side); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_filename, __pyx_v_side); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":23 +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":23 * return self.sa.arr[i] * * def read_text(self, filename, side): # <<<<<<<<<<<<<< @@ -34563,7 +34549,7 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, * of Larsson & Sadahkane (1999)''' */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_side) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_side) { int __pyx_v_V; int __pyx_v_N; int __pyx_v_i; @@ -34573,8 +34559,8 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su int __pyx_v_n; int __pyx_v_current_run; int __pyx_v_skip; - struct __pyx_obj_3_sa_IntList *__pyx_v_isa = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_word_count = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_word_count = 0; float __pyx_v_sort_start_time; float __pyx_v_start_time; PyObject *__pyx_r = NULL; @@ -34596,7 +34582,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_text", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":29 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":29 * cdef IntList isa, word_count * * self.darray = DataArray(from_text=filename, side=side, use_sent_id=True) # <<<<<<<<<<<<<< @@ -34611,16 +34597,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__use_sent_id), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->darray); __Pyx_DECREF(((PyObject *)__pyx_v_self->darray)); - __pyx_v_self->darray = ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_2); + __pyx_v_self->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":30 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":30 * * self.darray = DataArray(from_text=filename, side=side, use_sent_id=True) * N = len(self.darray) # <<<<<<<<<<<<<< @@ -34633,7 +34619,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_N = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":31 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -34646,7 +34632,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_V = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":33 * V = len(self.darray.id2word) * * self.sa = IntList(initial_len=N) # <<<<<<<<<<<<<< @@ -34659,16 +34645,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sa); __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); - __pyx_v_self->sa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":34 * * self.sa = IntList(initial_len=N) * self.ha = IntList(initial_len=V+1) # <<<<<<<<<<<<<< @@ -34681,16 +34667,16 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->ha); __Pyx_DECREF(((PyObject *)__pyx_v_self->ha)); - __pyx_v_self->ha = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __pyx_v_self->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":36 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":36 * self.ha = IntList(initial_len=V+1) * * isa = IntList(initial_len=N) # <<<<<<<<<<<<<< @@ -34703,13 +34689,13 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_isa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_isa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":37 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":37 * * isa = IntList(initial_len=N) * word_count = IntList(initial_len=V+1) # <<<<<<<<<<<<<< @@ -34722,13 +34708,13 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_word_count = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __pyx_v_word_count = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":40 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":40 * * '''Step 1: bucket sort data''' * cdef float sort_start_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -34744,7 +34730,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_sort_start_time = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":41 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -34753,7 +34739,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_start_time = __pyx_v_sort_start_time; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":42 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -34763,7 +34749,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_5 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":43 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< @@ -34772,7 +34758,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_a_i = (__pyx_v_self->darray->data->arr[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":44 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -34782,7 +34768,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su (__pyx_v_word_count->arr[__pyx_v_a_i]) = ((__pyx_v_word_count->arr[__pyx_v_a_i]) + 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":46 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":46 * word_count.arr[a_i] = word_count.arr[a_i] + 1 * * n = 0 # <<<<<<<<<<<<<< @@ -34791,7 +34777,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_n = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":47 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":47 * * n = 0 * for i from 0 <= i < V+1: # <<<<<<<<<<<<<< @@ -34801,7 +34787,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_6 = (__pyx_v_V + 1); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":48 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":48 * n = 0 * for i from 0 <= i < V+1: * self.ha.arr[i] = n # <<<<<<<<<<<<<< @@ -34810,7 +34796,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ (__pyx_v_self->ha->arr[__pyx_v_i]) = __pyx_v_n; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":49 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":49 * for i from 0 <= i < V+1: * self.ha.arr[i] = n * n = n + word_count.arr[i] # <<<<<<<<<<<<<< @@ -34819,7 +34805,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_n = (__pyx_v_n + (__pyx_v_word_count->arr[__pyx_v_i])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":50 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":50 * self.ha.arr[i] = n * n = n + word_count.arr[i] * word_count.arr[i] = 0 # <<<<<<<<<<<<<< @@ -34829,7 +34815,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su (__pyx_v_word_count->arr[__pyx_v_i]) = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":52 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":52 * word_count.arr[i] = 0 * * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -34839,7 +34825,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_5 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":53 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":53 * * for i from 0 <= i < N: * a_i = self.darray.data.arr[i] # <<<<<<<<<<<<<< @@ -34848,7 +34834,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_a_i = (__pyx_v_self->darray->data->arr[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":54 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -34857,7 +34843,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ (__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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":55 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -34866,7 +34852,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ (__pyx_v_isa->arr[__pyx_v_i]) = ((__pyx_v_self->ha->arr[(__pyx_v_a_i + 1)]) - 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":56 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -34876,7 +34862,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su (__pyx_v_word_count->arr[__pyx_v_a_i]) = ((__pyx_v_word_count->arr[__pyx_v_a_i]) + 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":59 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":59 * * '''Determine size of initial runs''' * current_run = 0 # <<<<<<<<<<<<<< @@ -34885,7 +34871,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_current_run = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":60 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":60 * '''Determine size of initial runs''' * current_run = 0 * for i from 0 <= i < V+1: # <<<<<<<<<<<<<< @@ -34895,7 +34881,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_6 = (__pyx_v_V + 1); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":61 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -34911,7 +34897,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":62 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -34923,7 +34909,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":64 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":64 * current_run = current_run + 1 * else: * if current_run > 0: # <<<<<<<<<<<<<< @@ -34933,7 +34919,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_9 = ((__pyx_v_current_run > 0) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":65 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":65 * else: * if current_run > 0: * self.sa.arr[self.ha.arr[i] - current_run] = -current_run # <<<<<<<<<<<<<< @@ -34942,7 +34928,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ (__pyx_v_self->sa->arr[((__pyx_v_self->ha->arr[__pyx_v_i]) - __pyx_v_current_run)]) = (-__pyx_v_current_run); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":66 * if current_run > 0: * self.sa.arr[self.ha.arr[i] - current_run] = -current_run * current_run = 0 # <<<<<<<<<<<<<< @@ -34957,7 +34943,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_L11:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":68 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":68 * current_run = 0 * * logger.info(" Bucket sort took %f seconds", (monitor_cpu() - sort_start_time)) # <<<<<<<<<<<<<< @@ -34994,7 +34980,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":71 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":71 * * '''Step 2: prefix-doubling sort''' * h = 1 # <<<<<<<<<<<<<< @@ -35003,7 +34989,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_h = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":72 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":72 * '''Step 2: prefix-doubling sort''' * h = 1 * while self.sa.arr[0] != -N: # <<<<<<<<<<<<<< @@ -35014,7 +35000,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_9 = (((__pyx_v_self->sa->arr[0]) != (-__pyx_v_N)) != 0); if (!__pyx_t_9) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":73 * h = 1 * while self.sa.arr[0] != -N: * sort_start_time = monitor_cpu() # <<<<<<<<<<<<<< @@ -35030,7 +35016,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_sort_start_time = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":74 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":74 * while self.sa.arr[0] != -N: * sort_start_time = monitor_cpu() * logger.debug(" Refining, sort depth = %d", h) # <<<<<<<<<<<<<< @@ -35058,7 +35044,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":75 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":75 * sort_start_time = monitor_cpu() * logger.debug(" Refining, sort depth = %d", h) * i = 0 # <<<<<<<<<<<<<< @@ -35067,7 +35053,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_i = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":76 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":76 * logger.debug(" Refining, sort depth = %d", h) * i = 0 * skip = 0 # <<<<<<<<<<<<<< @@ -35076,7 +35062,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_skip = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":77 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":77 * i = 0 * skip = 0 * while i < N: # <<<<<<<<<<<<<< @@ -35087,7 +35073,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_9 = ((__pyx_v_i < __pyx_v_N) != 0); if (!__pyx_t_9) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":78 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":78 * skip = 0 * while i < N: * if self.sa.arr[i] < 0: # <<<<<<<<<<<<<< @@ -35097,7 +35083,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_9 = (((__pyx_v_self->sa->arr[__pyx_v_i]) < 0) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":79 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":79 * while i < N: * if self.sa.arr[i] < 0: * skip = skip + self.sa.arr[i] # <<<<<<<<<<<<<< @@ -35106,7 +35092,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_skip = (__pyx_v_skip + (__pyx_v_self->sa->arr[__pyx_v_i])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":80 * if self.sa.arr[i] < 0: * skip = skip + self.sa.arr[i] * i = i - self.sa.arr[i] # <<<<<<<<<<<<<< @@ -35118,7 +35104,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":82 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":82 * i = i - self.sa.arr[i] * else: * if skip < 0: # <<<<<<<<<<<<<< @@ -35128,7 +35114,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_9 = ((__pyx_v_skip < 0) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":83 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":83 * else: * if skip < 0: * self.sa.arr[i+skip] = skip # <<<<<<<<<<<<<< @@ -35137,7 +35123,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ (__pyx_v_self->sa->arr[(__pyx_v_i + __pyx_v_skip)]) = __pyx_v_skip; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":84 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":84 * if skip < 0: * self.sa.arr[i+skip] = skip * skip = 0 # <<<<<<<<<<<<<< @@ -35149,7 +35135,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su } __pyx_L18:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":85 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":85 * self.sa.arr[i+skip] = skip * skip = 0 * j = isa.arr[self.sa.arr[i]] # <<<<<<<<<<<<<< @@ -35158,7 +35144,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_j = (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_i])]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":86 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":86 * skip = 0 * j = isa.arr[self.sa.arr[i]] * self.q3sort(i, j, h, isa) # <<<<<<<<<<<<<< @@ -35193,7 +35179,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":87 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":87 * j = isa.arr[self.sa.arr[i]] * self.q3sort(i, j, h, isa) * i = j+1 # <<<<<<<<<<<<<< @@ -35205,7 +35191,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_L17:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":88 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":88 * self.q3sort(i, j, h, isa) * i = j+1 * if skip < 0: # <<<<<<<<<<<<<< @@ -35215,7 +35201,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_9 = ((__pyx_v_skip < 0) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":89 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":89 * i = j+1 * if skip < 0: * self.sa.arr[i+skip] = skip # <<<<<<<<<<<<<< @@ -35227,7 +35213,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su } __pyx_L19:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":90 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":90 * if skip < 0: * self.sa.arr[i+skip] = skip * h = h * 2 # <<<<<<<<<<<<<< @@ -35236,7 +35222,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_h = (__pyx_v_h * 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":91 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -35274,7 +35260,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":94 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":94 * * '''Step 3: read off suffix array from inverse suffix array''' * logger.info(" Finalizing sort...") # <<<<<<<<<<<<<< @@ -35291,7 +35277,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":95 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -35301,7 +35287,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __pyx_t_5 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":96 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":96 * logger.info(" Finalizing sort...") * for i from 0 <= i < N: * j = isa.arr[i] # <<<<<<<<<<<<<< @@ -35310,7 +35296,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su */ __pyx_v_j = (__pyx_v_isa->arr[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":97 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":97 * for i from 0 <= i < N: * j = isa.arr[i] * self.sa.arr[j] = i # <<<<<<<<<<<<<< @@ -35320,7 +35306,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su (__pyx_v_self->sa->arr[__pyx_v_j]) = __pyx_v_i; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":98 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< @@ -35365,7 +35351,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_isa); @@ -35376,13 +35362,13 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_4read_text(struct __pyx_obj_3_sa_Su } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3_sa_11SuffixArray_6q3sort[] = "This is a ternary quicksort. It divides the array into\n three partitions: items less than the pivot, items equal\n to pivot, and items greater than pivot. The first and last\n of these partitions are then recursively sorted"; -static PyObject *__pyx_pw_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_11SuffixArray_6q3sort[] = "This is a ternary quicksort. It divides the array into\n three partitions: items less than the pivot, items equal\n to pivot, and items greater than pivot. The first and last\n of these partitions are then recursively sorted"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_h; - struct __pyx_obj_3_sa_IntList *__pyx_v_isa = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa = 0; PyObject *__pyx_v_pad = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -35449,19 +35435,19 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyO __pyx_v_i = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_j = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_j == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_h = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_isa = ((struct __pyx_obj_3_sa_IntList *)values[3]); + __pyx_v_isa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)values[3]); __pyx_v_pad = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isa), __pyx_ptype_3_sa_IntList, 1, "isa", 0))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3_sa_11SuffixArray_6q3sort(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_i, __pyx_v_j, __pyx_v_h, __pyx_v_isa, __pyx_v_pad); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isa), __pyx_ptype_4cdec_2sa_3_sa_IntList, 1, "isa", 0))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_i, __pyx_v_j, __pyx_v_h, __pyx_v_isa, __pyx_v_pad); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -35470,7 +35456,7 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":100 +/* "/home/mdenkows/cdec/python/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=""): # <<<<<<<<<<<<<< @@ -35478,7 +35464,7 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyO * three partitions: items less than the pivot, items equal */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_v_h, struct __pyx_obj_3_sa_IntList *__pyx_v_isa, PyObject *__pyx_v_pad) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_v_h, struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa, PyObject *__pyx_v_pad) { int __pyx_v_k; int __pyx_v_midpoint; int __pyx_v_pval; @@ -35500,7 +35486,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi int __pyx_clineno = 0; __Pyx_RefNannySetupContext("q3sort", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":107 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":107 * cdef int k, midpoint, pval, phead, ptail, tmp * * if j-i < -1: # <<<<<<<<<<<<<< @@ -35510,7 +35496,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __pyx_t_1 = (((__pyx_v_j - __pyx_v_i) < -1) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":108 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":108 * * if j-i < -1: * raise Exception("Unexpected condition found in q3sort: sort from %d to %d" % (i,j)) # <<<<<<<<<<<<<< @@ -35547,7 +35533,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":109 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -35557,7 +35543,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __pyx_t_1 = (((__pyx_v_j - __pyx_v_i) == -1) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":110 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -35571,7 +35557,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":111 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -35581,7 +35567,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __pyx_t_1 = (((__pyx_v_j - __pyx_v_i) == 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":112 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":112 * return * if (j-i == 0): # recursive base case -- singleton interval * isa.arr[self.sa.arr[i]] = i # <<<<<<<<<<<<<< @@ -35590,7 +35576,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_i])]) = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":113 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -35599,7 +35585,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ (__pyx_v_self->sa->arr[__pyx_v_i]) = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":114 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":114 * isa.arr[self.sa.arr[i]] = i * self.sa.arr[i] = -1 * return # <<<<<<<<<<<<<< @@ -35613,7 +35599,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":123 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -35622,7 +35608,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ __pyx_v_midpoint = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":124 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< @@ -35631,7 +35617,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ __pyx_v_pval = (__pyx_v_isa->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_h)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":125 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":125 * midpoint = (i+j)/2 * pval = isa.arr[self.sa.arr[midpoint] + h] * if i != midpoint: # <<<<<<<<<<<<<< @@ -35641,7 +35627,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __pyx_t_1 = ((__pyx_v_i != __pyx_v_midpoint) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":126 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":126 * pval = isa.arr[self.sa.arr[midpoint] + h] * if i != midpoint: * tmp = self.sa.arr[midpoint] # <<<<<<<<<<<<<< @@ -35650,7 +35636,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_midpoint]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":127 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":127 * if i != midpoint: * tmp = self.sa.arr[midpoint] * self.sa.arr[midpoint] = self.sa.arr[i] # <<<<<<<<<<<<<< @@ -35659,7 +35645,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ (__pyx_v_self->sa->arr[__pyx_v_midpoint]) = (__pyx_v_self->sa->arr[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":128 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":128 * tmp = self.sa.arr[midpoint] * self.sa.arr[midpoint] = self.sa.arr[i] * self.sa.arr[i] = tmp # <<<<<<<<<<<<<< @@ -35671,7 +35657,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":129 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":129 * self.sa.arr[midpoint] = self.sa.arr[i] * self.sa.arr[i] = tmp * phead = i # <<<<<<<<<<<<<< @@ -35680,7 +35666,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ __pyx_v_phead = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":130 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":130 * self.sa.arr[i] = tmp * phead = i * ptail = i # <<<<<<<<<<<<<< @@ -35689,7 +35675,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ __pyx_v_ptail = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":134 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -35699,7 +35685,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __pyx_t_5 = (__pyx_v_j + 1); for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":135 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -35709,7 +35695,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":136 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -35719,7 +35705,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __pyx_t_1 = ((__pyx_v_k > (__pyx_v_ptail + 1)) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":137 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":137 * if isa.arr[self.sa.arr[k] + h] < pval: * if k > ptail+1: * tmp = self.sa.arr[phead] # <<<<<<<<<<<<<< @@ -35728,7 +35714,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_phead]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":138 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":138 * if k > ptail+1: * tmp = self.sa.arr[phead] * self.sa.arr[phead] = self.sa.arr[k] # <<<<<<<<<<<<<< @@ -35737,7 +35723,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ (__pyx_v_self->sa->arr[__pyx_v_phead]) = (__pyx_v_self->sa->arr[__pyx_v_k]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":139 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< @@ -35746,7 +35732,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ (__pyx_v_self->sa->arr[__pyx_v_k]) = (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":140 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -35758,7 +35744,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":142 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":142 * self.sa.arr[ptail+1] = tmp * else: # k == ptail+1 * tmp = self.sa.arr[phead] # <<<<<<<<<<<<<< @@ -35767,7 +35753,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_phead]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":143 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":143 * else: # k == ptail+1 * tmp = self.sa.arr[phead] * self.sa.arr[phead] = self.sa.arr[k] # <<<<<<<<<<<<<< @@ -35776,7 +35762,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ (__pyx_v_self->sa->arr[__pyx_v_phead]) = (__pyx_v_self->sa->arr[__pyx_v_k]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":144 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":144 * tmp = self.sa.arr[phead] * self.sa.arr[phead] = self.sa.arr[k] * self.sa.arr[k] = tmp # <<<<<<<<<<<<<< @@ -35787,7 +35773,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi } __pyx_L10:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":145 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":145 * self.sa.arr[phead] = self.sa.arr[k] * self.sa.arr[k] = tmp * phead = phead + 1 # <<<<<<<<<<<<<< @@ -35796,7 +35782,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ __pyx_v_phead = (__pyx_v_phead + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":146 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":146 * self.sa.arr[k] = tmp * phead = phead + 1 * ptail = ptail + 1 # <<<<<<<<<<<<<< @@ -35808,7 +35794,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":148 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":148 * ptail = ptail + 1 * else: * if isa.arr[self.sa.arr[k] + h] == pval: # <<<<<<<<<<<<<< @@ -35818,7 +35804,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":149 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":149 * else: * if isa.arr[self.sa.arr[k] + h] == pval: * if k > ptail+1: # <<<<<<<<<<<<<< @@ -35828,7 +35814,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __pyx_t_1 = ((__pyx_v_k > (__pyx_v_ptail + 1)) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":150 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< @@ -35837,7 +35823,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ __pyx_v_tmp = (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":151 + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< @@ -35846,7 +35832,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi */ (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]) = (__pyx_v_self->sa->arr[__pyx_v_k]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":152 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -35858,7 +35844,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi } __pyx_L12:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":153 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":153 * self.sa.arr[ptail+1] = self.sa.arr[k] * self.sa.arr[k] = tmp * ptail = ptail + 1 # <<<<<<<<<<<<<< @@ -35873,7 +35859,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __pyx_L9:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":156 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":156 * * # recursively sort smaller suffixes * self.q3sort(i, phead-1, h, isa, pad+" ") # <<<<<<<<<<<<<< @@ -35913,7 +35899,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":160 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -35923,7 +35909,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __pyx_t_5 = (__pyx_v_ptail + 1); for (__pyx_v_k = __pyx_v_phead; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":161 + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< @@ -35933,7 +35919,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_k])]) = __pyx_v_ptail; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":162 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":162 * for k from phead <= k < ptail+1: * isa.arr[self.sa.arr[k]] = ptail * if phead == ptail: # <<<<<<<<<<<<<< @@ -35943,7 +35929,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __pyx_t_1 = ((__pyx_v_phead == __pyx_v_ptail) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":163 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":163 * isa.arr[self.sa.arr[k]] = ptail * if phead == ptail: * self.sa.arr[phead] = -1 # <<<<<<<<<<<<<< @@ -35955,7 +35941,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi } __pyx_L15:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":166 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":166 * * # recursively sort larger suffixes * self.q3sort(ptail+1, j, h, isa, pad+" ") # <<<<<<<<<<<<<< @@ -36004,7 +35990,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -36013,8 +35999,8 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_3_sa_Suffi } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_11SuffixArray_9write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_11SuffixArray_9write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_9write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_9write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -36027,16 +36013,16 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_9write_text(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_11SuffixArray_8write_text(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":169 +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":169 * * * def write_text(self, char* filename): # <<<<<<<<<<<<<< @@ -36044,7 +36030,7 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_9write_text(PyObject *__pyx_v_self, * */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_8write_text(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -36055,7 +36041,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_8write_text(struct __pyx_obj_3_sa_S int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_text", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":170 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":170 * * def write_text(self, char* filename): * self.darray.write_text(filename) # <<<<<<<<<<<<<< @@ -36083,7 +36069,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_8write_text(struct __pyx_obj_3_sa_S __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -36092,8 +36078,8 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_8write_text(struct __pyx_obj_3_sa_S } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_11SuffixArray_11read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_11SuffixArray_11read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_11read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_11read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -36106,16 +36092,16 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_11read_binary(PyObject *__pyx_v_sel } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.SuffixArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_11SuffixArray_10read_binary(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":172 +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":172 * self.darray.write_text(filename) * * def read_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -36123,13 +36109,13 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_11read_binary(PyObject *__pyx_v_sel * f = fopen(filename, "r") */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_10read_binary(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_binary", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":174 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":174 * def read_binary(self, char* filename): * cdef FILE *f * f = fopen(filename, "r") # <<<<<<<<<<<<<< @@ -36138,34 +36124,34 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_10read_binary(struct __pyx_obj_3_sa */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":175 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":175 * cdef FILE *f * f = fopen(filename, "r") * self.darray.read_handle(f) # <<<<<<<<<<<<<< * self.sa.read_handle(f) * self.ha.read_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->read_handle(__pyx_v_self->darray, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->read_handle(__pyx_v_self->darray, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":176 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":176 * f = fopen(filename, "r") * self.darray.read_handle(f) * self.sa.read_handle(f) # <<<<<<<<<<<<<< * self.ha.read_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->read_handle(__pyx_v_self->sa, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->read_handle(__pyx_v_self->sa, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":177 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":177 * self.darray.read_handle(f) * self.sa.read_handle(f) * self.ha.read_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->read_handle(__pyx_v_self->ha, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->read_handle(__pyx_v_self->ha, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":178 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":178 * self.sa.read_handle(f) * self.ha.read_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -36181,8 +36167,8 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_10read_binary(struct __pyx_obj_3_sa } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_11SuffixArray_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_11SuffixArray_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -36195,16 +36181,16 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_13write_binary(PyObject *__pyx_v_se } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.SuffixArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_11SuffixArray_12write_binary(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":180 +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":180 * fclose(f) * * def write_binary(self, char* filename): # <<<<<<<<<<<<<< @@ -36212,13 +36198,13 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_13write_binary(PyObject *__pyx_v_se * f = fopen(filename, "w") */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_12write_binary(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { +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) { FILE *__pyx_v_f; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_binary", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":182 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":182 * def write_binary(self, char* filename): * cdef FILE* f * f = fopen(filename, "w") # <<<<<<<<<<<<<< @@ -36227,34 +36213,34 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_12write_binary(struct __pyx_obj_3_s */ __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":183 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":183 * cdef FILE* f * f = fopen(filename, "w") * self.darray.write_handle(f) # <<<<<<<<<<<<<< * self.sa.write_handle(f) * self.ha.write_handle(f) */ - ((struct __pyx_vtabstruct_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->write_handle(__pyx_v_self->darray, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->write_handle(__pyx_v_self->darray, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":184 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":184 * f = fopen(filename, "w") * self.darray.write_handle(f) * self.sa.write_handle(f) # <<<<<<<<<<<<<< * self.ha.write_handle(f) * fclose(f) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->write_handle(__pyx_v_self->sa, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->write_handle(__pyx_v_self->sa, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":185 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":185 * self.darray.write_handle(f) * self.sa.write_handle(f) * self.ha.write_handle(f) # <<<<<<<<<<<<<< * fclose(f) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->write_handle(__pyx_v_self->ha, __pyx_v_f); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->write_handle(__pyx_v_self->ha, __pyx_v_f); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":186 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":186 * self.sa.write_handle(f) * self.ha.write_handle(f) * fclose(f) # <<<<<<<<<<<<<< @@ -36270,8 +36256,8 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_12write_binary(struct __pyx_obj_3_s } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_11SuffixArray_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_3_sa_11SuffixArray_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { char *__pyx_v_filename; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -36284,16 +36270,16 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_15write_enhanced(PyObject *__pyx_v_ } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_11SuffixArray_14write_enhanced(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":188 +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":188 * fclose(f) * * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< @@ -36301,7 +36287,7 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_15write_enhanced(PyObject *__pyx_v_ * self.darray.write_enhanced_handle(f) */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { +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) { PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_a_i = NULL; PyObject *__pyx_v_w_i = NULL; @@ -36325,7 +36311,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_enhanced", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":189 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -36365,7 +36351,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 __pyx_v_f = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":190 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":190 * def write_enhanced(self, char* filename): * with open(filename, "w") as f: * self.darray.write_enhanced_handle(f) # <<<<<<<<<<<<<< @@ -36385,7 +36371,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":191 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":191 * with open(filename, "w") as f: * self.darray.write_enhanced_handle(f) * for a_i in self.sa: # <<<<<<<<<<<<<< @@ -36430,7 +36416,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 __pyx_v_a_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":192 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":192 * self.darray.write_enhanced_handle(f) * for a_i in self.sa: * f.write("%d " % a_i) # <<<<<<<<<<<<<< @@ -36454,7 +36440,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":193 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":193 * for a_i in self.sa: * f.write("%d " % a_i) * f.write("\n") # <<<<<<<<<<<<<< @@ -36468,7 +36454,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":194 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":194 * f.write("%d " % a_i) * f.write("\n") * for w_i in self.ha: # <<<<<<<<<<<<<< @@ -36513,7 +36499,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 __pyx_v_w_i = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":195 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":195 * f.write("\n") * for w_i in self.ha: * f.write("%d " % w_i) # <<<<<<<<<<<<<< @@ -36537,7 +36523,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":196 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":196 * for w_i in self.ha: * f.write("%d " % w_i) * f.write("\n") # <<<<<<<<<<<<<< @@ -36561,7 +36547,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":189 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -36569,7 +36555,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 * for a_i in self.sa: */ /*except:*/ { - __Pyx_AddTraceback("_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); __Pyx_GOTREF(__pyx_t_4); @@ -36648,7 +36634,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); @@ -36659,7 +36645,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":198 +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":198 * f.write("\n") * * cdef int __search_high(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<< @@ -36667,14 +36653,14 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_14write_enhanced(struct __pyx_obj_3 * */ -static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_word_id, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high) { +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) { int __pyx_v_midpoint; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__search_high", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":201 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":201 * cdef int midpoint * * if low >= high: # <<<<<<<<<<<<<< @@ -36684,7 +36670,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix __pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":202 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":202 * * if low >= high: * return high # <<<<<<<<<<<<<< @@ -36697,7 +36683,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":203 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":203 * if low >= high: * return high * midpoint = (high + low) / 2 # <<<<<<<<<<<<<< @@ -36706,7 +36692,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix */ __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":204 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":204 * return high * midpoint = (high + low) / 2 * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: # <<<<<<<<<<<<<< @@ -36716,27 +36702,27 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":205 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * else: * return self.__search_high(word_id, offset, low, midpoint) */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_high(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); + __pyx_r = ((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 + 1), __pyx_v_high); goto __pyx_L0; goto __pyx_L4; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":207 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * * cdef int __search_low(self, int word_id, int offset, int low, int high): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_high(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); + __pyx_r = ((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_low, __pyx_v_midpoint); goto __pyx_L0; } __pyx_L4:; @@ -36747,7 +36733,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":209 +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -36755,14 +36741,14 @@ static int __pyx_f_3_sa_11SuffixArray___search_high(struct __pyx_obj_3_sa_Suffix * */ -static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_word_id, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high) { +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) { int __pyx_v_midpoint; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__search_low", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":212 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":212 * cdef int midpoint * * if low >= high: # <<<<<<<<<<<<<< @@ -36772,7 +36758,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA __pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":213 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":213 * * if low >= high: * return high # <<<<<<<<<<<<<< @@ -36785,7 +36771,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":214 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":214 * if low >= high: * return high * midpoint = (high + low) / 2 # <<<<<<<<<<<<<< @@ -36794,7 +36780,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA */ __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":215 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":215 * return high * midpoint = (high + low) / 2 * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: # <<<<<<<<<<<<<< @@ -36804,27 +36790,27 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":216 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * else: * return self.__search_low(word_id, offset, midpoint+1, high) */ - __pyx_r = ((struct __pyx_vtabstruct_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); + __pyx_r = ((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); goto __pyx_L0; goto __pyx_L4; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":218 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< * * cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint): */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___search_low(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); + __pyx_r = ((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_midpoint + 1), __pyx_v_high); goto __pyx_L0; } __pyx_L4:; @@ -36835,7 +36821,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":220 +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -36843,7 +36829,7 @@ static int __pyx_f_3_sa_11SuffixArray___search_low(struct __pyx_obj_3_sa_SuffixA * self.__search_high(word_id, offset, midpoint, high)) */ -static PyObject *__pyx_f_3_sa_11SuffixArray___get_range(struct __pyx_obj_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) { +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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -36854,7 +36840,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___get_range(struct __pyx_obj_3_sa_Su int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get_range", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":221 + /* "/home/mdenkows/cdec/python/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), # <<<<<<<<<<<<<< @@ -36862,17 +36848,17 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___get_range(struct __pyx_obj_3_sa_Su * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_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_t_1 = PyInt_FromLong(((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":222 + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< * * cdef __lookup_helper(self, int word_id, int offset, int low, int high): */ - __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_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_t_2 = PyInt_FromLong(((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); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -36892,7 +36878,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___get_range(struct __pyx_obj_3_sa_Su __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.SuffixArray.__get_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__get_range", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -36900,7 +36886,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___get_range(struct __pyx_obj_3_sa_Su return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":224 +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -36908,7 +36894,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___get_range(struct __pyx_obj_3_sa_Su * */ -static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_word_id, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high) { +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) { int __pyx_v_midpoint; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -36921,7 +36907,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__lookup_helper", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":227 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":227 * cdef int midpoint * * if offset == 0: # <<<<<<<<<<<<<< @@ -36931,7 +36917,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s __pyx_t_1 = ((__pyx_v_offset == 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":228 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":228 * * if offset == 0: * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) # <<<<<<<<<<<<<< @@ -36958,7 +36944,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":229 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":229 * if offset == 0: * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) * if low >= high: # <<<<<<<<<<<<<< @@ -36968,7 +36954,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s __pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":230 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":230 * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) * if low >= high: * return None # <<<<<<<<<<<<<< @@ -36983,7 +36969,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":232 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":232 * return None * * midpoint = (high + low) / 2 # <<<<<<<<<<<<<< @@ -36992,7 +36978,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s */ __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":233 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":233 * * midpoint = (high + low) / 2 * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: # <<<<<<<<<<<<<< @@ -37002,7 +36988,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":234 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -37010,7 +36996,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s * return self.__lookup_helper(word_id, offset, low, midpoint) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___get_range(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_high, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___get_range(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_high, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -37019,7 +37005,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":235 + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< @@ -37029,7 +37015,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":236 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -37037,7 +37023,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s * return self.__lookup_helper(word_id, offset, midpoint+1, high) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -37046,7 +37032,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":238 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -37054,7 +37040,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s * def lookup(self, word, int offset, int low, int high): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -37068,7 +37054,7 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.SuffixArray.__lookup_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__lookup_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -37077,8 +37063,8 @@ static PyObject *__pyx_f_3_sa_11SuffixArray___lookup_helper(struct __pyx_obj_3_s } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_11SuffixArray_17lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_11SuffixArray_17lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_17lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_17lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_word = 0; int __pyx_v_offset; int __pyx_v_low; @@ -37144,16 +37130,16 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_17lookup(PyObject *__pyx_v_self, Py __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_11SuffixArray_16lookup(((struct __pyx_obj_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_word, __pyx_v_offset, __pyx_v_low, __pyx_v_high); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_word, __pyx_v_offset, __pyx_v_low, __pyx_v_high); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":240 +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< @@ -37161,7 +37147,7 @@ static PyObject *__pyx_pw_3_sa_11SuffixArray_17lookup(PyObject *__pyx_v_self, Py * if low == -1: */ -static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_word, int __pyx_v_offset, int __pyx_v_low, int __pyx_v_high) { +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) { PyObject *__pyx_v_word_id = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -37175,7 +37161,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lookup", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":242 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":242 * def lookup(self, word, int offset, int low, int high): * cdef int wordid * if low == -1: # <<<<<<<<<<<<<< @@ -37185,7 +37171,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff __pyx_t_1 = ((__pyx_v_low == -1) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":243 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":243 * cdef int wordid * if low == -1: * low = 0 # <<<<<<<<<<<<<< @@ -37197,7 +37183,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":244 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":244 * if low == -1: * low = 0 * if high == -1: # <<<<<<<<<<<<<< @@ -37207,7 +37193,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff __pyx_t_1 = ((__pyx_v_high == -1) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":245 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":245 * low = 0 * if high == -1: * high = len(self.sa) # <<<<<<<<<<<<<< @@ -37223,7 +37209,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":246 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":246 * if high == -1: * high = len(self.sa) * if word in self.darray.word2id: # <<<<<<<<<<<<<< @@ -37234,7 +37220,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff __pyx_t_4 = (__pyx_t_1 != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":247 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":247 * high = len(self.sa) * if word in self.darray.word2id: * word_id = self.darray.word2id[word] # <<<<<<<<<<<<<< @@ -37246,7 +37232,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff __pyx_v_word_id = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":248 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -37255,7 +37241,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff */ __Pyx_XDECREF(__pyx_r); __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_word_id); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_t_5, __pyx_v_offset, __pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_t_5, __pyx_v_offset, __pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -37264,7 +37250,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":250 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":250 * return self.__lookup_helper(word_id, offset, low, high) * else: * return None # <<<<<<<<<<<<<< @@ -37280,7 +37266,7 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_word_id); @@ -37290,56 +37276,423 @@ static PyObject *__pyx_pf_3_sa_11SuffixArray_16lookup(struct __pyx_obj_3_sa_Suff } /* Python wrapper */ -static int __pyx_pw_3_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __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_3_sa_8TrieNode___cinit__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":49 - * cdef public children +/* 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) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":56 + * self.phrases_f = defaultdict(int) + * self.phrases_e = defaultdict(int) + * self.phrases_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< + * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.children = {} + */ + +static PyObject *__pyx_lambda_funcdef_lambda1(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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda1", 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 = 56; __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 = 56; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_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) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":57 + * self.phrases_e = defaultdict(int) + * self.phrases_fe = defaultdict(lambda: defaultdict(int)) + * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) # <<<<<<<<<<<<<< + * + * # Bilexical counts + */ + +static PyObject *__pyx_lambda_funcdef_lambda2(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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda2", 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 = 57; __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 = 57; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3 = {__Pyx_NAMESTR("lambda3"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3(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_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":62 + * self.bilex_f = defaultdict(int) + * self.bilex_e = defaultdict(int) + * self.bilex_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< + * + * cdef int PRECOMPUTE = 0 + */ + +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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 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 = 62; __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 = 62; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __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; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":49 + * cdef public bilex_fe * + * def __cinit__(self): # <<<<<<<<<<<<<< + * # Keep track of everything that can be sampled: + * self.samples_f = defaultdict(int) */ -static int __pyx_pf_3_sa_8TrieNode___cinit__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { int __pyx_r; __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("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":50 - * + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":51 * def __cinit__(self): - * self.children = {} # <<<<<<<<<<<<<< + * # Keep track of everything that can be sampled: + * self.samples_f = defaultdict(int) # <<<<<<<<<<<<<< * - * cdef class ExtendedTrieNode(TrieNode): + * # Phrase counts */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(__pyx_v_self->children); - __Pyx_DECREF(__pyx_v_self->children); - __pyx_v_self->children = ((PyObject *)__pyx_t_1); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __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 = 51; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __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_GIVEREF(__pyx_t_3); + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":54 + * + * # 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 = 54; __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 = 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_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), 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_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->phrases_f); + __Pyx_DECREF(__pyx_v_self->phrases_f); + __pyx_v_self->phrases_f = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":55 + * # 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 = 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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":56 + * 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 = 56; __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_101, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __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 = 56; __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(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":57 + * self.phrases_e = defaultdict(int) + * self.phrases_fe = defaultdict(lambda: defaultdict(int)) + * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) # <<<<<<<<<<<<<< + * + * # Bilexical counts + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __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_101, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __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 = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":60 + * + * # Bilexical counts + * self.bilex_f = defaultdict(int) # <<<<<<<<<<<<<< + * self.bilex_e = defaultdict(int) + * self.bilex_fe = defaultdict(lambda: defaultdict(int)) + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 60; __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 60; __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_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->bilex_f); + __Pyx_DECREF(__pyx_v_self->bilex_f); + __pyx_v_self->bilex_f = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":61 + * # Bilexical counts + * self.bilex_f = defaultdict(int) + * self.bilex_e = defaultdict(int) # <<<<<<<<<<<<<< + * self.bilex_fe = defaultdict(lambda: defaultdict(int)) + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 61; __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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->bilex_e); + __Pyx_DECREF(__pyx_v_self->bilex_e); + __pyx_v_self->bilex_e = __pyx_t_1; __pyx_t_1 = 0; + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":62 + * self.bilex_f = defaultdict(int) + * self.bilex_e = defaultdict(int) + * self.bilex_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< + * + * cdef int PRECOMPUTE = 0 + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3, 0, __pyx_n_s_101, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __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 = 62; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __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_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->bilex_fe); + __Pyx_DECREF(__pyx_v_self->bilex_fe); + __pyx_v_self->bilex_fe = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.TrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -37347,31 +37700,31 @@ static int __pyx_pf_3_sa_8TrieNode___cinit__(struct __pyx_obj_3_sa_TrieNode *__p } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_8TrieNode_8children___get__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":47 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":40 * - * cdef class TrieNode: - * cdef public children # <<<<<<<<<<<<<< - * - * def __cinit__(self): + * cdef class OnlineStats: + * cdef public samples_f # <<<<<<<<<<<<<< + * cdef public phrases_f + * cdef public phrases_e */ -static PyObject *__pyx_pf_3_sa_8TrieNode_8children___get__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->children); - __pyx_r = __pyx_v_self->children; + __Pyx_INCREF(__pyx_v_self->samples_f); + __pyx_r = __pyx_v_self->samples_f; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -37382,25 +37735,25 @@ static PyObject *__pyx_pf_3_sa_8TrieNode_8children___get__(struct __pyx_obj_3_sa } /* Python wrapper */ -static int __pyx_pw_3_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_8TrieNode_8children_2__set__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->children); - __Pyx_DECREF(__pyx_v_self->children); - __pyx_v_self->children = __pyx_v_value; + __Pyx_GOTREF(__pyx_v_self->samples_f); + __Pyx_DECREF(__pyx_v_self->samples_f); + __pyx_v_self->samples_f = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -37408,25 +37761,25 @@ static int __pyx_pf_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_3_sa_Trie } /* Python wrapper */ -static int __pyx_pw_3_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_3_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_8TrieNode_8children_4__del__(((struct __pyx_obj_3_sa_TrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_3_sa_TrieNode *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->children); - __Pyx_DECREF(__pyx_v_self->children); - __pyx_v_self->children = Py_None; + __Pyx_GOTREF(__pyx_v_self->samples_f); + __Pyx_DECREF(__pyx_v_self->samples_f); + __pyx_v_self->samples_f = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -37434,131 +37787,86 @@ static int __pyx_pf_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_3_sa_Trie } /* Python wrapper */ -static int __pyx_pw_3_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_phrase = 0; - PyObject *__pyx_v_phrase_location = 0; - PyObject *__pyx_v_suffix_link = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__phrase,&__pyx_n_s__phrase_location,&__pyx_n_s__suffix_link,0}; - PyObject* values[3] = {0,0,0}; + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":57 - * cdef public suffix_link - * - * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): # <<<<<<<<<<<<<< - * self.phrase = phrase - * self.phrase_location = phrase_location +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":41 + * cdef class OnlineStats: + * cdef public samples_f + * cdef public phrases_f # <<<<<<<<<<<<<< + * cdef public phrases_e + * cdef public phrases_fe */ - values[0] = ((PyObject *)Py_None); - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__phrase); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__phrase_location); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__suffix_link); - if (value) { values[2] = 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[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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_phrase = values[0]; - __pyx_v_phrase_location = values[1]; - __pyx_v_suffix_link = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.ExtendedTrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->phrases_f); + __pyx_r = __pyx_v_self->phrases_f; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self), __pyx_v_phrase, __pyx_v_phrase_location, __pyx_v_suffix_link); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_phrase, PyObject *__pyx_v_phrase_location, PyObject *__pyx_v_suffix_link) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->phrases_f); + __Pyx_DECREF(__pyx_v_self->phrases_f); + __pyx_v_self->phrases_f = __pyx_v_value; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":58 - * - * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): - * self.phrase = phrase # <<<<<<<<<<<<<< - * self.phrase_location = phrase_location - * self.suffix_link = suffix_link - */ - __Pyx_INCREF(__pyx_v_phrase); - __Pyx_GIVEREF(__pyx_v_phrase); - __Pyx_GOTREF(__pyx_v_self->phrase); - __Pyx_DECREF(__pyx_v_self->phrase); - __pyx_v_self->phrase = __pyx_v_phrase; + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":59 - * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): - * self.phrase = phrase - * self.phrase_location = phrase_location # <<<<<<<<<<<<<< - * self.suffix_link = suffix_link - * - */ - __Pyx_INCREF(__pyx_v_phrase_location); - __Pyx_GIVEREF(__pyx_v_phrase_location); - __Pyx_GOTREF(__pyx_v_self->phrase_location); - __Pyx_DECREF(__pyx_v_self->phrase_location); - __pyx_v_self->phrase_location = __pyx_v_phrase_location; +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":60 - * self.phrase = phrase - * self.phrase_location = phrase_location - * self.suffix_link = suffix_link # <<<<<<<<<<<<<< - * - * - */ - __Pyx_INCREF(__pyx_v_suffix_link); - __Pyx_GIVEREF(__pyx_v_suffix_link); - __Pyx_GOTREF(__pyx_v_self->suffix_link); - __Pyx_DECREF(__pyx_v_self->suffix_link); - __pyx_v_self->suffix_link = __pyx_v_suffix_link; +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->phrases_f); + __Pyx_DECREF(__pyx_v_self->phrases_f); + __pyx_v_self->phrases_f = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -37566,31 +37874,31 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_3_sa_Exte } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":53 - * - * cdef class ExtendedTrieNode(TrieNode): - * cdef public phrase # <<<<<<<<<<<<<< - * cdef public phrase_location - * cdef public suffix_link +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":42 + * cdef public samples_f + * cdef public phrases_f + * cdef public phrases_e # <<<<<<<<<<<<<< + * cdef public phrases_fe + * cdef public phrases_al */ -static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->phrase); - __pyx_r = __pyx_v_self->phrase; + __Pyx_INCREF(__pyx_v_self->phrases_e); + __pyx_r = __pyx_v_self->phrases_e; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -37601,25 +37909,25 @@ static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_o } /* Python wrapper */ -static int __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__set__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->phrase); - __Pyx_DECREF(__pyx_v_self->phrase); - __pyx_v_self->phrase = __pyx_v_value; + __Pyx_GOTREF(__pyx_v_self->phrases_e); + __Pyx_DECREF(__pyx_v_self->phrases_e); + __pyx_v_self->phrases_e = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -37627,25 +37935,25 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_3_ } /* Python wrapper */ -static int __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_4__del__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->phrase); - __Pyx_DECREF(__pyx_v_self->phrase); - __pyx_v_self->phrase = Py_None; + __Pyx_GOTREF(__pyx_v_self->phrases_e); + __Pyx_DECREF(__pyx_v_self->phrases_e); + __pyx_v_self->phrases_e = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -37653,31 +37961,31 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_3_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":54 - * cdef class ExtendedTrieNode(TrieNode): - * cdef public phrase - * cdef public phrase_location # <<<<<<<<<<<<<< - * cdef public suffix_link - * +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":43 + * cdef public phrases_f + * cdef public phrases_e + * cdef public phrases_fe # <<<<<<<<<<<<<< + * cdef public phrases_al + * cdef public bilex_f */ -static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->phrase_location); - __pyx_r = __pyx_v_self->phrase_location; + __Pyx_INCREF(__pyx_v_self->phrases_fe); + __pyx_r = __pyx_v_self->phrases_fe; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -37688,25 +37996,25 @@ static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location___get__(stru } /* Python wrapper */ -static int __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->phrase_location); - __Pyx_DECREF(__pyx_v_self->phrase_location); - __pyx_v_self->phrase_location = __pyx_v_value; + __Pyx_GOTREF(__pyx_v_self->phrases_fe); + __Pyx_DECREF(__pyx_v_self->phrases_fe); + __pyx_v_self->phrases_fe = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -37714,25 +38022,25 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __ } /* Python wrapper */ -static int __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->phrase_location); - __Pyx_DECREF(__pyx_v_self->phrase_location); - __pyx_v_self->phrase_location = Py_None; + __Pyx_GOTREF(__pyx_v_self->phrases_fe); + __Pyx_DECREF(__pyx_v_self->phrases_fe); + __pyx_v_self->phrases_fe = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -37740,31 +38048,31 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":55 - * cdef public phrase - * cdef public phrase_location - * cdef public suffix_link # <<<<<<<<<<<<<< - * - * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":44 + * cdef public phrases_e + * cdef public phrases_fe + * cdef public phrases_al # <<<<<<<<<<<<<< + * cdef public bilex_f + * cdef public bilex_e */ -static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->suffix_link); - __pyx_r = __pyx_v_self->suffix_link; + __Pyx_INCREF(__pyx_v_self->phrases_al); + __pyx_r = __pyx_v_self->phrases_al; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -37775,25 +38083,25 @@ static PyObject *__pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct _ } /* Python wrapper */ -static int __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->suffix_link); - __Pyx_DECREF(__pyx_v_self->suffix_link); - __pyx_v_self->suffix_link = __pyx_v_value; + __Pyx_GOTREF(__pyx_v_self->phrases_al); + __Pyx_DECREF(__pyx_v_self->phrases_al); + __pyx_v_self->phrases_al = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -37801,25 +38109,25 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_ } /* Python wrapper */ -static int __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(((struct __pyx_obj_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_3_sa_ExtendedTrieNode *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->suffix_link); - __Pyx_DECREF(__pyx_v_self->suffix_link); - __pyx_v_self->suffix_link = Py_None; + __Pyx_GOTREF(__pyx_v_self->phrases_al); + __Pyx_DECREF(__pyx_v_self->phrases_al); + __pyx_v_self->phrases_al = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -37827,272 +38135,121 @@ static int __pyx_pf_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_ } /* Python wrapper */ -static int __pyx_pw_3_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_extended = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__extended,0}; - PyObject* values[1] = {0}; - values[0] = __pyx_k_101; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - 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__extended); - 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[8]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_extended = values[0]; - } - 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[8]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_9TrieTable___cinit__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), __pyx_v_extended); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":67 - * cdef public int count - * cdef public root - * def __cinit__(self, extended=False): # <<<<<<<<<<<<<< - * self.count = 0 - * self.extended = extended +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":45 + * cdef public phrases_fe + * cdef public phrases_al + * cdef public bilex_f # <<<<<<<<<<<<<< + * cdef public bilex_e + * cdef public bilex_fe */ -static int __pyx_pf_3_sa_9TrieTable___cinit__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended) { - int __pyx_r; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":68 - * cdef public root - * def __cinit__(self, extended=False): - * self.count = 0 # <<<<<<<<<<<<<< - * self.extended = extended - * if extended: - */ - __pyx_v_self->count = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":69 - * def __cinit__(self, extended=False): - * self.count = 0 - * self.extended = extended # <<<<<<<<<<<<<< - * if extended: - * self.root = ExtendedTrieNode() - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_extended); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->extended = __pyx_t_1; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":70 - * self.count = 0 - * self.extended = extended - * if extended: # <<<<<<<<<<<<<< - * self.root = ExtendedTrieNode() - * else: - */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extended); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":71 - * self.extended = extended - * if extended: - * self.root = ExtendedTrieNode() # <<<<<<<<<<<<<< - * else: - * self.root = TrieNode() - */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->root); - __Pyx_DECREF(__pyx_v_self->root); - __pyx_v_self->root = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3; - } - /*else*/ { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":73 - * self.root = ExtendedTrieNode() - * else: - * self.root = TrieNode() # <<<<<<<<<<<<<< - * - * # linked list structure for storing matches in BaselineRuleFactory - */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_TrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->root); - __Pyx_DECREF(__pyx_v_self->root); - __pyx_v_self->root = __pyx_t_3; - __pyx_t_3 = 0; - } - __pyx_L3:; - - __pyx_r = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->bilex_f); + __pyx_r = __pyx_v_self->bilex_f; goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9TrieTable_8extended___get__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":64 - * - * cdef class TrieTable: - * cdef public int extended # <<<<<<<<<<<<<< - * cdef public int count - * cdef public root - */ - -static PyObject *__pyx_pf_3_sa_9TrieTable_8extended___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__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("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->extended); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 64; __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_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->bilex_f); + __Pyx_DECREF(__pyx_v_self->bilex_f); + __pyx_v_self->bilex_f = __pyx_v_value; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.TrieTable.extended.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static int __pyx_pw_3_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9TrieTable_8extended_2__set__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->extended = __pyx_t_1; + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->bilex_f); + __Pyx_DECREF(__pyx_v_self->bilex_f); + __pyx_v_self->bilex_f = Py_None; __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("_sa.TrieTable.extended.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9TrieTable_5count___get__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":65 - * cdef class TrieTable: - * cdef public int extended - * cdef public int count # <<<<<<<<<<<<<< - * cdef public root - * def __cinit__(self, extended=False): +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":46 + * cdef public phrases_al + * cdef public bilex_f + * cdef public bilex_e # <<<<<<<<<<<<<< + * cdef public bilex_fe + * */ -static PyObject *__pyx_pf_3_sa_9TrieTable_5count___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __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->bilex_e); + __pyx_r = __pyx_v_self->bilex_e; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.TrieTable.count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -38100,63 +38257,83 @@ static PyObject *__pyx_pf_3_sa_9TrieTable_5count___get__(struct __pyx_obj_3_sa_T } /* Python wrapper */ -static int __pyx_pw_3_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9TrieTable_5count_2__set__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->count = __pyx_t_1; + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->bilex_e); + __Pyx_DECREF(__pyx_v_self->bilex_e); + __pyx_v_self->bilex_e = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->bilex_e); + __Pyx_DECREF(__pyx_v_self->bilex_e); + __pyx_v_self->bilex_e = Py_None; __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("_sa.TrieTable.count.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9TrieTable_4root___get__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":66 - * cdef public int extended - * cdef public int count - * cdef public root # <<<<<<<<<<<<<< - * def __cinit__(self, extended=False): - * self.count = 0 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":47 + * cdef public bilex_f + * cdef public bilex_e + * cdef public bilex_fe # <<<<<<<<<<<<<< + * + * def __cinit__(self): */ -static PyObject *__pyx_pf_3_sa_9TrieTable_4root___get__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->root); - __pyx_r = __pyx_v_self->root; + __Pyx_INCREF(__pyx_v_self->bilex_fe); + __pyx_r = __pyx_v_self->bilex_fe; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -38167,25 +38344,25 @@ static PyObject *__pyx_pf_3_sa_9TrieTable_4root___get__(struct __pyx_obj_3_sa_Tr } /* Python wrapper */ -static int __pyx_pw_3_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_3_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9TrieTable_4root_2__set__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->root); - __Pyx_DECREF(__pyx_v_self->root); - __pyx_v_self->root = __pyx_v_value; + __Pyx_GOTREF(__pyx_v_self->bilex_fe); + __Pyx_DECREF(__pyx_v_self->bilex_fe); + __pyx_v_self->bilex_fe = __pyx_v_value; __pyx_r = 0; __Pyx_RefNannyFinishContext(); @@ -38193,94 +38370,205 @@ static int __pyx_pf_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_3_sa_TrieTab } /* Python wrapper */ -static int __pyx_pw_3_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_3_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self) { +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_9TrieTable_4root_4__del__(((struct __pyx_obj_3_sa_TrieTable *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_3_sa_TrieTable *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->root); - __Pyx_DECREF(__pyx_v_self->root); - __pyx_v_self->root = Py_None; + __Pyx_GOTREF(__pyx_v_self->bilex_fe); + __Pyx_DECREF(__pyx_v_self->bilex_fe); + __pyx_v_self->bilex_fe = Py_None; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":93 +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __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_2sa_3_sa_8TrieNode___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":74 + * cdef public children * - * # returns true if sent_id is contained - * cdef int contains(self, int sent_id): # <<<<<<<<<<<<<< - * return 1 + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.children = {} * */ -static int __pyx_f_3_sa_14PhraseLocation_contains(CYTHON_UNUSED struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_self, CYTHON_UNUSED int __pyx_v_sent_id) { +static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("contains", 0); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":94 - * # returns true if sent_id is contained - * cdef int contains(self, int sent_id): - * return 1 # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":75 * - * def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, + * def __cinit__(self): + * self.children = {} # <<<<<<<<<<<<<< + * + * cdef class ExtendedTrieNode(TrieNode): */ - __pyx_r = 1; - goto __pyx_L0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(__pyx_v_self->children); + __pyx_v_self->children = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.TrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static int __pyx_pw_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_sa_low; - int __pyx_v_sa_high; - int __pyx_v_arr_low; - int __pyx_v_arr_high; - PyObject *__pyx_v_arr = 0; - int __pyx_v_num_subpatterns; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - 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}; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":97 + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":72 * - * 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 - * self.sa_high = sa_high + * cdef class TrieNode: + * cdef public children # <<<<<<<<<<<<<< + * + * def __cinit__(self): */ - values[4] = ((PyObject *)Py_None); + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->children); + __pyx_r = __pyx_v_self->children; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(__pyx_v_self->children); + __pyx_v_self->children = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(__pyx_v_self->children); + __pyx_v_self->children = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_phrase = 0; + PyObject *__pyx_v_phrase_location = 0; + PyObject *__pyx_v_suffix_link = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__phrase,&__pyx_n_s__phrase_location,&__pyx_n_s__suffix_link,0}; + PyObject* values[3] = {0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":82 + * cdef public suffix_link + * + * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): # <<<<<<<<<<<<<< + * self.phrase = phrase + * self.phrase_location = phrase_location + */ + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -38291,43 +38579,25 @@ static int __pyx_pw_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyO switch (pos_args) { case 0: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sa_low); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__phrase); if (value) { values[0] = value; kw_args--; } } case 1: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sa_high); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__phrase_location); if (value) { values[1] = value; kw_args--; } } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr_low); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__suffix_link); if (value) { values[2] = value; kw_args--; } } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr_high); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_subpatterns); - if (value) { values[5] = 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[8]; __pyx_lineno = 96; __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[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -38335,136 +38605,337 @@ static int __pyx_pw_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyO default: goto __pyx_L5_argtuple_error; } } - if (values[0]) { - __pyx_v_sa_low = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_sa_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_sa_low = ((int)-1); - } - if (values[1]) { - __pyx_v_sa_high = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_sa_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_sa_high = ((int)-1); - } - if (values[2]) { - __pyx_v_arr_low = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_arr_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_arr_low = ((int)-1); - } - if (values[3]) { - __pyx_v_arr_high = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_arr_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_arr_high = ((int)-1); - } - __pyx_v_arr = values[4]; - if (values[5]) { - __pyx_v_num_subpatterns = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_num_subpatterns == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_num_subpatterns = ((int)1); - } + __pyx_v_phrase = values[0]; + __pyx_v_phrase_location = values[1]; + __pyx_v_suffix_link = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.ExtendedTrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_14PhraseLocation___cinit__(((struct __pyx_obj_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); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), __pyx_v_phrase, __pyx_v_phrase_location, __pyx_v_suffix_link); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":96 - * return 1 - * - * 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 - */ - -static int __pyx_pf_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_self, int __pyx_v_sa_low, int __pyx_v_sa_high, int __pyx_v_arr_low, int __pyx_v_arr_high, PyObject *__pyx_v_arr, int __pyx_v_num_subpatterns) { +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_phrase, PyObject *__pyx_v_phrase_location, PyObject *__pyx_v_suffix_link) { int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":98 - * 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 # <<<<<<<<<<<<<< - * self.sa_high = sa_high - * self.arr_low = arr_low + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":83 + * + * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): + * self.phrase = phrase # <<<<<<<<<<<<<< + * self.phrase_location = phrase_location + * self.suffix_link = suffix_link */ - __pyx_v_self->sa_low = __pyx_v_sa_low; + __Pyx_INCREF(__pyx_v_phrase); + __Pyx_GIVEREF(__pyx_v_phrase); + __Pyx_GOTREF(__pyx_v_self->phrase); + __Pyx_DECREF(__pyx_v_self->phrase); + __pyx_v_self->phrase = __pyx_v_phrase; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":99 - * arr=None, int num_subpatterns=1): - * self.sa_low = sa_low - * self.sa_high = sa_high # <<<<<<<<<<<<<< - * self.arr_low = arr_low - * self.arr_high = arr_high + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":84 + * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): + * self.phrase = phrase + * self.phrase_location = phrase_location # <<<<<<<<<<<<<< + * self.suffix_link = suffix_link + * */ - __pyx_v_self->sa_high = __pyx_v_sa_high; + __Pyx_INCREF(__pyx_v_phrase_location); + __Pyx_GIVEREF(__pyx_v_phrase_location); + __Pyx_GOTREF(__pyx_v_self->phrase_location); + __Pyx_DECREF(__pyx_v_self->phrase_location); + __pyx_v_self->phrase_location = __pyx_v_phrase_location; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":100 - * self.sa_low = sa_low - * self.sa_high = sa_high - * self.arr_low = arr_low # <<<<<<<<<<<<<< - * self.arr_high = arr_high - * self.arr = arr + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":85 + * self.phrase = phrase + * self.phrase_location = phrase_location + * self.suffix_link = suffix_link # <<<<<<<<<<<<<< + * + * */ - __pyx_v_self->arr_low = __pyx_v_arr_low; + __Pyx_INCREF(__pyx_v_suffix_link); + __Pyx_GIVEREF(__pyx_v_suffix_link); + __Pyx_GOTREF(__pyx_v_self->suffix_link); + __Pyx_DECREF(__pyx_v_self->suffix_link); + __pyx_v_self->suffix_link = __pyx_v_suffix_link; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":101 - * self.sa_high = sa_high - * self.arr_low = arr_low - * self.arr_high = arr_high # <<<<<<<<<<<<<< - * self.arr = arr - * self.num_subpatterns = num_subpatterns - */ - __pyx_v_self->arr_high = __pyx_v_arr_high; + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":102 - * self.arr_low = arr_low - * self.arr_high = arr_high - * self.arr = arr # <<<<<<<<<<<<<< - * self.num_subpatterns = num_subpatterns +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase___get__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":78 * + * cdef class ExtendedTrieNode(TrieNode): + * cdef public phrase # <<<<<<<<<<<<<< + * cdef public phrase_location + * cdef public suffix_link */ - if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_arr); - __Pyx_GIVEREF(__pyx_v_arr); - __Pyx_GOTREF(__pyx_v_self->arr); - __Pyx_DECREF(((PyObject *)__pyx_v_self->arr)); - __pyx_v_self->arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_v_arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":103 - * self.arr_high = arr_high - * self.arr = arr - * self.num_subpatterns = num_subpatterns # <<<<<<<<<<<<<< - * +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->phrase); + __pyx_r = __pyx_v_self->phrase; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->phrase); + __Pyx_DECREF(__pyx_v_self->phrase); + __pyx_v_self->phrase = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->phrase); + __Pyx_DECREF(__pyx_v_self->phrase); + __pyx_v_self->phrase = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location___get__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":79 + * cdef class ExtendedTrieNode(TrieNode): + * cdef public phrase + * cdef public phrase_location # <<<<<<<<<<<<<< + * cdef public suffix_link * */ - __pyx_v_self->num_subpatterns = __pyx_v_num_subpatterns; + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->phrase_location); + __pyx_r = __pyx_v_self->phrase_location; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->phrase_location); + __Pyx_DECREF(__pyx_v_self->phrase_location); + __pyx_v_self->phrase_location = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->phrase_location); + __Pyx_DECREF(__pyx_v_self->phrase_location); + __pyx_v_self->phrase_location = Py_None; __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link___get__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":80 + * cdef public phrase + * cdef public phrase_location + * cdef public suffix_link # <<<<<<<<<<<<<< + * + * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->suffix_link); + __pyx_r = __pyx_v_self->suffix_link; goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("_sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static int __pyx_pw_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_sample_size; - struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray = 0; +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->suffix_link); + __Pyx_DECREF(__pyx_v_self->suffix_link); + __pyx_v_self->suffix_link = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->suffix_link); + __Pyx_DECREF(__pyx_v_self->suffix_link); + __pyx_v_self->suffix_link = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_extended = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -38472,13 +38943,13 @@ static int __pyx_pw_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sample_size,&__pyx_n_s__fsarray,0}; - PyObject* values[2] = {0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__extended,0}; + PyObject* values[1] = {0}; + values[0] = __pyx_k_103; 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; @@ -38486,155 +38957,124 @@ static int __pyx_pw_3_sa_7Sampler_1__cinit__(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__sample_size)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__extended); + 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[8]; __pyx_lineno = 113; __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[8]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } } - __pyx_v_sample_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_sample_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_fsarray = ((struct __pyx_obj_3_sa_SuffixArray *)values[1]); + __pyx_v_extended = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3_sa_7Sampler___cinit__(((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self), __pyx_v_sample_size, __pyx_v_fsarray); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), __pyx_v_extended); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":113 - * cdef IntList sa - * - * def __cinit__(self, int sample_size, SuffixArray fsarray): # <<<<<<<<<<<<<< - * self.sample_size = sample_size - * self.sa = fsarray.sa +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":92 + * cdef public int count + * cdef public root + * def __cinit__(self, extended=False): # <<<<<<<<<<<<<< + * self.count = 0 + * self.extended = extended */ -static int __pyx_pf_3_sa_7Sampler___cinit__(struct __pyx_obj_3_sa_Sampler *__pyx_v_self, int __pyx_v_sample_size, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray) { +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended) { int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; int __pyx_t_2; 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("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":114 - * - * def __cinit__(self, int sample_size, SuffixArray fsarray): - * self.sample_size = sample_size # <<<<<<<<<<<<<< - * self.sa = fsarray.sa - * if sample_size > 0: + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":93 + * cdef public root + * def __cinit__(self, extended=False): + * self.count = 0 # <<<<<<<<<<<<<< + * self.extended = extended + * if extended: */ - __pyx_v_self->sample_size = __pyx_v_sample_size; + __pyx_v_self->count = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":115 - * def __cinit__(self, int sample_size, SuffixArray fsarray): - * self.sample_size = sample_size - * self.sa = fsarray.sa # <<<<<<<<<<<<<< - * if sample_size > 0: - * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":94 + * def __cinit__(self, extended=False): + * self.count = 0 + * self.extended = extended # <<<<<<<<<<<<<< + * if extended: + * self.root = ExtendedTrieNode() */ - __pyx_t_1 = ((PyObject *)__pyx_v_fsarray->sa); - __Pyx_INCREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->sa); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); - __pyx_v_self->sa = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_extended); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->extended = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":116 - * self.sample_size = sample_size - * self.sa = fsarray.sa - * if sample_size > 0: # <<<<<<<<<<<<<< - * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":95 + * self.count = 0 + * self.extended = extended + * if extended: # <<<<<<<<<<<<<< + * self.root = ExtendedTrieNode() * else: */ - __pyx_t_2 = ((__pyx_v_sample_size > 0) != 0); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extended); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":117 - * self.sa = fsarray.sa - * if sample_size > 0: - * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":96 + * self.extended = extended + * if extended: + * self.root = ExtendedTrieNode() # <<<<<<<<<<<<<< * else: - * logger.info("Sampling strategy: no sampling") + * self.root = TrieNode() */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 117; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_sample_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 117; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_102)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_102)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_102)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __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[8]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L3; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":119 - * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":98 + * self.root = ExtendedTrieNode() * else: - * logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<< + * self.root = TrieNode() # <<<<<<<<<<<<<< * - * def sample(self, PhraseLocation phrase_location): + * # linked list structure for storing matches in BaselineRuleFactory */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 119; __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_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 119; __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; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = __pyx_t_3; + __pyx_t_3 = 0; } __pyx_L3:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -38642,813 +39082,286 @@ static int __pyx_pf_3_sa_7Sampler___cinit__(struct __pyx_obj_3_sa_Sampler *__pyx } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location); /*proto*/ -static char __pyx_doc_3_sa_7Sampler_2sample[] = "Returns a sample of the locations for\n the phrase. If there are less than self.sample_size\n locations, return all of them; otherwise, return\n up to self.sample_size locations. In the latter case,\n we choose to sample UNIFORMLY -- that is, the locations\n are chosen at uniform intervals over the entire set, rather\n than randomly. This makes the algorithm deterministic, which\n is good for things like MERT"; -static PyObject *__pyx_pw_3_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location) { - CYTHON_UNUSED int __pyx_lineno = 0; - CYTHON_UNUSED const char *__pyx_filename = NULL; - CYTHON_UNUSED int __pyx_clineno = 0; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sample (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_phrase_location), __pyx_ptype_3_sa_PhraseLocation, 1, "phrase_location", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3_sa_7Sampler_2sample(((struct __pyx_obj_3_sa_Sampler *)__pyx_v_self), ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_v_phrase_location)); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":121 - * logger.info("Sampling strategy: no sampling") +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":89 * - * def sample(self, PhraseLocation phrase_location): # <<<<<<<<<<<<<< - * '''Returns a sample of the locations for - * the phrase. If there are less than self.sample_size + * cdef class TrieTable: + * cdef public int extended # <<<<<<<<<<<<<< + * cdef public int count + * cdef public root */ -static PyObject *__pyx_pf_3_sa_7Sampler_2sample(struct __pyx_obj_3_sa_Sampler *__pyx_v_self, struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_phrase_location) { - struct __pyx_obj_3_sa_IntList *__pyx_v_sample = 0; - double __pyx_v_i; - double __pyx_v_stepsize; - int __pyx_v_num_locations; - int __pyx_v_val; - int __pyx_v_j; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - 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); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":134 - * cdef int num_locations, val, j - * - * sample = IntList() # <<<<<<<<<<<<<< - * if phrase_location.arr is None: - * num_locations = phrase_location.sa_high - phrase_location.sa_low - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->extended); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_sample = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; + goto __pyx_L0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":135 - * - * sample = IntList() - * 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: - */ - __pyx_t_2 = (((PyObject *)__pyx_v_phrase_location->arr) == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":136 - * sample = IntList() - * 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) - */ - __pyx_v_num_locations = (__pyx_v_phrase_location->sa_high - __pyx_v_phrase_location->sa_low); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":137 - * 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; - } else { - __pyx_t_4 = __pyx_t_3; - } - if (__pyx_t_4) { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":138 - * 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: - * stepsize = float(num_locations)/float(self.sample_size) - */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_extend_arr(__pyx_v_sample, (__pyx_v_self->sa->arr + __pyx_v_phrase_location->sa_low), __pyx_v_num_locations); - goto __pyx_L4; - } - /*else*/ { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":140 - * sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations) - * 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: - */ - if (unlikely(((double)__pyx_v_self->sample_size) == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size)); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":141 - * 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; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":142 - * 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 - * 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; - } else { - __pyx_t_2 = __pyx_t_4; - } - if (!__pyx_t_2) break; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":145 - * '''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) { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":146 - * effect, according to the python documentation''' - * if fmod(i,1.0) > 0.5: - * val = int(ceil(i)) # <<<<<<<<<<<<<< - * else: - * val = int(floor(i)) - */ - __pyx_v_val = ((int)ceil(__pyx_v_i)); - goto __pyx_L7; - } - /*else*/ { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":148 - * val = int(ceil(i)) - * else: - * val = int(floor(i)) # <<<<<<<<<<<<<< - * sample._append(self.sa.arr[val]) - * i = i + stepsize - */ - __pyx_v_val = ((int)floor(__pyx_v_i)); - } - __pyx_L7:; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":149 - * else: - * val = int(floor(i)) - * sample._append(self.sa.arr[val]) # <<<<<<<<<<<<<< - * i = i + stepsize - * else: - */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_append(__pyx_v_sample, (__pyx_v_self->sa->arr[__pyx_v_val])); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":150 - * val = int(floor(i)) - * sample._append(self.sa.arr[val]) - * i = i + stepsize # <<<<<<<<<<<<<< - * else: - * num_locations = (phrase_location.arr_high - phrase_location.arr_low) / phrase_location.num_subpatterns - */ - __pyx_v_i = (__pyx_v_i + __pyx_v_stepsize); - } - } - __pyx_L4:; - goto __pyx_L3; - } - /*else*/ { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":152 - * 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); - if (unlikely(__pyx_v_phrase_location->num_subpatterns == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_phrase_location->num_subpatterns == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_num_locations = __Pyx_div_int(__pyx_t_5, __pyx_v_phrase_location->num_subpatterns); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":153 - * 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 - * else: - */ - __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; - } else { - __pyx_t_3 = __pyx_t_2; - } - if (__pyx_t_3) { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":154 - * 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 # <<<<<<<<<<<<<< - * else: - * stepsize = float(num_locations)/float(self.sample_size) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_phrase_location->arr); - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_sample)); - __pyx_v_sample = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L8; - } - /*else*/ { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":156 - * sample = phrase_location.arr - * 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: - */ - if (unlikely(((double)__pyx_v_self->sample_size) == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size)); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":157 - * 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; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":158 - * 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 - * 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; - } else { - __pyx_t_4 = __pyx_t_3; - } - if (!__pyx_t_4) break; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":161 - * '''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_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.extended.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":162 - * effect, according to the python documentation''' - * if fmod(i,1.0) > 0.5: - * val = int(ceil(i)) # <<<<<<<<<<<<<< - * else: - * val = int(floor(i)) - */ - __pyx_v_val = ((int)ceil(__pyx_v_i)); - goto __pyx_L11; - } - /*else*/ { +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":164 - * val = int(ceil(i)) - * else: - * 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) - */ - __pyx_v_val = ((int)floor(__pyx_v_i)); - } - __pyx_L11:; +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->extended = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":165 - * else: - * 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) - * i = i + stepsize - */ - __pyx_v_j = (__pyx_v_phrase_location->arr_low + (__pyx_v_val * __pyx_v_phrase_location->num_subpatterns)); + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.extended.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":166 - * 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) # <<<<<<<<<<<<<< - * i = i + stepsize - * return sample - */ - ((struct __pyx_vtabstruct_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); +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":167 - * 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 # <<<<<<<<<<<<<< - * return sample - * +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":90 + * cdef class TrieTable: + * cdef public int extended + * cdef public int count # <<<<<<<<<<<<<< + * cdef public root + * def __cinit__(self, extended=False): */ - __pyx_v_i = (__pyx_v_i + __pyx_v_stepsize); - } - } - __pyx_L8:; - } - __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":168 - * sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns) - * i = i + stepsize - * return sample # <<<<<<<<<<<<<< - * - * - */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_sample)); - __pyx_r = ((PyObject *)__pyx_v_sample); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.Sampler.sample", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_sample); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":180 - * - * - * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): # <<<<<<<<<<<<<< - * m.arr = arr - * m.start = start - */ - -static void __pyx_f_3_sa_assign_matching(struct __pyx_t_3_sa_Matching *__pyx_v_m, int *__pyx_v_arr, int __pyx_v_start, int __pyx_v_step, int *__pyx_v_sent_id_arr) { +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("assign_matching", 0); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":181 - * - * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): - * m.arr = arr # <<<<<<<<<<<<<< - * m.start = start - * m.end = start + step - */ - __pyx_v_m->arr = __pyx_v_arr; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":182 - * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): - * m.arr = arr - * m.start = start # <<<<<<<<<<<<<< - * m.end = start + step - * m.sent_id = sent_id_arr[arr[start]] - */ - __pyx_v_m->start = __pyx_v_start; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":183 - * m.arr = arr - * m.start = start - * m.end = start + step # <<<<<<<<<<<<<< - * m.sent_id = sent_id_arr[arr[start]] - * m.size = step - */ - __pyx_v_m->end = (__pyx_v_start + __pyx_v_step); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":184 - * m.start = start - * m.end = start + step - * m.sent_id = sent_id_arr[arr[start]] # <<<<<<<<<<<<<< - * m.size = step - * - */ - __pyx_v_m->sent_id = (__pyx_v_sent_id_arr[(__pyx_v_arr[__pyx_v_start])]); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":185 - * m.end = start + step - * m.sent_id = sent_id_arr[arr[start]] - * m.size = step # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_m->size = __pyx_v_step; - + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); __Pyx_RefNannyFinishContext(); + return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":188 - * - * - * cdef int* append_combined_matching(int* arr, Matching* loc1, Matching* loc2, # <<<<<<<<<<<<<< - * int offset_by_one, int num_subpatterns, int* result_len): - * cdef int i, new_len - */ - -static int *__pyx_f_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx_t_3_sa_Matching *__pyx_v_loc1, struct __pyx_t_3_sa_Matching *__pyx_v_loc2, CYTHON_UNUSED int __pyx_v_offset_by_one, int __pyx_v_num_subpatterns, int *__pyx_v_result_len) { - int __pyx_v_i; - int __pyx_v_new_len; - int *__pyx_r; +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("append_combined_matching", 0); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":192 - * cdef int i, new_len - * - * new_len = result_len[0] + num_subpatterns # <<<<<<<<<<<<<< - * arr = realloc(arr, new_len*sizeof(int)) - * - */ - __pyx_v_new_len = ((__pyx_v_result_len[0]) + __pyx_v_num_subpatterns); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":193 - * - * new_len = result_len[0] + num_subpatterns - * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < loc1.size: - */ - __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":195 - * arr = realloc(arr, new_len*sizeof(int)) - * - * for i from 0 <= i < loc1.size: # <<<<<<<<<<<<<< - * arr[result_len[0]+i] = loc1.arr[loc1.start+i] - * if num_subpatterns > loc1.size: - */ - __pyx_t_1 = __pyx_v_loc1->size; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":196 - * - * for i from 0 <= i < loc1.size: - * arr[result_len[0]+i] = loc1.arr[loc1.start+i] # <<<<<<<<<<<<<< - * if num_subpatterns > loc1.size: - * arr[new_len-1] = loc2.arr[loc2.end-1] - */ - (__pyx_v_arr[((__pyx_v_result_len[0]) + __pyx_v_i)]) = (__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]); - } - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":197 - * for i from 0 <= i < loc1.size: - * arr[result_len[0]+i] = loc1.arr[loc1.start+i] - * if num_subpatterns > loc1.size: # <<<<<<<<<<<<<< - * arr[new_len-1] = loc2.arr[loc2.end-1] - * result_len[0] = new_len - */ - __pyx_t_2 = ((__pyx_v_num_subpatterns > __pyx_v_loc1->size) != 0); - if (__pyx_t_2) { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":198 - * arr[result_len[0]+i] = loc1.arr[loc1.start+i] - * if num_subpatterns > loc1.size: - * arr[new_len-1] = loc2.arr[loc2.end-1] # <<<<<<<<<<<<<< - * result_len[0] = new_len - * return arr - */ - (__pyx_v_arr[(__pyx_v_new_len - 1)]) = (__pyx_v_loc2->arr[(__pyx_v_loc2->end - 1)]); - goto __pyx_L5; - } - __pyx_L5:; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":199 - * if num_subpatterns > loc1.size: - * arr[new_len-1] = loc2.arr[loc2.end-1] - * result_len[0] = new_len # <<<<<<<<<<<<<< - * return arr - * - */ - (__pyx_v_result_len[0]) = __pyx_v_new_len; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":200 - * arr[new_len-1] = loc2.arr[loc2.end-1] - * result_len[0] = new_len - * return arr # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_arr; - goto __pyx_L0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); 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->count = __pyx_t_1; __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.count.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":203 - * - * - * cdef int* extend_arr(int* arr, int* arr_len, int* appendix, int appendix_len): # <<<<<<<<<<<<<< - * cdef int new_len - * - */ - -static int *__pyx_f_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int *__pyx_v_appendix, int __pyx_v_appendix_len) { - int __pyx_v_new_len; - int *__pyx_r; +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("extend_arr", 0); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":206 - * cdef int new_len - * - * new_len = arr_len[0] + appendix_len # <<<<<<<<<<<<<< - * arr = realloc(arr, new_len*sizeof(int)) - * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":91 + * cdef public int extended + * cdef public int count + * cdef public root # <<<<<<<<<<<<<< + * def __cinit__(self, extended=False): + * self.count = 0 */ - __pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_appendix_len); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":207 - * - * new_len = arr_len[0] + appendix_len - * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< - * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) - * arr_len[0] = new_len - */ - __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->root); + __pyx_r = __pyx_v_self->root; + goto __pyx_L0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":208 - * new_len = arr_len[0] + appendix_len - * arr = realloc(arr, new_len*sizeof(int)) - * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) # <<<<<<<<<<<<<< - * arr_len[0] = new_len - * return arr - */ - memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_appendix, (__pyx_v_appendix_len * (sizeof(int)))); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":209 - * arr = realloc(arr, new_len*sizeof(int)) - * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) - * arr_len[0] = new_len # <<<<<<<<<<<<<< - * return arr - * - */ - (__pyx_v_arr_len[0]) = __pyx_v_new_len; +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":210 - * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) - * arr_len[0] = new_len - * return arr # <<<<<<<<<<<<<< - * - * cdef int median(int low, int high, int step): - */ - __pyx_r = __pyx_v_arr; - goto __pyx_L0; +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = __pyx_v_value; __pyx_r = 0; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":212 - * return arr - * - * cdef int median(int low, int high, int step): # <<<<<<<<<<<<<< - * return low + (((high - low)/step)/2)*step - * - */ - -static int __pyx_f_3_sa_median(int __pyx_v_low, int __pyx_v_high, int __pyx_v_step) { +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("median", 0); + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":213 - * - * cdef int median(int low, int high, int step): - * return low + (((high - low)/step)/2)*step # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = (__pyx_v_high - __pyx_v_low); - if (unlikely(__pyx_v_step == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_step == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_1))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_r = (__pyx_v_low + (__Pyx_div_long(__Pyx_div_int(__pyx_t_1, __pyx_v_step), 2) * __pyx_v_step)); - goto __pyx_L0; +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = Py_None; __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("_sa.median", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":216 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":118 * + * # returns true if sent_id is contained + * cdef int contains(self, int sent_id): # <<<<<<<<<<<<<< + * return 1 * - * cdef void find_comparable_matchings(int low, int high, int* arr, int step, int loc, int* loc_minus, int* loc_plus): # <<<<<<<<<<<<<< - * # Returns (minus, plus) indices for the portion of the array - * # in which all matchings have the same first index as the one */ -static void __pyx_f_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_high, int *__pyx_v_arr, int __pyx_v_step, int __pyx_v_loc, int *__pyx_v_loc_minus, int *__pyx_v_loc_plus) { +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) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("find_comparable_matchings", 0); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":220 - * # in which all matchings have the same first index as the one - * # starting at loc - * loc_plus[0] = loc + step # <<<<<<<<<<<<<< - * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: - * loc_plus[0] = loc_plus[0] + step - */ - (__pyx_v_loc_plus[0]) = (__pyx_v_loc + __pyx_v_step); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":221 - * # starting at loc - * loc_plus[0] = loc + step - * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: # <<<<<<<<<<<<<< - * loc_plus[0] = loc_plus[0] + step - * 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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (!__pyx_t_3) break; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":222 - * loc_plus[0] = loc + step - * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: - * 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]: - */ - (__pyx_v_loc_plus[0]) = ((__pyx_v_loc_plus[0]) + __pyx_v_step); - } - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":223 - * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: - * 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]: - * loc_minus[0] = loc_minus[0] - step - */ - (__pyx_v_loc_minus[0]) = __pyx_v_loc; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":224 - * 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]: # <<<<<<<<<<<<<< - * loc_minus[0] = loc_minus[0] - step - * - */ - 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; - } else { - __pyx_t_2 = __pyx_t_3; - } - if (!__pyx_t_2) break; + __Pyx_RefNannySetupContext("contains", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":225 - * 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 # <<<<<<<<<<<<<< - * + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":119 + * # returns true if sent_id is contained + * cdef int contains(self, int sent_id): + * return 1 # <<<<<<<<<<<<<< * + * def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, */ - (__pyx_v_loc_minus[0]) = ((__pyx_v_loc_minus[0]) - __pyx_v_step); - } + __pyx_r = 1; + goto __pyx_L0; + __pyx_r = 0; + __pyx_L0:; __Pyx_RefNannyFinishContext(); + return __pyx_r; } /* Python wrapper */ -static int __pyx_pw_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3_sa_Alignment *__pyx_v_alignment = 0; - float __pyx_v_by_slack_factor; - char *__pyx_v_category; - PyObject *__pyx_v_max_chunks = 0; - unsigned int __pyx_v_max_initial_size; - unsigned int __pyx_v_max_length; - unsigned int __pyx_v_max_nonterminals; - PyObject *__pyx_v_max_target_chunks = 0; - PyObject *__pyx_v_max_target_length = 0; - unsigned int __pyx_v_min_gap_size; - PyObject *__pyx_v_precompute_file = 0; - unsigned int __pyx_v_precompute_secondary_rank; - unsigned int __pyx_v_precompute_rank; - int __pyx_v_require_aligned_terminal; - int __pyx_v_require_aligned_chunks; - unsigned int __pyx_v_train_max_initial_size; - unsigned int __pyx_v_train_min_gap_size; - int __pyx_v_tight_phrases; - int __pyx_v_use_baeza_yates; - int __pyx_v_use_collocations; - int __pyx_v_use_index; +static int __pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_sa_low; + int __pyx_v_sa_high; + int __pyx_v_arr_low; + int __pyx_v_arr_high; + PyObject *__pyx_v_arr = 0; + int __pyx_v_num_subpatterns; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -39456,63 +39369,21 @@ static int __pyx_pw_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alignment,&__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_72,&__pyx_n_s__precompute_rank,&__pyx_n_s_105,&__pyx_n_s_106,&__pyx_n_s_73,&__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[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":296 - * 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, # <<<<<<<<<<<<<< - * # maximum span of a grammar rule in TEST DATA - * unsigned max_initial_size=10, - */ - values[3] = ((PyObject *)Py_None); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":304 - * 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, # <<<<<<<<<<<<<< - * # 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, - */ - values[7] = ((PyObject *)Py_None); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":306 - * 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, # <<<<<<<<<<<<<< - * # minimum span of a nonterminal in the RHS of a rule in TEST DATA - * unsigned min_gap_size=2, - */ - values[8] = ((PyObject *)Py_None); + 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}; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":310 - * unsigned min_gap_size=2, - * # filename of file containing precomputed collocations - * precompute_file=None, # <<<<<<<<<<<<<< - * # maximum frequency rank of patterns used to compute triples (don't set higher than 20). - * unsigned precompute_secondary_rank=20, + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":122 + * + * 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 + * self.sa_high = sa_high */ - values[10] = ((PyObject *)Py_None); + values[4] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); - case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); - case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); - case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); - case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); - case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -39525,291 +39396,232 @@ static int __pyx_pw_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_ kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alignment)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sa_low); + if (value) { values[0] = value; kw_args--; } + } case 1: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__by_slack_factor); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sa_high); if (value) { values[1] = value; kw_args--; } } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__category); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr_low); if (value) { values[2] = value; kw_args--; } } case 3: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_chunks); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr_high); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_initial_size); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr); if (value) { values[4] = value; kw_args--; } } case 5: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_length); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_subpatterns); if (value) { values[5] = value; kw_args--; } } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_nonterminals); - if (value) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_target_chunks); - if (value) { values[7] = value; kw_args--; } - } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_target_length); - if (value) { values[8] = value; kw_args--; } - } - case 9: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_gap_size); - if (value) { values[9] = value; kw_args--; } - } - case 10: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__precompute_file); - if (value) { values[10] = value; kw_args--; } - } - case 11: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_72); - if (value) { values[11] = value; kw_args--; } - } - case 12: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__precompute_rank); - if (value) { values[12] = value; kw_args--; } - } - case 13: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_105); - if (value) { values[13] = value; kw_args--; } - } - case 14: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_106); - if (value) { values[14] = value; kw_args--; } - } - case 15: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_73); - if (value) { values[15] = value; kw_args--; } - } - case 16: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__train_min_gap_size); - if (value) { values[16] = value; kw_args--; } - } - case 17: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tight_phrases); - if (value) { values[17] = value; kw_args--; } - } - case 18: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_baeza_yates); - if (value) { values[18] = value; kw_args--; } - } - case 19: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_collocations); - if (value) { values[19] = value; kw_args--; } - } - case 20: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_index); - if (value) { values[20] = 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[8]; __pyx_lineno = 288; __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[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { - case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); - case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); - case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); - case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); - case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); - case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; + case 0: break; default: goto __pyx_L5_argtuple_error; } } - __pyx_v_alignment = ((struct __pyx_obj_3_sa_Alignment *)values[0]); + if (values[0]) { + __pyx_v_sa_low = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_sa_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_sa_low = ((int)-1); + } if (values[1]) { - __pyx_v_by_slack_factor = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_by_slack_factor == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_sa_high = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_sa_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":292 - * Alignment alignment, - * # parameter for double-binary search; doesn't seem to matter much - * float by_slack_factor=1.0, # <<<<<<<<<<<<<< - * # name of generic nonterminal used by Hiero - * char* category="[X]", - */ - __pyx_v_by_slack_factor = ((float)1.0); + __pyx_v_sa_high = ((int)-1); } if (values[2]) { - __pyx_v_category = __Pyx_PyObject_AsString(values[2]); if (unlikely((!__pyx_v_category) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_arr_low = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_arr_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_category = ((char *)__pyx_k_107); + __pyx_v_arr_low = ((int)-1); } - __pyx_v_max_chunks = values[3]; - if (values[4]) { - __pyx_v_max_initial_size = __Pyx_PyInt_AsUnsignedInt(values[4]); if (unlikely((__pyx_v_max_initial_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[3]) { + __pyx_v_arr_high = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_arr_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_max_initial_size = ((unsigned int)10); + __pyx_v_arr_high = ((int)-1); } + __pyx_v_arr = values[4]; if (values[5]) { - __pyx_v_max_length = __Pyx_PyInt_AsUnsignedInt(values[5]); if (unlikely((__pyx_v_max_length == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_num_subpatterns = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_num_subpatterns == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_max_length = ((unsigned int)5); - } - if (values[6]) { - __pyx_v_max_nonterminals = __Pyx_PyInt_AsUnsignedInt(values[6]); if (unlikely((__pyx_v_max_nonterminals == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_max_nonterminals = ((unsigned int)2); + __pyx_v_num_subpatterns = ((int)1); } - __pyx_v_max_target_chunks = values[7]; - __pyx_v_max_target_length = values[8]; - if (values[9]) { - __pyx_v_min_gap_size = __Pyx_PyInt_AsUnsignedInt(values[9]); if (unlikely((__pyx_v_min_gap_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_min_gap_size = ((unsigned int)2); - } - __pyx_v_precompute_file = values[10]; - if (values[11]) { - __pyx_v_precompute_secondary_rank = __Pyx_PyInt_AsUnsignedInt(values[11]); if (unlikely((__pyx_v_precompute_secondary_rank == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_precompute_secondary_rank = ((unsigned int)20); - } - if (values[12]) { - __pyx_v_precompute_rank = __Pyx_PyInt_AsUnsignedInt(values[12]); if (unlikely((__pyx_v_precompute_rank == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_precompute_rank = ((unsigned int)100); - } - if (values[13]) { - __pyx_v_require_aligned_terminal = __Pyx_PyObject_IsTrue(values[13]); if (unlikely((__pyx_v_require_aligned_terminal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __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); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":316 - * unsigned precompute_rank=100, - * # require extracted rules to have at least one aligned word - * bint require_aligned_terminal=True, # <<<<<<<<<<<<<< - * # require each contiguous chunk of extracted rules to have at least one aligned word - * bint require_aligned_chunks=False, +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":121 + * return 1 + * + * 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 */ - __pyx_v_require_aligned_terminal = ((int)1); - } - if (values[14]) { - __pyx_v_require_aligned_chunks = __Pyx_PyObject_IsTrue(values[14]); if (unlikely((__pyx_v_require_aligned_chunks == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":318 - * bint require_aligned_terminal=True, - * # require each contiguous chunk of extracted rules to have at least one aligned word - * bint require_aligned_chunks=False, # <<<<<<<<<<<<<< - * # maximum span of a grammar rule extracted from TRAINING DATA - * unsigned train_max_initial_size=10, +static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_self, int __pyx_v_sa_low, int __pyx_v_sa_high, int __pyx_v_arr_low, int __pyx_v_arr_high, PyObject *__pyx_v_arr, int __pyx_v_num_subpatterns) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":123 + * 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 # <<<<<<<<<<<<<< + * self.sa_high = sa_high + * self.arr_low = arr_low */ - __pyx_v_require_aligned_chunks = ((int)0); - } - if (values[15]) { - __pyx_v_train_max_initial_size = __Pyx_PyInt_AsUnsignedInt(values[15]); if (unlikely((__pyx_v_train_max_initial_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_train_max_initial_size = ((unsigned int)10); - } - if (values[16]) { - __pyx_v_train_min_gap_size = __Pyx_PyInt_AsUnsignedInt(values[16]); if (unlikely((__pyx_v_train_min_gap_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_train_min_gap_size = ((unsigned int)2); - } - if (values[17]) { - __pyx_v_tight_phrases = __Pyx_PyObject_IsTrue(values[17]); if (unlikely((__pyx_v_tight_phrases == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { + __pyx_v_self->sa_low = __pyx_v_sa_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":324 - * unsigned train_min_gap_size=2, - * # False if phrases should be loose (better but slower), True otherwise - * bint tight_phrases=True, # <<<<<<<<<<<<<< - * # True to require use of double-binary alg, false otherwise - * bint use_baeza_yates=True, + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":124 + * arr=None, int num_subpatterns=1): + * self.sa_low = sa_low + * self.sa_high = sa_high # <<<<<<<<<<<<<< + * self.arr_low = arr_low + * self.arr_high = arr_high */ - __pyx_v_tight_phrases = ((int)1); - } - if (values[18]) { - __pyx_v_use_baeza_yates = __Pyx_PyObject_IsTrue(values[18]); if (unlikely((__pyx_v_use_baeza_yates == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { + __pyx_v_self->sa_high = __pyx_v_sa_high; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":326 - * bint tight_phrases=True, - * # True to require use of double-binary alg, false otherwise - * bint use_baeza_yates=True, # <<<<<<<<<<<<<< - * # True to enable used of precomputed collocations - * bint use_collocations=True, + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":125 + * self.sa_low = sa_low + * self.sa_high = sa_high + * self.arr_low = arr_low # <<<<<<<<<<<<<< + * self.arr_high = arr_high + * self.arr = arr */ - __pyx_v_use_baeza_yates = ((int)1); - } - if (values[19]) { - __pyx_v_use_collocations = __Pyx_PyObject_IsTrue(values[19]); if (unlikely((__pyx_v_use_collocations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { + __pyx_v_self->arr_low = __pyx_v_arr_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":328 - * bint use_baeza_yates=True, - * # True to enable used of precomputed collocations - * bint use_collocations=True, # <<<<<<<<<<<<<< - * # True to enable use of precomputed inverted indices - * bint use_index=True): + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":126 + * self.sa_high = sa_high + * self.arr_low = arr_low + * self.arr_high = arr_high # <<<<<<<<<<<<<< + * self.arr = arr + * self.num_subpatterns = num_subpatterns */ - __pyx_v_use_collocations = ((int)1); - } - if (values[20]) { - __pyx_v_use_index = __Pyx_PyObject_IsTrue(values[20]); if (unlikely((__pyx_v_use_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { + __pyx_v_self->arr_high = __pyx_v_arr_high; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":330 - * bint use_collocations=True, - * # True to enable use of precomputed inverted indices - * bint use_index=True): # <<<<<<<<<<<<<< - * '''Note: we make a distinction between the min_gap_size - * and max_initial_size used in test and train. The latter + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":127 + * self.arr_low = arr_low + * self.arr_high = arr_high + * self.arr = arr # <<<<<<<<<<<<<< + * self.num_subpatterns = num_subpatterns + * */ - __pyx_v_use_index = ((int)1); + if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_arr); + __Pyx_GIVEREF(__pyx_v_arr); + __Pyx_GOTREF(__pyx_v_self->arr); + __Pyx_DECREF(((PyObject *)__pyx_v_self->arr)); + __pyx_v_self->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":128 + * self.arr_high = arr_high + * self.arr = arr + * self.num_subpatterns = num_subpatterns # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->num_subpatterns = __pyx_v_num_subpatterns; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_sample_size; + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sample_size,&__pyx_n_s__fsarray,0}; + PyObject* values[2] = {0,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__sample_size)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } + __pyx_v_sample_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_sample_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_fsarray = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 21, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alignment), __pyx_ptype_3_sa_Alignment, 1, "alignment", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_alignment, __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); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)__pyx_v_self), __pyx_v_sample_size, __pyx_v_fsarray); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -39818,1235 +39630,2175 @@ static int __pyx_pw_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_ return __pyx_r; } -/* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9__cinit___lambda1(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_9__cinit___lambda1 = {__Pyx_NAMESTR("lambda1"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_9__cinit___lambda1, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9__cinit___lambda1(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_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":406 - * self.phrases_f = defaultdict(int) - * self.phrases_e = defaultdict(int) - * self.phrases_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< - * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":138 + * cdef IntList sa * + * def __cinit__(self, int sample_size, SuffixArray fsarray): # <<<<<<<<<<<<<< + * self.sample_size = sample_size + * self.sa = fsarray.sa */ -static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_self, int __pyx_v_sample_size, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray) { + int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; 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_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 406; __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 = 406; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 406; __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; - goto __pyx_L0; + __Pyx_RefNannySetupContext("__cinit__", 0); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.__cinit__.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":139 + * + * def __cinit__(self, int sample_size, SuffixArray fsarray): + * self.sample_size = sample_size # <<<<<<<<<<<<<< + * self.sa = fsarray.sa + * if sample_size > 0: + */ + __pyx_v_self->sample_size = __pyx_v_sample_size; -/* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9__cinit___1lambda2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_9__cinit___1lambda2 = {__Pyx_NAMESTR("lambda2"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_9__cinit___1lambda2, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9__cinit___1lambda2(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_RefNannyFinishContext(); - return __pyx_r; -} + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":140 + * def __cinit__(self, int sample_size, SuffixArray fsarray): + * self.sample_size = sample_size + * self.sa = fsarray.sa # <<<<<<<<<<<<<< + * if sample_size > 0: + * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) + */ + __pyx_t_1 = ((PyObject *)__pyx_v_fsarray->sa); + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); + __pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":407 - * self.phrases_e = defaultdict(int) - * self.phrases_fe = defaultdict(lambda: defaultdict(int)) - * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) # <<<<<<<<<<<<<< - * - * # Bilexical counts + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":141 + * self.sample_size = sample_size + * self.sa = fsarray.sa + * if sample_size > 0: # <<<<<<<<<<<<<< + * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) + * else: */ + __pyx_t_2 = ((__pyx_v_sample_size > 0) != 0); + if (__pyx_t_2) { -static PyObject *__pyx_lambda_funcdef_lambda2(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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("lambda2", 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 = 407; __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 = 407; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 407; __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; - goto __pyx_L0; + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":142 + * 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 = 142; __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_sample_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 142; __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_104)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_104)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_104)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __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[8]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } + /*else*/ { - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":144 + * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) + * else: + * logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<< + * + * def sample(self, PhraseLocation phrase_location): + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __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_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __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; + } + __pyx_L3:; + + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.__cinit__.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9__cinit___2lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_9__cinit___2lambda3 = {__Pyx_NAMESTR("lambda3"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_9__cinit___2lambda3, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9__cinit___2lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_7Sampler_2sample[] = "Returns a sample of the locations for\n the phrase. If there are less than self.sample_size\n locations, return all of them; otherwise, return\n up to self.sample_size locations. In the latter case,\n we choose to sample UNIFORMLY -- that is, the locations\n are chosen at uniform intervals over the entire set, rather\n than randomly. This makes the algorithm deterministic, which\n is good for things like MERT"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location) { + 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("lambda3 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":412 - * self.bilex_f = defaultdict(int) - * self.bilex_e = defaultdict(int) - * self.bilex_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< - * - * def configure(self, SuffixArray fsarray, DataArray edarray, - */ - -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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 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 = 412; __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 = 412; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 412; __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; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_RefNannySetupContext("sample (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_phrase_location), __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation, 1, "phrase_location", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)__pyx_v_self), ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_v_phrase_location)); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.__cinit__.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":288 - * cdef bilex_fe +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":146 + * logger.info("Sampling strategy: no sampling") * - * def __cinit__(self, # <<<<<<<<<<<<<< - * # compiled alignment object (REQUIRED) - * Alignment alignment, + * def sample(self, PhraseLocation phrase_location): # <<<<<<<<<<<<<< + * '''Returns a sample of the locations for + * the phrase. If there are less than self.sample_size */ -static int __pyx_pf_3_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_Alignment *__pyx_v_alignment, float __pyx_v_by_slack_factor, char *__pyx_v_category, PyObject *__pyx_v_max_chunks, unsigned int __pyx_v_max_initial_size, unsigned int __pyx_v_max_length, unsigned int __pyx_v_max_nonterminals, PyObject *__pyx_v_max_target_chunks, PyObject *__pyx_v_max_target_length, unsigned int __pyx_v_min_gap_size, PyObject *__pyx_v_precompute_file, unsigned int __pyx_v_precompute_secondary_rank, unsigned int __pyx_v_precompute_rank, int __pyx_v_require_aligned_terminal, int __pyx_v_require_aligned_chunks, unsigned int __pyx_v_train_max_initial_size, unsigned int __pyx_v_train_min_gap_size, int __pyx_v_tight_phrases, int __pyx_v_use_baeza_yates, int __pyx_v_use_collocations, int __pyx_v_use_index) { - int __pyx_r; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_phrase_location) { + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_sample = 0; + double __pyx_v_i; + double __pyx_v_stepsize; + int __pyx_v_num_locations; + int __pyx_v_val; + int __pyx_v_j; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_RefNannySetupContext("sample", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":336 - * 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 # <<<<<<<<<<<<<< - * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) - * if alignment is None: + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":159 + * cdef int num_locations, val, j + * + * sample = IntList() # <<<<<<<<<<<<<< + * if phrase_location.arr is None: + * num_locations = phrase_location.sa_high - phrase_location.sa_low */ - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 336; __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 = 336; __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_3_sa_TrieTable)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->rules); - __Pyx_DECREF(((PyObject *)__pyx_v_self->rules)); - __pyx_v_self->rules = ((struct __pyx_obj_3_sa_TrieTable *)__pyx_t_1); + __pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":337 - * them to be the same, therefore we don't either.''' - * self.rules = TrieTable(True) # cache - * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) # <<<<<<<<<<<<<< - * if alignment is None: - * raise Exception("Must specify an alignment object") + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":160 + * + * sample = IntList() + * 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: */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->rules->root); - __Pyx_DECREF(__pyx_v_self->rules->root); - __pyx_v_self->rules->root = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2 = (((PyObject *)__pyx_v_phrase_location->arr) == Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":338 - * self.rules = TrieTable(True) # cache - * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) - * if alignment is None: # <<<<<<<<<<<<<< - * raise Exception("Must specify an alignment object") - * self.alignment = alignment + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":161 + * sample = IntList() + * 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) */ - __pyx_t_3 = (((PyObject *)__pyx_v_alignment) == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_v_num_locations = (__pyx_v_phrase_location->sa_high - __pyx_v_phrase_location->sa_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":339 - * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) - * if alignment is None: - * raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<< - * self.alignment = alignment - * + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":162 + * 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_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 339; __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[8]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; + __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; + } else { + __pyx_t_4 = __pyx_t_3; + } + if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":340 - * if alignment is None: - * raise Exception("Must specify an alignment object") - * self.alignment = alignment # <<<<<<<<<<<<<< - * - * # grammar parameters and settings + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":163 + * 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: + * stepsize = float(num_locations)/float(self.sample_size) */ - __Pyx_INCREF(((PyObject *)__pyx_v_alignment)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_alignment)); - __Pyx_GOTREF(__pyx_v_self->alignment); - __Pyx_DECREF(((PyObject *)__pyx_v_self->alignment)); - __pyx_v_self->alignment = __pyx_v_alignment; + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_extend_arr(__pyx_v_sample, (__pyx_v_self->sa->arr + __pyx_v_phrase_location->sa_low), __pyx_v_num_locations); + goto __pyx_L4; + } + /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":344 - * # grammar parameters and settings - * # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero - * self.max_length = max_length # <<<<<<<<<<<<<< - * self.max_nonterminals = max_nonterminals - * self.max_initial_size = max_initial_size + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":165 + * sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations) + * 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: */ - __pyx_v_self->max_length = __pyx_v_max_length; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":345 - * # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero - * self.max_length = max_length - * self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<< - * self.max_initial_size = max_initial_size - * self.train_max_initial_size = train_max_initial_size - */ - __pyx_v_self->max_nonterminals = __pyx_v_max_nonterminals; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":346 - * self.max_length = max_length - * self.max_nonterminals = max_nonterminals - * self.max_initial_size = max_initial_size # <<<<<<<<<<<<<< - * self.train_max_initial_size = train_max_initial_size - * self.min_gap_size = min_gap_size - */ - __pyx_v_self->max_initial_size = __pyx_v_max_initial_size; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":347 - * self.max_nonterminals = max_nonterminals - * self.max_initial_size = max_initial_size - * 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 - */ - __pyx_v_self->train_max_initial_size = __pyx_v_train_max_initial_size; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":348 - * self.max_initial_size = max_initial_size - * 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 - * self.category = sym_fromstring(category, False) - */ - __pyx_v_self->min_gap_size = __pyx_v_min_gap_size; + if (unlikely(((double)__pyx_v_self->sample_size) == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":349 - * 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 # <<<<<<<<<<<<<< - * self.category = sym_fromstring(category, False) - * + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":166 + * 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_v_self->train_min_gap_size = __pyx_v_train_min_gap_size; + __pyx_t_5 = __pyx_v_phrase_location->sa_low; + __pyx_v_i = __pyx_t_5; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":350 - * self.min_gap_size = min_gap_size - * self.train_min_gap_size = train_min_gap_size - * self.category = sym_fromstring(category, False) # <<<<<<<<<<<<<< - * - * if max_chunks is None: + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":167 + * 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 + * effect, according to the python documentation''' */ - __pyx_v_self->category = __pyx_f_3_sa_sym_fromstring(__pyx_v_category, 0); + 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; + } else { + __pyx_t_2 = __pyx_t_4; + } + if (!__pyx_t_2) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":352 - * self.category = sym_fromstring(category, False) - * - * if max_chunks is None: # <<<<<<<<<<<<<< - * self.max_chunks = self.max_nonterminals + 1 - * else: + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":170 + * '''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 = (__pyx_v_max_chunks == Py_None); - __pyx_t_3 = (__pyx_t_4 != 0); - if (__pyx_t_3) { + __pyx_t_2 = ((fmod(__pyx_v_i, 1.0) > 0.5) != 0); + if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":353 - * - * if max_chunks is None: - * self.max_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<< - * else: - * self.max_chunks = max_chunks + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":171 + * effect, according to the python documentation''' + * if fmod(i,1.0) > 0.5: + * val = int(ceil(i)) # <<<<<<<<<<<<<< + * else: + * val = int(floor(i)) */ - __pyx_v_self->max_chunks = (__pyx_v_self->max_nonterminals + 1); - goto __pyx_L4; - } - /*else*/ { + __pyx_v_val = ((int)ceil(__pyx_v_i)); + goto __pyx_L7; + } + /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":355 - * self.max_chunks = self.max_nonterminals + 1 - * else: - * self.max_chunks = max_chunks # <<<<<<<<<<<<<< - * - * if max_target_chunks is None: + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":173 + * val = int(ceil(i)) + * else: + * val = int(floor(i)) # <<<<<<<<<<<<<< + * sample._append(self.sa.arr[val]) + * i = i + stepsize */ - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_chunks); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->max_chunks = __pyx_t_5; - } - __pyx_L4:; + __pyx_v_val = ((int)floor(__pyx_v_i)); + } + __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":357 - * self.max_chunks = max_chunks - * - * if max_target_chunks is None: # <<<<<<<<<<<<<< - * self.max_target_chunks = self.max_nonterminals + 1 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":174 + * else: + * val = int(floor(i)) + * sample._append(self.sa.arr[val]) # <<<<<<<<<<<<<< + * i = i + stepsize * else: */ - __pyx_t_3 = (__pyx_v_max_target_chunks == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + ((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])); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":358 - * - * if max_target_chunks is None: - * self.max_target_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":175 + * val = int(floor(i)) + * sample._append(self.sa.arr[val]) + * i = i + stepsize # <<<<<<<<<<<<<< * else: - * self.max_target_chunks = max_target_chunks + * num_locations = (phrase_location.arr_high - phrase_location.arr_low) / phrase_location.num_subpatterns */ - __pyx_v_self->max_target_chunks = (__pyx_v_self->max_nonterminals + 1); - goto __pyx_L5; + __pyx_v_i = (__pyx_v_i + __pyx_v_stepsize); + } + } + __pyx_L4:; + goto __pyx_L3; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":360 - * self.max_target_chunks = self.max_nonterminals + 1 - * else: - * self.max_target_chunks = max_target_chunks # <<<<<<<<<<<<<< - * - * if max_target_length is None: - */ - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_target_chunks); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->max_target_chunks = __pyx_t_5; - } - __pyx_L5:; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":362 - * self.max_target_chunks = max_target_chunks - * - * if max_target_length is None: # <<<<<<<<<<<<<< - * self.max_target_length = max_initial_size - * else: - */ - __pyx_t_4 = (__pyx_v_max_target_length == Py_None); - __pyx_t_3 = (__pyx_t_4 != 0); - if (__pyx_t_3) { - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":363 - * - * if max_target_length is None: - * self.max_target_length = max_initial_size # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":177 + * i = i + stepsize * else: - * self.max_target_length = max_target_length + * 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_v_self->max_target_length = __pyx_v_max_initial_size; - goto __pyx_L6; - } - /*else*/ { + __pyx_t_5 = (__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(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_phrase_location->num_subpatterns == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_num_locations = __Pyx_div_int(__pyx_t_5, __pyx_v_phrase_location->num_subpatterns); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":365 - * self.max_target_length = max_initial_size + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":178 * else: - * self.max_target_length = max_target_length # <<<<<<<<<<<<<< - * - * # algorithmic parameters and settings + * 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 + * else: */ - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_target_length); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->max_target_length = __pyx_t_5; - } - __pyx_L6:; + __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; + } else { + __pyx_t_3 = __pyx_t_2; + } + if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":368 - * - * # algorithmic parameters and settings - * self.precomputed_collocations = {} # <<<<<<<<<<<<<< - * self.precomputed_index = {} - * self.use_index = use_index + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":179 + * 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 # <<<<<<<<<<<<<< + * else: + * stepsize = float(num_locations)/float(self.sample_size) */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __Pyx_GOTREF(__pyx_v_self->precomputed_collocations); - __Pyx_DECREF(__pyx_v_self->precomputed_collocations); - __pyx_v_self->precomputed_collocations = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_1 = ((PyObject *)__pyx_v_phrase_location->arr); + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_v_sample)); + __pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L8; + } + /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":369 - * # algorithmic parameters and settings - * self.precomputed_collocations = {} - * self.precomputed_index = {} # <<<<<<<<<<<<<< - * self.use_index = use_index - * self.use_collocations = use_collocations + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":181 + * sample = phrase_location.arr + * 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: */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __Pyx_GOTREF(__pyx_v_self->precomputed_index); - __Pyx_DECREF(__pyx_v_self->precomputed_index); - __pyx_v_self->precomputed_index = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; + if (unlikely(((double)__pyx_v_self->sample_size) == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":370 - * self.precomputed_collocations = {} - * self.precomputed_index = {} - * self.use_index = use_index # <<<<<<<<<<<<<< - * self.use_collocations = use_collocations - * self.max_rank = {} + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":182 + * 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_v_self->use_index = __pyx_v_use_index; + __pyx_t_5 = __pyx_v_phrase_location->arr_low; + __pyx_v_i = __pyx_t_5; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":371 - * self.precomputed_index = {} - * self.use_index = use_index - * self.use_collocations = use_collocations # <<<<<<<<<<<<<< - * self.max_rank = {} - * self.precompute_file = precompute_file + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":183 + * 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 + * effect, according to the python documentation''' */ - __pyx_v_self->use_collocations = __pyx_v_use_collocations; + 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; + } else { + __pyx_t_4 = __pyx_t_3; + } + if (!__pyx_t_4) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":372 - * self.use_index = use_index - * self.use_collocations = use_collocations - * self.max_rank = {} # <<<<<<<<<<<<<< - * self.precompute_file = precompute_file - * self.precompute_rank = precompute_rank + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":186 + * '''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 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __Pyx_GOTREF(__pyx_v_self->max_rank); - __Pyx_DECREF(__pyx_v_self->max_rank); - __pyx_v_self->max_rank = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_4 = ((fmod(__pyx_v_i, 1.0) > 0.5) != 0); + if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":373 - * self.use_collocations = use_collocations - * self.max_rank = {} - * self.precompute_file = precompute_file # <<<<<<<<<<<<<< - * self.precompute_rank = precompute_rank - * self.precompute_secondary_rank = precompute_secondary_rank + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":187 + * effect, according to the python documentation''' + * if fmod(i,1.0) > 0.5: + * val = int(ceil(i)) # <<<<<<<<<<<<<< + * else: + * val = int(floor(i)) */ - __Pyx_INCREF(__pyx_v_precompute_file); - __Pyx_GIVEREF(__pyx_v_precompute_file); - __Pyx_GOTREF(__pyx_v_self->precompute_file); - __Pyx_DECREF(__pyx_v_self->precompute_file); - __pyx_v_self->precompute_file = __pyx_v_precompute_file; + __pyx_v_val = ((int)ceil(__pyx_v_i)); + goto __pyx_L11; + } + /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":374 - * self.max_rank = {} - * self.precompute_file = precompute_file - * self.precompute_rank = precompute_rank # <<<<<<<<<<<<<< - * self.precompute_secondary_rank = precompute_secondary_rank - * self.use_baeza_yates = use_baeza_yates + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":189 + * val = int(ceil(i)) + * else: + * 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) */ - __pyx_v_self->precompute_rank = __pyx_v_precompute_rank; + __pyx_v_val = ((int)floor(__pyx_v_i)); + } + __pyx_L11:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":375 - * self.precompute_file = precompute_file - * self.precompute_rank = precompute_rank - * self.precompute_secondary_rank = precompute_secondary_rank # <<<<<<<<<<<<<< - * self.use_baeza_yates = use_baeza_yates - * self.by_slack_factor = by_slack_factor + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":190 + * else: + * 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) + * i = i + stepsize */ - __pyx_v_self->precompute_secondary_rank = __pyx_v_precompute_secondary_rank; + __pyx_v_j = (__pyx_v_phrase_location->arr_low + (__pyx_v_val * __pyx_v_phrase_location->num_subpatterns)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":376 - * self.precompute_rank = precompute_rank - * self.precompute_secondary_rank = precompute_secondary_rank - * self.use_baeza_yates = use_baeza_yates # <<<<<<<<<<<<<< - * self.by_slack_factor = by_slack_factor - * self.tight_phrases = tight_phrases + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":191 + * 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) # <<<<<<<<<<<<<< + * i = i + stepsize + * return sample */ - __pyx_v_self->use_baeza_yates = __pyx_v_use_baeza_yates; + ((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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":377 - * self.precompute_secondary_rank = precompute_secondary_rank - * self.use_baeza_yates = use_baeza_yates - * self.by_slack_factor = by_slack_factor # <<<<<<<<<<<<<< - * self.tight_phrases = tight_phrases + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":192 + * 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 # <<<<<<<<<<<<<< + * return sample * */ - __pyx_v_self->by_slack_factor = __pyx_v_by_slack_factor; + __pyx_v_i = (__pyx_v_i + __pyx_v_stepsize); + } + } + __pyx_L8:; + } + __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":378 - * self.use_baeza_yates = use_baeza_yates - * self.by_slack_factor = by_slack_factor - * self.tight_phrases = tight_phrases # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":193 + * sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns) + * i = i + stepsize + * return sample # <<<<<<<<<<<<<< + * * - * if require_aligned_chunks: */ - __pyx_v_self->tight_phrases = __pyx_v_tight_phrases; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_sample)); + __pyx_r = ((PyObject *)__pyx_v_sample); + goto __pyx_L0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":380 - * self.tight_phrases = tight_phrases + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.Sampler.sample", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_sample); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":205 * - * if require_aligned_chunks: # <<<<<<<<<<<<<< - * # one condition is a stronger version of the other. - * self.require_aligned_chunks = self.require_aligned_terminal = True + * + * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): # <<<<<<<<<<<<<< + * m.arr = arr + * m.start = start */ - __pyx_t_3 = (__pyx_v_require_aligned_chunks != 0); - if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":382 - * if require_aligned_chunks: - * # one condition is a stronger version of the other. - * self.require_aligned_chunks = self.require_aligned_terminal = True # <<<<<<<<<<<<<< - * elif require_aligned_terminal: - * self.require_aligned_chunks = False - */ - __pyx_v_self->require_aligned_chunks = 1; - __pyx_v_self->require_aligned_terminal = 1; - goto __pyx_L7; - } +static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_m, int *__pyx_v_arr, int __pyx_v_start, int __pyx_v_step, int *__pyx_v_sent_id_arr) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("assign_matching", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":383 - * # one condition is a stronger version of the other. - * self.require_aligned_chunks = self.require_aligned_terminal = True - * elif require_aligned_terminal: # <<<<<<<<<<<<<< - * self.require_aligned_chunks = False - * self.require_aligned_terminal = True + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":206 + * + * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): + * m.arr = arr # <<<<<<<<<<<<<< + * m.start = start + * m.end = start + step */ - __pyx_t_3 = (__pyx_v_require_aligned_terminal != 0); - if (__pyx_t_3) { + __pyx_v_m->arr = __pyx_v_arr; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":384 - * self.require_aligned_chunks = self.require_aligned_terminal = True - * elif require_aligned_terminal: - * self.require_aligned_chunks = False # <<<<<<<<<<<<<< - * self.require_aligned_terminal = True - * else: + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":207 + * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): + * m.arr = arr + * m.start = start # <<<<<<<<<<<<<< + * m.end = start + step + * m.sent_id = sent_id_arr[arr[start]] */ - __pyx_v_self->require_aligned_chunks = 0; + __pyx_v_m->start = __pyx_v_start; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":385 - * elif require_aligned_terminal: - * self.require_aligned_chunks = False - * self.require_aligned_terminal = True # <<<<<<<<<<<<<< - * else: - * self.require_aligned_chunks = self.require_aligned_terminal = False + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":208 + * m.arr = arr + * m.start = start + * m.end = start + step # <<<<<<<<<<<<<< + * m.sent_id = sent_id_arr[arr[start]] + * m.size = step */ - __pyx_v_self->require_aligned_terminal = 1; - goto __pyx_L7; - } - /*else*/ { + __pyx_v_m->end = (__pyx_v_start + __pyx_v_step); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":387 - * self.require_aligned_terminal = True - * else: - * self.require_aligned_chunks = self.require_aligned_terminal = False # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":209 + * m.start = start + * m.end = start + step + * m.sent_id = sent_id_arr[arr[start]] # <<<<<<<<<<<<<< + * m.size = step * - * # diagnostics */ - __pyx_v_self->require_aligned_chunks = 0; - __pyx_v_self->require_aligned_terminal = 0; - } - __pyx_L7:; + __pyx_v_m->sent_id = (__pyx_v_sent_id_arr[(__pyx_v_arr[__pyx_v_start])]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":390 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":210 + * m.end = start + step + * m.sent_id = sent_id_arr[arr[start]] + * m.size = step # <<<<<<<<<<<<<< * - * # diagnostics - * self.prev_norm_prefix = () # <<<<<<<<<<<<<< * - * self.findexes = IntList(initial_len=10) */ - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); - __Pyx_GOTREF(__pyx_v_self->prev_norm_prefix); - __Pyx_DECREF(__pyx_v_self->prev_norm_prefix); - __pyx_v_self->prev_norm_prefix = ((PyObject *)__pyx_empty_tuple); + __pyx_v_m->size = __pyx_v_step; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":392 - * self.prev_norm_prefix = () + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":213 * - * self.findexes = IntList(initial_len=10) # <<<<<<<<<<<<<< - * self.findexes1 = IntList(initial_len=10) * + * cdef int* append_combined_matching(int* arr, Matching* loc1, Matching* loc2, # <<<<<<<<<<<<<< + * int offset_by_one, int num_subpatterns, int* result_len): + * cdef int i, new_len */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->findexes); - __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes)); - __pyx_v_self->findexes = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":393 - * - * self.findexes = IntList(initial_len=10) - * self.findexes1 = IntList(initial_len=10) # <<<<<<<<<<<<<< - * - * # Online stats - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->findexes1); - __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes1)); - __pyx_v_self->findexes1 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; +static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc1, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc2, CYTHON_UNUSED int __pyx_v_offset_by_one, int __pyx_v_num_subpatterns, int *__pyx_v_result_len) { + int __pyx_v_i; + int __pyx_v_new_len; + int *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("append_combined_matching", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":398 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":217 + * cdef int i, new_len * - * # True after data is added - * self.online = False # <<<<<<<<<<<<<< + * new_len = result_len[0] + num_subpatterns # <<<<<<<<<<<<<< + * arr = realloc(arr, new_len*sizeof(int)) * - * # Keep track of everything that can be sampled: */ - __pyx_v_self->online = 0; + __pyx_v_new_len = ((__pyx_v_result_len[0]) + __pyx_v_num_subpatterns); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":401 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":218 * - * # Keep track of everything that can be sampled: - * self.samples_f = defaultdict(int) # <<<<<<<<<<<<<< + * new_len = result_len[0] + num_subpatterns + * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< * - * # Phrase counts + * for i from 0 <= i < loc1.size: */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 401; __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 = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_v_self->samples_f); - __Pyx_DECREF(__pyx_v_self->samples_f); - __pyx_v_self->samples_f = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":404 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":220 + * arr = realloc(arr, new_len*sizeof(int)) * - * # Phrase counts - * self.phrases_f = defaultdict(int) # <<<<<<<<<<<<<< - * self.phrases_e = defaultdict(int) - * self.phrases_fe = defaultdict(lambda: defaultdict(int)) - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->phrases_f); - __Pyx_DECREF(__pyx_v_self->phrases_f); - __pyx_v_self->phrases_f = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":405 - * # 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)) + * for i from 0 <= i < loc1.size: # <<<<<<<<<<<<<< + * arr[result_len[0]+i] = loc1.arr[loc1.start+i] + * if num_subpatterns > loc1.size: */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 405; __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 = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_v_self->phrases_e); - __Pyx_DECREF(__pyx_v_self->phrases_e); - __pyx_v_self->phrases_e = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_1 = __pyx_v_loc1->size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":406 - * self.phrases_f = defaultdict(int) - * self.phrases_e = defaultdict(int) - * self.phrases_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< - * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":221 * + * for i from 0 <= i < loc1.size: + * arr[result_len[0]+i] = loc1.arr[loc1.start+i] # <<<<<<<<<<<<<< + * if num_subpatterns > loc1.size: + * arr[new_len-1] = loc2.arr[loc2.end-1] */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_9__cinit___lambda1, 0, __pyx_n_s_110, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 406; __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 = 406; __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(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__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_1; - __pyx_t_1 = 0; + (__pyx_v_arr[((__pyx_v_result_len[0]) + __pyx_v_i)]) = (__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]); + } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":407 - * self.phrases_e = defaultdict(int) - * self.phrases_fe = defaultdict(lambda: defaultdict(int)) - * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) # <<<<<<<<<<<<<< - * - * # Bilexical counts + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":222 + * for i from 0 <= i < loc1.size: + * arr[result_len[0]+i] = loc1.arr[loc1.start+i] + * if num_subpatterns > loc1.size: # <<<<<<<<<<<<<< + * arr[new_len-1] = loc2.arr[loc2.end-1] + * result_len[0] = new_len */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_9__cinit___1lambda2, 0, __pyx_n_s_110, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 407; __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[8]; __pyx_lineno = 407; __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); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 407; __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_6)); __pyx_t_6 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->phrases_al); - __Pyx_DECREF(__pyx_v_self->phrases_al); - __pyx_v_self->phrases_al = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2 = ((__pyx_v_num_subpatterns > __pyx_v_loc1->size) != 0); + if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":410 - * - * # Bilexical counts - * self.bilex_f = defaultdict(int) # <<<<<<<<<<<<<< - * self.bilex_e = defaultdict(int) - * self.bilex_fe = defaultdict(lambda: defaultdict(int)) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":223 + * arr[result_len[0]+i] = loc1.arr[loc1.start+i] + * if num_subpatterns > loc1.size: + * arr[new_len-1] = loc2.arr[loc2.end-1] # <<<<<<<<<<<<<< + * result_len[0] = new_len + * return arr */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __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[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->bilex_f); - __Pyx_DECREF(__pyx_v_self->bilex_f); - __pyx_v_self->bilex_f = __pyx_t_1; - __pyx_t_1 = 0; + (__pyx_v_arr[(__pyx_v_new_len - 1)]) = (__pyx_v_loc2->arr[(__pyx_v_loc2->end - 1)]); + goto __pyx_L5; + } + __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":411 - * # Bilexical counts - * self.bilex_f = defaultdict(int) - * self.bilex_e = defaultdict(int) # <<<<<<<<<<<<<< - * self.bilex_fe = defaultdict(lambda: defaultdict(int)) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":224 + * if num_subpatterns > loc1.size: + * arr[new_len-1] = loc2.arr[loc2.end-1] + * result_len[0] = new_len # <<<<<<<<<<<<<< + * return arr * */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __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_6)); __pyx_t_6 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->bilex_e); - __Pyx_DECREF(__pyx_v_self->bilex_e); - __pyx_v_self->bilex_e = __pyx_t_2; - __pyx_t_2 = 0; + (__pyx_v_result_len[0]) = __pyx_v_new_len; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":412 - * self.bilex_f = defaultdict(int) - * self.bilex_e = defaultdict(int) - * self.bilex_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":225 + * arr[new_len-1] = loc2.arr[loc2.end-1] + * result_len[0] = new_len + * return arr # <<<<<<<<<<<<<< + * * - * 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 = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_9__cinit___2lambda3, 0, __pyx_n_s_110, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_v_self->bilex_fe); - __Pyx_DECREF(__pyx_v_self->bilex_fe); - __pyx_v_self->bilex_fe = __pyx_t_6; - __pyx_t_6 = 0; - - __pyx_r = 0; + __pyx_r = __pyx_v_arr; goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -/* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3_sa_23HieroCachingRuleFactory_2configure[] = "This gives the RuleFactory access to the Context object.\n Here we also use it to precompute the most expensive intersections\n in the corpus quickly."; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray = 0; - struct __pyx_obj_3_sa_DataArray *__pyx_v_edarray = 0; - struct __pyx_obj_3_sa_Sampler *__pyx_v_sampler = 0; - struct __pyx_obj_3_sa_Scorer *__pyx_v_scorer = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("configure (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__edarray,&__pyx_n_s__sampler,&__pyx_n_s__scorer,0}; - PyObject* values[4] = {0,0,0,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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__fsarray)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__edarray)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sampler)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scorer)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "configure") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_fsarray = ((struct __pyx_obj_3_sa_SuffixArray *)values[0]); - __pyx_v_edarray = ((struct __pyx_obj_3_sa_DataArray *)values[1]); - __pyx_v_sampler = ((struct __pyx_obj_3_sa_Sampler *)values[2]); - __pyx_v_scorer = ((struct __pyx_obj_3_sa_Scorer *)values[3]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_edarray), __pyx_ptype_3_sa_DataArray, 1, "edarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sampler), __pyx_ptype_3_sa_Sampler, 1, "sampler", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scorer), __pyx_ptype_3_sa_Scorer, 1, "scorer", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_2configure(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_edarray, __pyx_v_sampler, __pyx_v_scorer); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; + __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":414 - * self.bilex_fe = defaultdict(lambda: defaultdict(int)) +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":228 + * + * + * cdef int* extend_arr(int* arr, int* arr_len, int* appendix, int appendix_len): # <<<<<<<<<<<<<< + * cdef int new_len * - * def configure(self, SuffixArray fsarray, DataArray edarray, # <<<<<<<<<<<<<< - * Sampler sampler, Scorer scorer): - * '''This gives the RuleFactory access to the Context object. */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_2configure(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_SuffixArray *__pyx_v_fsarray, struct __pyx_obj_3_sa_DataArray *__pyx_v_edarray, struct __pyx_obj_3_sa_Sampler *__pyx_v_sampler, struct __pyx_obj_3_sa_Scorer *__pyx_v_scorer) { - PyObject *__pyx_r = NULL; +static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int *__pyx_v_appendix, int __pyx_v_appendix_len) { + int __pyx_v_new_len; + int *__pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("configure", 0); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":419 - * Here we also use it to precompute the most expensive intersections - * in the corpus quickly.''' - * self.fsa = fsarray # <<<<<<<<<<<<<< - * self.fda = fsarray.darray - * self.eda = edarray - */ - __Pyx_INCREF(((PyObject *)__pyx_v_fsarray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fsarray)); - __Pyx_GOTREF(__pyx_v_self->fsa); - __Pyx_DECREF(((PyObject *)__pyx_v_self->fsa)); - __pyx_v_self->fsa = __pyx_v_fsarray; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":420 - * in the corpus quickly.''' - * self.fsa = fsarray - * self.fda = fsarray.darray # <<<<<<<<<<<<<< - * self.eda = edarray - * self.fid2symid = self.set_idmap(self.fda) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_fsarray->darray); - __Pyx_INCREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->fda); - __Pyx_DECREF(((PyObject *)__pyx_v_self->fda)); - __pyx_v_self->fda = ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":421 - * self.fsa = fsarray - * self.fda = fsarray.darray - * self.eda = edarray # <<<<<<<<<<<<<< - * self.fid2symid = self.set_idmap(self.fda) - * self.eid2symid = self.set_idmap(self.eda) - */ - __Pyx_INCREF(((PyObject *)__pyx_v_edarray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_edarray)); - __Pyx_GOTREF(__pyx_v_self->eda); - __Pyx_DECREF(((PyObject *)__pyx_v_self->eda)); - __pyx_v_self->eda = __pyx_v_edarray; + __Pyx_RefNannySetupContext("extend_arr", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":422 - * self.fda = fsarray.darray - * self.eda = edarray - * self.fid2symid = self.set_idmap(self.fda) # <<<<<<<<<<<<<< - * self.eid2symid = self.set_idmap(self.eda) - * self.precompute() + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":231 + * cdef int new_len + * + * new_len = arr_len[0] + appendix_len # <<<<<<<<<<<<<< + * arr = realloc(arr, new_len*sizeof(int)) + * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->fda); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->fid2symid); - __Pyx_DECREF(((PyObject *)__pyx_v_self->fid2symid)); - __pyx_v_self->fid2symid = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_appendix_len); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":423 - * self.eda = edarray - * self.fid2symid = self.set_idmap(self.fda) - * self.eid2symid = self.set_idmap(self.eda) # <<<<<<<<<<<<<< - * self.precompute() - * self.sampler = sampler + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":232 + * + * new_len = arr_len[0] + appendix_len + * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< + * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) + * arr_len[0] = new_len */ - __pyx_t_2 = ((PyObject *)__pyx_v_self->eda); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_3_sa_DataArray *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->eid2symid); - __Pyx_DECREF(((PyObject *)__pyx_v_self->eid2symid)); - __pyx_v_self->eid2symid = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":424 - * self.fid2symid = self.set_idmap(self.fda) - * self.eid2symid = self.set_idmap(self.eda) - * self.precompute() # <<<<<<<<<<<<<< - * self.sampler = sampler - * self.scorer = scorer + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":233 + * new_len = arr_len[0] + appendix_len + * arr = realloc(arr, new_len*sizeof(int)) + * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) # <<<<<<<<<<<<<< + * arr_len[0] = new_len + * return arr */ - __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 = 424; __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[8]; __pyx_lineno = 424; __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; + memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_appendix, (__pyx_v_appendix_len * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":425 - * self.eid2symid = self.set_idmap(self.eda) - * self.precompute() - * self.sampler = sampler # <<<<<<<<<<<<<< - * self.scorer = scorer + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":234 + * arr = realloc(arr, new_len*sizeof(int)) + * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) + * arr_len[0] = new_len # <<<<<<<<<<<<<< + * return arr * */ - __Pyx_INCREF(((PyObject *)__pyx_v_sampler)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_sampler)); - __Pyx_GOTREF(__pyx_v_self->sampler); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sampler)); - __pyx_v_self->sampler = __pyx_v_sampler; + (__pyx_v_arr_len[0]) = __pyx_v_new_len; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":426 - * self.precompute() - * self.sampler = sampler - * self.scorer = scorer # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":235 + * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) + * arr_len[0] = new_len + * return arr # <<<<<<<<<<<<<< * - * cdef set_idmap(self, DataArray darray): + * cdef int median(int low, int high, int step): */ - __Pyx_INCREF(((PyObject *)__pyx_v_scorer)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_scorer)); - __Pyx_GOTREF(__pyx_v_self->scorer); - __Pyx_DECREF(((PyObject *)__pyx_v_self->scorer)); - __pyx_v_self->scorer = __pyx_v_scorer; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_v_arr; goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + + __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":428 - * self.scorer = scorer +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":237 + * return arr + * + * cdef int median(int low, int high, int step): # <<<<<<<<<<<<<< + * return low + (((high - low)/step)/2)*step * - * cdef set_idmap(self, DataArray darray): # <<<<<<<<<<<<<< - * cdef int word_id, new_word_id, N - * cdef IntList idmap */ -static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(CYTHON_UNUSED struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_DataArray *__pyx_v_darray) { - int __pyx_v_word_id; - int __pyx_v_new_word_id; - int __pyx_v_N; - struct __pyx_obj_3_sa_IntList *__pyx_v_idmap = 0; - PyObject *__pyx_r = NULL; +static int __pyx_f_4cdec_2sa_3_sa_median(int __pyx_v_low, int __pyx_v_high, int __pyx_v_step) { + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - char *__pyx_t_5; + int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("set_idmap", 0); + __Pyx_RefNannySetupContext("median", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":432 - * cdef IntList idmap + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":238 + * + * cdef int median(int low, int high, int step): + * return low + (((high - low)/step)/2)*step # <<<<<<<<<<<<<< + * * - * N = len(darray.id2word) # <<<<<<<<<<<<<< - * idmap = IntList(initial_len=N) - * for word_id from 0 <= word_id < N: */ - __pyx_t_1 = __pyx_v_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[8]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_N = __pyx_t_2; + __pyx_t_1 = (__pyx_v_high - __pyx_v_low); + if (unlikely(__pyx_v_step == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_step == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_1))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_r = (__pyx_v_low + (__Pyx_div_long(__Pyx_div_int(__pyx_t_1, __pyx_v_step), 2) * __pyx_v_step)); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("cdec.sa._sa.median", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":433 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":241 * - * N = len(darray.id2word) - * idmap = IntList(initial_len=N) # <<<<<<<<<<<<<< - * for word_id from 0 <= word_id < N: - * new_word_id = sym_fromstring(darray.id2word[word_id], True) + * + * cdef void find_comparable_matchings(int low, int high, int* arr, int step, int loc, int* loc_minus, int* loc_plus): # <<<<<<<<<<<<<< + * # Returns (minus, plus) indices for the portion of the array + * # in which all matchings have the same first index as the one */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_idmap = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); - __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":434 - * N = len(darray.id2word) - * idmap = IntList(initial_len=N) - * 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 +static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_high, int *__pyx_v_arr, int __pyx_v_step, int __pyx_v_loc, int *__pyx_v_loc_minus, int *__pyx_v_loc_plus) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("find_comparable_matchings", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":245 + * # in which all matchings have the same first index as the one + * # starting at loc + * loc_plus[0] = loc + step # <<<<<<<<<<<<<< + * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: + * loc_plus[0] = loc_plus[0] + step */ - __pyx_t_4 = __pyx_v_N; - for (__pyx_v_word_id = 0; __pyx_v_word_id < __pyx_t_4; __pyx_v_word_id++) { + (__pyx_v_loc_plus[0]) = (__pyx_v_loc + __pyx_v_step); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":435 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":246 + * # starting at loc + * loc_plus[0] = loc + step + * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: # <<<<<<<<<<<<<< + * loc_plus[0] = loc_plus[0] + step + * 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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (!__pyx_t_3) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":247 + * loc_plus[0] = loc + step + * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: + * 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]: + */ + (__pyx_v_loc_plus[0]) = ((__pyx_v_loc_plus[0]) + __pyx_v_step); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":248 + * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: + * 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]: + * loc_minus[0] = loc_minus[0] - step + */ + (__pyx_v_loc_minus[0]) = __pyx_v_loc; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":249 + * 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]: # <<<<<<<<<<<<<< + * loc_minus[0] = loc_minus[0] - step + * + */ + 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; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (!__pyx_t_2) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":250 + * 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 # <<<<<<<<<<<<<< + * + * + */ + (__pyx_v_loc_minus[0]) = ((__pyx_v_loc_minus[0]) - __pyx_v_step); + } + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_alignment = 0; + float __pyx_v_by_slack_factor; + char *__pyx_v_category; + PyObject *__pyx_v_max_chunks = 0; + unsigned int __pyx_v_max_initial_size; + unsigned int __pyx_v_max_length; + unsigned int __pyx_v_max_nonterminals; + PyObject *__pyx_v_max_target_chunks = 0; + PyObject *__pyx_v_max_target_length = 0; + unsigned int __pyx_v_min_gap_size; + PyObject *__pyx_v_precompute_file = 0; + unsigned int __pyx_v_precompute_secondary_rank; + unsigned int __pyx_v_precompute_rank; + int __pyx_v_require_aligned_terminal; + int __pyx_v_require_aligned_chunks; + unsigned int __pyx_v_train_max_initial_size; + unsigned int __pyx_v_train_min_gap_size; + int __pyx_v_tight_phrases; + int __pyx_v_use_baeza_yates; + int __pyx_v_use_collocations; + int __pyx_v_use_index; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alignment,&__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_72,&__pyx_n_s__precompute_rank,&__pyx_n_s_107,&__pyx_n_s_108,&__pyx_n_s_73,&__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[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":314 + * 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, # <<<<<<<<<<<<<< + * # maximum span of a grammar rule in TEST DATA + * unsigned max_initial_size=10, + */ + values[3] = ((PyObject *)Py_None); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":322 + * 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, # <<<<<<<<<<<<<< + * # 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, + */ + values[7] = ((PyObject *)Py_None); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":324 + * 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, # <<<<<<<<<<<<<< + * # minimum span of a nonterminal in the RHS of a rule in TEST DATA + * unsigned min_gap_size=2, + */ + values[8] = ((PyObject *)Py_None); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":328 + * unsigned min_gap_size=2, + * # filename of file containing precomputed collocations + * precompute_file=None, # <<<<<<<<<<<<<< + * # maximum frequency rank of patterns used to compute triples (don't set higher than 20). + * unsigned precompute_secondary_rank=20, + */ + values[10] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); + case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); + case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); + case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); + case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); + case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); + case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__alignment)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__by_slack_factor); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__category); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_chunks); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_initial_size); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_length); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_nonterminals); + if (value) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_target_chunks); + if (value) { values[7] = value; kw_args--; } + } + case 8: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_target_length); + if (value) { values[8] = value; kw_args--; } + } + case 9: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_gap_size); + if (value) { values[9] = value; kw_args--; } + } + case 10: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__precompute_file); + if (value) { values[10] = value; kw_args--; } + } + case 11: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_72); + if (value) { values[11] = value; kw_args--; } + } + case 12: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__precompute_rank); + if (value) { values[12] = value; kw_args--; } + } + case 13: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_107); + if (value) { values[13] = value; kw_args--; } + } + case 14: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_108); + if (value) { values[14] = value; kw_args--; } + } + case 15: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_73); + if (value) { values[15] = value; kw_args--; } + } + case 16: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__train_min_gap_size); + if (value) { values[16] = value; kw_args--; } + } + case 17: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tight_phrases); + if (value) { values[17] = value; kw_args--; } + } + case 18: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_baeza_yates); + if (value) { values[18] = value; kw_args--; } + } + case 19: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_collocations); + if (value) { values[19] = value; kw_args--; } + } + case 20: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_index); + if (value) { values[20] = 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[8]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); + case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); + case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); + case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); + case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); + case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); + case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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_alignment = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)values[0]); + if (values[1]) { + __pyx_v_by_slack_factor = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_by_slack_factor == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":310 + * Alignment alignment, + * # parameter for double-binary search; doesn't seem to matter much + * float by_slack_factor=1.0, # <<<<<<<<<<<<<< + * # name of generic nonterminal used by Hiero + * char* category="[X]", + */ + __pyx_v_by_slack_factor = ((float)1.0); + } + if (values[2]) { + __pyx_v_category = __Pyx_PyObject_AsString(values[2]); if (unlikely((!__pyx_v_category) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_category = ((char *)__pyx_k_109); + } + __pyx_v_max_chunks = values[3]; + if (values[4]) { + __pyx_v_max_initial_size = __Pyx_PyInt_AsUnsignedInt(values[4]); if (unlikely((__pyx_v_max_initial_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_max_initial_size = ((unsigned int)10); + } + if (values[5]) { + __pyx_v_max_length = __Pyx_PyInt_AsUnsignedInt(values[5]); if (unlikely((__pyx_v_max_length == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_max_length = ((unsigned int)5); + } + if (values[6]) { + __pyx_v_max_nonterminals = __Pyx_PyInt_AsUnsignedInt(values[6]); if (unlikely((__pyx_v_max_nonterminals == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_max_nonterminals = ((unsigned int)2); + } + __pyx_v_max_target_chunks = values[7]; + __pyx_v_max_target_length = values[8]; + if (values[9]) { + __pyx_v_min_gap_size = __Pyx_PyInt_AsUnsignedInt(values[9]); if (unlikely((__pyx_v_min_gap_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_min_gap_size = ((unsigned int)2); + } + __pyx_v_precompute_file = values[10]; + if (values[11]) { + __pyx_v_precompute_secondary_rank = __Pyx_PyInt_AsUnsignedInt(values[11]); if (unlikely((__pyx_v_precompute_secondary_rank == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_precompute_secondary_rank = ((unsigned int)20); + } + if (values[12]) { + __pyx_v_precompute_rank = __Pyx_PyInt_AsUnsignedInt(values[12]); if (unlikely((__pyx_v_precompute_rank == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_precompute_rank = ((unsigned int)100); + } + if (values[13]) { + __pyx_v_require_aligned_terminal = __Pyx_PyObject_IsTrue(values[13]); if (unlikely((__pyx_v_require_aligned_terminal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":334 + * unsigned precompute_rank=100, + * # require extracted rules to have at least one aligned word + * bint require_aligned_terminal=True, # <<<<<<<<<<<<<< + * # require each contiguous chunk of extracted rules to have at least one aligned word + * bint require_aligned_chunks=False, + */ + __pyx_v_require_aligned_terminal = ((int)1); + } + if (values[14]) { + __pyx_v_require_aligned_chunks = __Pyx_PyObject_IsTrue(values[14]); if (unlikely((__pyx_v_require_aligned_chunks == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":336 + * bint require_aligned_terminal=True, + * # require each contiguous chunk of extracted rules to have at least one aligned word + * bint require_aligned_chunks=False, # <<<<<<<<<<<<<< + * # maximum span of a grammar rule extracted from TRAINING DATA + * unsigned train_max_initial_size=10, + */ + __pyx_v_require_aligned_chunks = ((int)0); + } + if (values[15]) { + __pyx_v_train_max_initial_size = __Pyx_PyInt_AsUnsignedInt(values[15]); if (unlikely((__pyx_v_train_max_initial_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_train_max_initial_size = ((unsigned int)10); + } + if (values[16]) { + __pyx_v_train_min_gap_size = __Pyx_PyInt_AsUnsignedInt(values[16]); if (unlikely((__pyx_v_train_min_gap_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_train_min_gap_size = ((unsigned int)2); + } + if (values[17]) { + __pyx_v_tight_phrases = __Pyx_PyObject_IsTrue(values[17]); if (unlikely((__pyx_v_tight_phrases == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":342 + * unsigned train_min_gap_size=2, + * # False if phrases should be loose (better but slower), True otherwise + * bint tight_phrases=True, # <<<<<<<<<<<<<< + * # True to require use of double-binary alg, false otherwise + * bint use_baeza_yates=True, + */ + __pyx_v_tight_phrases = ((int)1); + } + if (values[18]) { + __pyx_v_use_baeza_yates = __Pyx_PyObject_IsTrue(values[18]); if (unlikely((__pyx_v_use_baeza_yates == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":344 + * bint tight_phrases=True, + * # True to require use of double-binary alg, false otherwise + * bint use_baeza_yates=True, # <<<<<<<<<<<<<< + * # True to enable used of precomputed collocations + * bint use_collocations=True, + */ + __pyx_v_use_baeza_yates = ((int)1); + } + if (values[19]) { + __pyx_v_use_collocations = __Pyx_PyObject_IsTrue(values[19]); if (unlikely((__pyx_v_use_collocations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":346 + * bint use_baeza_yates=True, + * # True to enable used of precomputed collocations + * bint use_collocations=True, # <<<<<<<<<<<<<< + * # True to enable use of precomputed inverted indices + * bint use_index=True): + */ + __pyx_v_use_collocations = ((int)1); + } + if (values[20]) { + __pyx_v_use_index = __Pyx_PyObject_IsTrue(values[20]); if (unlikely((__pyx_v_use_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":348 + * bint use_collocations=True, + * # True to enable use of precomputed inverted indices + * bint use_index=True): # <<<<<<<<<<<<<< + * '''Note: we make a distinction between the min_gap_size + * and max_initial_size used in test and train. The latter + */ + __pyx_v_use_index = ((int)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 21, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + 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 = 308; __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_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); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":306 + * cdef online_stats + * + * def __cinit__(self, # <<<<<<<<<<<<<< + * # compiled alignment object (REQUIRED) + * Alignment alignment, + */ + +static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_alignment, float __pyx_v_by_slack_factor, char *__pyx_v_category, PyObject *__pyx_v_max_chunks, unsigned int __pyx_v_max_initial_size, unsigned int __pyx_v_max_length, unsigned int __pyx_v_max_nonterminals, PyObject *__pyx_v_max_target_chunks, PyObject *__pyx_v_max_target_length, unsigned int __pyx_v_min_gap_size, PyObject *__pyx_v_precompute_file, unsigned int __pyx_v_precompute_secondary_rank, unsigned int __pyx_v_precompute_rank, int __pyx_v_require_aligned_terminal, int __pyx_v_require_aligned_chunks, unsigned int __pyx_v_train_max_initial_size, unsigned int __pyx_v_train_min_gap_size, int __pyx_v_tight_phrases, int __pyx_v_use_baeza_yates, int __pyx_v_use_collocations, int __pyx_v_use_index) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":354 + * 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 # <<<<<<<<<<<<<< + * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) + * if alignment is None: + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 354; __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 = 354; __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_2sa_3_sa_TrieTable)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->rules); + __Pyx_DECREF(((PyObject *)__pyx_v_self->rules)); + __pyx_v_self->rules = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":355 + * them to be the same, therefore we don't either.''' + * self.rules = TrieTable(True) # cache + * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) # <<<<<<<<<<<<<< + * if alignment is None: + * raise Exception("Must specify an alignment object") + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->rules->root); + __Pyx_DECREF(__pyx_v_self->rules->root); + __pyx_v_self->rules->root = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":356 + * self.rules = TrieTable(True) # cache + * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) + * if alignment is None: # <<<<<<<<<<<<<< + * raise Exception("Must specify an alignment object") + * self.alignment = alignment + */ + __pyx_t_3 = (((PyObject *)__pyx_v_alignment) == Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":357 + * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) + * if alignment is None: + * raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<< + * self.alignment = alignment + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 357; __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[8]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":358 + * if alignment is None: + * raise Exception("Must specify an alignment object") + * self.alignment = alignment # <<<<<<<<<<<<<< + * + * # grammar parameters and settings + */ + __Pyx_INCREF(((PyObject *)__pyx_v_alignment)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_alignment)); + __Pyx_GOTREF(__pyx_v_self->alignment); + __Pyx_DECREF(((PyObject *)__pyx_v_self->alignment)); + __pyx_v_self->alignment = __pyx_v_alignment; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":362 + * # grammar parameters and settings + * # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero + * self.max_length = max_length # <<<<<<<<<<<<<< + * self.max_nonterminals = max_nonterminals + * self.max_initial_size = max_initial_size + */ + __pyx_v_self->max_length = __pyx_v_max_length; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":363 + * # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero + * self.max_length = max_length + * self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<< + * self.max_initial_size = max_initial_size + * self.train_max_initial_size = train_max_initial_size + */ + __pyx_v_self->max_nonterminals = __pyx_v_max_nonterminals; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":364 + * self.max_length = max_length + * self.max_nonterminals = max_nonterminals + * self.max_initial_size = max_initial_size # <<<<<<<<<<<<<< + * self.train_max_initial_size = train_max_initial_size + * self.min_gap_size = min_gap_size + */ + __pyx_v_self->max_initial_size = __pyx_v_max_initial_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":365 + * self.max_nonterminals = max_nonterminals + * self.max_initial_size = max_initial_size + * 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 + */ + __pyx_v_self->train_max_initial_size = __pyx_v_train_max_initial_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":366 + * self.max_initial_size = max_initial_size + * 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 + * self.category = sym_fromstring(category, False) + */ + __pyx_v_self->min_gap_size = __pyx_v_min_gap_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":367 + * 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 # <<<<<<<<<<<<<< + * self.category = sym_fromstring(category, False) + * + */ + __pyx_v_self->train_min_gap_size = __pyx_v_train_min_gap_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":368 + * self.min_gap_size = min_gap_size + * self.train_min_gap_size = train_min_gap_size + * self.category = sym_fromstring(category, False) # <<<<<<<<<<<<<< + * + * if max_chunks is None: + */ + __pyx_v_self->category = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_v_category, 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":370 + * self.category = sym_fromstring(category, False) + * + * if max_chunks is None: # <<<<<<<<<<<<<< + * self.max_chunks = self.max_nonterminals + 1 + * else: + */ + __pyx_t_4 = (__pyx_v_max_chunks == Py_None); + __pyx_t_3 = (__pyx_t_4 != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":371 + * + * if max_chunks is None: + * self.max_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<< + * else: + * self.max_chunks = max_chunks + */ + __pyx_v_self->max_chunks = (__pyx_v_self->max_nonterminals + 1); + goto __pyx_L4; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":373 + * self.max_chunks = self.max_nonterminals + 1 + * else: + * self.max_chunks = max_chunks # <<<<<<<<<<<<<< + * + * if max_target_chunks is None: + */ + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_chunks); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->max_chunks = __pyx_t_5; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":375 + * self.max_chunks = max_chunks + * + * if max_target_chunks is None: # <<<<<<<<<<<<<< + * self.max_target_chunks = self.max_nonterminals + 1 + * else: + */ + __pyx_t_3 = (__pyx_v_max_target_chunks == Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":376 + * + * if max_target_chunks is None: + * self.max_target_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<< + * else: + * self.max_target_chunks = max_target_chunks + */ + __pyx_v_self->max_target_chunks = (__pyx_v_self->max_nonterminals + 1); + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":378 + * self.max_target_chunks = self.max_nonterminals + 1 + * else: + * self.max_target_chunks = max_target_chunks # <<<<<<<<<<<<<< + * + * if max_target_length is None: + */ + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_target_chunks); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->max_target_chunks = __pyx_t_5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":380 + * self.max_target_chunks = max_target_chunks + * + * if max_target_length is None: # <<<<<<<<<<<<<< + * self.max_target_length = max_initial_size + * else: + */ + __pyx_t_4 = (__pyx_v_max_target_length == Py_None); + __pyx_t_3 = (__pyx_t_4 != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":381 + * + * if max_target_length is None: + * self.max_target_length = max_initial_size # <<<<<<<<<<<<<< + * else: + * self.max_target_length = max_target_length + */ + __pyx_v_self->max_target_length = __pyx_v_max_initial_size; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":383 + * self.max_target_length = max_initial_size + * else: + * self.max_target_length = max_target_length # <<<<<<<<<<<<<< + * + * # algorithmic parameters and settings + */ + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_target_length); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->max_target_length = __pyx_t_5; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":386 + * + * # algorithmic parameters and settings + * self.precomputed_collocations = {} # <<<<<<<<<<<<<< + * self.precomputed_index = {} + * self.use_index = use_index + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_v_self->precomputed_collocations); + __Pyx_DECREF(__pyx_v_self->precomputed_collocations); + __pyx_v_self->precomputed_collocations = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":387 + * # algorithmic parameters and settings + * self.precomputed_collocations = {} + * self.precomputed_index = {} # <<<<<<<<<<<<<< + * self.use_index = use_index + * self.use_collocations = use_collocations + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_v_self->precomputed_index); + __Pyx_DECREF(__pyx_v_self->precomputed_index); + __pyx_v_self->precomputed_index = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":388 + * self.precomputed_collocations = {} + * self.precomputed_index = {} + * self.use_index = use_index # <<<<<<<<<<<<<< + * self.use_collocations = use_collocations + * self.max_rank = {} + */ + __pyx_v_self->use_index = __pyx_v_use_index; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":389 + * self.precomputed_index = {} + * self.use_index = use_index + * self.use_collocations = use_collocations # <<<<<<<<<<<<<< + * self.max_rank = {} + * self.precompute_file = precompute_file + */ + __pyx_v_self->use_collocations = __pyx_v_use_collocations; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":390 + * self.use_index = use_index + * self.use_collocations = use_collocations + * self.max_rank = {} # <<<<<<<<<<<<<< + * self.precompute_file = precompute_file + * self.precompute_rank = precompute_rank + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_v_self->max_rank); + __Pyx_DECREF(__pyx_v_self->max_rank); + __pyx_v_self->max_rank = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":391 + * self.use_collocations = use_collocations + * self.max_rank = {} + * self.precompute_file = precompute_file # <<<<<<<<<<<<<< + * self.precompute_rank = precompute_rank + * self.precompute_secondary_rank = precompute_secondary_rank + */ + __Pyx_INCREF(__pyx_v_precompute_file); + __Pyx_GIVEREF(__pyx_v_precompute_file); + __Pyx_GOTREF(__pyx_v_self->precompute_file); + __Pyx_DECREF(__pyx_v_self->precompute_file); + __pyx_v_self->precompute_file = __pyx_v_precompute_file; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":392 + * self.max_rank = {} + * self.precompute_file = precompute_file + * self.precompute_rank = precompute_rank # <<<<<<<<<<<<<< + * self.precompute_secondary_rank = precompute_secondary_rank + * self.use_baeza_yates = use_baeza_yates + */ + __pyx_v_self->precompute_rank = __pyx_v_precompute_rank; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":393 + * self.precompute_file = precompute_file + * self.precompute_rank = precompute_rank + * self.precompute_secondary_rank = precompute_secondary_rank # <<<<<<<<<<<<<< + * self.use_baeza_yates = use_baeza_yates + * self.by_slack_factor = by_slack_factor + */ + __pyx_v_self->precompute_secondary_rank = __pyx_v_precompute_secondary_rank; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":394 + * self.precompute_rank = precompute_rank + * self.precompute_secondary_rank = precompute_secondary_rank + * self.use_baeza_yates = use_baeza_yates # <<<<<<<<<<<<<< + * self.by_slack_factor = by_slack_factor + * self.tight_phrases = tight_phrases + */ + __pyx_v_self->use_baeza_yates = __pyx_v_use_baeza_yates; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":395 + * self.precompute_secondary_rank = precompute_secondary_rank + * self.use_baeza_yates = use_baeza_yates + * self.by_slack_factor = by_slack_factor # <<<<<<<<<<<<<< + * self.tight_phrases = tight_phrases + * + */ + __pyx_v_self->by_slack_factor = __pyx_v_by_slack_factor; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":396 + * self.use_baeza_yates = use_baeza_yates + * self.by_slack_factor = by_slack_factor + * self.tight_phrases = tight_phrases # <<<<<<<<<<<<<< + * + * if require_aligned_chunks: + */ + __pyx_v_self->tight_phrases = __pyx_v_tight_phrases; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":398 + * self.tight_phrases = tight_phrases + * + * if require_aligned_chunks: # <<<<<<<<<<<<<< + * # one condition is a stronger version of the other. + * self.require_aligned_chunks = self.require_aligned_terminal = True + */ + __pyx_t_3 = (__pyx_v_require_aligned_chunks != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":400 + * if require_aligned_chunks: + * # one condition is a stronger version of the other. + * self.require_aligned_chunks = self.require_aligned_terminal = True # <<<<<<<<<<<<<< + * elif require_aligned_terminal: + * self.require_aligned_chunks = False + */ + __pyx_v_self->require_aligned_chunks = 1; + __pyx_v_self->require_aligned_terminal = 1; + goto __pyx_L7; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":401 + * # one condition is a stronger version of the other. + * self.require_aligned_chunks = self.require_aligned_terminal = True + * elif require_aligned_terminal: # <<<<<<<<<<<<<< + * self.require_aligned_chunks = False + * self.require_aligned_terminal = True + */ + __pyx_t_3 = (__pyx_v_require_aligned_terminal != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":402 + * self.require_aligned_chunks = self.require_aligned_terminal = True + * elif require_aligned_terminal: + * self.require_aligned_chunks = False # <<<<<<<<<<<<<< + * self.require_aligned_terminal = True + * else: + */ + __pyx_v_self->require_aligned_chunks = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":403 + * elif require_aligned_terminal: + * self.require_aligned_chunks = False + * self.require_aligned_terminal = True # <<<<<<<<<<<<<< + * else: + * self.require_aligned_chunks = self.require_aligned_terminal = False + */ + __pyx_v_self->require_aligned_terminal = 1; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":405 + * self.require_aligned_terminal = True + * else: + * self.require_aligned_chunks = self.require_aligned_terminal = False # <<<<<<<<<<<<<< + * + * # diagnostics + */ + __pyx_v_self->require_aligned_chunks = 0; + __pyx_v_self->require_aligned_terminal = 0; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":408 + * + * # diagnostics + * self.prev_norm_prefix = () # <<<<<<<<<<<<<< + * + * self.findexes = IntList(initial_len=10) + */ + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); + __Pyx_GOTREF(__pyx_v_self->prev_norm_prefix); + __Pyx_DECREF(__pyx_v_self->prev_norm_prefix); + __pyx_v_self->prev_norm_prefix = ((PyObject *)__pyx_empty_tuple); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":410 + * self.prev_norm_prefix = () + * + * self.findexes = IntList(initial_len=10) # <<<<<<<<<<<<<< + * self.findexes1 = IntList(initial_len=10) + * + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->findexes); + __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes)); + __pyx_v_self->findexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":411 + * + * self.findexes = IntList(initial_len=10) + * self.findexes1 = IntList(initial_len=10) # <<<<<<<<<<<<<< + * + * # Online stats + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->findexes1); + __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes1)); + __pyx_v_self->findexes1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":416 + * + * # True after data is added + * self.online = False # <<<<<<<<<<<<<< + * self.online_stats = defaultdict(OnlineStats) + * + */ + __pyx_v_self->online = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":417 + * # 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 = 417; __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 = 417; __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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_6); + __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_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure[] = "This gives the RuleFactory access to the Context object.\n Here we also use it to precompute the most expensive intersections\n in the corpus quickly."; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray = 0; + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_edarray = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_sampler = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_scorer = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("configure (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__edarray,&__pyx_n_s__sampler,&__pyx_n_s__scorer,0}; + PyObject* values[4] = {0,0,0,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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__fsarray)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__edarray)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sampler)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scorer)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "configure") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_fsarray = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[0]); + __pyx_v_edarray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)values[1]); + __pyx_v_sampler = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)values[2]); + __pyx_v_scorer = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)values[3]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_edarray), __pyx_ptype_4cdec_2sa_3_sa_DataArray, 1, "edarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sampler), __pyx_ptype_4cdec_2sa_3_sa_Sampler, 1, "sampler", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scorer), __pyx_ptype_4cdec_2sa_3_sa_Scorer, 1, "scorer", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_edarray, __pyx_v_sampler, __pyx_v_scorer); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":419 + * self.online_stats = defaultdict(OnlineStats) + * + * def configure(self, SuffixArray fsarray, DataArray edarray, # <<<<<<<<<<<<<< + * Sampler sampler, Scorer scorer): + * '''This gives the RuleFactory access to the Context object. + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray, struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_edarray, struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_sampler, struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_scorer) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("configure", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":424 + * Here we also use it to precompute the most expensive intersections + * in the corpus quickly.''' + * self.fsa = fsarray # <<<<<<<<<<<<<< + * self.fda = fsarray.darray + * self.eda = edarray + */ + __Pyx_INCREF(((PyObject *)__pyx_v_fsarray)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_fsarray)); + __Pyx_GOTREF(__pyx_v_self->fsa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->fsa)); + __pyx_v_self->fsa = __pyx_v_fsarray; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":425 + * in the corpus quickly.''' + * self.fsa = fsarray + * self.fda = fsarray.darray # <<<<<<<<<<<<<< + * self.eda = edarray + * self.fid2symid = self.set_idmap(self.fda) + */ + __pyx_t_1 = ((PyObject *)__pyx_v_fsarray->darray); + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->fda); + __Pyx_DECREF(((PyObject *)__pyx_v_self->fda)); + __pyx_v_self->fda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":426 + * self.fsa = fsarray + * self.fda = fsarray.darray + * self.eda = edarray # <<<<<<<<<<<<<< + * self.fid2symid = self.set_idmap(self.fda) + * self.eid2symid = self.set_idmap(self.eda) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_edarray)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_edarray)); + __Pyx_GOTREF(__pyx_v_self->eda); + __Pyx_DECREF(((PyObject *)__pyx_v_self->eda)); + __pyx_v_self->eda = __pyx_v_edarray; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":427 + * self.fda = fsarray.darray + * self.eda = edarray + * self.fid2symid = self.set_idmap(self.fda) # <<<<<<<<<<<<<< + * self.eid2symid = self.set_idmap(self.eda) + * self.precompute() + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->fda); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->fid2symid); + __Pyx_DECREF(((PyObject *)__pyx_v_self->fid2symid)); + __pyx_v_self->fid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":428 + * self.eda = edarray + * self.fid2symid = self.set_idmap(self.fda) + * self.eid2symid = self.set_idmap(self.eda) # <<<<<<<<<<<<<< + * self.precompute() + * self.sampler = sampler + */ + __pyx_t_2 = ((PyObject *)__pyx_v_self->eda); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->eid2symid); + __Pyx_DECREF(((PyObject *)__pyx_v_self->eid2symid)); + __pyx_v_self->eid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":429 + * 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 = 429; __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[8]; __pyx_lineno = 429; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":430 + * self.eid2symid = self.set_idmap(self.eda) + * self.precompute() + * self.sampler = sampler # <<<<<<<<<<<<<< + * self.scorer = scorer + * + */ + __Pyx_INCREF(((PyObject *)__pyx_v_sampler)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_sampler)); + __Pyx_GOTREF(__pyx_v_self->sampler); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sampler)); + __pyx_v_self->sampler = __pyx_v_sampler; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":431 + * self.precompute() + * self.sampler = sampler + * self.scorer = scorer # <<<<<<<<<<<<<< + * + * cdef set_idmap(self, DataArray darray): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_scorer)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_scorer)); + __Pyx_GOTREF(__pyx_v_self->scorer); + __Pyx_DECREF(((PyObject *)__pyx_v_self->scorer)); + __pyx_v_self->scorer = __pyx_v_scorer; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":433 + * self.scorer = scorer + * + * cdef set_idmap(self, DataArray darray): # <<<<<<<<<<<<<< + * cdef int word_id, new_word_id, N + * cdef IntList idmap + */ + +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) { + int __pyx_v_word_id; + int __pyx_v_new_word_id; + int __pyx_v_N; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_idmap = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_idmap", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":437 + * cdef IntList idmap + * + * N = len(darray.id2word) # <<<<<<<<<<<<<< + * idmap = IntList(initial_len=N) + * for word_id from 0 <= word_id < N: + */ + __pyx_t_1 = __pyx_v_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[8]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_N = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":438 + * + * N = len(darray.id2word) + * idmap = IntList(initial_len=N) # <<<<<<<<<<<<<< + * for word_id from 0 <= word_id < N: + * new_word_id = sym_fromstring(darray.id2word[word_id], True) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_idmap = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":439 + * N = len(darray.id2word) + * idmap = IntList(initial_len=N) + * 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 + */ + __pyx_t_4 = __pyx_v_N; + for (__pyx_v_word_id = 0; __pyx_v_word_id < __pyx_t_4; __pyx_v_word_id++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":440 * idmap = IntList(initial_len=N) * 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 * return idmap */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_darray->id2word, __pyx_v_word_id, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_darray->id2word, __pyx_v_word_id, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __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 = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_new_word_id = __pyx_f_3_sa_sym_fromstring(__pyx_t_5, 1); + __pyx_v_new_word_id = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_5, 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":436 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":441 * 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 # <<<<<<<<<<<<<< @@ -41056,7 +41808,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(CYTHON_UNUSED (__pyx_v_idmap->arr[__pyx_v_word_id]) = __pyx_v_new_word_id; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":437 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":442 * new_word_id = sym_fromstring(darray.id2word[word_id], True) * idmap.arr[word_id] = new_word_id * return idmap # <<<<<<<<<<<<<< @@ -41073,7 +41825,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(CYTHON_UNUSED __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.set_idmap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.set_idmap", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_idmap); @@ -41083,17 +41835,17 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap(CYTHON_UNUSED } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("pattern2phrase (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phrase(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":440 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":445 * * * def pattern2phrase(self, pattern): # <<<<<<<<<<<<<< @@ -41101,7 +41853,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObjec * result = () */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_arity = NULL; PyObject *__pyx_v_word_id = NULL; @@ -41121,7 +41873,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pattern2phrase", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":442 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":447 * def pattern2phrase(self, pattern): * # pattern is a tuple, which we must convert to a hiero Phrase * result = () # <<<<<<<<<<<<<< @@ -41131,7 +41883,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); __pyx_v_result = __pyx_empty_tuple; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":443 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":448 * # pattern is a tuple, which we must convert to a hiero Phrase * result = () * arity = 0 # <<<<<<<<<<<<<< @@ -41141,7 +41893,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __Pyx_INCREF(__pyx_int_0); __pyx_v_arity = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":444 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":449 * result = () * arity = 0 * for word_id in pattern: # <<<<<<<<<<<<<< @@ -41152,7 +41904,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __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 = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -41160,23 +41912,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct 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 = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 449; __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 = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 449; __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 = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 449; __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 = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 449; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -41186,74 +41938,74 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_v_word_id = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":445 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":450 * arity = 0 * for word_id in pattern: * if word_id == -1: # <<<<<<<<<<<<<< * arity = arity + 1 * new_id = sym_setindex(self.category, arity) */ - __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[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":446 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":451 * for word_id in pattern: * if word_id == -1: * arity = arity + 1 # <<<<<<<<<<<<<< * new_id = sym_setindex(self.category, arity) * else: */ - __pyx_t_4 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_v_arity); __pyx_v_arity = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":447 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":452 * if word_id == -1: * arity = arity + 1 * new_id = sym_setindex(self.category, arity) # <<<<<<<<<<<<<< * else: * new_id = sym_fromstring(self.fda.id2word[word_id], True) */ - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_arity); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_new_id = __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_arity); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_new_id = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6); goto __pyx_L5; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":449 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":454 * new_id = sym_setindex(self.category, arity) * else: * new_id = sym_fromstring(self.fda.id2word[word_id], True) # <<<<<<<<<<<<<< * result = result + (new_id,) * return Phrase(result) */ - __pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 454; __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 = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_new_id = __pyx_f_3_sa_sym_fromstring(__pyx_t_7, 1); + __pyx_v_new_id = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_7, 1); } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":450 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":455 * else: * new_id = sym_fromstring(self.fda.id2word[word_id], True) * result = result + (new_id,) # <<<<<<<<<<<<<< * return Phrase(result) * */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_new_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_new_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __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); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_result)); @@ -41262,7 +42014,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":451 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":456 * new_id = sym_fromstring(self.fda.id2word[word_id], True) * result = result + (new_id,) * return Phrase(result) # <<<<<<<<<<<<<< @@ -41270,12 +42022,12 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct * def pattern2phrase_plus(self, pattern): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 451; __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 = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_result)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; @@ -41288,7 +42040,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.pattern2phrase", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.pattern2phrase", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -41300,17 +42052,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("pattern2phrase_plus (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":453 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":458 * return Phrase(result) * * def pattern2phrase_plus(self, pattern): # <<<<<<<<<<<<<< @@ -41318,7 +42070,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(Py * # suffixed/prefixed with the NT category. */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { PyObject *__pyx_v_patterns = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_arity = NULL; @@ -41340,19 +42092,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pattern2phrase_plus", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":456 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":461 * # returns a list containing both the pattern, and pattern * # suffixed/prefixed with the NT category. * patterns = [] # <<<<<<<<<<<<<< * result = () * arity = 0 */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 456; __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 = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_patterns = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":457 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":462 * # suffixed/prefixed with the NT category. * patterns = [] * result = () # <<<<<<<<<<<<<< @@ -41362,7 +42114,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(st __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); __pyx_v_result = __pyx_empty_tuple; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":458 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":463 * patterns = [] * result = () * arity = 0 # <<<<<<<<<<<<<< @@ -41372,7 +42124,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(st __Pyx_INCREF(__pyx_int_0); __pyx_v_arity = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":459 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":464 * result = () * arity = 0 * for word_id in pattern: # <<<<<<<<<<<<<< @@ -41383,7 +42135,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(st __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 = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -41391,23 +42143,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(st 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 = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 464; __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 = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 464; __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 = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 464; __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 = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 464; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -41417,74 +42169,74 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(st __pyx_v_word_id = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":460 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":465 * arity = 0 * for word_id in pattern: * if word_id == -1: # <<<<<<<<<<<<<< * arity = arity + 1 * new_id = sym_setindex(self.category, arity) */ - __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[8]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[8]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":461 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":466 * for word_id in pattern: * if word_id == -1: * arity = arity + 1 # <<<<<<<<<<<<<< * new_id = sym_setindex(self.category, arity) * else: */ - __pyx_t_4 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_v_arity); __pyx_v_arity = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":462 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":467 * if word_id == -1: * arity = arity + 1 * new_id = sym_setindex(self.category, arity) # <<<<<<<<<<<<<< * else: * new_id = sym_fromstring(self.fda.id2word[word_id], True) */ - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_arity); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_new_id = __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_arity); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_new_id = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6); goto __pyx_L5; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":464 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":469 * new_id = sym_setindex(self.category, arity) * else: * new_id = sym_fromstring(self.fda.id2word[word_id], True) # <<<<<<<<<<<<<< * result = result + (new_id,) * patterns.append(Phrase(result)) */ - __pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 469; __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 = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_new_id = __pyx_f_3_sa_sym_fromstring(__pyx_t_7, 1); + __pyx_v_new_id = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_7, 1); } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":465 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":470 * else: * new_id = sym_fromstring(self.fda.id2word[word_id], True) * result = result + (new_id,) # <<<<<<<<<<<<<< * patterns.append(Phrase(result)) * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_new_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_new_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 470; __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); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_result)); @@ -41493,81 +42245,81 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(st } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":466 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":471 * new_id = sym_fromstring(self.fda.id2word[word_id], True) * result = result + (new_id,) * patterns.append(Phrase(result)) # <<<<<<<<<<<<<< * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 466; __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 = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_result)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __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 = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":467 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":472 * result = result + (new_id,) * patterns.append(Phrase(result)) * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) # <<<<<<<<<<<<<< * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) * return patterns */ - __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __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[8]; __pyx_lineno = 467; __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 = 472; __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 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __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 = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __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 = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":468 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":473 * patterns.append(Phrase(result)) * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) # <<<<<<<<<<<<<< * return patterns * */ - __pyx_t_4 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __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[8]; __pyx_lineno = 468; __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 = 473; __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 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __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 = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __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 = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":469 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":474 * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) * return patterns # <<<<<<<<<<<<<< @@ -41585,7 +42337,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(st __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.pattern2phrase_plus", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.pattern2phrase_plus", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_patterns); @@ -41598,17 +42350,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(st } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("precompute (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":471 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":476 * return patterns * * def precompute(self): # <<<<<<<<<<<<<< @@ -41616,8 +42368,8 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *_ * */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self) { - struct __pyx_obj_3_sa_Precomputation *__pyx_v_pre = 0; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self) { + struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_pre = 0; PyObject *__pyx_v_start_time = NULL; PyObject *__pyx_v_pattern = NULL; PyObject *__pyx_v_arr = NULL; @@ -41643,7 +42395,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("precompute", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":474 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":479 * cdef Precomputation pre * * if self.precompute_file is not None: # <<<<<<<<<<<<<< @@ -41654,64 +42406,64 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":475 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":480 * * 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 = 475; __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 = 480; __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[8]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 480; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":476 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":481 * 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) * # check parameters of precomputation -- some are critical and some are not */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 476; __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[8]; __pyx_lineno = 481; __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 = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 481; __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(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_111)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_111)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_111)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_112)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_112)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112)); __Pyx_INCREF(__pyx_v_self->precompute_file); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->precompute_file); __Pyx_GIVEREF(__pyx_v_self->precompute_file); - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 481; __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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":477 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":482 * 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 = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__from_binary), __pyx_v_self->precompute_file) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Precomputation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__from_binary), __pyx_v_self->precompute_file) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Precomputation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_v_pre = ((struct __pyx_obj_3_sa_Precomputation *)__pyx_t_4); + __pyx_v_pre = ((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":479 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":484 * 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: # <<<<<<<<<<<<<< @@ -41721,34 +42473,34 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_t_2 = ((__pyx_v_pre->max_nonterminals != __pyx_v_self->max_nonterminals) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":480 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":485 * # 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 = 480; __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[8]; __pyx_lineno = 485; __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 = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__pyx_v_pre->max_nonterminals); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_pre->max_nonterminals); 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_t_3 = PyInt_FromLong(__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->max_nonterminals); 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); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_112)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_112)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_113)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_113)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_113)); 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); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); 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); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; @@ -41757,7 +42509,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":481 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":486 * 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: # <<<<<<<<<<<<<< @@ -41767,34 +42519,34 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_t_2 = ((__pyx_v_pre->max_length != __pyx_v_self->max_length) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":482 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":487 * 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 = 482; __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 = 487; __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 = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromLong(__pyx_v_pre->max_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_pre->max_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyInt_FromLong(__pyx_v_self->max_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_self->max_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __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 = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_113)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_113)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_113)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_114)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_114)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114)); 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 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -41803,7 +42555,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":483 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":488 * 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: # <<<<<<<<<<<<<< @@ -41813,18 +42565,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_t_2 = ((__pyx_v_pre->train_max_initial_size != __pyx_v_self->train_max_initial_size) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":484 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":489 * 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)) # <<<<<<<<<<<<<< * 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)) */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_pre->train_max_initial_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_pre->train_max_initial_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyInt_FromLong(__pyx_v_self->train_max_initial_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_self->train_max_initial_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __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 = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __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); @@ -41832,25 +42584,25 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __Pyx_GIVEREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_114), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_115), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__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 = 484; __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 = 489; __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_builtin_Exception, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[8]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":485 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":490 * 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: # <<<<<<<<<<<<<< @@ -41860,18 +42612,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_t_2 = ((__pyx_v_pre->train_min_gap_size != __pyx_v_self->train_min_gap_size) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":486 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":491 * 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 = PyInt_FromLong(__pyx_v_pre->train_min_gap_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_pre->train_min_gap_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyInt_FromLong(__pyx_v_self->train_min_gap_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_self->train_min_gap_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __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); @@ -41879,25 +42631,25 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __Pyx_GIVEREF(__pyx_t_6); __pyx_t_4 = 0; __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_115), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_116), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(((PyObject *)__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 = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __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 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[8]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":487 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":492 * 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: # <<<<<<<<<<<<<< @@ -41907,39 +42659,39 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_t_2 = (__pyx_v_self->use_index != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":488 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":493 * 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 = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 493; __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 = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 493; __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 = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 493; __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 = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 493; __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 = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_116)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_116)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_116)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_117)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_117)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_117)); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":489 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":494 * 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(): # <<<<<<<<<<<<<< @@ -41949,9 +42701,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_t_7 = 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 = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_index, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_index, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_8), (&__pyx_t_9)); 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_XDECREF(__pyx_t_6); __pyx_t_6 = __pyx_t_4; @@ -41959,7 +42711,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py 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 = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF(__pyx_v_pattern); @@ -41969,21 +42721,21 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_v_arr = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":490 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":495 * 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 = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 495; __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 = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 495; __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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -41991,7 +42743,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_v_phrases = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":491 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":496 * for pattern, arr in pre.precomputed_index.iteritems(): * phrases = self.pattern2phrase_plus(pattern) * for phrase in phrases: # <<<<<<<<<<<<<< @@ -42002,7 +42754,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_t_3 = __pyx_v_phrases; __Pyx_INCREF(__pyx_t_3); __pyx_t_11 = 0; __pyx_t_12 = 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 = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_phrases); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -42010,23 +42762,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py 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 = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 496; __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 = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 496; __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 = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 496; __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 = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_4 = __pyx_t_12(__pyx_t_3); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -42036,14 +42788,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_v_phrase = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":492 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":497 * phrases = self.pattern2phrase_plus(pattern) * for phrase in phrases: * self.precomputed_index[phrase] = arr # <<<<<<<<<<<<<< * if self.use_collocations: * logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations)) */ - if (PyObject_SetItem(__pyx_v_self->precomputed_index, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_self->precomputed_index, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } @@ -42052,7 +42804,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":493 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":498 * for phrase in phrases: * self.precomputed_index[phrase] = arr * if self.use_collocations: # <<<<<<<<<<<<<< @@ -42062,39 +42814,39 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_t_2 = (__pyx_v_self->use_collocations != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":494 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":499 * 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 = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __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 = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 499; __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 = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __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 = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __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 = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_117)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_117)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_117)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_118)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_118)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_118)); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":495 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":500 * 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(): # <<<<<<<<<<<<<< @@ -42104,9 +42856,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_t_8 = 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 = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_collocations, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_7), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_collocations, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_7), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = __pyx_t_4; @@ -42114,7 +42866,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py 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 = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_pattern); @@ -42124,21 +42876,21 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_v_arr = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":496 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":501 * 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 = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 501; __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 = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 501; __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 501; __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; @@ -42146,58 +42898,58 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __pyx_v_phrase = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":497 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":502 * for pattern, arr in pre.precomputed_collocations.iteritems(): * phrase = self.pattern2phrase(pattern) * self.precomputed_collocations[phrase] = arr # <<<<<<<<<<<<<< * stop_time = monitor_cpu() * logger.info("Processing precomputations took %f seconds", stop_time - start_time) */ - if (PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L13; } __pyx_L13:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":498 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":503 * 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 = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 503; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":499 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":504 * self.precomputed_collocations[phrase] = arr * stop_time = monitor_cpu() * logger.info("Processing precomputations took %f seconds", stop_time - start_time) # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __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 = 504; __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 = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 504; __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_Subtract(__pyx_v_stop_time, __pyx_v_start_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 504; __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 = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); 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(((PyObject *)__pyx_kp_s_118)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_118)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_118)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_119)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_119)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_119)); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__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_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -42213,7 +42965,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_pre); @@ -42229,17 +42981,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8precompute(struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_precomputed_collocation (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_phrase)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_phrase)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":502 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":507 * * * def get_precomputed_collocation(self, phrase): # <<<<<<<<<<<<<< @@ -42247,7 +42999,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_11get_precomputed_collo * arr = self.precomputed_collocations[phrase] */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase) { PyObject *__pyx_v_arr = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -42262,30 +43014,30 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collo int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_precomputed_collocation", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":503 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":508 * * def get_precomputed_collocation(self, phrase): * 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) */ - __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_phrase, __pyx_v_self->precomputed_collocations, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_phrase, __pyx_v_self->precomputed_collocations, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":504 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":509 * def get_precomputed_collocation(self, phrase): * 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) * return None */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_arr = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":505 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":510 * 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) # <<<<<<<<<<<<<< @@ -42293,26 +43045,26 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collo * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr), __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr_low), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr), __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr_low), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr_high), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr_high), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __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 = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __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 = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __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, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; @@ -42322,7 +43074,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collo } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":506 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":511 * arr = self.precomputed_collocations[phrase] * return PhraseLocation(arr=arr, arr_low=0, arr_high=len(arr), num_subpatterns=phrase.arity()+1) * return None # <<<<<<<<<<<<<< @@ -42340,7 +43092,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collo __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_precomputed_collocation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_precomputed_collocation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_arr); @@ -42349,7 +43101,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collo return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":509 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":514 * * * cdef int* baeza_yates_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<< @@ -42357,7 +43109,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_10get_precomputed_collo * int offset_by_one, int len_last, int num_subpatterns, int* result_len): */ -static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __pyx_obj_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) { +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) { int __pyx_v_i1; int __pyx_v_i2; int __pyx_v_med1; @@ -42380,8 +43132,8 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p int *__pyx_v_low_result; int *__pyx_v_med_result; int *__pyx_v_high_result; - struct __pyx_t_3_sa_Matching __pyx_v_loc1; - struct __pyx_t_3_sa_Matching __pyx_v_loc2; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc1; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc2; int *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -42395,7 +43147,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("baeza_yates_helper", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":522 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":527 * cdef Matching loc1, loc2 * * result = malloc(0*sizeof(int*)) # <<<<<<<<<<<<<< @@ -42404,7 +43156,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_result = ((int *)malloc((0 * (sizeof(int *))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":524 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":529 * result = malloc(0*sizeof(int*)) * * d_first = 0 # <<<<<<<<<<<<<< @@ -42413,7 +43165,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_d_first = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":525 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":530 * * d_first = 0 * if high1 - low1 > high2 - low2: # <<<<<<<<<<<<<< @@ -42423,7 +43175,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_1 = (((__pyx_v_high1 - __pyx_v_low1) > (__pyx_v_high2 - __pyx_v_low2)) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":526 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":531 * d_first = 0 * if high1 - low1 > high2 - low2: * d_first = 1 # <<<<<<<<<<<<<< @@ -42435,7 +43187,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":530 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":535 * # 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: # <<<<<<<<<<<<<< @@ -42451,7 +43203,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":531 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":536 * # Case 1: one of the sets is empty * if low1 >= high1 or low2 >= high2: * return result # <<<<<<<<<<<<<< @@ -42464,35 +43216,35 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":534 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":539 * * # 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) * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1: */ - __pyx_f_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":535 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":540 * # 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) # <<<<<<<<<<<<<< * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1: * return result */ - __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_low2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":536 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":541 * 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_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); + __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":537 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":542 * 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 # <<<<<<<<<<<<<< @@ -42505,35 +43257,35 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":539 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":544 * return result * * 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: */ - __pyx_f_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_low1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":540 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":545 * * 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_f_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":541 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":546 * 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_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); + __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":542 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":547 * 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 # <<<<<<<<<<<<<< @@ -42546,7 +43298,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":546 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":551 * # Case 3: query set and data set do not meet size mismatch constraints; * # We use mergesort instead in this case * qsetsize = (high1-low1) / step1 # <<<<<<<<<<<<<< @@ -42562,7 +43314,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_step1 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_4))) { #ifdef WITH_THREAD @@ -42572,11 +43324,11 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_qsetsize = __Pyx_div_int(__pyx_t_4, __pyx_v_step1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":547 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":552 * # We use mergesort instead in this case * qsetsize = (high1-low1) / step1 * dsetsize = (high2-low2) / step2 # <<<<<<<<<<<<<< @@ -42592,7 +43344,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_step2 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_4))) { #ifdef WITH_THREAD @@ -42602,11 +43354,11 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_dsetsize = __Pyx_div_int(__pyx_t_4, __pyx_v_step2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":548 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":553 * qsetsize = (high1-low1) / step1 * dsetsize = (high2-low2) / step2 * if d_first: # <<<<<<<<<<<<<< @@ -42616,7 +43368,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_d_first != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":549 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":554 * dsetsize = (high2-low2) / step2 * if d_first: * tmp = qsetsize # <<<<<<<<<<<<<< @@ -42625,7 +43377,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_tmp = __pyx_v_qsetsize; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":550 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":555 * if d_first: * tmp = qsetsize * qsetsize = dsetsize # <<<<<<<<<<<<<< @@ -42634,7 +43386,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_qsetsize = __pyx_v_dsetsize; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":551 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":556 * tmp = qsetsize * qsetsize = dsetsize * dsetsize = tmp # <<<<<<<<<<<<<< @@ -42646,7 +43398,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":553 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":558 * dsetsize = tmp * * if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize: # <<<<<<<<<<<<<< @@ -42663,12 +43415,12 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_3 = (((__pyx_t_5 / __pyx_t_6) > __pyx_v_dsetsize) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":554 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":559 * * if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize: * free(result) # <<<<<<<<<<<<<< @@ -42677,20 +43429,20 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ free(__pyx_v_result); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":555 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":560 * 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) # <<<<<<<<<<<<<< * * # binary search. There are two flavors, depending on */ - __pyx_r = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->merge_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, __pyx_v_result_len); + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->merge_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, __pyx_v_result_len); goto __pyx_L0; goto __pyx_L8; } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":559 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":564 * # binary search. There are two flavors, depending on * # whether the queryset or dataset is first * if d_first: # <<<<<<<<<<<<<< @@ -42700,25 +43452,25 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_d_first != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":560 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":565 * # 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_v_med2 = __pyx_f_3_sa_median(__pyx_v_low2, __pyx_v_high2, __pyx_v_step2); + __pyx_v_med2 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_low2, __pyx_v_high2, __pyx_v_step2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":561 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":566 * if d_first: * med2 = median(low2, high2, step2) * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< * * search_low = low1 */ - __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_med2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":563 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":568 * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) * * search_low = low1 # <<<<<<<<<<<<<< @@ -42727,7 +43479,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_search_low = __pyx_v_low1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":564 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":569 * * search_low = low1 * search_high = high1 # <<<<<<<<<<<<<< @@ -42736,7 +43488,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_search_high = __pyx_v_high1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":565 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":570 * search_low = low1 * search_high = high1 * while search_low < search_high: # <<<<<<<<<<<<<< @@ -42747,34 +43499,34 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_search_low < __pyx_v_search_high) != 0); if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":566 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":571 * search_high = high1 * while search_low < search_high: * 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) */ - __pyx_v_med1 = __pyx_f_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step1); + __pyx_v_med1 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":567 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":572 * while search_low < search_high: * 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) * if comparison == -1: */ - __pyx_f_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)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":568 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":573 * 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) # <<<<<<<<<<<<<< * if comparison == -1: * search_low = med1_plus */ - __pyx_v_comparison = ((struct __pyx_vtabstruct_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":571 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":576 * if comparison == -1: * search_low = med1_plus * elif comparison == 1: # <<<<<<<<<<<<<< @@ -42783,7 +43535,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ switch (__pyx_v_comparison) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":569 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":574 * 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: # <<<<<<<<<<<<<< @@ -42792,7 +43544,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ case -1: - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":570 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":575 * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) * if comparison == -1: * search_low = med1_plus # <<<<<<<<<<<<<< @@ -42802,7 +43554,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_v_search_low = __pyx_v_med1_plus; break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":571 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":576 * if comparison == -1: * search_low = med1_plus * elif comparison == 1: # <<<<<<<<<<<<<< @@ -42811,7 +43563,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ case 1: - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":572 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":577 * search_low = med1_plus * elif comparison == 1: * search_high = med1_minus # <<<<<<<<<<<<<< @@ -42822,7 +43574,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p break; default: - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":574 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":579 * search_high = med1_minus * else: * break # <<<<<<<<<<<<<< @@ -42838,25 +43590,25 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":576 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":581 * break * else: * med1 = median(low1, high1, step1) # <<<<<<<<<<<<<< * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) * */ - __pyx_v_med1 = __pyx_f_3_sa_median(__pyx_v_low1, __pyx_v_high1, __pyx_v_step1); + __pyx_v_med1 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_low1, __pyx_v_high1, __pyx_v_step1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":577 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":582 * else: * med1 = median(low1, high1, step1) * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) # <<<<<<<<<<<<<< * * search_low = low2 */ - __pyx_f_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)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":579 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":584 * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) * * search_low = low2 # <<<<<<<<<<<<<< @@ -42865,7 +43617,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_search_low = __pyx_v_low2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":580 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":585 * * search_low = low2 * search_high = high2 # <<<<<<<<<<<<<< @@ -42874,7 +43626,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_search_high = __pyx_v_high2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":581 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":586 * search_low = low2 * search_high = high2 * while search_low < search_high: # <<<<<<<<<<<<<< @@ -42885,34 +43637,34 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_search_low < __pyx_v_search_high) != 0); if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":582 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":587 * search_high = high2 * while search_low < search_high: * 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) */ - __pyx_v_med2 = __pyx_f_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step2); + __pyx_v_med2 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":583 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":588 * while search_low < search_high: * 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) * if comparison == -1: */ - __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_med2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":584 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":589 * 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) # <<<<<<<<<<<<<< * if comparison == -1: * search_high = med2 */ - __pyx_v_comparison = ((struct __pyx_vtabstruct_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":587 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":592 * if comparison == -1: * search_high = med2 * elif comparison == 1: # <<<<<<<<<<<<<< @@ -42921,7 +43673,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ switch (__pyx_v_comparison) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":585 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":590 * 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: # <<<<<<<<<<<<<< @@ -42930,7 +43682,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ case -1: - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":586 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":591 * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) * if comparison == -1: * search_high = med2 # <<<<<<<<<<<<<< @@ -42940,7 +43692,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_v_search_high = __pyx_v_med2; break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":587 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":592 * if comparison == -1: * search_high = med2 * elif comparison == 1: # <<<<<<<<<<<<<< @@ -42949,7 +43701,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ case 1: - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":588 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":593 * search_high = med2 * elif comparison == 1: * search_low = med2 + step2 # <<<<<<<<<<<<<< @@ -42960,7 +43712,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p break; default: - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":590 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":595 * search_low = med2 + step2 * else: * break # <<<<<<<<<<<<<< @@ -42975,7 +43727,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L9:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":592 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":597 * break * * med_result_len = 0 # <<<<<<<<<<<<<< @@ -42984,7 +43736,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med_result_len = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":593 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":598 * * med_result_len = 0 * med_result = malloc(0*sizeof(int*)) # <<<<<<<<<<<<<< @@ -42993,7 +43745,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med_result = ((int *)malloc((0 * (sizeof(int *))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":594 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":599 * med_result_len = 0 * med_result = malloc(0*sizeof(int*)) * if search_high > search_low: # <<<<<<<<<<<<<< @@ -43003,7 +43755,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_search_high > __pyx_v_search_low) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":600 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":605 * # want to store the bindings for all of those elements. We can * # subsequently throw all of them away. * med2_minus = med2 # <<<<<<<<<<<<<< @@ -43012,7 +43764,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_minus = __pyx_v_med2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":601 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":606 * # subsequently throw all of them away. * med2_minus = med2 * med2_plus = med2 + step2 # <<<<<<<<<<<<<< @@ -43021,7 +43773,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_plus = (__pyx_v_med2 + __pyx_v_step2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":602 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":607 * med2_minus = med2 * med2_plus = med2 + step2 * i1 = med1_minus # <<<<<<<<<<<<<< @@ -43030,7 +43782,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_i1 = __pyx_v_med1_minus; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":603 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":608 * med2_plus = med2 + step2 * i1 = med1_minus * while i1 < med1_plus: # <<<<<<<<<<<<<< @@ -43041,16 +43793,16 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_i1 < __pyx_v_med1_plus) != 0); if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":604 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":609 * i1 = med1_minus * while i1 < med1_plus: * 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) */ - __pyx_f_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":605 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":610 * while i1 < med1_plus: * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) * while med2_minus-step2 >= low2: # <<<<<<<<<<<<<< @@ -43061,26 +43813,26 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (((__pyx_v_med2_minus - __pyx_v_step2) >= __pyx_v_low2) != 0); if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":606 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":611 * 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) # <<<<<<<<<<<<<< * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) < 1: * med2_minus = med2_minus - step2 */ - __pyx_f_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":607 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":612 * 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_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); + __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":608 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":613 * 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 # <<<<<<<<<<<<<< @@ -43092,7 +43844,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":610 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":615 * med2_minus = med2_minus - step2 * else: * break # <<<<<<<<<<<<<< @@ -43105,7 +43857,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L18_break:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":611 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":616 * else: * break * i2 = med2_minus # <<<<<<<<<<<<<< @@ -43114,7 +43866,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_i2 = __pyx_v_med2_minus; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":612 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":617 * break * i2 = med2_minus * while i2 < high2: # <<<<<<<<<<<<<< @@ -43125,25 +43877,25 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_i2 < __pyx_v_high2) != 0); if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":613 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":618 * i2 = med2_minus * 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) * if comparison == 0: */ - __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_i2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":614 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":619 * 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) # <<<<<<<<<<<<<< * if comparison == 0: * pass */ - __pyx_v_comparison = ((struct __pyx_vtabstruct_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":615 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":620 * 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: # <<<<<<<<<<<<<< @@ -43153,19 +43905,19 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_comparison == 0) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":617 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":622 * if comparison == 0: * pass * med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len) # <<<<<<<<<<<<<< * if comparison == -1: * break */ - __pyx_v_med_result = __pyx_f_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)); + __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; } __pyx_L22:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":618 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":623 * pass * med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len) * if comparison == -1: # <<<<<<<<<<<<<< @@ -43175,7 +43927,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_comparison == -1) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":619 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":624 * med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len) * if comparison == -1: * break # <<<<<<<<<<<<<< @@ -43187,7 +43939,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L23:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":620 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":625 * if comparison == -1: * break * i2 = i2 + step2 # <<<<<<<<<<<<<< @@ -43198,7 +43950,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L21_break:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":621 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":626 * break * i2 = i2 + step2 * if i2 > med2_plus: # <<<<<<<<<<<<<< @@ -43208,7 +43960,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_i2 > __pyx_v_med2_plus) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":622 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":627 * i2 = i2 + step2 * if i2 > med2_plus: * med2_plus = i2 # <<<<<<<<<<<<<< @@ -43220,7 +43972,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L24:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":623 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":628 * if i2 > med2_plus: * med2_plus = i2 * i1 = i1 + step1 # <<<<<<<<<<<<<< @@ -43230,7 +43982,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_v_i1 = (__pyx_v_i1 + __pyx_v_step1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":625 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":630 * i1 = i1 + step1 * * tmp = med1_minus # <<<<<<<<<<<<<< @@ -43239,7 +43991,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_tmp = __pyx_v_med1_minus; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":626 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":631 * * tmp = med1_minus * med1_minus = med1_plus # <<<<<<<<<<<<<< @@ -43248,7 +44000,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med1_minus = __pyx_v_med1_plus; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":627 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":632 * tmp = med1_minus * med1_minus = med1_plus * med1_plus = tmp # <<<<<<<<<<<<<< @@ -43260,7 +44012,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":630 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":635 * else: * # No match; need to figure out the point of division in D and Q * med2_minus = med2 # <<<<<<<<<<<<<< @@ -43269,7 +44021,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_minus = __pyx_v_med2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":631 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":636 * # No match; need to figure out the point of division in D and Q * med2_minus = med2 * med2_plus = med2 # <<<<<<<<<<<<<< @@ -43278,7 +44030,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_plus = __pyx_v_med2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":632 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":637 * med2_minus = med2 * med2_plus = med2 * if d_first: # <<<<<<<<<<<<<< @@ -43288,7 +44040,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = (__pyx_v_d_first != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":633 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":638 * med2_plus = med2 * if d_first: * med2_minus = med2_minus + step2 # <<<<<<<<<<<<<< @@ -43297,7 +44049,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_minus = (__pyx_v_med2_minus + __pyx_v_step2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":634 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":639 * if d_first: * med2_minus = med2_minus + step2 * if comparison == -1: # <<<<<<<<<<<<<< @@ -43307,7 +44059,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_comparison == -1) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":635 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":640 * med2_minus = med2_minus + step2 * if comparison == -1: * med1_minus = med1_plus # <<<<<<<<<<<<<< @@ -43319,7 +44071,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L26:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":636 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":641 * if comparison == -1: * med1_minus = med1_plus * if comparison == 1: # <<<<<<<<<<<<<< @@ -43329,7 +44081,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_comparison == 1) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":637 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":642 * med1_minus = med1_plus * if comparison == 1: * med1_plus = med1_minus # <<<<<<<<<<<<<< @@ -43344,7 +44096,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":639 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":644 * med1_plus = med1_minus * else: * tmp = med1_minus # <<<<<<<<<<<<<< @@ -43353,7 +44105,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_tmp = __pyx_v_med1_minus; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":640 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":645 * else: * tmp = med1_minus * med1_minus = med1_plus # <<<<<<<<<<<<<< @@ -43362,7 +44114,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med1_minus = __pyx_v_med1_plus; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":641 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":646 * tmp = med1_minus * med1_minus = med1_plus * med1_plus = tmp # <<<<<<<<<<<<<< @@ -43371,7 +44123,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med1_plus = __pyx_v_tmp; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":642 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":647 * med1_minus = med1_plus * med1_plus = tmp * if comparison == 1: # <<<<<<<<<<<<<< @@ -43381,7 +44133,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_t_3 = ((__pyx_v_comparison == 1) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":643 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":648 * med1_plus = tmp * if comparison == 1: * med2_minus = med2_minus + step2 # <<<<<<<<<<<<<< @@ -43390,7 +44142,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_med2_minus = (__pyx_v_med2_minus + __pyx_v_step2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":644 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":649 * if comparison == 1: * med2_minus = med2_minus + step2 * med2_plus = med2_plus + step2 # <<<<<<<<<<<<<< @@ -43406,7 +44158,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p } __pyx_L14:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":646 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":651 * med2_plus = med2_plus + step2 * * low_result_len = 0 # <<<<<<<<<<<<<< @@ -43415,16 +44167,16 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_low_result_len = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":647 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":652 * * 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 * 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) */ - __pyx_v_low_result = ((struct __pyx_vtabstruct_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)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":648 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":653 * 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 # <<<<<<<<<<<<<< @@ -43433,43 +44185,43 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ __pyx_v_high_result_len = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":649 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":654 * 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) # <<<<<<<<<<<<<< * * result = extend_arr(result, result_len, low_result, low_result_len) */ - __pyx_v_high_result = ((struct __pyx_vtabstruct_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)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":651 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":656 * 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) # <<<<<<<<<<<<<< * result = extend_arr(result, result_len, med_result, med_result_len) * result = extend_arr(result, result_len, high_result, high_result_len) */ - __pyx_v_result = __pyx_f_3_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_low_result, __pyx_v_low_result_len); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":652 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":657 * * 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) * free(low_result) */ - __pyx_v_result = __pyx_f_3_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_med_result, __pyx_v_med_result_len); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":653 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":658 * 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) # <<<<<<<<<<<<<< * free(low_result) * free(med_result) */ - __pyx_v_result = __pyx_f_3_sa_extend_arr(__pyx_v_result, __pyx_v_result_len, __pyx_v_high_result, __pyx_v_high_result_len); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":654 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":659 * 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) # <<<<<<<<<<<<<< @@ -43478,7 +44230,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ free(__pyx_v_low_result); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":655 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":660 * result = extend_arr(result, result_len, high_result, high_result_len) * free(low_result) * free(med_result) # <<<<<<<<<<<<<< @@ -43487,7 +44239,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ free(__pyx_v_med_result); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":656 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":661 * free(low_result) * free(med_result) * free(high_result) # <<<<<<<<<<<<<< @@ -43496,7 +44248,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p */ free(__pyx_v_high_result); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":658 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":663 * free(high_result) * * return result # <<<<<<<<<<<<<< @@ -43509,14 +44261,14 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("_sa.HieroCachingRuleFactory.baeza_yates_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.HieroCachingRuleFactory.baeza_yates_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":662 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":667 * * * cdef long compare_matchings_set(self, int i1_minus, int i1_plus, int* arr1, int step1, # <<<<<<<<<<<<<< @@ -43524,18 +44276,18 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper(struct __p * """ */ -static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_obj_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_3_sa_Matching *__pyx_v_loc2, int __pyx_v_offset_by_one, int __pyx_v_len_last) { +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) { int __pyx_v_i1; int __pyx_v_comparison; int __pyx_v_prev_comparison; - struct __pyx_t_3_sa_Matching __pyx_v_l1_stack; - struct __pyx_t_3_sa_Matching *__pyx_v_loc1; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_l1_stack; + struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc1; long __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("compare_matchings_set", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":673 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":678 * cdef Matching* loc1 * * loc1 = &l1_stack # <<<<<<<<<<<<<< @@ -43544,7 +44296,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct */ __pyx_v_loc1 = (&__pyx_v_l1_stack); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":675 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":680 * loc1 = &l1_stack * * i1 = i1_minus # <<<<<<<<<<<<<< @@ -43553,7 +44305,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct */ __pyx_v_i1 = __pyx_v_i1_minus; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":676 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":681 * * i1 = i1_minus * while i1 < i1_plus: # <<<<<<<<<<<<<< @@ -43564,25 +44316,25 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_t_1 = ((__pyx_v_i1 < __pyx_v_i1_plus) != 0); if (!__pyx_t_1) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":677 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":682 * i1 = i1_minus * 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) * if comparison == 0: */ - __pyx_f_3_sa_assign_matching(__pyx_v_loc1, __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":678 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":683 * 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) # <<<<<<<<<<<<<< * if comparison == 0: * prev_comparison = 0 */ - __pyx_v_comparison = ((struct __pyx_vtabstruct_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":679 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":684 * 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: # <<<<<<<<<<<<<< @@ -43592,7 +44344,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_t_1 = ((__pyx_v_comparison == 0) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":680 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":685 * comparison = self.compare_matchings(loc1, loc2, offset_by_one, len_last) * if comparison == 0: * prev_comparison = 0 # <<<<<<<<<<<<<< @@ -43601,7 +44353,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct */ __pyx_v_prev_comparison = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":681 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":686 * if comparison == 0: * prev_comparison = 0 * break # <<<<<<<<<<<<<< @@ -43612,7 +44364,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct goto __pyx_L5; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":682 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":687 * prev_comparison = 0 * break * elif i1 == i1_minus: # <<<<<<<<<<<<<< @@ -43622,7 +44374,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_t_1 = ((__pyx_v_i1 == __pyx_v_i1_minus) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":683 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":688 * break * elif i1 == i1_minus: * prev_comparison = comparison # <<<<<<<<<<<<<< @@ -43634,7 +44386,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":685 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":690 * prev_comparison = comparison * else: * if comparison != prev_comparison: # <<<<<<<<<<<<<< @@ -43644,7 +44396,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct __pyx_t_1 = ((__pyx_v_comparison != __pyx_v_prev_comparison) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":686 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":691 * else: * if comparison != prev_comparison: * prev_comparison = 0 # <<<<<<<<<<<<<< @@ -43653,7 +44405,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct */ __pyx_v_prev_comparison = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":687 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":692 * if comparison != prev_comparison: * prev_comparison = 0 * break # <<<<<<<<<<<<<< @@ -43667,7 +44419,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":688 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":693 * prev_comparison = 0 * break * i1 = i1 + step1 # <<<<<<<<<<<<<< @@ -43678,7 +44430,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct } __pyx_L4_break:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":689 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":694 * break * i1 = i1 + step1 * return prev_comparison # <<<<<<<<<<<<<< @@ -43694,7 +44446,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":692 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":697 * * * cdef long compare_matchings(self, Matching* loc1, Matching* loc2, int offset_by_one, int len_last): # <<<<<<<<<<<<<< @@ -43702,7 +44454,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set(struct * */ -static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_t_3_sa_Matching *__pyx_v_loc1, struct __pyx_t_3_sa_Matching *__pyx_v_loc2, int __pyx_v_offset_by_one, int __pyx_v_len_last) { +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) { int __pyx_v_i; long __pyx_r; __Pyx_RefNannyDeclarations @@ -43712,7 +44464,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py int __pyx_t_4; __Pyx_RefNannySetupContext("compare_matchings", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":695 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":700 * cdef int i * * if loc1.sent_id > loc2.sent_id: # <<<<<<<<<<<<<< @@ -43722,7 +44474,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_1 = ((__pyx_v_loc1->sent_id > __pyx_v_loc2->sent_id) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":696 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":701 * * if loc1.sent_id > loc2.sent_id: * return 1 # <<<<<<<<<<<<<< @@ -43735,7 +44487,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":697 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":702 * if loc1.sent_id > loc2.sent_id: * return 1 * if loc2.sent_id > loc1.sent_id: # <<<<<<<<<<<<<< @@ -43745,7 +44497,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_1 = ((__pyx_v_loc2->sent_id > __pyx_v_loc1->sent_id) != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":698 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":703 * return 1 * if loc2.sent_id > loc1.sent_id: * return -1 # <<<<<<<<<<<<<< @@ -43758,7 +44510,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":700 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":705 * return -1 * * if loc1.size == 1 and loc2.size == 1: # <<<<<<<<<<<<<< @@ -43774,7 +44526,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":701 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":706 * * if loc1.size == 1 and loc2.size == 1: * if loc2.arr[loc2.start] - loc1.arr[loc1.start] <= self.train_min_gap_size: # <<<<<<<<<<<<<< @@ -43784,7 +44536,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":702 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":707 * if loc1.size == 1 and loc2.size == 1: * if loc2.arr[loc2.start] - loc1.arr[loc1.start] <= self.train_min_gap_size: * return 1 # <<<<<<<<<<<<<< @@ -43799,7 +44551,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py goto __pyx_L5; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":704 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":709 * return 1 * * elif offset_by_one: # <<<<<<<<<<<<<< @@ -43809,7 +44561,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_3 = (__pyx_v_offset_by_one != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":705 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":710 * * elif offset_by_one: * for i from 1 <= i < loc1.size: # <<<<<<<<<<<<<< @@ -43819,7 +44571,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_4 = __pyx_v_loc1->size; for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":706 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":711 * elif offset_by_one: * for i from 1 <= i < loc1.size: * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i-1]: # <<<<<<<<<<<<<< @@ -43829,7 +44581,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":707 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":712 * for i from 1 <= i < loc1.size: * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i-1]: * return 1 # <<<<<<<<<<<<<< @@ -43842,7 +44594,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L9:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":708 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":713 * 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]: # <<<<<<<<<<<<<< @@ -43852,7 +44604,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":709 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":714 * return 1 * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i-1]: * return -1 # <<<<<<<<<<<<<< @@ -43869,7 +44621,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":712 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":717 * * else: * if loc1.arr[loc1.start]+1 > loc2.arr[loc2.start]: # <<<<<<<<<<<<<< @@ -43879,7 +44631,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":713 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":718 * else: * if loc1.arr[loc1.start]+1 > loc2.arr[loc2.start]: * return 1 # <<<<<<<<<<<<<< @@ -43892,7 +44644,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L11:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":714 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":719 * if loc1.arr[loc1.start]+1 > loc2.arr[loc2.start]: * return 1 * if loc1.arr[loc1.start]+1 < loc2.arr[loc2.start]: # <<<<<<<<<<<<<< @@ -43902,7 +44654,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":715 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":720 * return 1 * if loc1.arr[loc1.start]+1 < loc2.arr[loc2.start]: * return -1 # <<<<<<<<<<<<<< @@ -43915,7 +44667,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L12:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":717 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":722 * return -1 * * for i from 1 <= i < loc1.size: # <<<<<<<<<<<<<< @@ -43925,7 +44677,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __pyx_t_4 = __pyx_v_loc1->size; for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":718 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":723 * * for i from 1 <= i < loc1.size: * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i]: # <<<<<<<<<<<<<< @@ -43935,7 +44687,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":719 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":724 * for i from 1 <= i < loc1.size: * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i]: * return 1 # <<<<<<<<<<<<<< @@ -43948,7 +44700,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L15:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":720 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":725 * if loc1.arr[loc1.start+i] > loc2.arr[loc2.start+i]: * return 1 * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i]: # <<<<<<<<<<<<<< @@ -43958,7 +44710,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":721 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":726 * return 1 * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i]: * return -1 # <<<<<<<<<<<<<< @@ -43974,7 +44726,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":723 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":728 * return -1 * * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: # <<<<<<<<<<<<<< @@ -43984,7 +44736,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":724 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":729 * * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: * return -1 # <<<<<<<<<<<<<< @@ -43997,7 +44749,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py } __pyx_L17:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":725 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":730 * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: * return -1 * return 0 # <<<<<<<<<<<<<< @@ -44013,7 +44765,7 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":728 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":733 * * * cdef int* merge_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<< @@ -44021,15 +44773,15 @@ static long __pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings(struct __py * int offset_by_one, int len_last, int num_subpatterns, int* result_len): */ -static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj_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) { +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) { int __pyx_v_i1; int __pyx_v_i2; int __pyx_v_j1; int __pyx_v_j2; long __pyx_v_comparison; int *__pyx_v_result; - struct __pyx_t_3_sa_Matching __pyx_v_loc1; - struct __pyx_t_3_sa_Matching __pyx_v_loc2; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc1; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc2; int *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -44037,7 +44789,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj int __pyx_t_3; __Pyx_RefNannySetupContext("merge_helper", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":736 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":741 * cdef Matching loc1, loc2 * * result_len[0] = 0 # <<<<<<<<<<<<<< @@ -44046,7 +44798,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ (__pyx_v_result_len[0]) = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":737 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":742 * * result_len[0] = 0 * result = malloc(0*sizeof(int)) # <<<<<<<<<<<<<< @@ -44055,7 +44807,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_result = ((int *)malloc((0 * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":739 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":744 * result = malloc(0*sizeof(int)) * * i1 = low1 # <<<<<<<<<<<<<< @@ -44064,7 +44816,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_i1 = __pyx_v_low1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":740 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":745 * * i1 = low1 * i2 = low2 # <<<<<<<<<<<<<< @@ -44073,7 +44825,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_i2 = __pyx_v_low2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":741 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":746 * i1 = low1 * i2 = low2 * while i1 < high1 and i2 < high2: # <<<<<<<<<<<<<< @@ -44090,16 +44842,16 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":744 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":749 * * # First, pop all unneeded loc2's off the stack * 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) */ - __pyx_f_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":745 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":750 * # First, pop all unneeded loc2's off the stack * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) * while i2 < high2: # <<<<<<<<<<<<<< @@ -44110,26 +44862,26 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj __pyx_t_3 = ((__pyx_v_i2 < __pyx_v_high2) != 0); if (!__pyx_t_3) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":746 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":751 * 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) # <<<<<<<<<<<<<< * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: * i2 = i2 + step2 */ - __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_i2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":747 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":752 * 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_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); + __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":748 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":753 * 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 # <<<<<<<<<<<<<< @@ -44141,7 +44893,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":750 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":755 * i2 = i2 + step2 * else: * break # <<<<<<<<<<<<<< @@ -44154,7 +44906,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } __pyx_L6_break:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":753 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":758 * * # Next: process all loc1's with the same starting val * j1 = i1 # <<<<<<<<<<<<<< @@ -44163,7 +44915,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_j1 = __pyx_v_i1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":754 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":759 * # Next: process all loc1's with the same starting val * j1 = i1 * while i1 < high1 and arr1[j1] == arr1[i1]: # <<<<<<<<<<<<<< @@ -44180,16 +44932,16 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } if (!__pyx_t_2) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":755 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":760 * j1 = i1 * while i1 < high1 and arr1[j1] == arr1[i1]: * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<< * j2 = i2 * while j2 < high2: */ - __pyx_f_3_sa_assign_matching((&__pyx_v_loc1), __pyx_v_arr1, __pyx_v_i1, __pyx_v_step1, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":756 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":761 * while i1 < high1 and arr1[j1] == arr1[i1]: * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) * j2 = i2 # <<<<<<<<<<<<<< @@ -44198,7 +44950,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj */ __pyx_v_j2 = __pyx_v_i2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":757 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":762 * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) * j2 = i2 * while j2 < high2: # <<<<<<<<<<<<<< @@ -44209,25 +44961,25 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj __pyx_t_2 = ((__pyx_v_j2 < __pyx_v_high2) != 0); if (!__pyx_t_2) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":758 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":763 * j2 = i2 * 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) * if comparison == 0: */ - __pyx_f_3_sa_assign_matching((&__pyx_v_loc2), __pyx_v_arr2, __pyx_v_j2, __pyx_v_step2, __pyx_v_self->fda->sent_id->arr); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":759 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":764 * 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) # <<<<<<<<<<<<<< * if comparison == 0: * result = append_combined_matching(result, &loc1, &loc2, offset_by_one, num_subpatterns, result_len) */ - __pyx_v_comparison = ((struct __pyx_vtabstruct_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":760 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":765 * 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: # <<<<<<<<<<<<<< @@ -44237,19 +44989,19 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj __pyx_t_2 = ((__pyx_v_comparison == 0) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":761 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":766 * 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: * pass */ - __pyx_v_result = __pyx_f_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); + __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; } __pyx_L12:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":762 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":767 * if comparison == 0: * result = append_combined_matching(result, &loc1, &loc2, offset_by_one, num_subpatterns, result_len) * if comparison == 1: # <<<<<<<<<<<<<< @@ -44262,7 +45014,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } __pyx_L13:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":764 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":769 * if comparison == 1: * pass * if comparison == -1: # <<<<<<<<<<<<<< @@ -44272,7 +45024,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj __pyx_t_2 = ((__pyx_v_comparison == -1) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":765 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":770 * pass * if comparison == -1: * break # <<<<<<<<<<<<<< @@ -44284,7 +45036,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":767 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":772 * break * else: * j2 = j2 + step2 # <<<<<<<<<<<<<< @@ -44297,7 +45049,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } __pyx_L11_break:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":768 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":773 * else: * j2 = j2 + step2 * i1 = i1 + step1 # <<<<<<<<<<<<<< @@ -44308,7 +45060,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj } } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":769 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":774 * j2 = j2 + step2 * i1 = i1 + step1 * return result # <<<<<<<<<<<<<< @@ -44324,7 +45076,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":772 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":777 * * * cdef void sort_phrase_loc(self, IntList arr, PhraseLocation loc, Phrase phrase): # <<<<<<<<<<<<<< @@ -44332,10 +45084,10 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper(struct __pyx_obj * cdef VEB veb */ -static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_IntList *__pyx_v_arr, struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_loc, struct __pyx_obj_3_sa_Phrase *__pyx_v_phrase) { +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) { int __pyx_v_i; int __pyx_v_j; - struct __pyx_obj_3_sa_VEB *__pyx_v_veb = 0; + struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_veb = 0; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; @@ -44347,79 +45099,79 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("sort_phrase_loc", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":777 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":782 * cdef IntList result * * if phrase in self.precomputed_index: # <<<<<<<<<<<<<< * loc.arr = self.precomputed_index[phrase] * else: */ - __pyx_t_1 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_phrase), __pyx_v_self->precomputed_index, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_phrase), __pyx_v_self->precomputed_index, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":778 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":783 * * if phrase in self.precomputed_index: * loc.arr = self.precomputed_index[phrase] # <<<<<<<<<<<<<< * else: * loc.arr = IntList(initial_len=loc.sa_high-loc.sa_low) */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_self->precomputed_index, ((PyObject *)__pyx_v_phrase)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_self->precomputed_index, ((PyObject *)__pyx_v_phrase)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 783; __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_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_loc->arr); __Pyx_DECREF(((PyObject *)__pyx_v_loc->arr)); - __pyx_v_loc->arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); + __pyx_v_loc->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L3; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":780 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":785 * loc.arr = self.precomputed_index[phrase] * else: * 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: */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = PyInt_FromLong((__pyx_v_loc->sa_high - __pyx_v_loc->sa_low)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_loc->sa_high - __pyx_v_loc->sa_low)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_loc->arr); __Pyx_DECREF(((PyObject *)__pyx_v_loc->arr)); - __pyx_v_loc->arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_4); + __pyx_v_loc->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":781 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":786 * else: * 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: * veb._insert(arr.arr[i]) */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_arr->len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_arr->len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 786; __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[8]; __pyx_lineno = 781; __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 = 786; __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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_VEB)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_VEB)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_veb = ((struct __pyx_obj_3_sa_VEB *)__pyx_t_4); + __pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":782 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":787 * 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: # <<<<<<<<<<<<<< @@ -44429,17 +45181,17 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":783 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":788 * veb = VEB(arr.len) * for i from loc.sa_low <= i < loc.sa_high: * veb._insert(arr.arr[i]) # <<<<<<<<<<<<<< * i = veb.veb.min_val * for j from 0 <= j < loc.sa_high-loc.sa_low: */ - ((struct __pyx_vtabstruct_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_insert(__pyx_v_veb, (__pyx_v_arr->arr[__pyx_v_i])); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_insert(__pyx_v_veb, (__pyx_v_arr->arr[__pyx_v_i])); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":784 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":789 * for i from loc.sa_low <= i < loc.sa_high: * veb._insert(arr.arr[i]) * i = veb.veb.min_val # <<<<<<<<<<<<<< @@ -44449,7 +45201,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __pyx_t_5 = __pyx_v_veb->veb->min_val; __pyx_v_i = __pyx_t_5; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":785 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":790 * veb._insert(arr.arr[i]) * i = veb.veb.min_val * for j from 0 <= j < loc.sa_high-loc.sa_low: # <<<<<<<<<<<<<< @@ -44459,7 +45211,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":786 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":791 * i = veb.veb.min_val * for j from 0 <= j < loc.sa_high-loc.sa_low: * loc.arr.arr[j] = i # <<<<<<<<<<<<<< @@ -44468,19 +45220,19 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ */ (__pyx_v_loc->arr->arr[__pyx_v_j]) = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":787 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":792 * for j from 0 <= j < loc.sa_high-loc.sa_low: * loc.arr.arr[j] = i * i = veb._findsucc(i) # <<<<<<<<<<<<<< * loc.arr_low = 0 * loc.arr_high = loc.arr.len */ - __pyx_v_i = ((struct __pyx_vtabstruct_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_findsucc(__pyx_v_veb, __pyx_v_i); + __pyx_v_i = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_findsucc(__pyx_v_veb, __pyx_v_i); } } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":788 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":793 * loc.arr.arr[j] = i * i = veb._findsucc(i) * loc.arr_low = 0 # <<<<<<<<<<<<<< @@ -44489,7 +45241,7 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ */ __pyx_v_loc->arr_low = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":789 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":794 * i = veb._findsucc(i) * loc.arr_low = 0 * loc.arr_high = loc.arr.len # <<<<<<<<<<<<<< @@ -44503,13 +45255,13 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("_sa.HieroCachingRuleFactory.sort_phrase_loc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.HieroCachingRuleFactory.sort_phrase_loc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_veb); __Pyx_RefNannyFinishContext(); } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":792 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":797 * * * cdef intersect_helper(self, Phrase prefix, Phrase suffix, # <<<<<<<<<<<<<< @@ -44517,10 +45269,10 @@ static void __pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc(struct __pyx_ * */ -static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_Phrase *__pyx_v_prefix, struct __pyx_obj_3_sa_Phrase *__pyx_v_suffix, struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_prefix_loc, struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_suffix_loc, int __pyx_v_algorithm) { - struct __pyx_obj_3_sa_IntList *__pyx_v_arr1 = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_arr2 = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_result = 0; +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) { + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr1 = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr2 = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_result = 0; int __pyx_v_low1; int __pyx_v_high1; int __pyx_v_step1; @@ -44546,7 +45298,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intersect_helper", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":799 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":804 * cdef int* result_ptr * * result_len = 0 # <<<<<<<<<<<<<< @@ -44555,21 +45307,21 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_result_len = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":801 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":806 * result_len = 0 * * if sym_isvar(suffix[0]): # <<<<<<<<<<<<<< * offset_by_one = 1 * else: */ - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_suffix), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_suffix), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_f_3_sa_sym_isvar(__pyx_t_2) != 0); + __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_2) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":802 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":807 * * if sym_isvar(suffix[0]): * offset_by_one = 1 # <<<<<<<<<<<<<< @@ -44581,7 +45333,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":804 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":809 * offset_by_one = 1 * else: * offset_by_one = 0 # <<<<<<<<<<<<<< @@ -44592,34 +45344,34 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":806 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":811 * 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 = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 811; __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 = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __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(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __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_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__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 = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_len_last = __pyx_t_6; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":808 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":813 * len_last = len(suffix.getchunk(suffix.arity())) * * if prefix_loc.arr is None: # <<<<<<<<<<<<<< @@ -44630,7 +45382,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_7 = (__pyx_t_3 != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":809 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":814 * * if prefix_loc.arr is None: * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) # <<<<<<<<<<<<<< @@ -44639,13 +45391,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_t_5 = ((PyObject *)__pyx_v_self->fsa->sa); __Pyx_INCREF(__pyx_t_5); - ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->sort_phrase_loc(__pyx_v_self, ((struct __pyx_obj_3_sa_IntList *)__pyx_t_5), __pyx_v_prefix_loc, __pyx_v_prefix); + ((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; goto __pyx_L4; } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":810 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":815 * if prefix_loc.arr is None: * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) * arr1 = prefix_loc.arr # <<<<<<<<<<<<<< @@ -44654,10 +45406,10 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_t_5 = ((PyObject *)__pyx_v_prefix_loc->arr); __Pyx_INCREF(__pyx_t_5); - __pyx_v_arr1 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_5); + __pyx_v_arr1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":811 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":816 * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) * arr1 = prefix_loc.arr * low1 = prefix_loc.arr_low # <<<<<<<<<<<<<< @@ -44667,7 +45419,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_2 = __pyx_v_prefix_loc->arr_low; __pyx_v_low1 = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":812 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":817 * arr1 = prefix_loc.arr * low1 = prefix_loc.arr_low * high1 = prefix_loc.arr_high # <<<<<<<<<<<<<< @@ -44677,7 +45429,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_2 = __pyx_v_prefix_loc->arr_high; __pyx_v_high1 = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":813 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":818 * low1 = prefix_loc.arr_low * high1 = prefix_loc.arr_high * step1 = prefix_loc.num_subpatterns # <<<<<<<<<<<<<< @@ -44687,7 +45439,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_2 = __pyx_v_prefix_loc->num_subpatterns; __pyx_v_step1 = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":815 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":820 * step1 = prefix_loc.num_subpatterns * * if suffix_loc.arr is None: # <<<<<<<<<<<<<< @@ -44698,7 +45450,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_3 = (__pyx_t_7 != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":816 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":821 * * if suffix_loc.arr is None: * self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix) # <<<<<<<<<<<<<< @@ -44707,13 +45459,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_t_5 = ((PyObject *)__pyx_v_self->fsa->sa); __Pyx_INCREF(__pyx_t_5); - ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->sort_phrase_loc(__pyx_v_self, ((struct __pyx_obj_3_sa_IntList *)__pyx_t_5), __pyx_v_suffix_loc, __pyx_v_suffix); + ((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; goto __pyx_L5; } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":817 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":822 * if suffix_loc.arr is None: * self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix) * arr2 = suffix_loc.arr # <<<<<<<<<<<<<< @@ -44722,10 +45474,10 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_t_5 = ((PyObject *)__pyx_v_suffix_loc->arr); __Pyx_INCREF(__pyx_t_5); - __pyx_v_arr2 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_5); + __pyx_v_arr2 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":818 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":823 * self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix) * arr2 = suffix_loc.arr * low2 = suffix_loc.arr_low # <<<<<<<<<<<<<< @@ -44735,7 +45487,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_2 = __pyx_v_suffix_loc->arr_low; __pyx_v_low2 = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":819 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":824 * arr2 = suffix_loc.arr * low2 = suffix_loc.arr_low * high2 = suffix_loc.arr_high # <<<<<<<<<<<<<< @@ -44745,7 +45497,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_2 = __pyx_v_suffix_loc->arr_high; __pyx_v_high2 = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":820 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":825 * low2 = suffix_loc.arr_low * high2 = suffix_loc.arr_high * step2 = suffix_loc.num_subpatterns # <<<<<<<<<<<<<< @@ -44755,59 +45507,59 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_2 = __pyx_v_suffix_loc->num_subpatterns; __pyx_v_step2 = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":822 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":827 * 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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 827; __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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_num_subpatterns = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":824 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":829 * num_subpatterns = prefix.arity()+1 * * if algorithm == MERGE: # <<<<<<<<<<<<<< * result_ptr = self.merge_helper(low1, high1, arr1.arr, step1, * low2, high2, arr2.arr, step2, */ - __pyx_t_3 = ((__pyx_v_algorithm == __pyx_v_3_sa_MERGE) != 0); + __pyx_t_3 = ((__pyx_v_algorithm == __pyx_v_4cdec_2sa_3_sa_MERGE) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":827 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":832 * result_ptr = self.merge_helper(low1, high1, arr1.arr, step1, * low2, high2, arr2.arr, step2, * offset_by_one, len_last, num_subpatterns, &result_len) # <<<<<<<<<<<<<< * else: * result_ptr = self.baeza_yates_helper(low1, high1, arr1.arr, step1, */ - __pyx_v_result_ptr = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->merge_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1->arr, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2->arr, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_result_len)); + __pyx_v_result_ptr = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->merge_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1->arr, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2->arr, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_result_len)); goto __pyx_L6; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":831 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":836 * result_ptr = self.baeza_yates_helper(low1, high1, arr1.arr, step1, * low2, high2, arr2.arr, step2, * offset_by_one, len_last, num_subpatterns, &result_len) # <<<<<<<<<<<<<< * * if result_len == 0: */ - __pyx_v_result_ptr = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->baeza_yates_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1->arr, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2->arr, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_result_len)); + __pyx_v_result_ptr = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->baeza_yates_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1->arr, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2->arr, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_result_len)); } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":833 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":838 * offset_by_one, len_last, num_subpatterns, &result_len) * * if result_len == 0: # <<<<<<<<<<<<<< @@ -44817,7 +45569,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __pyx_t_3 = ((__pyx_v_result_len == 0) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":834 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":839 * * if result_len == 0: * free(result_ptr) # <<<<<<<<<<<<<< @@ -44826,7 +45578,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ free(__pyx_v_result_ptr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":835 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":840 * if result_len == 0: * free(result_ptr) * return None # <<<<<<<<<<<<<< @@ -44841,19 +45593,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":837 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":842 * return None * else: * result = IntList() # <<<<<<<<<<<<<< * free(result.arr) * result.arr = result_ptr */ - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_v_result = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_5); + __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":838 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":843 * else: * result = IntList() * free(result.arr) # <<<<<<<<<<<<<< @@ -44862,7 +45614,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ free(__pyx_v_result->arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":839 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":844 * result = IntList() * free(result.arr) * result.arr = result_ptr # <<<<<<<<<<<<<< @@ -44871,7 +45623,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_result->arr = __pyx_v_result_ptr; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":840 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":845 * free(result.arr) * result.arr = result_ptr * result.len = result_len # <<<<<<<<<<<<<< @@ -44880,7 +45632,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_result->len = __pyx_v_result_len; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":841 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":846 * result.arr = result_ptr * result.len = result_len * result.size = result_len # <<<<<<<<<<<<<< @@ -44889,7 +45641,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct */ __pyx_v_result->size = __pyx_v_result_len; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":842 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":847 * result.len = result_len * result.size = result_len * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) # <<<<<<<<<<<<<< @@ -44897,19 +45649,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct * 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 = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr_low), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_v_result_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr_low), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_result_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr_high), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr_high), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr), ((PyObject *)__pyx_v_result)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr), ((PyObject *)__pyx_v_result)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_r = __pyx_t_4; @@ -44924,7 +45676,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.intersect_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.intersect_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_arr1); @@ -44935,7 +45687,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":844 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":849 * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) * * cdef loc2str(self, PhraseLocation loc): # <<<<<<<<<<<<<< @@ -44943,7 +45695,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper(struct * result = "{" */ -static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_loc) { +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) { int __pyx_v_i; int __pyx_v_j; PyObject *__pyx_v_result = NULL; @@ -44958,17 +45710,17 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("loc2str", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":846 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":851 * cdef loc2str(self, PhraseLocation loc): * cdef int i, j * result = "{" # <<<<<<<<<<<<<< * i = 0 * while i < loc.arr_high: */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_119)); - __pyx_v_result = ((PyObject *)__pyx_kp_s_119); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_120)); + __pyx_v_result = ((PyObject *)__pyx_kp_s_120); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":847 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":852 * cdef int i, j * result = "{" * i = 0 # <<<<<<<<<<<<<< @@ -44977,7 +45729,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED st */ __pyx_v_i = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":848 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":853 * result = "{" * i = 0 * while i < loc.arr_high: # <<<<<<<<<<<<<< @@ -44988,20 +45740,20 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED st __pyx_t_1 = ((__pyx_v_i < __pyx_v_loc->arr_high) != 0); if (!__pyx_t_1) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":849 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":854 * i = 0 * while i < loc.arr_high: * result = result + "(" # <<<<<<<<<<<<<< * for j from i <= j < i + loc.num_subpatterns: * result = result + ("%d " %loc.arr[j]) */ - __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_120)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_121)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":850 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":855 * while i < loc.arr_high: * result = result + "(" * for j from i <= j < i + loc.num_subpatterns: # <<<<<<<<<<<<<< @@ -45011,19 +45763,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED st __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":851 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":856 * result = result + "(" * for j from i <= j < i + loc.num_subpatterns: * result = result + ("%d " %loc.arr[j]) # <<<<<<<<<<<<<< * result = result + ")" * i = i + loc.num_subpatterns */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_loc->arr), __pyx_v_j, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_loc->arr), __pyx_v_j, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_result); @@ -45031,20 +45783,20 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED st __pyx_t_2 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":852 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":857 * for j from i <= j < i + loc.num_subpatterns: * result = result + ("%d " %loc.arr[j]) * result = result + ")" # <<<<<<<<<<<<<< * i = i + loc.num_subpatterns * result = result + "}" */ - __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":853 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":858 * result = result + ("%d " %loc.arr[j]) * result = result + ")" * i = i + loc.num_subpatterns # <<<<<<<<<<<<<< @@ -45054,20 +45806,20 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED st __pyx_v_i = (__pyx_v_i + __pyx_v_loc->num_subpatterns); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":854 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":859 * result = result + ")" * i = i + loc.num_subpatterns * result = result + "}" # <<<<<<<<<<<<<< * return result * */ - __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_121)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_122)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":855 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":860 * i = i + loc.num_subpatterns * result = result + "}" * return result # <<<<<<<<<<<<<< @@ -45084,7 +45836,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED st __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.loc2str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.loc2str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -45093,7 +45845,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED st return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":857 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":862 * return result * * cdef PhraseLocation intersect(self, prefix_node, suffix_node, Phrase phrase): # <<<<<<<<<<<<<< @@ -45101,14 +45853,14 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str(CYTHON_UNUSED st * cdef PhraseLocation prefix_loc, suffix_loc, result */ -static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFactory_intersect(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_prefix_node, PyObject *__pyx_v_suffix_node, struct __pyx_obj_3_sa_Phrase *__pyx_v_phrase) { - struct __pyx_obj_3_sa_Phrase *__pyx_v_prefix = 0; - struct __pyx_obj_3_sa_Phrase *__pyx_v_suffix = 0; - struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_prefix_loc = 0; - struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_suffix_loc = 0; - struct __pyx_obj_3_sa_PhraseLocation *__pyx_v_result = 0; +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) { + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_prefix = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_suffix = 0; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_prefix_loc = 0; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_suffix_loc = 0; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_result = 0; CYTHON_UNUSED PyObject *__pyx_v_intersect_method = NULL; - struct __pyx_obj_3_sa_PhraseLocation *__pyx_r = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -45120,81 +45872,81 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intersect", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":861 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":866 * cdef PhraseLocation prefix_loc, suffix_loc, result * * prefix = prefix_node.phrase # <<<<<<<<<<<<<< * suffix = suffix_node.phrase * prefix_loc = prefix_node.phrase_location */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix_node, __pyx_n_s__phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix_node, __pyx_n_s__phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __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_3_sa_Phrase))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_prefix = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_2sa_3_sa_Phrase))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_prefix = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":862 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":867 * * prefix = prefix_node.phrase * suffix = suffix_node.phrase # <<<<<<<<<<<<<< * prefix_loc = prefix_node.phrase_location * suffix_loc = suffix_node.phrase_location */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_suffix_node, __pyx_n_s__phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_suffix_node, __pyx_n_s__phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 867; __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_3_sa_Phrase))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_suffix = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_2sa_3_sa_Phrase))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_suffix = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":863 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":868 * prefix = prefix_node.phrase * suffix = suffix_node.phrase * prefix_loc = prefix_node.phrase_location # <<<<<<<<<<<<<< * suffix_loc = suffix_node.phrase_location * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 868; __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_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_prefix_loc = ((struct __pyx_obj_3_sa_PhraseLocation *)__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 = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_prefix_loc = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":864 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":869 * suffix = suffix_node.phrase * prefix_loc = prefix_node.phrase_location * suffix_loc = suffix_node.phrase_location # <<<<<<<<<<<<<< * * result = self.get_precomputed_collocation(phrase) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_suffix_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_suffix_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 869; __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_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_suffix_loc = ((struct __pyx_obj_3_sa_PhraseLocation *)__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 = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_suffix_loc = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":866 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":871 * 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_122); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_123); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __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 = 866; __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 = 871; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __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 (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_result = ((struct __pyx_obj_3_sa_PhraseLocation *)__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 = 871; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":867 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":872 * * result = self.get_precomputed_collocation(phrase) * if result is not None: # <<<<<<<<<<<<<< @@ -45205,7 +45957,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":868 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":873 * result = self.get_precomputed_collocation(phrase) * if result is not None: * intersect_method = "precomputed" # <<<<<<<<<<<<<< @@ -45218,7 +45970,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":870 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":875 * intersect_method = "precomputed" * * if result is None: # <<<<<<<<<<<<<< @@ -45229,7 +45981,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_t_4 = (__pyx_t_5 != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":871 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":876 * * if result is None: * if self.use_baeza_yates: # <<<<<<<<<<<<<< @@ -45239,49 +45991,49 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_t_4 = (__pyx_v_self->use_baeza_yates != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":872 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":877 * 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_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_3_sa_BAEZA_YATES); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 877; __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_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); + __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":873 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":878 * if self.use_baeza_yates: * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, BAEZA_YATES) * intersect_method="double binary" # <<<<<<<<<<<<<< * else: * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_123)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_124)); __Pyx_XDECREF(__pyx_v_intersect_method); - __pyx_v_intersect_method = ((PyObject *)__pyx_kp_s_123); + __pyx_v_intersect_method = ((PyObject *)__pyx_kp_s_124); goto __pyx_L5; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":875 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":880 * 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_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_3_sa_MERGE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 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_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); + __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":876 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":881 * else: * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) * intersect_method="merge" # <<<<<<<<<<<<<< @@ -45297,7 +46049,7 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":877 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":882 * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) * intersect_method="merge" * return result # <<<<<<<<<<<<<< @@ -45309,13 +46061,13 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact __pyx_r = __pyx_v_result; goto __pyx_L0; - __pyx_r = ((struct __pyx_obj_3_sa_PhraseLocation *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_prefix); @@ -45330,8 +46082,8 @@ static struct __pyx_obj_3_sa_PhraseLocation *__pyx_f_3_sa_23HieroCachingRuleFact } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_frontier = 0; PyObject *__pyx_v_res = 0; PyObject *__pyx_v_fwords = 0; @@ -45362,16 +46114,16 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__p case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "advance") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "advance") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -45386,18 +46138,18 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__p } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_frontier, __pyx_v_res, __pyx_v_fwords); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_frontier, __pyx_v_res, __pyx_v_fwords); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":879 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":884 * return result * * def advance(self, frontier, res, fwords): # <<<<<<<<<<<<<< @@ -45405,7 +46157,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__p * nf = [] */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_frontier, PyObject *__pyx_v_res, PyObject *__pyx_v_fwords) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_frontier, PyObject *__pyx_v_res, PyObject *__pyx_v_fwords) { unsigned int __pyx_v_na; PyObject *__pyx_v_nf = NULL; PyObject *__pyx_v_toskip = NULL; @@ -45438,19 +46190,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("advance", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":881 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":886 * def advance(self, frontier, res, fwords): * cdef unsigned na * nf = [] # <<<<<<<<<<<<<< * for toskip, (i, alt, pathlen) in frontier: * spanlen = fwords[i][alt][2] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 881; __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 = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_nf = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":882 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":887 * cdef unsigned na * nf = [] * for toskip, (i, alt, pathlen) in frontier: # <<<<<<<<<<<<<< @@ -45461,7 +46213,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_frontier); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -45469,23 +46221,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ 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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 887; __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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 887; __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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 887; __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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 887; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -45501,7 +46253,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -45514,16 +46266,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __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 = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; @@ -45531,7 +46283,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __Pyx_GOTREF(__pyx_t_5); 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[8]; __pyx_lineno = 882; __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 = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_unpacking_done; @@ -45539,7 +46291,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __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 = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } __Pyx_XDECREF(__pyx_v_toskip); @@ -45555,7 +46307,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -45571,18 +46323,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_10); #else - __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); #endif __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_11)->tp_iternext; @@ -45592,7 +46344,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __Pyx_GOTREF(__pyx_t_9); index = 2; __pyx_t_10 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L8_unpacking_done; @@ -45600,7 +46352,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L8_unpacking_done:; } __Pyx_XDECREF(__pyx_v_i); @@ -45613,45 +46365,45 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __pyx_v_pathlen = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":883 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":888 * nf = [] * for toskip, (i, alt, pathlen) in frontier: * spanlen = fwords[i][alt][2] # <<<<<<<<<<<<<< * if toskip == 0: * res.append((i, alt, pathlen)) */ - __pyx_t_4 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_v_alt); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_v_alt); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __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_GetItemInt(__pyx_t_6, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_v_spanlen); __pyx_v_spanlen = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":884 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":889 * for toskip, (i, alt, pathlen) in frontier: * spanlen = fwords[i][alt][2] * if toskip == 0: # <<<<<<<<<<<<<< * res.append((i, alt, pathlen)) * ni = i + spanlen */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_toskip, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_v_toskip, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_12) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":885 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":890 * spanlen = fwords[i][alt][2] * if toskip == 0: * res.append((i, alt, pathlen)) # <<<<<<<<<<<<<< * ni = i + spanlen * if ni < len(fwords) and pathlen + 1 < self.max_initial_size: */ - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); @@ -45662,7 +46414,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __Pyx_INCREF(__pyx_v_pathlen); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_pathlen); __Pyx_GIVEREF(__pyx_v_pathlen); - __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_res, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_res, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -45670,42 +46422,42 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ } __pyx_L9:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":886 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":891 * if toskip == 0: * res.append((i, alt, pathlen)) * ni = i + spanlen # <<<<<<<<<<<<<< * if ni < len(fwords) and pathlen + 1 < self.max_initial_size: * for na in range(len(fwords[ni])): */ - __pyx_t_6 = PyNumber_Add(__pyx_v_i, __pyx_v_spanlen); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Add(__pyx_v_i, __pyx_v_spanlen); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF(__pyx_v_ni); __pyx_v_ni = __pyx_t_6; __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":887 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":892 * res.append((i, alt, pathlen)) * ni = i + spanlen * 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))) */ - __pyx_t_13 = PyObject_Length(__pyx_v_fwords); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Length(__pyx_v_fwords); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_ni, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_v_ni, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_12) { - __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_15 = __pyx_t_14; } else { @@ -45713,34 +46465,34 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ } if (__pyx_t_15) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":888 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":893 * ni = i + spanlen * 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))) * if len(nf) > 0: */ - __pyx_t_5 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ni); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ni); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_13 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_13; __pyx_t_16+=1) { __pyx_v_na = __pyx_t_16; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":889 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":894 * 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))) # <<<<<<<<<<<<<< * if len(nf) > 0: * return self.advance(nf, res, fwords) */ - __pyx_t_5 = PyNumber_Subtract(__pyx_v_toskip, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_toskip, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_na); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_na); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __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 = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_v_ni); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ni); @@ -45751,7 +46503,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __Pyx_GIVEREF(__pyx_t_4); __pyx_t_6 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __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); @@ -45759,7 +46511,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); __pyx_t_5 = 0; __pyx_t_10 = 0; - __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_nf, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_nf, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; } goto __pyx_L10; @@ -45768,18 +46520,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":890 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":895 * for na in range(len(fwords[ni])): * nf.append((toskip - 1, (ni, na, pathlen + 1))) * if len(nf) > 0: # <<<<<<<<<<<<<< * return self.advance(nf, res, fwords) * else: */ - __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_nf)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_nf)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((__pyx_t_2 > 0) != 0); if (__pyx_t_15) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":891 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":896 * nf.append((toskip - 1, (ni, na, pathlen + 1))) * if len(nf) > 0: * return self.advance(nf, res, fwords) # <<<<<<<<<<<<<< @@ -45787,9 +46539,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ * 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 = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 896; __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 = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_nf)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_nf)); @@ -45800,7 +46552,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __Pyx_INCREF(__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_fwords); __Pyx_GIVEREF(__pyx_v_fwords); - __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -45811,7 +46563,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":893 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":898 * return self.advance(nf, res, fwords) * else: * return res # <<<<<<<<<<<<<< @@ -45836,7 +46588,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_nf); @@ -45852,8 +46604,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_skip = 0; PyObject *__pyx_v_i = 0; PyObject *__pyx_v_spanlen = 0; @@ -45892,36 +46644,36 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__spanlen)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pathlen)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__next_states)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reachable_buffer)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __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_all_nodes_isteps_away") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_all_nodes_isteps_away") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -45944,18 +46696,18 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_skip, __pyx_v_i, __pyx_v_spanlen, __pyx_v_pathlen, __pyx_v_fwords, __pyx_v_next_states, __pyx_v_reachable_buffer); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_skip, __pyx_v_i, __pyx_v_spanlen, __pyx_v_pathlen, __pyx_v_fwords, __pyx_v_next_states, __pyx_v_reachable_buffer); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":895 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":900 * return res * * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): # <<<<<<<<<<<<<< @@ -45963,7 +46715,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_ * frontier = [] */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_skip, PyObject *__pyx_v_i, PyObject *__pyx_v_spanlen, PyObject *__pyx_v_pathlen, PyObject *__pyx_v_fwords, PyObject *__pyx_v_next_states, PyObject *__pyx_v_reachable_buffer) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_skip, PyObject *__pyx_v_i, PyObject *__pyx_v_spanlen, PyObject *__pyx_v_pathlen, PyObject *__pyx_v_fwords, PyObject *__pyx_v_next_states, PyObject *__pyx_v_reachable_buffer) { PyObject *__pyx_v_frontier = NULL; PyObject *__pyx_v_key = NULL; PyObject *__pyx_v_reachable = NULL; @@ -45994,41 +46746,41 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_all_nodes_isteps_away", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":897 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":902 * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): * cdef unsigned alt_it * frontier = [] # <<<<<<<<<<<<<< * if i+spanlen+skip >= len(next_states): * return frontier */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 897; __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 = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_frontier = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":898 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":903 * cdef unsigned alt_it * frontier = [] * if i+spanlen+skip >= len(next_states): # <<<<<<<<<<<<<< * return frontier * key = tuple([i,spanlen]) */ - __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_Length(__pyx_v_next_states); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_v_next_states); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __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_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":899 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":904 * frontier = [] * if i+spanlen+skip >= len(next_states): * return frontier # <<<<<<<<<<<<<< @@ -46043,14 +46795,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":900 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":905 * if i+spanlen+skip >= len(next_states): * return frontier * key = tuple([i,spanlen]) # <<<<<<<<<<<<<< * reachable = [] * if key in reachable_buffer: */ - __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __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 = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_i); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); @@ -46058,43 +46810,43 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __Pyx_INCREF(__pyx_v_spanlen); PyList_SET_ITEM(__pyx_t_4, 1, __pyx_v_spanlen); __Pyx_GIVEREF(__pyx_v_spanlen); - __pyx_t_1 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_4))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_4))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_v_key = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":901 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":906 * return frontier * key = tuple([i,spanlen]) * reachable = [] # <<<<<<<<<<<<<< * if key in reachable_buffer: * reachable = reachable_buffer[key] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 901; __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 = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_reachable = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":902 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":907 * key = tuple([i,spanlen]) * reachable = [] * if key in reachable_buffer: # <<<<<<<<<<<<<< * reachable = reachable_buffer[key] * else: */ - __pyx_t_5 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_key), __pyx_v_reachable_buffer, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_key), __pyx_v_reachable_buffer, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":903 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":908 * reachable = [] * if key in reachable_buffer: * reachable = reachable_buffer[key] # <<<<<<<<<<<<<< * else: * reachable = self.reachable(fwords, i, spanlen) */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_reachable); __pyx_v_reachable = __pyx_t_1; @@ -46103,16 +46855,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":905 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":910 * 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 = 905; __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 = 910; __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 = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fwords); @@ -46123,7 +46875,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __Pyx_INCREF(__pyx_v_spanlen); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_spanlen); __Pyx_GIVEREF(__pyx_v_spanlen); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 910; __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_4)); __pyx_t_4 = 0; @@ -46131,18 +46883,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __pyx_v_reachable = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":906 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":911 * else: * reachable = self.reachable(fwords, i, spanlen) * reachable_buffer[key] = reachable # <<<<<<<<<<<<<< * for nextreachable in reachable: * for next_id in next_states[nextreachable]: */ - if (PyObject_SetItem(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key), __pyx_v_reachable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key), __pyx_v_reachable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":907 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":912 * reachable = self.reachable(fwords, i, spanlen) * reachable_buffer[key] = reachable * for nextreachable in reachable: # <<<<<<<<<<<<<< @@ -46153,7 +46905,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __pyx_t_2 = __pyx_v_reachable; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_7 = 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 = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_reachable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; } @@ -46161,23 +46913,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ 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 = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 912; __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 = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 912; __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 = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 912; __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 = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_4 = __pyx_t_7(__pyx_t_2); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -46187,20 +46939,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __pyx_v_nextreachable = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":908 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":913 * 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_t_4 = PyObject_GetItem(__pyx_v_next_states, __pyx_v_nextreachable); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_next_states, __pyx_v_nextreachable); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __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; } 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 = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); 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_9 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -46209,23 +46961,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ 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 = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 913; __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 = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 913; __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 = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 913; __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 = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_4 = __pyx_t_9(__pyx_t_1); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -46235,16 +46987,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __pyx_v_next_id = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":909 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":914 * 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 = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 914; __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 = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_fwords); @@ -46255,7 +47007,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __Pyx_INCREF(__pyx_v_next_id); PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_next_id); __Pyx_GIVEREF(__pyx_v_next_id); - __pyx_t_11 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; @@ -46263,19 +47015,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __pyx_v_jump = __pyx_t_11; __pyx_t_11 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":910 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":915 * 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 = 910; __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 = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 915; __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 = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":911 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":916 * jump = self.shortest(fwords,i,next_id) * if jump < skip: * continue # <<<<<<<<<<<<<< @@ -46287,50 +47039,50 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ } __pyx_L9:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":912 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":917 * 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 = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); 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_t_10 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_v_self->max_initial_size); 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_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 = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 917; __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 = 912; __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 = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":913 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":918 * 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 (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_next_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __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 = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { __pyx_t_10 = __pyx_t_4; __Pyx_INCREF(__pyx_t_10); __pyx_t_12 = 0; __pyx_t_13 = NULL; } else { - __pyx_t_12 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_13 = Py_TYPE(__pyx_t_10)->tp_iternext; } @@ -46339,23 +47091,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_10)) { if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_10)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_10, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_10, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_10)) { if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_10)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_10, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_10, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_4 = __pyx_t_13(__pyx_t_10); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -46365,40 +47117,40 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __pyx_v_alt_id = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":914 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":919 * 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 (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_next_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyObject_GetItem(__pyx_t_4, __pyx_v_alt_id); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetItem(__pyx_t_4, __pyx_v_alt_id); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_11, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_11, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_14 = PyObject_RichCompare(__pyx_t_4, __pyx_t_11, Py_NE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_RichCompare(__pyx_t_4, __pyx_t_11, Py_NE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":915 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":920 * 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_14 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(3); 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_INCREF(__pyx_v_next_id); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_next_id); @@ -46413,27 +47165,27 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __pyx_v_newel = ((PyObject*)__pyx_t_11); __pyx_t_11 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":916 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":921 * 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)) * return frontier */ - __pyx_t_6 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_newel), ((PyObject *)__pyx_v_frontier), Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_newel), ((PyObject *)__pyx_v_frontier), Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = (__pyx_t_6 != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":917 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":922 * newel = (next_id,alt_id,pathlen+jump) * if newel not in frontier: * frontier.append((next_id,alt_id,pathlen+jump)) # <<<<<<<<<<<<<< * return frontier * */ - __pyx_t_11 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(__pyx_v_next_id); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_next_id); @@ -46444,7 +47196,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_frontier, ((PyObject *)__pyx_t_14)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_frontier, ((PyObject *)__pyx_t_14)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; goto __pyx_L14; } @@ -46463,7 +47215,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":918 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":923 * if newel not in frontier: * frontier.append((next_id,alt_id,pathlen+jump)) * return frontier # <<<<<<<<<<<<<< @@ -46484,7 +47236,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_frontier); @@ -46501,8 +47253,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fwords = 0; PyObject *__pyx_v_ifrom = 0; PyObject *__pyx_v_dist = 0; @@ -46533,16 +47285,16 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dist)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reachable") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reachable") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -46557,18 +47309,18 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_dist); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_dist); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":920 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":925 * return frontier * * def reachable(self, fwords, ifrom, dist): # <<<<<<<<<<<<<< @@ -46576,7 +47328,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *_ * if ifrom >= len(fwords): */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_dist) { +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) { PyObject *__pyx_v_ret = NULL; PyObject *__pyx_v_alt_id = NULL; PyObject *__pyx_v_ifromchild = NULL; @@ -46599,35 +47351,35 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("reachable", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":921 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":926 * * def reachable(self, fwords, ifrom, dist): * ret = [] # <<<<<<<<<<<<<< * if ifrom >= len(fwords): * return ret */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 921; __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 = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_ret = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":922 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":927 * def reachable(self, fwords, ifrom, dist): * ret = [] * if ifrom >= len(fwords): # <<<<<<<<<<<<<< * return ret * for alt_id in range(len(fwords[ifrom])): */ - __pyx_t_2 = PyObject_Length(__pyx_v_fwords); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __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 = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_v_fwords); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 927; __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 = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __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 = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":923 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":928 * ret = [] * if ifrom >= len(fwords): * return ret # <<<<<<<<<<<<<< @@ -46642,32 +47394,32 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":924 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":929 * if ifrom >= len(fwords): * return ret * 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)) */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __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[8]; __pyx_lineno = 924; __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[8]; __pyx_lineno = 929; __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 = 924; __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 = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -46676,23 +47428,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py 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 = 924; __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 = 929; __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 = 924; __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 = 929; __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 = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 929; __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 = 924; __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 = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -46702,53 +47454,53 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py __pyx_v_alt_id = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":925 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":930 * return ret * 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: */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __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_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __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 = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":926 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":931 * 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_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ret), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ret), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __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 = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fwords); @@ -46759,16 +47511,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_dist); __Pyx_GIVEREF(__pyx_v_dist); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __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[8]; __pyx_lineno = 926; __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 = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -46777,37 +47529,37 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":928 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":933 * 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_8 = PyObject_RichCompare(__pyx_v_dist, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 928; __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 = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_v_dist, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __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 = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":929 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":934 * else: * if dist == 0: * if ifrom not in ret: # <<<<<<<<<<<<<< * ret.append(ifrom) * else: */ - __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_ifrom, ((PyObject *)__pyx_v_ret), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_ifrom, ((PyObject *)__pyx_v_ret), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = (__pyx_t_4 != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":930 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":935 * 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_10 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_ifrom); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __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 = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; @@ -46815,29 +47567,29 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":932 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":937 * 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_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__reachable); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__reachable); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __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_GetItemInt(__pyx_t_7, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_7, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __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 = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __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_Subtract(__pyx_v_dist, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_v_dist, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __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 = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fwords); @@ -46848,7 +47600,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py __Pyx_GIVEREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; @@ -46856,7 +47608,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py __pyx_t_6 = __pyx_t_3; __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_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; } @@ -46865,23 +47617,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_6)) { if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_6)) { if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_12(__pyx_t_6); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -46891,25 +47643,25 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py __pyx_v_ifromchild = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":933 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":938 * 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_9 = (__Pyx_PySequence_Contains(__pyx_v_ifromchild, ((PyObject *)__pyx_v_ret), Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_v_ifromchild, ((PyObject *)__pyx_v_ret), Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = (__pyx_t_9 != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":934 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":939 * 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_10 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_ifromchild); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __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 = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L11; } __pyx_L11:; @@ -46922,7 +47674,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":936 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":941 * ret.append(ifromchild) * * return ret # <<<<<<<<<<<<<< @@ -46942,7 +47694,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ret); @@ -46954,8 +47706,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_16reachable(struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fwords = 0; PyObject *__pyx_v_ifrom = 0; PyObject *__pyx_v_ito = 0; @@ -46986,16 +47738,16 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ito)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shortest") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shortest") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -47010,18 +47762,18 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_ito); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_ito); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":938 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":943 * return ret * * def shortest(self, fwords, ifrom, ito): # <<<<<<<<<<<<<< @@ -47029,7 +47781,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__ * min = 1000 */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_ifrom, PyObject *__pyx_v_ito) { +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) { unsigned int __pyx_v_alt_id; PyObject *__pyx_v_min = NULL; PyObject *__pyx_v_currmin = NULL; @@ -47046,7 +47798,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("shortest", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":940 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":945 * def shortest(self, fwords, ifrom, ito): * cdef unsigned alt_id * min = 1000 # <<<<<<<<<<<<<< @@ -47056,19 +47808,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx __Pyx_INCREF(__pyx_int_1000); __pyx_v_min = __pyx_int_1000; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":941 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":946 * cdef unsigned alt_id * min = 1000 * if ifrom > ito: # <<<<<<<<<<<<<< * return min * if ifrom == ito: */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 941; __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 = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 946; __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 = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":942 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":947 * min = 1000 * if ifrom > ito: * return min # <<<<<<<<<<<<<< @@ -47083,19 +47835,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":943 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":948 * if ifrom > ito: * return min * if ifrom == ito: # <<<<<<<<<<<<<< * return 0 * for alt_id in range(len(fwords[ifrom])): */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __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 = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 948; __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 = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":944 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":949 * return min * if ifrom == ito: * return 0 # <<<<<<<<<<<<<< @@ -47110,41 +47862,41 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":945 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":950 * if ifrom == ito: * 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: */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_alt_id = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":946 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":951 * 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 = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_alt_id, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_alt_id, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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 = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __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 = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_fwords); @@ -47155,7 +47907,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_ito); __Pyx_GIVEREF(__pyx_v_ito); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -47163,38 +47915,38 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx __pyx_v_currmin = __pyx_t_6; __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":947 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":952 * 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 (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_alt_id, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_alt_id, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __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 = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 952; __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 = 947; __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 = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":948 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":953 * 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 = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_currmin, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_currmin); __pyx_v_currmin = __pyx_t_1; @@ -47203,19 +47955,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":949 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":954 * 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 = 949; __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 = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 954; __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 = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":950 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":955 * currmin += 1 * if currmin < min: * min = currmin # <<<<<<<<<<<<<< @@ -47230,7 +47982,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx __pyx_L8:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":951 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":956 * if currmin < min: * min = currmin * return min # <<<<<<<<<<<<<< @@ -47248,7 +48000,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_min); @@ -47259,8 +48011,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_18shortest(struct __pyx } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v__columns = 0; PyObject *__pyx_v_curr_idx = 0; PyObject *__pyx_v_min_dist = 0; @@ -47292,7 +48044,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObj case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__curr_idx)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_next_states", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get_next_states", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { @@ -47301,7 +48053,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_next_states") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_next_states") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -47318,18 +48070,18 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_next_states", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("get_next_states", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v__columns, __pyx_v_curr_idx, __pyx_v_min_dist); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_states(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v__columns, __pyx_v_curr_idx, __pyx_v_min_dist); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":953 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":958 * return min * * def get_next_states(self, _columns, curr_idx, min_dist=2): # <<<<<<<<<<<<<< @@ -47337,7 +48089,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObj * candidate = [[curr_idx,0]] */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v__columns, PyObject *__pyx_v_curr_idx, PyObject *__pyx_v_min_dist) { +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) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_candidate = NULL; PyObject *__pyx_v_curr = NULL; @@ -47362,26 +48114,26 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_next_states", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":954 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":959 * * def get_next_states(self, _columns, curr_idx, min_dist=2): * result = [] # <<<<<<<<<<<<<< * candidate = [[curr_idx,0]] * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 954; __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 = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":955 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":960 * def get_next_states(self, _columns, curr_idx, min_dist=2): * result = [] * candidate = [[curr_idx,0]] # <<<<<<<<<<<<<< * * while len(candidate) > 0: */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_curr_idx); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_curr_idx); @@ -47389,7 +48141,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc __Pyx_INCREF(__pyx_int_0); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -47397,7 +48149,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc __pyx_v_candidate = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":957 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":962 * candidate = [[curr_idx,0]] * * while len(candidate) > 0: # <<<<<<<<<<<<<< @@ -47405,43 +48157,43 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc * if curr[0] >= len(_columns): */ while (1) { - __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_candidate)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_candidate)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((__pyx_t_3 > 0) != 0); if (!__pyx_t_4) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":958 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":963 * * while len(candidate) > 0: * curr = candidate.pop() # <<<<<<<<<<<<<< * if curr[0] >= len(_columns): * continue */ - __pyx_t_2 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_candidate)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_candidate)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_curr); __pyx_v_curr = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":959 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":964 * while len(candidate) > 0: * curr = candidate.pop() * if curr[0] >= len(_columns): # <<<<<<<<<<<<<< * continue * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: */ - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Length(__pyx_v__columns); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_v__columns); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __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_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 959; __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 = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":960 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":965 * curr = candidate.pop() * if curr[0] >= len(_columns): * continue # <<<<<<<<<<<<<< @@ -47453,30 +48205,30 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":961 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":966 * if curr[0] >= len(_columns): * continue * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: # <<<<<<<<<<<<<< * result.append(curr[0]); * curr_col = _columns[curr[0]] */ - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_5, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_5, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __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 = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { __Pyx_DECREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __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 = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 966; __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 = 961; __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 = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = __pyx_t_6; } else { @@ -47484,38 +48236,38 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":962 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":967 * continue * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: * result.append(curr[0]); # <<<<<<<<<<<<<< * curr_col = _columns[curr[0]] * for alt in curr_col: */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L6; } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":963 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":968 * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: * result.append(curr[0]); * curr_col = _columns[curr[0]] # <<<<<<<<<<<<<< * for alt in curr_col: * next_id = curr[0]+alt[2] */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetItem(__pyx_v__columns, __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetItem(__pyx_v__columns, __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_v_curr_col); __pyx_v_curr_col = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":964 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":969 * result.append(curr[0]); * curr_col = _columns[curr[0]] * for alt in curr_col: # <<<<<<<<<<<<<< @@ -47526,7 +48278,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc __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 = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; } @@ -47534,23 +48286,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc 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 = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 969; __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 = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 969; __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 = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 969; __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 = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_9(__pyx_t_5); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -47560,18 +48312,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc __pyx_v_alt = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":965 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":970 * curr_col = _columns[curr[0]] * for alt in curr_col: * next_id = curr[0]+alt[2] # <<<<<<<<<<<<<< * jump = 1 * if alt[0] == EPSILON: */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_alt, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_alt, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -47579,7 +48331,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc __pyx_v_next_id = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":966 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":971 * for alt in curr_col: * next_id = curr[0]+alt[2] * jump = 1 # <<<<<<<<<<<<<< @@ -47590,25 +48342,25 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc __Pyx_XDECREF(__pyx_v_jump); __pyx_v_jump = __pyx_int_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":967 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":972 * next_id = curr[0]+alt[2] * jump = 1 * if alt[0] == EPSILON: # <<<<<<<<<<<<<< * jump = 0 * if next_id not in result and min_dist <= curr[1]+jump <= self.max_initial_size+1: */ - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_alt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_alt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __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 = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 972; __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 = 967; __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 = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":968 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":973 * jump = 1 * if alt[0] == EPSILON: * jump = 0 # <<<<<<<<<<<<<< @@ -47622,30 +48374,30 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc } __pyx_L9:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":969 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":974 * if alt[0] == EPSILON: * 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]) * return sorted(result); */ - __pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_next_id, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_next_id, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_7) { - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __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 = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_jump); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __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 = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { __Pyx_DECREF(__pyx_t_1); - __pyx_t_10 = PyInt_FromLong((__pyx_v_self->max_initial_size + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong((__pyx_v_self->max_initial_size + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __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 = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 974; __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 = 969; __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 = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_4; } else { @@ -47653,19 +48405,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc } if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":970 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":975 * 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]) # <<<<<<<<<<<<<< * return sorted(result); * */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __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 = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_jump); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_next_id); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_next_id); @@ -47673,7 +48425,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_candidate, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_candidate, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L10; } @@ -47683,20 +48435,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc __pyx_L3_continue:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":971 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":976 * 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); # <<<<<<<<<<<<<< * - * def input(self, fwords, meta): + * def input(self, fwords, meta, ctx_name=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_result)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_result)); __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); - __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_r = __pyx_t_1; @@ -47710,7 +48462,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -47724,14 +48476,15 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_20get_next_states(struc __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_3_sa_23HieroCachingRuleFactory_22input[] = "When this function is called on the RuleFactory,\n it looks up all of the rules that can be used to translate\n the input sentence"; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input[] = "When this function is called on the RuleFactory,\n it looks up all of the rules that can be used to translate\n the input sentence"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fwords = 0; PyObject *__pyx_v_meta = 0; + PyObject *__pyx_v_ctx_name = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -47739,12 +48492,22 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("input (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__meta,0}; - PyObject* values[2] = {0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__meta,&__pyx_n_s__ctx_name,0}; + PyObject* values[3] = {0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":978 + * 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 + */ + values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; @@ -47758,38 +48521,47 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__meta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("input", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("input", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx_name); + if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "input") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "input") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } __pyx_v_fwords = values[0]; __pyx_v_meta = values[1]; + __pyx_v_ctx_name = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("input", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("input", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_22input(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_meta); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_meta, __pyx_v_ctx_name); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_lambda4 = {__Pyx_NAMESTR("lambda4"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_lambda4, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4 = {__Pyx_NAMESTR("lambda4"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda4 (wrapper)", 0); @@ -47799,9 +48571,9 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_lambda4(PyObject } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5 = {__Pyx_NAMESTR("lambda5"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5 = {__Pyx_NAMESTR("lambda5"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda5 (wrapper)", 0); @@ -47810,7 +48582,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5 return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1142 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1147 * if len(extracts) > 0: * fcount = Counter() * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) # <<<<<<<<<<<<<< @@ -47829,14 +48601,14 @@ static PyObject *__pyx_lambda_funcdef_lambda5(CYTHON_UNUSED PyObject *__pyx_self int __pyx_clineno = 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 = 1142; __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 = 1147; __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 = 1142; __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 = 1147; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __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; @@ -47850,7 +48622,7 @@ static PyObject *__pyx_lambda_funcdef_lambda5(CYTHON_UNUSED PyObject *__pyx_self __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input.lambda4.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda4.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -47869,16 +48641,16 @@ static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self int __pyx_clineno = 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 = 1142; __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 = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5, 0, __pyx_n_s_124, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5, 0, __pyx_n_s_125, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __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 = 1142; __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 = 1147; __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[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __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; @@ -47892,7 +48664,7 @@ 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("_sa.HieroCachingRuleFactory.input.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -47901,9 +48673,9 @@ static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_1lambda6(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_1lambda6 = {__Pyx_NAMESTR("lambda6"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_1lambda6, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_1lambda6(PyObject *__pyx_self, PyObject *__pyx_v_x) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6 = {__Pyx_NAMESTR("lambda6"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6(PyObject *__pyx_self, PyObject *__pyx_v_x) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda6 (wrapper)", 0); @@ -47912,7 +48684,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_5input_1lambda6(PyObjec return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1148 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1153 * for f, elist in fphrases.iteritems(): * for e, alslist in elist.iteritems(): * alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) # <<<<<<<<<<<<<< @@ -47930,11 +48702,11 @@ static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda6", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __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 = 1153; __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 = 1148; __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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -47944,42 +48716,42 @@ static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input.lambda6", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda6", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_5input_4generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_4generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1187 - * # Online rule extraction and scoring +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1193 * 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 */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_5input_2genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *__pyx_cur_scope; +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; 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_3_sa___pyx_scope_struct_20_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_20_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_20_genexpr, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_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_19_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_3_sa_23HieroCachingRuleFactory_5input_4generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __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_4generator14, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -47988,7 +48760,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_5input_2genexpr(PyObjec __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -47997,9 +48769,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_5input_2genexpr(PyObjec return __pyx_r; } -static PyObject *__pyx_gb_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_4generator14(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *)__pyx_generator->closure); + 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); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -48019,13 +48791,13 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_5input_4generator14(__p return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __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 = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __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 = 1193; __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)) { __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 = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -48033,23 +48805,23 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_5input_4generator14(__p 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 = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1193; __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 = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1193; __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 = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1193; __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 = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1193; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -48060,9 +48832,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_5input_4generator14(__p __Pyx_GIVEREF(__pyx_t_4); __pyx_cur_scope->__pyx_v_word = __pyx_t_4; __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_word, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_word, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_5; @@ -48082,7 +48854,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_5input_4generator14(__p __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 = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyErr_SetNone(PyExc_StopIteration); @@ -48100,23 +48872,23 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_5input_4generator14(__p return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":973 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":978 * return sorted(result); * - * def input(self, fwords, meta): # <<<<<<<<<<<<<< + * 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 */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_fwords, PyObject *__pyx_v_meta) { - struct __pyx_obj_3_sa___pyx_scope_struct_19_input *__pyx_cur_scope; +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; 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_3_sa___pyx_scope_struct_19_input *)__pyx_tp_new_3_sa___pyx_scope_struct_19_input(__pyx_ptype_3_sa___pyx_scope_struct_19_input, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -48131,8 +48903,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_ob __pyx_cur_scope->__pyx_v_meta = __pyx_v_meta; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_meta); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_meta); + __pyx_cur_scope->__pyx_v_ctx_name = __pyx_v_ctx_name; + __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_3_sa_23HieroCachingRuleFactory_24generator4, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -48141,7 +48916,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_ob __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -48150,9 +48925,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_22input(struct __pyx_ob return __pyx_r; } -static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_19_input *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_19_input *)__pyx_generator->closure); + 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); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -48197,9 +48972,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":984 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":989 * cdef Phrase hiero_phrase * * flen = len(fwords) # <<<<<<<<<<<<<< @@ -48208,27 +48983,27 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __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 = 984; __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 = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_cur_scope->__pyx_v_flen = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":985 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":990 * * 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 = 985; __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[8]; __pyx_lineno = 990; __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[8]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 990; __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 = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_cur_scope->__pyx_v_start_time = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":986 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":991 * flen = len(fwords) * start_time = monitor_cpu() * self.extract_time = 0.0 # <<<<<<<<<<<<<< @@ -48237,7 +49012,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __pyx_cur_scope->__pyx_v_self->extract_time = 0.0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":987 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":992 * start_time = monitor_cpu() * self.extract_time = 0.0 * self.intersect_time = 0.0 # <<<<<<<<<<<<<< @@ -48246,20 +49021,20 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __pyx_cur_scope->__pyx_v_self->intersect_time = 0.0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":988 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":993 * 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 = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":989 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":994 * self.intersect_time = 0.0 * nodes_isteps_away_buffer = {} * hit = 0 # <<<<<<<<<<<<<< @@ -48268,46 +49043,46 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __pyx_cur_scope->__pyx_v_hit = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":990 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":995 * 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 = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_cur_scope->__pyx_v_reachable_buffer = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":995 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1000 * # 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 = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_cur_scope->__pyx_v_seen_phrases = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":998 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1003 * * # 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 = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); 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); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_1); @@ -48316,20 +49091,20 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_self->rules->root = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1000 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1005 * 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 = 1000; __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 = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_cur_scope->__pyx_v_frontier = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1001 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1006 * * frontier = [] * for i in range(len(fwords)): # <<<<<<<<<<<<<< @@ -48338,72 +49113,72 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __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 = 1001; __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 = 1006; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1002 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1007 * 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, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1007; __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 = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1007; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1003 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1008 * 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, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __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, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); 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_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 = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1008; __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_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1004 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1009 * 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 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __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 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PyTuple_New(8); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyTuple_New(8); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); @@ -48429,7 +49204,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_10 = 0; __pyx_t_1 = 0; __pyx_t_11 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_12)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_12)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; goto __pyx_L8; } @@ -48437,7 +49212,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1006 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1011 * frontier.append((i, i, (i,), alt, 0, self.rules.root, (), False)) * * xroot = None # <<<<<<<<<<<<<< @@ -48448,42 +49223,42 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GIVEREF(Py_None); __pyx_cur_scope->__pyx_v_xroot = Py_None; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1007 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1012 * * xroot = None * x1 = sym_setindex(self.category, 1) # <<<<<<<<<<<<<< * if x1 in self.rules.root.children: * xroot = self.rules.root.children[x1] */ - __pyx_cur_scope->__pyx_v_x1 = __pyx_f_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, 1); + __pyx_cur_scope->__pyx_v_x1 = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1008 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1013 * xroot = None * x1 = sym_setindex(self.category, 1) * if x1 in self.rules.root.children: # <<<<<<<<<<<<<< * xroot = self.rules.root.children[x1] * else: */ - __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_t_12, __pyx_t_11, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_t_12, __pyx_t_11, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_14 = (__pyx_t_9 != 0); if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1009 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1014 * 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_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_x1, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_x1, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot); @@ -48495,21 +49270,21 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1011 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1016 * xroot = self.rules.root.children[x1] * else: * xroot = ExtendedTrieNode(suffix_link=self.rules.root, phrase_location=PhraseLocation()) # <<<<<<<<<<<<<< * self.rules.root.children[x1] = xroot * */ - __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_self->rules->root) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_self->rules->root) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); 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); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_11) < 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_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); 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_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot); @@ -48518,21 +49293,21 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_xroot = __pyx_t_11; __pyx_t_11 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1012 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1017 * 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_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - if (__Pyx_SetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_xroot, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_xroot, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __pyx_L9:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1014 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1019 * self.rules.root.children[x1] = xroot * * for i in range(self.min_gap_size, len(fwords)): # <<<<<<<<<<<<<< @@ -48541,81 +49316,81 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __pyx_t_11 = __pyx_cur_scope->__pyx_v_fwords; __Pyx_INCREF(__pyx_t_11); - __pyx_t_2 = PyObject_Length(__pyx_t_11); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_t_11); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1015 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1020 * * 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_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_6 = PyObject_Length(__pyx_t_11); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(__pyx_t_11); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1016 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1021 * 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_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_12, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_12, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_11, __pyx_t_12, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_11, __pyx_t_12, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1017 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1022 * 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)) # <<<<<<<<<<<<<< * * next_states = [] */ - __pyx_t_1 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_i - __pyx_cur_scope->__pyx_v_self->min_gap_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_i - __pyx_cur_scope->__pyx_v_self->min_gap_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __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 = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_16 = PyTuple_New(8); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyTuple_New(8); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -48641,7 +49416,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_3 = 0; __pyx_t_15 = 0; __pyx_t_8 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_16)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_16)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; goto __pyx_L14; } @@ -48649,20 +49424,20 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1019 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1024 * frontier.append((i-self.min_gap_size, i, (i,), alt, self.min_gap_size, xroot, (x1,), True)) * * next_states = [] # <<<<<<<<<<<<<< * for i in range(len(fwords)): * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) */ - __pyx_t_16 = PyList_New(0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyList_New(0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_GIVEREF(((PyObject *)__pyx_t_16)); __pyx_cur_scope->__pyx_v_next_states = ((PyObject*)__pyx_t_16); __pyx_t_16 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1020 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1025 * * next_states = [] * for i in range(len(fwords)): # <<<<<<<<<<<<<< @@ -48671,25 +49446,25 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __pyx_t_16 = __pyx_cur_scope->__pyx_v_fwords; __Pyx_INCREF(__pyx_t_16); - __pyx_t_2 = PyObject_Length(__pyx_t_16); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_t_16); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1021 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1026 * 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_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__get_next_states); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__get_next_states); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); - __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_fwords); @@ -48700,15 +49475,15 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GIVEREF(__pyx_t_15); __pyx_t_8 = 0; __pyx_t_15 = 0; - __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_next_states, __pyx_t_15); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_next_states, __pyx_t_15); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1023 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1028 * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) * * while len(frontier) > 0: # <<<<<<<<<<<<<< @@ -48716,18 +49491,18 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene * for k, i, input_match, alt, pathlen, node, prefix, is_shadow_path in frontier: */ while (1) { - __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_14 = ((__pyx_t_2 > 0) != 0); if (!__pyx_t_14) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1024 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1029 * * 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_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyList_New(0); 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_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); @@ -48735,7 +49510,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_new_frontier = ((PyObject*)__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1025 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1030 * while len(frontier) > 0: * new_frontier = [] * for k, i, input_match, alt, pathlen, node, prefix, is_shadow_path in frontier: # <<<<<<<<<<<<<< @@ -48746,9 +49521,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene for (;;) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_15)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_15, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_15, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __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; @@ -48760,7 +49535,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene if (unlikely(size != 8)) { if (size > 8) __Pyx_RaiseTooManyValuesError(8); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -48794,7 +49569,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene Py_ssize_t i; PyObject** temps[8] = {&__pyx_t_16,&__pyx_t_8,&__pyx_t_11,&__pyx_t_10,&__pyx_t_12,&__pyx_t_1,&__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 = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(item); *(temps[i]) = item; } @@ -48804,7 +49579,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene { Py_ssize_t index = -1; PyObject** temps[8] = {&__pyx_t_16,&__pyx_t_8,&__pyx_t_11,&__pyx_t_10,&__pyx_t_12,&__pyx_t_1,&__pyx_t_17,&__pyx_t_18}; - __pyx_t_19 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_20 = Py_TYPE(__pyx_t_19)->tp_iternext; @@ -48813,7 +49588,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_19), 8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_19), 8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = NULL; __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; goto __pyx_L22_unpacking_done; @@ -48821,14 +49596,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_t_20 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L22_unpacking_done:; } - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_16); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_16); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_cur_scope->__pyx_v_k = __pyx_t_5; __pyx_cur_scope->__pyx_v_i = __pyx_t_7; @@ -48859,19 +49634,19 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_is_shadow_path = __pyx_t_18; __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1026 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1031 * 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_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_18, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_18, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word_id); @@ -48880,19 +49655,19 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_word_id = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1027 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1032 * 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_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_18, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_18, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_spanlen); @@ -48901,47 +49676,47 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1029 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1034 * 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_3 = PyInt_FromLong(__pyx_v_3_sa_EPSILON); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_18); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_18); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1031 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1036 * if word_id == EPSILON: * # skipping because word_id is epsilon * if i+spanlen >= len(fwords): # <<<<<<<<<<<<<< * continue * for nualt in range(0,len(fwords[i+spanlen])): */ - __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __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 = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1036; __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_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 = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(__pyx_t_18); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __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 = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = PyObject_RichCompare(__pyx_t_3, __pyx_t_18, Py_GE); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyObject_RichCompare(__pyx_t_3, __pyx_t_18, Py_GE); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __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_14 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1032 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1037 * # skipping because word_id is epsilon * if i+spanlen >= len(fwords): * continue # <<<<<<<<<<<<<< @@ -48953,43 +49728,43 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L24:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1033 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1038 * if i+spanlen >= len(fwords): * continue * for nualt in range(0,len(fwords[i+spanlen])): # <<<<<<<<<<<<<< * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) * continue */ - __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyNumber_Add(__pyx_t_17, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyNumber_Add(__pyx_t_17, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_18); if (!__pyx_t_17) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_18); if (!__pyx_t_17) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __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 = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(__pyx_t_17); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __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) { __pyx_cur_scope->__pyx_v_nualt = __pyx_t_21; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1034 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1039 * continue * for nualt in range(0,len(fwords[i+spanlen])): * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) # <<<<<<<<<<<<<< * continue * */ - __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyInt_FromLong(__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_3 = PyNumber_Add(__pyx_t_18, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_nualt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_nualt); 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 = PyTuple_New(8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(8); 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); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_17); __Pyx_GIVEREF(__pyx_t_17); @@ -49015,11 +49790,11 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_17 = 0; __pyx_t_3 = 0; __pyx_t_18 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1035 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1040 * for nualt in range(0,len(fwords[i+spanlen])): * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) * continue # <<<<<<<<<<<<<< @@ -49031,19 +49806,19 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L23:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1037 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1042 * continue * * phrase = prefix + (word_id,) # <<<<<<<<<<<<<< * hiero_phrase = Phrase(phrase) * arity = hiero_phrase.arity() */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1037; __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 = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_word_id); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_word_id); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_word_id); - __pyx_t_18 = PyNumber_Add(__pyx_cur_scope->__pyx_v_prefix, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyNumber_Add(__pyx_cur_scope->__pyx_v_prefix, ((PyObject *)__pyx_t_1)); 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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_phrase); @@ -49052,44 +49827,44 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_phrase = __pyx_t_18; __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1038 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1043 * * phrase = prefix + (word_id,) * hiero_phrase = Phrase(phrase) # <<<<<<<<<<<<<< * arity = hiero_phrase.arity() * */ - __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_cur_scope->__pyx_v_phrase); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)); __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_hiero_phrase = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); + __pyx_cur_scope->__pyx_v_hiero_phrase = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1039 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1044 * phrase = prefix + (word_id,) * hiero_phrase = Phrase(phrase) * arity = hiero_phrase.arity() # <<<<<<<<<<<<<< * * lookup_required = False */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase), __pyx_n_s__arity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase), __pyx_n_s__arity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_18 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __pyx_cur_scope->__pyx_v_arity = __pyx_t_21; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1041 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1046 * arity = hiero_phrase.arity() * * lookup_required = False # <<<<<<<<<<<<<< @@ -49098,30 +49873,30 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __pyx_cur_scope->__pyx_v_lookup_required = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1042 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1047 * * 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 = 1042; __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 = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_14 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_18, Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_18, Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __pyx_t_9 = (__pyx_t_14 != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1043 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1048 * 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 = 1043; __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 = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_1 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __pyx_t_9 = (__pyx_t_1 == Py_None); @@ -49129,7 +49904,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_14 = (__pyx_t_9 != 0); if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1045 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1050 * if node.children[word_id] is None: * # Path dead-ends at this node * continue # <<<<<<<<<<<<<< @@ -49141,16 +49916,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1048 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1053 * else: * # Path continues at this node * node = node.children[word_id] # <<<<<<<<<<<<<< * else: * if node.suffix_link is None: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_18 = PyObject_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node); @@ -49164,21 +49939,21 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1050 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1055 * 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 = 1050; __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 = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __pyx_t_14 = (__pyx_t_18 == Py_None); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __pyx_t_9 = (__pyx_t_14 != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1052 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1057 * if node.suffix_link is None: * # Current node is root; lookup required * lookup_required = True # <<<<<<<<<<<<<< @@ -49190,36 +49965,36 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1054 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1059 * 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 = 1054; __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 = 1059; __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 = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_14 = (__pyx_t_9 != 0); if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1055 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1060 * 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_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 = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1060; __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 = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1060; __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 (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __pyx_t_14 = (__pyx_t_1 == Py_None); @@ -49227,19 +50002,19 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_9 = (__pyx_t_14 != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1057 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1062 * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1058 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1063 * # Suffix link reports path is dead end * node.children[word_id] = None * continue # <<<<<<<<<<<<<< @@ -49251,7 +50026,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1061 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1066 * else: * # Suffix link indicates lookup is reqired * lookup_required = True # <<<<<<<<<<<<<< @@ -49265,18 +50040,18 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1064 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1069 * else: * #ERROR: We never get here * raise Exception("Keyword trie error") # <<<<<<<<<<<<<< * # checking whether lookup_required * if lookup_required: */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_126), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __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[8]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L30:; } @@ -49284,7 +50059,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L27:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1066 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1071 * raise Exception("Keyword trie error") * # checking whether lookup_required * if lookup_required: # <<<<<<<<<<<<<< @@ -49294,7 +50069,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_9 = (__pyx_cur_scope->__pyx_v_lookup_required != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1067 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1072 * # checking whether lookup_required * if lookup_required: * new_node = None # <<<<<<<<<<<<<< @@ -49307,66 +50082,66 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GIVEREF(Py_None); __pyx_cur_scope->__pyx_v_new_node = Py_None; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1068 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1073 * if lookup_required: * new_node = None * if is_shadow_path: # <<<<<<<<<<<<<< * # Extending shadow path * # on the shadow path we don't do any search, we just use info from suffix link */ - __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 = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1071 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1076 * # 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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __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 = 1071; __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 = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyObject_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1072 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1077 * # 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_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1073 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1078 * 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_1, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node); @@ -49378,7 +50153,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1075 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1080 * phrase=hiero_phrase) * else: * if arity > 0: # <<<<<<<<<<<<<< @@ -49388,16 +50163,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_9 = ((__pyx_cur_scope->__pyx_v_arity > 0) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1077 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1082 * 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __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 = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_intersect_start_time); @@ -49406,40 +50181,40 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_intersect_start_time = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1078 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1083 * # 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_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 = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __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_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __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 *)((struct __pyx_vtabstruct_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_1, __pyx_cur_scope->__pyx_v_hiero_phrase)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((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_1, __pyx_cur_scope->__pyx_v_hiero_phrase)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_3); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1079 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1084 * 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __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 = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_intersect_stop_time); @@ -49448,67 +50223,67 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_intersect_stop_time = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1080 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1085 * 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_1 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_intersect_stop_time, __pyx_cur_scope->__pyx_v_intersect_start_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_intersect_stop_time, __pyx_cur_scope->__pyx_v_intersect_start_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_3); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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 = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __pyx_cur_scope->__pyx_v_self->intersect_time = __pyx_t_4; goto __pyx_L34; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1083 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1088 * 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 = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1088; __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_3_sa_PhraseLocation))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_18); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_18); __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1084 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1089 * # 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 = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_phrase, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_phrase, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_21)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_21)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_6 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_6 - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_6 - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_low); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_low); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_17); - __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_high); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_high); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); @@ -49522,7 +50297,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_1 = 0; __pyx_t_17 = 0; __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; @@ -49532,7 +50307,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_sa_range = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1085 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1090 * 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: # <<<<<<<<<<<<<< @@ -49543,36 +50318,36 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_14 = (__pyx_t_9 != 0); if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1086 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1091 * 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __pyx_t_10 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__sa_low), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__sa_low), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__sa_high), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__sa_high), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); __Pyx_GIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_10); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L35; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1088 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1093 * phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1]) * else: * phrase_location = None # <<<<<<<<<<<<<< @@ -49583,13 +50358,13 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); __Pyx_GIVEREF(Py_None); - __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_3_sa_PhraseLocation *)Py_None); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None); } __pyx_L35:; } __pyx_L34:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1090 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1095 * phrase_location = None * * if phrase_location is None: # <<<<<<<<<<<<<< @@ -49600,19 +50375,19 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_9 = (__pyx_t_14 != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1091 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1096 * * if phrase_location is None: * node.children[word_id] = None # <<<<<<<<<<<<<< * # Search failed * continue */ - __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 = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1093 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1098 * node.children[word_id] = None * # Search failed * continue # <<<<<<<<<<<<<< @@ -49624,7 +50399,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L36:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1095 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1100 * continue * # Search succeeded * suffix_link = self.rules.root # <<<<<<<<<<<<<< @@ -49639,33 +50414,33 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_suffix_link = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1096 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1101 * # 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_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = (__pyx_t_10 != Py_None); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_14 = (__pyx_t_9 != 0); if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1097 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1102 * 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_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_GetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link); @@ -49677,35 +50452,35 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L37:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1098 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1103 * 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 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase_location), ((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase_location), ((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1099 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1104 * 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_10, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_suffix_link) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_suffix_link) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1100 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1105 * 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_10, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node); @@ -49716,19 +50491,19 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L33:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1101 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1106 * suffix_link=suffix_link, * phrase=hiero_phrase) * node.children[word_id] = new_node # <<<<<<<<<<<<<< * node = new_node * */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - if (PyObject_SetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_word_id, __pyx_cur_scope->__pyx_v_new_node) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_word_id, __pyx_cur_scope->__pyx_v_new_node) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1102 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1107 * phrase=hiero_phrase) * node.children[word_id] = new_node * node = new_node # <<<<<<<<<<<<<< @@ -49741,7 +50516,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_node); __pyx_cur_scope->__pyx_v_node = __pyx_cur_scope->__pyx_v_new_node; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1107 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1112 * This should happen before we get to extraction (so that * the node will exist if needed)''' * if arity < self.max_nonterminals: # <<<<<<<<<<<<<< @@ -49751,14 +50526,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_14 = ((__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals) != 0); if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1108 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1113 * 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_12 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_arity + 1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_arity + 1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xcat_index); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_xcat_index); @@ -49766,17 +50541,17 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_xcat_index = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1109 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1114 * if arity < self.max_nonterminals: * xcat_index = arity+1 * xcat = sym_setindex(self.category, xcat_index) # <<<<<<<<<<<<<< * suffix_link_xcat_index = xcat_index * if is_shadow_path: */ - __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_xcat_index); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_cur_scope->__pyx_v_xcat = __pyx_f_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_21); + __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_xcat_index); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1110 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1115 * xcat_index = arity+1 * xcat = sym_setindex(self.category, xcat_index) * suffix_link_xcat_index = xcat_index # <<<<<<<<<<<<<< @@ -49789,24 +50564,24 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xcat_index); __pyx_cur_scope->__pyx_v_suffix_link_xcat_index = __pyx_cur_scope->__pyx_v_xcat_index; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1111 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1116 * xcat = sym_setindex(self.category, xcat_index) * 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) */ - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1112 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1117 * 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_12 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); @@ -49817,169 +50592,169 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L39:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1113 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1118 * 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, * suffix_link=node.suffix_link.children[suffix_link_xcat], */ - __pyx_t_21 = __Pyx_PyInt_AsInt(__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 = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_cur_scope->__pyx_v_suffix_link_xcat = __pyx_f_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_21); + __pyx_t_21 = __Pyx_PyInt_AsInt(__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 = 1118; __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1114 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1119 * 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __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 = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1115 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1120 * 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 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); 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_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_18, __pyx_cur_scope->__pyx_v_suffix_link_xcat, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_18, __pyx_cur_scope->__pyx_v_suffix_link_xcat, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1116 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1121 * 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_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __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 = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __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 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__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 = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1114 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1119 * 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_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - if (__Pyx_SetItemInt(__pyx_t_12, __pyx_cur_scope->__pyx_v_xcat, __pyx_t_10, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_12, __pyx_cur_scope->__pyx_v_xcat, __pyx_t_10, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L38; } __pyx_L38:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1119 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1124 * * # sample from range * if not is_shadow_path: # <<<<<<<<<<<<<< * sample = self.sampler.sample(node.phrase_location) * num_subpatterns = ( node.phrase_location).num_subpatterns */ - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((!__pyx_t_14) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1120 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1125 * # sample from range * if not is_shadow_path: * sample = self.sampler.sample(node.phrase_location) # <<<<<<<<<<<<<< * num_subpatterns = ( node.phrase_location).num_subpatterns * chunklen = IntList(initial_len=num_subpatterns) */ - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->sampler), __pyx_n_s__sample); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->sampler), __pyx_n_s__sample); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_sample)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_sample)); __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_sample = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_12); + __pyx_cur_scope->__pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1121 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1126 * if not is_shadow_path: * sample = self.sampler.sample(node.phrase_location) * num_subpatterns = ( node.phrase_location).num_subpatterns # <<<<<<<<<<<<<< * chunklen = IntList(initial_len=num_subpatterns) * for j from 0 <= j < num_subpatterns: */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_21 = ((struct __pyx_obj_3_sa_PhraseLocation *)__pyx_t_12)->num_subpatterns; + __pyx_t_21 = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_12)->num_subpatterns; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_cur_scope->__pyx_v_num_subpatterns = __pyx_t_21; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1122 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1127 * sample = self.sampler.sample(node.phrase_location) * num_subpatterns = ( 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_18) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_18) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen)); __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_chunklen = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_18); + __pyx_cur_scope->__pyx_v_chunklen = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_18); __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1123 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1128 * num_subpatterns = ( node.phrase_location).num_subpatterns * chunklen = IntList(initial_len=num_subpatterns) * for j from 0 <= j < num_subpatterns: # <<<<<<<<<<<<<< @@ -49989,24 +50764,24 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1124 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1129 * chunklen = IntList(initial_len=num_subpatterns) * for j from 0 <= j < num_subpatterns: * chunklen.arr[j] = hiero_phrase.chunklen(j) # <<<<<<<<<<<<<< * extracts = [] * j = 0 */ - (__pyx_cur_scope->__pyx_v_chunklen->arr[__pyx_cur_scope->__pyx_v_j]) = ((struct __pyx_vtabstruct_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); + (__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); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1125 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1130 * 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 = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyList_New(0); 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_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); @@ -50014,7 +50789,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_extracts = ((PyObject*)__pyx_t_18); __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1126 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1131 * chunklen.arr[j] = hiero_phrase.chunklen(j) * extracts = [] * j = 0 # <<<<<<<<<<<<<< @@ -50023,16 +50798,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __pyx_cur_scope->__pyx_v_j = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1127 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1132 * 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 = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_12 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_start); @@ -50041,7 +50816,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_extract_start = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1128 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1133 * j = 0 * extract_start = monitor_cpu() * while j < sample.len: # <<<<<<<<<<<<<< @@ -50052,14 +50827,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_9 = ((__pyx_cur_scope->__pyx_v_j < __pyx_cur_scope->__pyx_v_sample->len) != 0); if (!__pyx_t_9) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1129 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1134 * extract_start = monitor_cpu() * while j < sample.len: * extract = [] # <<<<<<<<<<<<<< * * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) */ - __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract); @@ -50067,30 +50842,30 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_extract = ((PyObject *)__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1131 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1136 * extract = [] * * 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) */ - __pyx_f_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1132 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1137 * * 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_12 = __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_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __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_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_loc); @@ -50099,14 +50874,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_loc = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1133 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1138 * 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_12 = ((struct __pyx_vtabstruct_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_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = ((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_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_extract); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_extract); @@ -50114,22 +50889,22 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_extract = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1134 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1139 * 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_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_extracts), __pyx_n_s__extend); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_extracts), __pyx_n_s__extend); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_extract) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_extract)) { __pyx_t_10 = __pyx_cur_scope->__pyx_v_extract; __Pyx_INCREF(__pyx_t_10); __pyx_t_6 = 0; __pyx_t_22 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_extract); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_extract); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_22 = Py_TYPE(__pyx_t_10)->tp_iternext; } @@ -50137,23 +50912,23 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_10)) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_10)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_17 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_17); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_17); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_17 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_10)) { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_10)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_17); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_17); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_17 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_17 = __pyx_t_22(__pyx_t_10); if (unlikely(!__pyx_t_17)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -50164,7 +50939,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GIVEREF(__pyx_t_17); __pyx_cur_scope->__pyx_v_e = __pyx_t_17; __pyx_t_17 = 0; - __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_17); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_cur_scope->__pyx_v_e); @@ -50172,22 +50947,22 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_INCREF(__pyx_cur_scope->__pyx_v_loc); PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_cur_scope->__pyx_v_loc); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_loc); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_18, (PyObject*)__pyx_t_17))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_18, (PyObject*)__pyx_t_17))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_18)); __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - __pyx_t_18 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1135 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1140 * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) * extracts.extend([(e, loc) for e in extract]) * j = j + num_subpatterns # <<<<<<<<<<<<<< @@ -50197,7 +50972,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_j = (__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_num_subpatterns); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1137 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1142 * j = j + num_subpatterns * * num_samples = sample.len/num_subpatterns # <<<<<<<<<<<<<< @@ -50212,7 +50987,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else if (sizeof(int) == sizeof(long) && unlikely(__pyx_cur_scope->__pyx_v_num_subpatterns == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_cur_scope->__pyx_v_sample->len))) { #ifdef WITH_THREAD @@ -50222,20 +50997,20 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_cur_scope->__pyx_v_num_samples = __Pyx_div_int(__pyx_cur_scope->__pyx_v_sample->len, __pyx_cur_scope->__pyx_v_num_subpatterns); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1138 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1143 * * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_stop); @@ -50244,46 +51019,46 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_extract_stop = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1139 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1144 * 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_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __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_extract_stop); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_extract_stop); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyNumber_Subtract(__pyx_t_18, __pyx_cur_scope->__pyx_v_extract_start); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Subtract(__pyx_t_18, __pyx_cur_scope->__pyx_v_extract_start); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_10); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_10); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_cur_scope->__pyx_v_self->extract_time = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1140 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1145 * 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(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((__pyx_t_6 > 0) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1141 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1146 * 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_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__Counter); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__Counter); 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 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_Call(__pyx_t_10, ((PyObject *)__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_XGOTREF(__pyx_cur_scope->__pyx_v_fcount); @@ -50292,23 +51067,23 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_fcount = __pyx_t_18; __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1142 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1147 * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); 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 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_lambda4, 0, __pyx_n_s_127, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4, 0, __pyx_n_s_128, NULL, __pyx_n_s_102, NULL); 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_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_12), NULL); 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_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; @@ -50318,7 +51093,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_fphrases = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1143 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1148 * fcount = Counter() * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) * for (f, e, count, als), loc in extracts: # <<<<<<<<<<<<<< @@ -50329,9 +51104,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene for (;;) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_10)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_12 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_12); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_12); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if ((likely(PyTuple_CheckExact(__pyx_t_12))) || (PyList_CheckExact(__pyx_t_12))) { PyObject* sequence = __pyx_t_12; @@ -50343,7 +51118,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -50356,16 +51131,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_INCREF(__pyx_t_18); __Pyx_INCREF(__pyx_t_17); #else - __pyx_t_18 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_17); #endif __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } else { Py_ssize_t index = -1; - __pyx_t_1 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_20 = Py_TYPE(__pyx_t_1)->tp_iternext; @@ -50373,7 +51148,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GOTREF(__pyx_t_18); index = 1; __pyx_t_17 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_17)) goto __pyx_L50_unpacking_failed; __Pyx_GOTREF(__pyx_t_17); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = NULL; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L51_unpacking_done; @@ -50381,7 +51156,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __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 = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L51_unpacking_done:; } if ((likely(PyTuple_CheckExact(__pyx_t_18))) || (PyList_CheckExact(__pyx_t_18))) { @@ -50394,7 +51169,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene if (unlikely(size != 4)) { if (size > 4) __Pyx_RaiseTooManyValuesError(4); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -50416,7 +51191,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene Py_ssize_t i; PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_11,&__pyx_t_8}; for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(item); *(temps[i]) = item; } @@ -50426,7 +51201,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene { Py_ssize_t index = -1; PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_11,&__pyx_t_8}; - __pyx_t_16 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __pyx_t_20 = Py_TYPE(__pyx_t_16)->tp_iternext; @@ -50435,7 +51210,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_16), 4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_16), 4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = NULL; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; goto __pyx_L53_unpacking_done; @@ -50443,7 +51218,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_20 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L53_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); @@ -50472,7 +51247,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_loc = __pyx_t_17; __pyx_t_17 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1144 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1149 * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) * for (f, e, count, als), loc in extracts: * fcount[f] += count # <<<<<<<<<<<<<< @@ -50481,38 +51256,38 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); __pyx_t_12 = __pyx_cur_scope->__pyx_v_f; - __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_12); if (!__pyx_t_17) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_12); if (!__pyx_t_17) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_17, __pyx_cur_scope->__pyx_v_count); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_17, __pyx_cur_scope->__pyx_v_count); 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_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (PyObject_SetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_12, __pyx_t_18) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_12, __pyx_t_18) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1145 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1150 * 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_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fphrases, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fphrases, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_18 = PyObject_GetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_e); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_GetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_e); if (!__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_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_als); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_als); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_cur_scope->__pyx_v_loc); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_cur_scope->__pyx_v_loc); 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_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1146 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1151 * fcount[f] += count * fphrases[f][e][als].append(loc) * for f, elist in fphrases.iteritems(): # <<<<<<<<<<<<<< @@ -50522,9 +51297,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_6 = 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 = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_18 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_fphrases, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_23), (&__pyx_t_21)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_fphrases, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_23), (&__pyx_t_21)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = __pyx_t_18; @@ -50532,7 +51307,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene while (1) { __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_10, __pyx_t_23, &__pyx_t_6, &__pyx_t_18, &__pyx_t_12, NULL, __pyx_t_21); if (unlikely(__pyx_t_7 == 0)) break; - if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_GOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); @@ -50546,7 +51321,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_elist = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1147 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1152 * fphrases[f][e][als].append(loc) * for f, elist in fphrases.iteritems(): * for e, alslist in elist.iteritems(): # <<<<<<<<<<<<<< @@ -50556,9 +51331,9 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_24 = 0; if (unlikely(__pyx_cur_scope->__pyx_v_elist == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_18 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_elist, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_25), (&__pyx_t_7)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_elist, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_25), (&__pyx_t_7)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = __pyx_t_18; @@ -50566,7 +51341,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene while (1) { __pyx_t_5 = __Pyx_dict_iter_next(__pyx_t_12, __pyx_t_25, &__pyx_t_24, &__pyx_t_18, &__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 = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_GOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); @@ -50580,30 +51355,30 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_alslist = __pyx_t_17; __pyx_t_17 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1148 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1153 * 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 = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __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 = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __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 = 0; - __pyx_t_18 = PyDict_New(); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyDict_New(); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_18)); - __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_5input_1lambda6, 0, __pyx_n_s_127, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6, 0, __pyx_n_s_128, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_18, ((PyObject *)__pyx_n_s__key), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_18, ((PyObject *)__pyx_n_s__key), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_17), ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_17), ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; @@ -50617,7 +51392,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -50630,16 +51405,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_INCREF(__pyx_t_18); __Pyx_INCREF(__pyx_t_17); #else - __pyx_t_18 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_17); #endif __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else { Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_20 = Py_TYPE(__pyx_t_11)->tp_iternext; @@ -50647,7 +51422,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GOTREF(__pyx_t_18); index = 1; __pyx_t_17 = __pyx_t_20(__pyx_t_11); if (unlikely(!__pyx_t_17)) goto __pyx_L58_unpacking_failed; __Pyx_GOTREF(__pyx_t_17); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L59_unpacking_done; @@ -50655,7 +51430,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __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 = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L59_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment); @@ -50669,41 +51444,41 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_max_locs = __pyx_t_17; __pyx_t_17 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1149 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1154 * 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) * scores = self.scorer.score(FeatureContext( */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__itertools); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__itertools); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__chain); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__chain); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_17); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s__from_iterable); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s__from_iterable); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __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 = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __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 = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __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 = 0; - __pyx_t_18 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__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 = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __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 = 0; - __pyx_t_18 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); @@ -50712,15 +51487,15 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_locs = ((PyObject*)__pyx_t_18); __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1150 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1155 * alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) * locs = tuple(itertools.chain.from_iterable(alslist.itervalues())) * count = len(locs) # <<<<<<<<<<<<<< * scores = self.scorer.score(FeatureContext( * f, e, count, fcount[f], num_samples, */ - __pyx_t_26 = PyTuple_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); if (unlikely(__pyx_t_26 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_26); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_26 = PyTuple_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); if (unlikely(__pyx_t_26 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_26); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_count); @@ -50728,43 +51503,43 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_count = __pyx_t_18; __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1151 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1156 * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__FeatureContext); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__FeatureContext); 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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1152 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1157 * count = len(locs) * scores = self.scorer.score(FeatureContext( * f, e, count, fcount[f], num_samples, # <<<<<<<<<<<<<< * (k,i+spanlen), locs, input_match, * fwords, self.fda, self.eda, */ - __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_17) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_cur_scope->__pyx_v_f); if (!__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_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_samples); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_samples); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1153 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1158 * 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_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); 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_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __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 = 1153; __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 = 1158; __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); @@ -50773,16 +51548,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_11 = 0; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1157 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1162 * meta, * # Include online stats. None if none. - * self.online_ctx_lookup(f, e))) # <<<<<<<<<<<<<< + * self.online_ctx_lookup(f, e, ctx_name))) # <<<<<<<<<<<<<< * # Phrase pair processed * if self.online: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__online_ctx_lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__online_ctx_lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1162; __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 = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1162; __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_11, 0, __pyx_cur_scope->__pyx_v_f); @@ -50790,11 +51565,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_INCREF(__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_16 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ctx_name); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_cur_scope->__pyx_v_ctx_name); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ctx_name); + __pyx_t_16 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(13); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(13); 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_INCREF(__pyx_cur_scope->__pyx_v_f); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_cur_scope->__pyx_v_f); @@ -50835,21 +51613,21 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_8 = 0; __pyx_t_3 = 0; __pyx_t_16 = 0; - __pyx_t_16 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = ((PyObject *)((struct __pyx_vtabstruct_3_sa_Scorer *)__pyx_cur_scope->__pyx_v_self->scorer->__pyx_vtab)->score(__pyx_cur_scope->__pyx_v_self->scorer, __pyx_t_16)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = ((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_16)); 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_16); __pyx_t_16 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); __Pyx_GIVEREF(__pyx_t_11); - __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_t_11); + __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_11); __pyx_t_11 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1159 - * self.online_ctx_lookup(f, e))) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1164 + * self.online_ctx_lookup(f, e, ctx_name))) * # Phrase pair processed * if self.online: # <<<<<<<<<<<<<< * seen_phrases.add((f, e)) @@ -50858,14 +51636,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_9 = (__pyx_cur_scope->__pyx_v_self->online != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1160 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1165 * # Phrase pair processed * if self.online: * seen_phrases.add((f, e)) # <<<<<<<<<<<<<< * yield Rule(self.category, f, e, scores, alignment) * */ - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(2); 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_INCREF(__pyx_cur_scope->__pyx_v_f); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_cur_scope->__pyx_v_f); @@ -50873,22 +51651,22 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_INCREF(__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_13 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, ((PyObject *)__pyx_t_11)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, ((PyObject *)__pyx_t_11)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; goto __pyx_L60; } __pyx_L60:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1161 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1166 * 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_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_16 = PyTuple_New(5); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyTuple_New(5); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); @@ -50905,7 +51683,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene PyTuple_SET_ITEM(__pyx_t_16, 4, __pyx_cur_scope->__pyx_v_alignment); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignment); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Rule)), ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)), ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; __pyx_r = __pyx_t_11; @@ -50945,7 +51723,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __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 = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } @@ -50960,41 +51738,41 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L32:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1163 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1168 * 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: # <<<<<<<<<<<<<< * 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)) */ - __pyx_t_23 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __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_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __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_cur_scope->__pyx_v_fwords; __Pyx_INCREF(__pyx_t_10); - __pyx_t_23 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_23); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_23); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (__pyx_t_14) { - __pyx_t_11 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, __pyx_t_10, Py_LE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, __pyx_t_10, Py_LE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __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_27 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_27 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_27 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_27 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_28 = __pyx_t_27; } else { @@ -51006,45 +51784,45 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1164 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1169 * * 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_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_10 = PyNumber_Add(__pyx_t_12, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Add(__pyx_t_12, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_10); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_10); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_23 = PyObject_Length(__pyx_t_12); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_Length(__pyx_t_12); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1165 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1170 * 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_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt_id); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt_id); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_16 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); - __pyx_t_18 = PyTuple_New(8); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyTuple_New(8); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); @@ -51070,11 +51848,11 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_16 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_18)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_18)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1166 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1171 * 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 # <<<<<<<<<<<<<< @@ -51083,18 +51861,18 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene */ __pyx_cur_scope->__pyx_v_num_subpatterns = __pyx_cur_scope->__pyx_v_arity; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1167 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1172 * 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_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((!__pyx_t_14) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1168 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1173 * num_subpatterns = arity * if not is_shadow_path: * num_subpatterns = num_subpatterns + 1 # <<<<<<<<<<<<<< @@ -51106,14 +51884,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L65:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1169 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1174 * 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: # <<<<<<<<<<<<<< * xcat = sym_setindex(self.category, arity+1) * xnode = node.children[xcat] */ - __pyx_t_23 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1174; __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_14 = ((__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals) != 0); @@ -51129,25 +51907,25 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1170 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1175 * 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) # <<<<<<<<<<<<<< * xnode = node.children[xcat] * # I put spanlen=1 below */ - __pyx_cur_scope->__pyx_v_xcat = __pyx_f_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, (__pyx_cur_scope->__pyx_v_arity + 1)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1171 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1176 * 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_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 = 1171; __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 = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_18, __pyx_cur_scope->__pyx_v_xcat, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_16) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_18, __pyx_cur_scope->__pyx_v_xcat, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_16) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xnode); @@ -51156,18 +51934,18 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_xnode = __pyx_t_16; __pyx_t_16 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1173 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1178 * 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_16 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); - __pyx_t_18 = PyInt_FromLong(__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_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_10 = PyList_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyList_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); @@ -51181,7 +51959,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pathlen); __pyx_t_16 = 0; __pyx_t_18 = 0; - __pyx_t_18 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_10))); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_10))); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_18)); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_key)); @@ -51190,14 +51968,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_key = ((PyObject*)__pyx_t_18); __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1174 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1179 * # 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_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); @@ -51205,25 +51983,25 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_frontier_nodes = ((PyObject *)__pyx_t_18); __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1175 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1180 * 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] * else: */ - __pyx_t_14 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_cur_scope->__pyx_v_key), ((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_cur_scope->__pyx_v_key), ((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = (__pyx_t_14 != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1176 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1181 * 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_18 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); @@ -51234,20 +52012,20 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1178 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1183 * 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_18 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_128); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_129); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_16 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); - __pyx_t_11 = PyTuple_New(7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __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); @@ -51270,7 +52048,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); __pyx_t_10 = 0; __pyx_t_16 = 0; - __pyx_t_16 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; @@ -51280,18 +52058,18 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_16; __pyx_t_16 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1179 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1184 * 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 # <<<<<<<<<<<<<< * * for i, alt, pathlen in frontier_nodes: */ - if (PyDict_SetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key), __pyx_cur_scope->__pyx_v_frontier_nodes) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key), __pyx_cur_scope->__pyx_v_frontier_nodes) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L67:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1181 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1186 * nodes_isteps_away_buffer[key] = frontier_nodes * * for i, alt, pathlen in frontier_nodes: # <<<<<<<<<<<<<< @@ -51302,7 +52080,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_16 = __pyx_cur_scope->__pyx_v_frontier_nodes; __Pyx_INCREF(__pyx_t_16); __pyx_t_23 = 0; __pyx_t_22 = NULL; } else { - __pyx_t_23 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_frontier_nodes); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_frontier_nodes); 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_22 = Py_TYPE(__pyx_t_16)->tp_iternext; } @@ -51310,23 +52088,23 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_16)) { if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_16)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_11 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_23); __Pyx_INCREF(__pyx_t_11); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_23); __Pyx_INCREF(__pyx_t_11); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_11 = PySequence_ITEM(__pyx_t_16, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PySequence_ITEM(__pyx_t_16, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_16)) { if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_16)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_23); __Pyx_INCREF(__pyx_t_11); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_23); __Pyx_INCREF(__pyx_t_11); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_11 = PySequence_ITEM(__pyx_t_16, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PySequence_ITEM(__pyx_t_16, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_11 = __pyx_t_22(__pyx_t_16); if (unlikely(!__pyx_t_11)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -51342,7 +52120,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -51358,18 +52136,18 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_12); #else - __pyx_t_18 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PySequence_ITEM(sequence, 0); 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_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); #endif __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } else { Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetIter(__pyx_t_11); 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); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_20 = Py_TYPE(__pyx_t_3)->tp_iternext; @@ -51379,7 +52157,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GOTREF(__pyx_t_10); index = 2; __pyx_t_12 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_12)) goto __pyx_L70_unpacking_failed; __Pyx_GOTREF(__pyx_t_12); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = NULL; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L71_unpacking_done; @@ -51387,12 +52165,12 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __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 = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L71_unpacking_done:; } - __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_cur_scope->__pyx_v_i = __pyx_t_21; __pyx_cur_scope->__pyx_v_alt = __pyx_t_7; @@ -51402,40 +52180,40 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1182 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1187 * * 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_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __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 = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __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 = PyNumber_Add(__pyx_cur_scope->__pyx_v_input_match, ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Add(__pyx_cur_scope->__pyx_v_input_match, ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); @@ -51461,7 +52239,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_10 = 0; __pyx_t_18 = 0; __pyx_t_3 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; @@ -51475,7 +52253,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1183 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1188 * 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 # <<<<<<<<<<<<<< @@ -51489,52 +52267,65 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_frontier = __pyx_cur_scope->__pyx_v_new_frontier; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1186 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1191 * * # 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_9 = (__pyx_cur_scope->__pyx_v_self->online != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1187 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1192 * # 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_15 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->online_stats, __pyx_cur_scope->__pyx_v_ctx_name); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_v_stats = __pyx_t_15; + __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1193 + * 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_15 = __pyx_pf_3_sa_23HieroCachingRuleFactory_5input_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; __Pyx_GIVEREF(__pyx_t_15); __pyx_cur_scope->__pyx_v_f_syms = ((PyObject*)__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1188 - * if self.online: + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1194 + * 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_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__get_f_phrases); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__get_f_phrases); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_syms)); PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_f_syms)); __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_syms)); - __pyx_t_8 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; @@ -51542,7 +52333,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_t_16 = __pyx_t_8; __Pyx_INCREF(__pyx_t_16); __pyx_t_2 = 0; __pyx_t_22 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __pyx_t_22 = Py_TYPE(__pyx_t_16)->tp_iternext; } @@ -51551,23 +52342,23 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_16)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_16)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_16, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(__pyx_t_16, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_16)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_16)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_16, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(__pyx_t_16, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_8 = __pyx_t_22(__pyx_t_16); if (unlikely(!__pyx_t_8)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -51583,7 +52374,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -51599,18 +52390,18 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_18); #else - __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); #endif __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else { Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_20 = Py_TYPE(__pyx_t_10)->tp_iternext; @@ -51620,7 +52411,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_GOTREF(__pyx_t_3); index = 2; __pyx_t_18 = __pyx_t_20(__pyx_t_10); if (unlikely(!__pyx_t_18)) goto __pyx_L75_unpacking_failed; __Pyx_GOTREF(__pyx_t_18); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L76_unpacking_done; @@ -51628,7 +52419,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_20 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L76_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); @@ -51647,16 +52438,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_lex_j = __pyx_t_18; __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1189 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1195 * 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_8 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_lex_j, __pyx_cur_scope->__pyx_v_lex_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_lex_j, __pyx_cur_scope->__pyx_v_lex_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_18 = PyNumber_Add(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyNumber_Add(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_spanlen); @@ -51665,28 +52456,28 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_18; __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1190 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1196 * 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 * if not sym_isvar(f[1]): */ - __pyx_t_18 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_f, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_f, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_9 = ((!(__pyx_f_3_sa_sym_isvar(__pyx_t_7) != 0)) != 0); + __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_7) != 0)) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1191 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1197 * spanlen = (lex_j - lex_i) + 1 * if not sym_isvar(f[0]): * spanlen += 1 # <<<<<<<<<<<<<< * if not sym_isvar(f[1]): * spanlen += 1 */ - __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_spanlen, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_spanlen, __pyx_int_1); 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_GOTREF(__pyx_cur_scope->__pyx_v_spanlen); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_spanlen); @@ -51697,28 +52488,28 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L77:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1192 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1198 * if not sym_isvar(f[0]): * spanlen += 1 * if not sym_isvar(f[1]): # <<<<<<<<<<<<<< * spanlen += 1 - * for e in self.phrases_fe.get(f, ()): + * for e in stats.phrases_fe.get(f, ()): */ - __pyx_t_18 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_f, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_f, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_9 = ((!(__pyx_f_3_sa_sym_isvar(__pyx_t_7) != 0)) != 0); + __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_7) != 0)) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1193 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1199 * spanlen += 1 * if not sym_isvar(f[1]): * spanlen += 1 # <<<<<<<<<<<<<< - * for e in self.phrases_fe.get(f, ()): + * for e in stats.phrases_fe.get(f, ()): * if (f, e) not in seen_phrases: */ - __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_spanlen, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_spanlen, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_spanlen); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_spanlen); @@ -51729,57 +52520,60 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene } __pyx_L78:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1194 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1200 * if not sym_isvar(f[1]): * spanlen += 1 - * for e in self.phrases_fe.get(f, ()): # <<<<<<<<<<<<<< + * 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_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->phrases_fe, __pyx_n_s__get); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_stats, __pyx_n_s__phrases_fe); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__get); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); __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_18, 0, __pyx_cur_scope->__pyx_v_f); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f); __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_18, 1, ((PyObject *)__pyx_empty_tuple)); __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); - __pyx_t_3 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_8 = __pyx_t_3; __Pyx_INCREF(__pyx_t_8); __pyx_t_23 = 0; + __pyx_t_18 = __pyx_t_3; __Pyx_INCREF(__pyx_t_18); __pyx_t_23 = 0; __pyx_t_29 = NULL; } else { - __pyx_t_23 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_29 = Py_TYPE(__pyx_t_8)->tp_iternext; + __pyx_t_23 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_29 = Py_TYPE(__pyx_t_18)->tp_iternext; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { - if (!__pyx_t_29 && PyList_CheckExact(__pyx_t_8)) { - if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_8)) break; + if (!__pyx_t_29 && PyList_CheckExact(__pyx_t_18)) { + if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_18)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_18, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - } else if (!__pyx_t_29 && PyTuple_CheckExact(__pyx_t_8)) { - if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + } else if (!__pyx_t_29 && PyTuple_CheckExact(__pyx_t_18)) { + if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_18)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_18, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { - __pyx_t_3 = __pyx_t_29(__pyx_t_8); + __pyx_t_3 = __pyx_t_29(__pyx_t_18); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -51791,14 +52585,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __pyx_cur_scope->__pyx_v_e = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1195 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1201 * spanlen += 1 - * for e in self.phrases_fe.get(f, ()): + * 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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1195; __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 = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_f); @@ -51806,19 +52600,19 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_e); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); - __pyx_t_9 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_cur_scope->__pyx_v_seen_phrases), Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_cur_scope->__pyx_v_seen_phrases), Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_14 = (__pyx_t_9 != 0); if (__pyx_t_14) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1197 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1203 * 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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __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 = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_f); @@ -51826,29 +52620,29 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_e); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); - __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1198 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1204 * # 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__FeatureContext); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__FeatureContext); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1203 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1209 * fwords, self.fda, self.eda, * meta, - * self.online_ctx_lookup(f, e))) # <<<<<<<<<<<<<< - * alignment = self.phrases_al[f][e] + * self.online_ctx_lookup(f, e, ctx_name))) # <<<<<<<<<<<<<< + * alignment = stats.phrases_al[f][e] * yield Rule(self.category, f, e, scores, alignment) */ - __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 = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__online_ctx_lookup); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __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_15, 0, __pyx_cur_scope->__pyx_v_f); @@ -51856,11 +52650,14 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene __Pyx_INCREF(__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_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ctx_name); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_cur_scope->__pyx_v_ctx_name); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ctx_name); + __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __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_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __pyx_t_15 = PyTuple_New(13); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyTuple_New(13); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __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_15, 0, __pyx_cur_scope->__pyx_v_f); @@ -51901,73 +52698,76 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene PyTuple_SET_ITEM(__pyx_t_15, 12, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_3_sa_Scorer *)__pyx_cur_scope->__pyx_v_self->scorer->__pyx_vtab)->score(__pyx_cur_scope->__pyx_v_self->scorer, __pyx_t_10)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_10)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); __Pyx_GIVEREF(__pyx_t_15); - __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_t_15); + __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1204 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1210 * meta, - * self.online_ctx_lookup(f, e))) - * alignment = self.phrases_al[f][e] # <<<<<<<<<<<<<< + * self.online_ctx_lookup(f, e, ctx_name))) + * alignment = stats.phrases_al[f][e] # <<<<<<<<<<<<<< * yield Rule(self.category, f, e, scores, alignment) * */ - __pyx_t_15 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->phrases_al, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_stats, __pyx_n_s__phrases_al); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_e); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyObject_GetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_e); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alignment); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_v_alignment = __pyx_t_10; - __pyx_t_10 = 0; + __Pyx_GIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_v_alignment = __pyx_t_15; + __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1205 - * self.online_ctx_lookup(f, e))) - * alignment = self.phrases_al[f][e] + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1211 + * 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_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_15 = PyTuple_New(5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = PyTuple_New(5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_cur_scope->__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_10, 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_15, 2, __pyx_cur_scope->__pyx_v_e); + PyTuple_SET_ITEM(__pyx_t_10, 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_15, 3, ((PyObject *)__pyx_cur_scope->__pyx_v_scores)); + PyTuple_SET_ITEM(__pyx_t_10, 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_15, 4, __pyx_cur_scope->__pyx_v_alignment); + PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_cur_scope->__pyx_v_alignment); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignment); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Rule)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __pyx_r = __pyx_t_10; - __pyx_t_10 = 0; + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_r = __pyx_t_15; + __pyx_t_15 = 0; __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __Pyx_XGIVEREF(__pyx_t_8); - __pyx_cur_scope->__pyx_t_3 = __pyx_t_8; __Pyx_XGIVEREF(__pyx_t_16); - __pyx_cur_scope->__pyx_t_4 = __pyx_t_16; + __pyx_cur_scope->__pyx_t_3 = __pyx_t_16; + __Pyx_XGIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_t_4 = __pyx_t_18; __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; @@ -51978,146 +52778,146 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene return __pyx_r; __pyx_L82_resume_from_yield:; __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; - __pyx_t_8 = __pyx_cur_scope->__pyx_t_3; + __pyx_t_16 = __pyx_cur_scope->__pyx_t_3; __pyx_cur_scope->__pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_t_8); - __pyx_t_16 = __pyx_cur_scope->__pyx_t_4; - __pyx_cur_scope->__pyx_t_4 = 0; __Pyx_XGOTREF(__pyx_t_16); + __pyx_t_18 = __pyx_cur_scope->__pyx_t_4; + __pyx_cur_scope->__pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_t_18); __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; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L81; } __pyx_L81:; } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; } __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; goto __pyx_L72; } __pyx_L72:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1207 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1213 * 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_16 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); - __pyx_t_8 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_empty_tuple), NULL); 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_18 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_GIVEREF(__pyx_t_8); - __pyx_cur_scope->__pyx_v_stop_time = __pyx_t_8; - __pyx_t_8 = 0; + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_stop_time = __pyx_t_18; + __pyx_t_18 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1208 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1214 * * 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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__info); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_start_time); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_stop_time, __pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_129)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_129)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_129)); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_start_time); 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); + __pyx_t_15 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_stop_time, __pyx_t_18); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyTuple_New(2); 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); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_130)); + PyTuple_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_kp_s_130)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_130)); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1209 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1215 * 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_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__gc); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__collect); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1210 + __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s__gc); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s__collect); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1215; __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_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1216 * 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_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s__info); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_130)); - PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_kp_s_130)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_130)); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_s_131)); + PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_kp_s_131)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_131)); + PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1211 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1217 * gc.collect() * logger.info(" Extract time = %f seconds", self.extract_time) * logger.info(" Intersect time = %f seconds", self.intersect_time) # <<<<<<<<<<<<<< * * */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__info); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s__info); 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); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_131)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_131)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_131)); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_132)); + PyTuple_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_kp_s_132)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_132)); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; @@ -52141,7 +52941,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1214 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1220 * * * cdef int find_fixpoint(self, # <<<<<<<<<<<<<< @@ -52149,7 +52949,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_24generator4(__pyx_Gene * int* f_links_low, int* f_links_high, */ -static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj_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) { +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) { int __pyx_v_e_low_prev; int __pyx_v_e_high_prev; int __pyx_v_f_low_prev; @@ -52171,7 +52971,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("find_fixpoint", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1229 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1235 * 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 # <<<<<<<<<<<<<< @@ -52180,7 +52980,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_e_low[0]) = __pyx_v_e_in_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1230 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1236 * * e_low[0] = e_in_low * e_high[0] = e_in_high # <<<<<<<<<<<<<< @@ -52189,19 +52989,19 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_e_high[0]) = __pyx_v_e_in_high; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1231 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1237 * 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) # <<<<<<<<<<<<<< * if e_low[0] == -1: * # low-priority corner case: if phrase w is unaligned, */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, __pyx_v_f_low, __pyx_t_1, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_low, __pyx_v_e_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, __pyx_v_f_low, __pyx_t_1, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_low, __pyx_v_e_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1232 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1238 * 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: # <<<<<<<<<<<<<< @@ -52211,7 +53011,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_3 = (((__pyx_v_e_low[0]) == -1) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1238 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1244 * # rule X -> X_1 w X_2 / X_1 X_2. This is probably * # not worth the bother, though. * return 0 # <<<<<<<<<<<<<< @@ -52223,7 +53023,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj goto __pyx_L3; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1239 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1245 * # not worth the bother, though. * return 0 * elif e_in_low != -1 and e_low[0] != e_in_low: # <<<<<<<<<<<<<< @@ -52239,7 +53039,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1240 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1246 * return 0 * elif e_in_low != -1 and e_low[0] != e_in_low: * if e_in_low - e_low[0] < min_ex_size: # <<<<<<<<<<<<<< @@ -52249,7 +53049,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_5 = (((__pyx_v_e_in_low - (__pyx_v_e_low[0])) < __pyx_v_min_ex_size) != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1241 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1247 * 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 # <<<<<<<<<<<<<< @@ -52258,7 +53058,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_e_low[0]) = (__pyx_v_e_in_low - __pyx_v_min_ex_size); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1242 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1248 * if e_in_low - e_low[0] < min_ex_size: * e_low[0] = e_in_low - min_ex_size * if e_low[0] < 0: # <<<<<<<<<<<<<< @@ -52268,7 +53068,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_5 = (((__pyx_v_e_low[0]) < 0) != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1243 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1249 * e_low[0] = e_in_low - min_ex_size * if e_low[0] < 0: * return 0 # <<<<<<<<<<<<<< @@ -52287,7 +53087,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1245 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1251 * return 0 * * if e_high[0] - e_low[0] > max_e_len: # <<<<<<<<<<<<<< @@ -52297,7 +53097,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_5 = ((((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len) != 0); if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1246 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1252 * * if e_high[0] - e_low[0] > max_e_len: * return 0 # <<<<<<<<<<<<<< @@ -52309,7 +53109,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj goto __pyx_L6; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1247 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1253 * if e_high[0] - e_low[0] > max_e_len: * return 0 * elif e_in_high != -1 and e_high[0] != e_in_high: # <<<<<<<<<<<<<< @@ -52325,7 +53125,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1248 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1254 * return 0 * elif e_in_high != -1 and e_high[0] != e_in_high: * if e_high[0] - e_in_high < min_ex_size: # <<<<<<<<<<<<<< @@ -52335,7 +53135,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((((__pyx_v_e_high[0]) - __pyx_v_e_in_high) < __pyx_v_min_ex_size) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1249 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1255 * 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 # <<<<<<<<<<<<<< @@ -52344,7 +53144,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_e_high[0]) = (__pyx_v_e_in_high + __pyx_v_min_ex_size); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1250 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1256 * 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: # <<<<<<<<<<<<<< @@ -52354,7 +53154,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (((__pyx_v_e_high[0]) > __pyx_v_e_sent_len) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1251 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1257 * e_high[0] = e_in_high + min_ex_size * if e_high[0] > e_sent_len: * return 0 # <<<<<<<<<<<<<< @@ -52373,7 +53173,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1253 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1259 * return 0 * * f_back_low[0] = -1 # <<<<<<<<<<<<<< @@ -52382,7 +53182,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_f_back_low[0]) = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1254 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1260 * * f_back_low[0] = -1 * f_back_high[0] = -1 # <<<<<<<<<<<<<< @@ -52391,7 +53191,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_f_back_high[0]) = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1255 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1261 * f_back_low[0] = -1 * f_back_high[0] = -1 * f_low_prev = f_low # <<<<<<<<<<<<<< @@ -52400,17 +53200,17 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_f_low_prev = __pyx_v_f_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1256 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1262 * f_back_high[0] = -1 * f_low_prev = f_low * f_high_prev = f_high # <<<<<<<<<<<<<< * new_x = 0 * new_low_x = 0 */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f_high_prev = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1257 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1263 * f_low_prev = f_low * f_high_prev = f_high * new_x = 0 # <<<<<<<<<<<<<< @@ -52419,7 +53219,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_new_x = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1258 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1264 * f_high_prev = f_high * new_x = 0 * new_low_x = 0 # <<<<<<<<<<<<<< @@ -52428,7 +53228,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_new_low_x = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1259 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1265 * new_x = 0 * new_low_x = 0 * new_high_x = 0 # <<<<<<<<<<<<<< @@ -52437,7 +53237,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_new_high_x = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1261 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1267 * new_high_x = 0 * * while True: # <<<<<<<<<<<<<< @@ -52447,7 +53247,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj while (1) { if (!1) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1263 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1269 * while True: * * if f_back_low[0] == -1: # <<<<<<<<<<<<<< @@ -52457,45 +53257,45 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (((__pyx_v_f_back_low[0]) == -1) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1264 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1270 * * 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: * self.find_projection(e_low[0], e_low_prev, e_links_low, e_links_high, f_back_low, f_back_high) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_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 = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L11; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1266 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1272 * 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) # <<<<<<<<<<<<<< * self.find_projection(e_high_prev, e_high[0], e_links_low, e_links_high, f_back_low, f_back_high) * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, (__pyx_v_e_low[0]), __pyx_v_e_low_prev, __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 = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_low_prev, __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 = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1267 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1273 * 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) # <<<<<<<<<<<<<< * * if f_back_low[0] > f_low: */ - __pyx_t_2 = ((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, __pyx_v_e_high_prev, (__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 = 1267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, __pyx_v_e_high_prev, (__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; } __pyx_L11:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1269 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1275 * 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: # <<<<<<<<<<<<<< @@ -52505,7 +53305,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (((__pyx_v_f_back_low[0]) > __pyx_v_f_low) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1270 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1276 * * if f_back_low[0] > f_low: * f_back_low[0] = f_low # <<<<<<<<<<<<<< @@ -52517,35 +53317,35 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L12:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1272 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1278 * f_back_low[0] = f_low * * if f_back_high[0] < f_high: # <<<<<<<<<<<<<< * f_back_high[0] = f_high * */ - __pyx_t_2 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1278; __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 = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1278; __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 = 1272; __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 = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1273 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1279 * * if f_back_high[0] < f_high: * f_back_high[0] = f_high # <<<<<<<<<<<<<< * * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} (__pyx_v_f_back_high[0]) = __pyx_t_1; goto __pyx_L13; } __pyx_L13:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1275 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1281 * f_back_high[0] = f_high * * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: # <<<<<<<<<<<<<< @@ -52561,7 +53361,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1276 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1282 * * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: * return 1 # <<<<<<<<<<<<<< @@ -52574,7 +53374,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L14:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1278 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1284 * return 1 * * if allow_low_x == 0 and f_back_low[0] < f_low: # <<<<<<<<<<<<<< @@ -52590,7 +53390,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1280 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1286 * if allow_low_x == 0 and f_back_low[0] < f_low: * # FAIL: f phrase is not tight * return 0 # <<<<<<<<<<<<<< @@ -52603,7 +53403,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L15:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1282 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1288 * return 0 * * if f_back_high[0] - f_back_low[0] > max_f_len: # <<<<<<<<<<<<<< @@ -52613,7 +53413,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1284 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1290 * if f_back_high[0] - f_back_low[0] > max_f_len: * # FAIL: f back projection is too wide * return 0 # <<<<<<<<<<<<<< @@ -52626,7 +53426,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L16:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1286 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1292 * return 0 * * if allow_high_x == 0 and f_back_high[0] > f_high: # <<<<<<<<<<<<<< @@ -52635,11 +53435,11 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_t_5 = (__pyx_v_allow_high_x == 0); if (__pyx_t_5) { - __pyx_t_6 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1292; __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 = 1286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1292; __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 = 1286; __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 = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; } else { @@ -52647,7 +53447,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1288 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1294 * if allow_high_x == 0 and f_back_high[0] > f_high: * # FAIL: extension on high side not allowed * return 0 # <<<<<<<<<<<<<< @@ -52660,7 +53460,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L17:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1290 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1296 * return 0 * * if f_low != f_back_low[0]: # <<<<<<<<<<<<<< @@ -52670,7 +53470,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_f_low != (__pyx_v_f_back_low[0])) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1291 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1297 * * if f_low != f_back_low[0]: * if new_low_x == 0: # <<<<<<<<<<<<<< @@ -52680,7 +53480,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_new_low_x == 0) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1292 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1298 * if f_low != f_back_low[0]: * if new_low_x == 0: * if new_x >= max_new_x: # <<<<<<<<<<<<<< @@ -52690,7 +53490,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_new_x >= __pyx_v_max_new_x) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1294 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1300 * if new_x >= max_new_x: * # FAIL: extension required on low side violates max # of gaps * return 0 # <<<<<<<<<<<<<< @@ -52703,7 +53503,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1296 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1302 * return 0 * else: * new_x = new_x + 1 # <<<<<<<<<<<<<< @@ -52712,7 +53512,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_new_x = (__pyx_v_new_x + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1297 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1303 * else: * new_x = new_x + 1 * new_low_x = 1 # <<<<<<<<<<<<<< @@ -52726,7 +53526,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L19:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1298 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1304 * new_x = new_x + 1 * new_low_x = 1 * if f_low - f_back_low[0] < min_fx_size: # <<<<<<<<<<<<<< @@ -52736,7 +53536,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (((__pyx_v_f_low - (__pyx_v_f_back_low[0])) < __pyx_v_min_fx_size) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1299 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1305 * new_low_x = 1 * if f_low - f_back_low[0] < min_fx_size: * f_back_low[0] = f_low - min_fx_size # <<<<<<<<<<<<<< @@ -52745,7 +53545,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ (__pyx_v_f_back_low[0]) = (__pyx_v_f_low - __pyx_v_min_fx_size); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1300 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1306 * 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: # <<<<<<<<<<<<<< @@ -52755,7 +53555,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1302 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1308 * if f_back_high[0] - f_back_low[0] > max_f_len: * # FAIL: extension required on low side violates max initial length * return 0 # <<<<<<<<<<<<<< @@ -52768,7 +53568,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L22:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1303 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1309 * # FAIL: extension required on low side violates max initial length * return 0 * if f_back_low[0] < 0: # <<<<<<<<<<<<<< @@ -52778,7 +53578,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (((__pyx_v_f_back_low[0]) < 0) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1305 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1311 * if f_back_low[0] < 0: * # FAIL: extension required on low side violates sentence boundary * return 0 # <<<<<<<<<<<<<< @@ -52797,22 +53597,22 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L18:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1307 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1313 * return 0 * * if f_high != f_back_high[0]: # <<<<<<<<<<<<<< * if new_high_x == 0: * if new_x >= max_new_x: */ - __pyx_t_2 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1313; __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 = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1313; __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 = 1307; __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 = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1308 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1314 * * if f_high != f_back_high[0]: * if new_high_x == 0: # <<<<<<<<<<<<<< @@ -52822,7 +53622,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_new_high_x == 0) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1309 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1315 * if f_high != f_back_high[0]: * if new_high_x == 0: * if new_x >= max_new_x: # <<<<<<<<<<<<<< @@ -52832,7 +53632,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = ((__pyx_v_new_x >= __pyx_v_max_new_x) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1311 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1317 * if new_x >= max_new_x: * # FAIL: extension required on high side violates max # of gaps * return 0 # <<<<<<<<<<<<<< @@ -52845,7 +53645,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1313 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1319 * return 0 * else: * new_x = new_x + 1 # <<<<<<<<<<<<<< @@ -52854,7 +53654,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_new_x = (__pyx_v_new_x + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1314 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1320 * else: * new_x = new_x + 1 * new_high_x = 1 # <<<<<<<<<<<<<< @@ -52868,44 +53668,44 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L25:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1315 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1321 * 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 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1321; __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 = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_v_f_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromLong(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1321; __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 = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __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 = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1316 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1322 * 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 = PyInt_FromLong(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromLong(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1322; __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 = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Add(__pyx_v_f_high, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1322; __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_AsInt(__pyx_t_6); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; (__pyx_v_f_back_high[0]) = __pyx_t_1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1317 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1323 * 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: # <<<<<<<<<<<<<< @@ -52915,7 +53715,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1319 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1325 * if f_back_high[0] - f_back_low[0] > max_f_len: * # FAIL: extension required on high side violates max initial length * return 0 # <<<<<<<<<<<<<< @@ -52928,7 +53728,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L28:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1320 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1326 * # FAIL: extension required on high side violates max initial length * return 0 * if f_back_high[0] > f_sent_len: # <<<<<<<<<<<<<< @@ -52938,7 +53738,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_4 = (((__pyx_v_f_back_high[0]) > __pyx_v_f_sent_len) != 0); if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1322 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1328 * if f_back_high[0] > f_sent_len: * # FAIL: extension required on high side violates sentence boundary * return 0 # <<<<<<<<<<<<<< @@ -52957,7 +53757,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L24:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1324 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1330 * return 0 * * e_low_prev = e_low[0] # <<<<<<<<<<<<<< @@ -52966,7 +53766,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_e_low_prev = (__pyx_v_e_low[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1325 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1331 * * e_low_prev = e_low[0] * e_high_prev = e_high[0] # <<<<<<<<<<<<<< @@ -52975,29 +53775,29 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_e_high_prev = (__pyx_v_e_high[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1327 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1333 * 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_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 = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1328 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1334 * * 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_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 = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1329 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1335 * 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: # <<<<<<<<<<<<<< @@ -53013,7 +53813,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1330 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1336 * 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 # <<<<<<<<<<<<<< @@ -53026,7 +53826,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L30:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1331 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1337 * if e_low[0] == e_low_prev and e_high[0] == e_high_prev: * return 1 * if allow_arbitrary_x == 0: # <<<<<<<<<<<<<< @@ -53036,7 +53836,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_3 = ((__pyx_v_allow_arbitrary_x == 0) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1333 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1339 * if allow_arbitrary_x == 0: * # FAIL: arbitrary expansion not permitted * return 0 # <<<<<<<<<<<<<< @@ -53049,7 +53849,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L31:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1334 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1340 * # FAIL: arbitrary expansion not permitted * return 0 * if e_high[0] - e_low[0] > max_e_len: # <<<<<<<<<<<<<< @@ -53059,7 +53859,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __pyx_t_3 = ((((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1336 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1342 * if e_high[0] - e_low[0] > max_e_len: * # FAIL: re-projection violates sentence max phrase length * return 0 # <<<<<<<<<<<<<< @@ -53072,7 +53872,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj } __pyx_L32:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1337 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1343 * # FAIL: re-projection violates sentence max phrase length * return 0 * f_low_prev = f_back_low[0] # <<<<<<<<<<<<<< @@ -53081,7 +53881,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj */ __pyx_v_f_low_prev = (__pyx_v_f_back_low[0]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1338 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1344 * return 0 * f_low_prev = f_back_low[0] * f_high_prev = f_back_high[0] # <<<<<<<<<<<<<< @@ -53097,14 +53897,14 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("_sa.HieroCachingRuleFactory.find_fixpoint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("cdec.sa._sa.HieroCachingRuleFactory.find_fixpoint", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1341 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1347 * * * cdef find_projection(self, int in_low, int in_high, int* in_links_low, int* in_links_high, # <<<<<<<<<<<<<< @@ -53112,7 +53912,7 @@ static int __pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint(struct __pyx_obj * cdef int i */ -static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_UNUSED struct __pyx_obj_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) { +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) { int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -53122,7 +53922,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_U int __pyx_t_4; __Pyx_RefNannySetupContext("find_projection", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1344 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1350 * int* out_low, int* out_high): * cdef int i * for i from in_low <= i < in_high: # <<<<<<<<<<<<<< @@ -53132,7 +53932,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_U __pyx_t_1 = __pyx_v_in_high; for (__pyx_v_i = __pyx_v_in_low; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1345 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1351 * cdef int i * for i from in_low <= i < in_high: * if in_links_low[i] != -1: # <<<<<<<<<<<<<< @@ -53142,7 +53942,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_U __pyx_t_2 = (((__pyx_v_in_links_low[__pyx_v_i]) != -1) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1346 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1352 * 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]: # <<<<<<<<<<<<<< @@ -53158,7 +53958,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_U } if (__pyx_t_4) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1347 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1353 * 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] # <<<<<<<<<<<<<< @@ -53170,7 +53970,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_U } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1348 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1354 * 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]: # <<<<<<<<<<<<<< @@ -53186,7 +53986,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_U } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1349 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1355 * 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] # <<<<<<<<<<<<<< @@ -53208,7 +54008,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_U return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1352 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1358 * * * cdef int* int_arr_extend(self, int* arr, int* arr_len, int* data, int data_len): # <<<<<<<<<<<<<< @@ -53216,13 +54016,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection(CYTHON_U * new_len = arr_len[0] + data_len */ -static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UNUSED struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int *__pyx_v_arr, int *__pyx_v_arr_len, int *__pyx_v_data, int __pyx_v_data_len) { +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) { int __pyx_v_new_len; int *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("int_arr_extend", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1354 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1360 * 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 # <<<<<<<<<<<<<< @@ -53231,7 +54031,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UNUSED */ __pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_data_len); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1355 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1361 * cdef int new_len * new_len = arr_len[0] + data_len * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -53240,7 +54040,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UNUSED */ __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1356 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1362 * new_len = arr_len[0] + data_len * arr = realloc(arr, new_len*sizeof(int)) * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -53249,7 +54049,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UNUSED */ memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_data, (__pyx_v_data_len * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1357 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1363 * arr = realloc(arr, new_len*sizeof(int)) * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) * arr_len[0] = new_len # <<<<<<<<<<<<<< @@ -53258,7 +54058,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UNUSED */ (__pyx_v_arr_len[0]) = __pyx_v_new_len; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1358 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1364 * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) * arr_len[0] = new_len * return arr # <<<<<<<<<<<<<< @@ -53274,7 +54074,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UNUSED return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1361 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1367 * * * 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, # <<<<<<<<<<<<<< @@ -53282,7 +54082,7 @@ static int *__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend(CYTHON_UNUSED * int sent_id, int e_sent_len, int e_sent_start): */ -static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct __pyx_obj_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) { +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) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; @@ -53299,9 +54099,9 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ int __pyx_v_len2; int __pyx_v_step; int __pyx_v_num_chunks; - struct __pyx_obj_3_sa_IntList *__pyx_v_ephr_arr = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_ephr_arr = 0; PyObject *__pyx_v_result = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_indexes = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_indexes = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -53319,19 +54119,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extract_phrases", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1369 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1375 * cdef result * * result = [] # <<<<<<<<<<<<<< * len1 = 0 * e_gaps1 = malloc(0) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1369; __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 = 1375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1370 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1376 * * result = [] * len1 = 0 # <<<<<<<<<<<<<< @@ -53340,7 +54140,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_len1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1371 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1377 * result = [] * len1 = 0 * e_gaps1 = malloc(0) # <<<<<<<<<<<<<< @@ -53349,19 +54149,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps1 = ((int *)malloc(0)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1372 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1378 * len1 = 0 * e_gaps1 = malloc(0) * ephr_arr = IntList() # <<<<<<<<<<<<<< * * e_gap_order = malloc(num_gaps*sizeof(int)) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_ephr_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_ephr_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1374 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1380 * ephr_arr = IntList() * * e_gap_order = malloc(num_gaps*sizeof(int)) # <<<<<<<<<<<<<< @@ -53370,7 +54170,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gap_order = ((int *)malloc((__pyx_v_num_gaps * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1375 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1381 * * e_gap_order = malloc(num_gaps*sizeof(int)) * if num_gaps > 0: # <<<<<<<<<<<<<< @@ -53380,7 +54180,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = ((__pyx_v_num_gaps > 0) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1376 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1382 * e_gap_order = malloc(num_gaps*sizeof(int)) * if num_gaps > 0: * e_gap_order[0] = 0 # <<<<<<<<<<<<<< @@ -53389,7 +54189,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ (__pyx_v_e_gap_order[0]) = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1377 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1383 * if num_gaps > 0: * e_gap_order[0] = 0 * for i from 1 <= i < num_gaps: # <<<<<<<<<<<<<< @@ -53399,7 +54199,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_3 = __pyx_v_num_gaps; for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1378 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1384 * e_gap_order[0] = 0 * for i from 1 <= i < num_gaps: * for j from 0 <= j < i: # <<<<<<<<<<<<<< @@ -53409,7 +54209,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_4 = __pyx_v_i; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1379 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1385 * for i from 1 <= i < num_gaps: * for j from 0 <= j < i: * if e_gap_low[i] < e_gap_low[j]: # <<<<<<<<<<<<<< @@ -53419,7 +54219,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = (((__pyx_v_e_gap_low[__pyx_v_i]) < (__pyx_v_e_gap_low[__pyx_v_j])) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1380 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1386 * for j from 0 <= j < i: * if e_gap_low[i] < e_gap_low[j]: * for k from j <= k < i: # <<<<<<<<<<<<<< @@ -53429,7 +54229,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_5 = __pyx_v_i; for (__pyx_v_k = __pyx_v_j; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1381 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1387 * if e_gap_low[i] < e_gap_low[j]: * for k from j <= k < i: * e_gap_order[k+1] = e_gap_order[k] # <<<<<<<<<<<<<< @@ -53439,7 +54239,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ (__pyx_v_e_gap_order[(__pyx_v_k + 1)]) = (__pyx_v_e_gap_order[__pyx_v_k]); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1382 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1388 * for k from j <= k < i: * e_gap_order[k+1] = e_gap_order[k] * e_gap_order[j] = i # <<<<<<<<<<<<<< @@ -53448,7 +54248,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ (__pyx_v_e_gap_order[__pyx_v_j]) = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1383 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1389 * e_gap_order[k+1] = e_gap_order[k] * e_gap_order[j] = i * break # <<<<<<<<<<<<<< @@ -53462,7 +54262,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1385 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1391 * break * else: * e_gap_order[i] = i # <<<<<<<<<<<<<< @@ -53477,7 +54277,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1387 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1393 * e_gap_order[i] = i * * e_x_low = e_low # <<<<<<<<<<<<<< @@ -53486,7 +54286,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_x_low = __pyx_v_e_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1388 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1394 * * e_x_low = e_low * e_x_high = e_high # <<<<<<<<<<<<<< @@ -53495,7 +54295,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_x_high = __pyx_v_e_high; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1389 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1395 * e_x_low = e_low * e_x_high = e_high * if not self.tight_phrases: # <<<<<<<<<<<<<< @@ -53505,7 +54305,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = ((!(__pyx_v_self->tight_phrases != 0)) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1390 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1396 * 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: # <<<<<<<<<<<<<< @@ -53528,7 +54328,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (!__pyx_t_6) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1391 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1397 * 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 # <<<<<<<<<<<<<< @@ -53538,7 +54338,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_v_e_x_low = (__pyx_v_e_x_low - 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1392 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1398 * 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: # <<<<<<<<<<<<<< @@ -53561,7 +54361,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (!__pyx_t_2) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1393 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1399 * 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 # <<<<<<<<<<<<<< @@ -53574,7 +54374,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } __pyx_L11:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1395 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1401 * e_x_high = e_x_high + 1 * * for i from e_x_low <= i <= e_low: # <<<<<<<<<<<<<< @@ -53584,17 +54384,17 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1396 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1402 * * for i from e_x_low <= i <= e_low: * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) # <<<<<<<<<<<<<< * * for i from 0 <= i < num_gaps: */ - __pyx_v_e_gaps1 = ((struct __pyx_vtabstruct_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); + __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); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1398 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1404 * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) * * for i from 0 <= i < num_gaps: # <<<<<<<<<<<<<< @@ -53604,7 +54404,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_3 = __pyx_v_num_gaps; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1399 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1405 * * for i from 0 <= i < num_gaps: * e_gaps2 = malloc(0) # <<<<<<<<<<<<<< @@ -53613,7 +54413,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps2 = ((int *)malloc(0)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1400 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1406 * for i from 0 <= i < num_gaps: * e_gaps2 = malloc(0) * len2 = 0 # <<<<<<<<<<<<<< @@ -53622,7 +54422,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_len2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1402 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1408 * len2 = 0 * * j = e_gap_order[i] # <<<<<<<<<<<<<< @@ -53631,7 +54431,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_j = (__pyx_v_e_gap_order[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1403 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1409 * * j = e_gap_order[i] * e_x_gap_low = e_gap_low[j] # <<<<<<<<<<<<<< @@ -53640,7 +54440,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_x_gap_low = (__pyx_v_e_gap_low[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1404 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1410 * j = e_gap_order[i] * e_x_gap_low = e_gap_low[j] * e_x_gap_high = e_gap_high[j] # <<<<<<<<<<<<<< @@ -53649,7 +54449,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_x_gap_high = (__pyx_v_e_gap_high[__pyx_v_j]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1405 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1411 * e_x_gap_low = e_gap_low[j] * e_x_gap_high = e_gap_high[j] * if not self.tight_phrases: # <<<<<<<<<<<<<< @@ -53659,7 +54459,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = ((!(__pyx_v_self->tight_phrases != 0)) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1406 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1412 * 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: # <<<<<<<<<<<<<< @@ -53676,7 +54476,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (!__pyx_t_7) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1407 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1413 * 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 # <<<<<<<<<<<<<< @@ -53686,7 +54486,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_v_e_x_gap_low = (__pyx_v_e_x_gap_low - 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1408 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1414 * 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: # <<<<<<<<<<<<<< @@ -53703,7 +54503,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (!__pyx_t_6) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1409 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1415 * 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 # <<<<<<<<<<<<<< @@ -53716,7 +54516,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } __pyx_L20:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1411 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1417 * e_x_gap_high = e_x_gap_high + 1 * * k = 0 # <<<<<<<<<<<<<< @@ -53725,7 +54525,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_k = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1412 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1418 * * k = 0 * step = 1+(i*2) # <<<<<<<<<<<<<< @@ -53734,7 +54534,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_step = (1 + (__pyx_v_i * 2)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1413 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1419 * k = 0 * step = 1+(i*2) * while k < len1: # <<<<<<<<<<<<<< @@ -53745,7 +54545,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_6 = ((__pyx_v_k < __pyx_v_len1) != 0); if (!__pyx_t_6) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1414 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1420 * step = 1+(i*2) * while k < len1: * for m from e_x_gap_low <= m <= e_gap_low[j]: # <<<<<<<<<<<<<< @@ -53755,7 +54555,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1415 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1421 * while k < len1: * for m from e_x_gap_low <= m <= e_gap_low[j]: * if m >= e_gaps1[k+step-1]: # <<<<<<<<<<<<<< @@ -53765,7 +54565,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_6 = ((__pyx_v_m >= (__pyx_v_e_gaps1[((__pyx_v_k + __pyx_v_step) - 1)])) != 0); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1416 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1422 * 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: # <<<<<<<<<<<<<< @@ -53775,7 +54575,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1417 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1423 * 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 # <<<<<<<<<<<<<< @@ -53785,32 +54585,32 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_6 = (((__pyx_v_n - __pyx_v_m) >= 1) != 0); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1418 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1424 * 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) * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) */ - __pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1419 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1425 * 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) # <<<<<<<<<<<<<< * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) * k = k + step */ - __pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1420 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1426 * 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) # <<<<<<<<<<<<<< * k = k + step * free(e_gaps1) */ - __pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_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); + __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; } __pyx_L32:; @@ -53820,7 +54620,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_L29:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1421 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1427 * 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 # <<<<<<<<<<<<<< @@ -53830,7 +54630,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_v_k = (__pyx_v_k + __pyx_v_step); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1422 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1428 * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) * k = k + step * free(e_gaps1) # <<<<<<<<<<<<<< @@ -53839,7 +54639,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ free(__pyx_v_e_gaps1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1423 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1429 * k = k + step * free(e_gaps1) * e_gaps1 = e_gaps2 # <<<<<<<<<<<<<< @@ -53848,7 +54648,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps1 = __pyx_v_e_gaps2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1424 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1430 * free(e_gaps1) * e_gaps1 = e_gaps2 * len1 = len2 # <<<<<<<<<<<<<< @@ -53858,7 +54658,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_v_len1 = __pyx_v_len2; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1426 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1432 * len1 = len2 * * step = 1+(num_gaps*2) # <<<<<<<<<<<<<< @@ -53867,7 +54667,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_step = (1 + (__pyx_v_num_gaps * 2)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1427 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1433 * * step = 1+(num_gaps*2) * e_gaps2 = malloc(0) # <<<<<<<<<<<<<< @@ -53876,7 +54676,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps2 = ((int *)malloc(0)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1428 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1434 * step = 1+(num_gaps*2) * e_gaps2 = malloc(0) * len2 = 0 # <<<<<<<<<<<<<< @@ -53885,7 +54685,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_len2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1429 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1435 * e_gaps2 = malloc(0) * len2 = 0 * for i from e_high <= i <= e_x_high: # <<<<<<<<<<<<<< @@ -53895,7 +54695,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1430 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1436 * len2 = 0 * for i from e_high <= i <= e_x_high: * j = 0 # <<<<<<<<<<<<<< @@ -53904,7 +54704,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_j = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1431 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1437 * for i from e_high <= i <= e_x_high: * j = 0 * while j < len1: # <<<<<<<<<<<<<< @@ -53915,7 +54715,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_6 = ((__pyx_v_j < __pyx_v_len1) != 0); if (!__pyx_t_6) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1432 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1438 * j = 0 * while j < len1: * if i - e_gaps1[j] <= self.train_max_initial_size and i >= e_gaps1[j+step-1]: # <<<<<<<<<<<<<< @@ -53931,28 +54731,28 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1433 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1439 * 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) # <<<<<<<<<<<<<< * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) * j = j + step */ - __pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_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); + __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1434 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1440 * 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) # <<<<<<<<<<<<<< * j = j + step * free(e_gaps1) */ - __pyx_v_e_gaps2 = ((struct __pyx_vtabstruct_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); + __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; } __pyx_L37:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1435 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1441 * 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 # <<<<<<<<<<<<<< @@ -53963,7 +54763,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1436 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1442 * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) * j = j + step * free(e_gaps1) # <<<<<<<<<<<<<< @@ -53972,7 +54772,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ free(__pyx_v_e_gaps1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1437 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1443 * j = j + step * free(e_gaps1) * e_gaps1 = e_gaps2 # <<<<<<<<<<<<<< @@ -53981,7 +54781,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_e_gaps1 = __pyx_v_e_gaps2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1438 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1444 * free(e_gaps1) * e_gaps1 = e_gaps2 * len1 = len2 # <<<<<<<<<<<<<< @@ -53990,7 +54790,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_len1 = __pyx_v_len2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1440 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1446 * len1 = len2 * * step = (num_gaps+1)*2 # <<<<<<<<<<<<<< @@ -53999,7 +54799,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_step = ((__pyx_v_num_gaps + 1) * 2); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1441 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1447 * * step = (num_gaps+1)*2 * i = 0 # <<<<<<<<<<<<<< @@ -54008,7 +54808,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_i = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1444 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1450 * * cdef IntList indexes * while i < len1: # <<<<<<<<<<<<<< @@ -54019,16 +54819,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = ((__pyx_v_i < __pyx_v_len1) != 0); if (!__pyx_t_2) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1445 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1451 * cdef IntList indexes * while i < len1: * ephr_arr._clear() # <<<<<<<<<<<<<< * num_chunks = 0 * indexes = IntList() */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_clear(__pyx_v_ephr_arr); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_clear(__pyx_v_ephr_arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1446 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1452 * while i < len1: * ephr_arr._clear() * num_chunks = 0 # <<<<<<<<<<<<<< @@ -54037,20 +54837,20 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_num_chunks = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1447 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1453 * 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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(((PyObject *)__pyx_v_indexes)); - __pyx_v_indexes = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_indexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1448 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1454 * num_chunks = 0 * indexes = IntList() * for j from 0 <= j < num_gaps+1: # <<<<<<<<<<<<<< @@ -54060,7 +54860,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_9 = (__pyx_v_num_gaps + 1); for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_9; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1449 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1455 * indexes = IntList() * for j from 0 <= j < num_gaps+1: * if e_gaps1[i+2*j] < e_gaps1[i+(2*j)+1]: # <<<<<<<<<<<<<< @@ -54070,7 +54870,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1450 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1456 * 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 # <<<<<<<<<<<<<< @@ -54082,7 +54882,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } __pyx_L42:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1451 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1457 * 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]: # <<<<<<<<<<<<<< @@ -54092,21 +54892,21 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __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++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1452 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1458 * 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 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1458; __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)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_indexes), __pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1453 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1459 * 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]]) # <<<<<<<<<<<<<< @@ -54114,14 +54914,14 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ * 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_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->eid2symid), __pyx_t_4, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->eid2symid), __pyx_t_4, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_append(__pyx_v_ephr_arr, __pyx_t_4); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_append(__pyx_v_ephr_arr, __pyx_t_4); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1454 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1460 * indexes.append(k) * ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]]) * if j < num_gaps: # <<<<<<<<<<<<<< @@ -54131,34 +54931,34 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_t_2 = ((__pyx_v_j < __pyx_v_num_gaps) != 0); if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1455 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1461 * 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_10 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, ((__pyx_v_e_gap_order[__pyx_v_j]) + 1))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__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_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_indexes), __pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_indexes), __pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1461; __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_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1456 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1462 * 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 * if ephr_arr.len <= self.max_target_length and num_chunks <= self.max_target_chunks: */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_append(__pyx_v_ephr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, ((__pyx_v_e_gap_order[__pyx_v_j]) + 1))); + ((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; } __pyx_L45:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1457 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1463 * 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 # <<<<<<<<<<<<<< @@ -54167,7 +54967,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ __pyx_v_i = (__pyx_v_i + __pyx_v_step); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1458 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1464 * 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: # <<<<<<<<<<<<<< @@ -54183,22 +54983,22 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1459 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1465 * 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 = 1459; __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 = 1465; __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_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__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 = 1459; __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 = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); @@ -54206,7 +55006,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_indexes)); __Pyx_GIVEREF(((PyObject *)__pyx_v_indexes)); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; @@ -54215,7 +55015,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_L46:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1461 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1467 * result.append((Phrase(ephr_arr),indexes)) * * free(e_gaps1) # <<<<<<<<<<<<<< @@ -54224,7 +55024,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ free(__pyx_v_e_gaps1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1462 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1468 * * free(e_gaps1) * free(e_gap_order) # <<<<<<<<<<<<<< @@ -54233,7 +55033,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ */ free(__pyx_v_e_gap_order); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1463 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1469 * free(e_gaps1) * free(e_gap_order) * return result # <<<<<<<<<<<<<< @@ -54250,7 +55050,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.extract_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.extract_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_ephr_arr); @@ -54261,7 +55061,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1465 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1471 * return result * * cdef IntList create_alignments(self, int* sent_links, int num_links, # <<<<<<<<<<<<<< @@ -54269,13 +55069,13 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases(struct _ * cdef unsigned i */ -static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_create_alignments(CYTHON_UNUSED struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, int *__pyx_v_sent_links, int __pyx_v_num_links, struct __pyx_obj_3_sa_IntList *__pyx_v_findexes, struct __pyx_obj_3_sa_IntList *__pyx_v_eindexes) { +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) { unsigned int __pyx_v_i; - struct __pyx_obj_3_sa_IntList *__pyx_v_ret = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_ret = 0; int __pyx_v_s; PyObject *__pyx_v_idx = NULL; PyObject *__pyx_v_j = NULL; - struct __pyx_obj_3_sa_IntList *__pyx_r = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; @@ -54289,19 +55089,19 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre int __pyx_clineno = 0; __Pyx_RefNannySetupContext("create_alignments", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1468 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1474 * IntList findexes, IntList eindexes): * cdef unsigned i * cdef IntList ret = IntList() # <<<<<<<<<<<<<< * for i in range(findexes.len): * s = findexes.arr[i] */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_ret = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_ret = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1469 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1475 * cdef unsigned i * cdef IntList ret = IntList() * for i in range(findexes.len): # <<<<<<<<<<<<<< @@ -54312,7 +55112,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1470 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1476 * cdef IntList ret = IntList() * for i in range(findexes.len): * s = findexes.arr[i] # <<<<<<<<<<<<<< @@ -54321,7 +55121,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre */ __pyx_v_s = (__pyx_v_findexes->arr[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1471 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1477 * for i in range(findexes.len): * s = findexes.arr[i] * if s < 0: continue # <<<<<<<<<<<<<< @@ -54335,7 +55135,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1472 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1478 * s = findexes.arr[i] * if s < 0: continue * idx = 0 # <<<<<<<<<<<<<< @@ -54346,7 +55146,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __Pyx_XDECREF(__pyx_v_idx); __pyx_v_idx = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1473 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1479 * if s < 0: continue * idx = 0 * while idx < num_links * 2: # <<<<<<<<<<<<<< @@ -54354,46 +55154,46 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre * j = eindexes.index(sent_links[idx+1]) */ while (1) { - __pyx_t_1 = PyInt_FromLong((__pyx_v_num_links * 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_num_links * 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1479; __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 = 1473; __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 = 1479; __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 = 1473; __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 = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (!__pyx_t_4) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1474 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1480 * 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 = 1474; __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 = 1480; __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1475 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1481 * 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 = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1481; __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 = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_v_idx, __pyx_int_1); 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_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 = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong((__pyx_v_sent_links[__pyx_t_6])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_sent_links[__pyx_t_6])); 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_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1481; __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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; @@ -54401,19 +55201,19 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __pyx_v_j = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1476 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1482 * 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 = PyLong_FromUnsignedLong((__pyx_v_i * __pyx_v_3_sa_ALIGNMENT_CODE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong((__pyx_v_i * __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __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 = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_v_j); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __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_PyObject_Append(((PyObject *)__pyx_v_ret), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_ret), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __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_1); __pyx_t_1 = 0; @@ -54421,14 +55221,14 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1477 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1483 * j = eindexes.index(sent_links[idx+1]) * ret.append(i * ALIGNMENT_CODE + j) * idx += 2 # <<<<<<<<<<<<<< * return ret * */ - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_idx); __pyx_v_idx = __pyx_t_1; @@ -54437,7 +55237,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __pyx_L3_continue:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1478 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1484 * ret.append(i * ALIGNMENT_CODE + j) * idx += 2 * return ret # <<<<<<<<<<<<<< @@ -54449,13 +55249,13 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre __pyx_r = __pyx_v_ret; goto __pyx_L0; - __pyx_r = ((struct __pyx_obj_3_sa_IntList *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.create_alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.create_alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_ret); @@ -54466,7 +55266,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1480 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1486 * return ret * * cdef extract(self, Phrase phrase, Matching* matching, int* chunklen, int num_chunks): # <<<<<<<<<<<<<< @@ -54474,7 +55274,7 @@ static struct __pyx_obj_3_sa_IntList *__pyx_f_3_sa_23HieroCachingRuleFactory_cre * cdef int *f_gap_low, *f_gap_high, *e_gap_low, *e_gap_high, num_gaps, gap_start */ -static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_3_sa_Phrase *__pyx_v_phrase, struct __pyx_t_3_sa_Matching *__pyx_v_matching, int *__pyx_v_chunklen, int __pyx_v_num_chunks) { +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) { int *__pyx_v_sent_links; int *__pyx_v_e_links_low; int *__pyx_v_e_links_high; @@ -54515,8 +55315,8 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj float __pyx_v_pair_count; PyObject *__pyx_v_extracts = 0; PyObject *__pyx_v_phrase_list = 0; - struct __pyx_obj_3_sa_IntList *__pyx_v_fphr_arr = 0; - struct __pyx_obj_3_sa_Phrase *__pyx_v_fphr = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_fphr_arr = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_fphr = 0; CYTHON_UNUSED PyObject *__pyx_v_reason_for_failure = 0; PyObject *__pyx_v_sofar = NULL; PyObject *__pyx_v_als = NULL; @@ -54524,10 +55324,10 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj long __pyx_v_gap_error; PyObject *__pyx_v_phrase2 = NULL; PyObject *__pyx_v_eindexes = NULL; - struct __pyx_obj_3_sa_IntList *__pyx_v_als1 = NULL; - struct __pyx_obj_3_sa_IntList *__pyx_v_als2 = NULL; - struct __pyx_obj_3_sa_IntList *__pyx_v_als3 = NULL; - struct __pyx_obj_3_sa_IntList *__pyx_v_als4 = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als1 = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als2 = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als3 = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als4 = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -54560,19 +55360,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extract", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1493 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1499 * cdef reason_for_failure * * fphr_arr = IntList() # <<<<<<<<<<<<<< * phrase_len = phrase.n * extracts = [] */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_fphr_arr = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1); + __pyx_v_fphr_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1494 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1500 * * fphr_arr = IntList() * phrase_len = phrase.n # <<<<<<<<<<<<<< @@ -54582,28 +55382,28 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = __pyx_v_phrase->n; __pyx_v_phrase_len = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1495 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1501 * 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 = 1495; __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 = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_extracts = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1496 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1502 * phrase_len = phrase.n * extracts = [] * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) # <<<<<<<<<<<<<< * * e_sent_start = self.eda.sent_index.arr[matching.sent_id] */ - __pyx_v_sent_links = ((struct __pyx_vtabstruct_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)); + __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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1498 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1504 * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) * * e_sent_start = self.eda.sent_index.arr[matching.sent_id] # <<<<<<<<<<<<<< @@ -54612,7 +55412,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_sent_start = (__pyx_v_self->eda->sent_index->arr[__pyx_v_matching->sent_id]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1499 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1505 * * e_sent_start = self.eda.sent_index.arr[matching.sent_id] * e_sent_end = self.eda.sent_index.arr[matching.sent_id+1] # <<<<<<<<<<<<<< @@ -54621,7 +55421,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_sent_end = (__pyx_v_self->eda->sent_index->arr[(__pyx_v_matching->sent_id + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1500 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1506 * 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 # <<<<<<<<<<<<<< @@ -54630,7 +55430,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_sent_len = ((__pyx_v_e_sent_end - __pyx_v_e_sent_start) - 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1501 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1507 * 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] # <<<<<<<<<<<<<< @@ -54639,7 +55439,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_sent_start = (__pyx_v_self->fda->sent_index->arr[__pyx_v_matching->sent_id]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1502 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1508 * 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] # <<<<<<<<<<<<<< @@ -54648,7 +55448,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_sent_end = (__pyx_v_self->fda->sent_index->arr[(__pyx_v_matching->sent_id + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1503 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1509 * 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 # <<<<<<<<<<<<<< @@ -54657,21 +55457,21 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_sent_len = ((__pyx_v_f_sent_end - __pyx_v_f_sent_start) - 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1505 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1511 * 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 = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1511; __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[8]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1511; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1506 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1512 * * self.findexes1.reset() * sofar = 0 # <<<<<<<<<<<<<< @@ -54681,7 +55481,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_INCREF(__pyx_int_0); __pyx_v_sofar = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1507 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1513 * self.findexes1.reset() * sofar = 0 * for i in range(num_chunks): # <<<<<<<<<<<<<< @@ -54692,7 +55492,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_2; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1508 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1514 * sofar = 0 * for i in range(num_chunks): * for j in range(chunklen[i]): # <<<<<<<<<<<<<< @@ -54703,35 +55503,35 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1509 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1515 * 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 = PyInt_FromLong((((__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 = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((((__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 = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1515; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1510 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1516 * 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_1 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); 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_DECREF(__pyx_v_sofar); __pyx_v_sofar = __pyx_t_1; __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1511 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1517 * self.findexes1.append(matching.arr[matching.start+i]+j-f_sent_start); * sofar += 1 * if i+1 < num_chunks: # <<<<<<<<<<<<<< @@ -54741,28 +55541,28 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = (((__pyx_v_i + 1) < __pyx_v_num_chunks) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1512 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1518 * sofar += 1 * if i+1 < num_chunks: * self.findexes1.append(phrase[sofar]) # <<<<<<<<<<<<<< * sofar += 1 * */ - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_phrase), __pyx_v_sofar); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_phrase), __pyx_v_sofar); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_1); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1513 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1519 * 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 = 1513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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(__pyx_v_sofar); __pyx_v_sofar = __pyx_t_3; @@ -54772,7 +55572,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_L7:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1516 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1522 * * * e_links_low = malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -54781,7 +55581,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_links_low = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1517 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1523 * * e_links_low = malloc(e_sent_len*sizeof(int)) * e_links_high = malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -54790,7 +55590,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_links_high = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1518 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1524 * e_links_low = malloc(e_sent_len*sizeof(int)) * e_links_high = malloc(e_sent_len*sizeof(int)) * f_links_low = malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -54799,7 +55599,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_links_low = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1519 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1525 * e_links_high = malloc(e_sent_len*sizeof(int)) * f_links_low = malloc(f_sent_len*sizeof(int)) * f_links_high = malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<< @@ -54808,7 +55608,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_links_high = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1520 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1526 * f_links_low = malloc(f_sent_len*sizeof(int)) * f_links_high = malloc(f_sent_len*sizeof(int)) * f_gap_low = malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -54817,7 +55617,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1521 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1527 * f_links_high = malloc(f_sent_len*sizeof(int)) * f_gap_low = malloc((num_chunks+1)*sizeof(int)) * f_gap_high = malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -54826,7 +55626,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1522 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1528 * f_gap_low = malloc((num_chunks+1)*sizeof(int)) * f_gap_high = malloc((num_chunks+1)*sizeof(int)) * e_gap_low = malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -54835,7 +55635,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1523 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1529 * f_gap_high = malloc((num_chunks+1)*sizeof(int)) * e_gap_low = malloc((num_chunks+1)*sizeof(int)) * e_gap_high = malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -54844,7 +55644,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1524 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1530 * e_gap_low = malloc((num_chunks+1)*sizeof(int)) * e_gap_high = malloc((num_chunks+1)*sizeof(int)) * memset(f_gap_low, 0, (num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< @@ -54853,7 +55653,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ memset(__pyx_v_f_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1525 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1531 * e_gap_high = 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)) # <<<<<<<<<<<<<< @@ -54862,7 +55662,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ memset(__pyx_v_f_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1526 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1532 * 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)) # <<<<<<<<<<<<<< @@ -54871,7 +55671,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ memset(__pyx_v_e_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1527 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1533 * 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)) # <<<<<<<<<<<<<< @@ -54880,7 +55680,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ memset(__pyx_v_e_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1529 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1535 * memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) * * reason_for_failure = "" # <<<<<<<<<<<<<< @@ -54890,7 +55690,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_INCREF(((PyObject *)__pyx_kp_s_47)); __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_47); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1531 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1537 * reason_for_failure = "" * * for i from 0 <= i < e_sent_len: # <<<<<<<<<<<<<< @@ -54900,7 +55700,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = __pyx_v_e_sent_len; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1532 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1538 * * for i from 0 <= i < e_sent_len: * e_links_low[i] = -1 # <<<<<<<<<<<<<< @@ -54909,7 +55709,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_e_links_low[__pyx_v_i]) = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1533 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1539 * for i from 0 <= i < e_sent_len: * e_links_low[i] = -1 * e_links_high[i] = -1 # <<<<<<<<<<<<<< @@ -54919,7 +55719,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj (__pyx_v_e_links_high[__pyx_v_i]) = -1; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1534 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1540 * e_links_low[i] = -1 * e_links_high[i] = -1 * for i from 0 <= i < f_sent_len: # <<<<<<<<<<<<<< @@ -54929,7 +55729,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = __pyx_v_f_sent_len; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1535 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1541 * e_links_high[i] = -1 * for i from 0 <= i < f_sent_len: * f_links_low[i] = -1 # <<<<<<<<<<<<<< @@ -54938,7 +55738,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_links_low[__pyx_v_i]) = -1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1536 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1542 * for i from 0 <= i < f_sent_len: * f_links_low[i] = -1 * f_links_high[i] = -1 # <<<<<<<<<<<<<< @@ -54948,7 +55748,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj (__pyx_v_f_links_high[__pyx_v_i]) = -1; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1542 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1548 * # links that we care about (but then how to look up * # when we want to check something on the e side?) * i = 0 # <<<<<<<<<<<<<< @@ -54957,7 +55757,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1543 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1549 * # when we want to check something on the e side?) * i = 0 * while i < num_links*2: # <<<<<<<<<<<<<< @@ -54968,7 +55768,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_i < (__pyx_v_num_links * 2)) != 0); if (!__pyx_t_7) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1544 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1550 * i = 0 * while i < num_links*2: * f_i = sent_links[i] # <<<<<<<<<<<<<< @@ -54977,7 +55777,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_i = (__pyx_v_sent_links[__pyx_v_i]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1545 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1551 * while i < num_links*2: * f_i = sent_links[i] * e_i = sent_links[i+1] # <<<<<<<<<<<<<< @@ -54986,7 +55786,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_i = (__pyx_v_sent_links[(__pyx_v_i + 1)]); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1546 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1552 * 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: # <<<<<<<<<<<<<< @@ -55002,7 +55802,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1547 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1553 * 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 # <<<<<<<<<<<<<< @@ -55014,7 +55814,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L14:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1548 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1554 * 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: # <<<<<<<<<<<<<< @@ -55030,7 +55830,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1549 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1555 * 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 # <<<<<<<<<<<<<< @@ -55042,7 +55842,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L15:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1550 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1556 * 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: # <<<<<<<<<<<<<< @@ -55058,7 +55858,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1551 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1557 * 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 # <<<<<<<<<<<<<< @@ -55070,7 +55870,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L16:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1552 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1558 * 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: # <<<<<<<<<<<<<< @@ -55086,7 +55886,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1553 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1559 * 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 # <<<<<<<<<<<<<< @@ -55098,7 +55898,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L17:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1554 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1560 * 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 # <<<<<<<<<<<<<< @@ -55108,19 +55908,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_i = (__pyx_v_i + 2); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1556 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1562 * 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 = 1556; __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 = 1562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_als = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1557 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1563 * * als = [] * for x in range(matching.start,matching.end): # <<<<<<<<<<<<<< @@ -55131,18 +55931,18 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj for (__pyx_t_4 = __pyx_v_matching->start; __pyx_t_4 < __pyx_t_2; __pyx_t_4+=1) { __pyx_v_x = __pyx_t_4; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1558 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1564 * 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 = PyInt_FromLong(((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyInt_FromLong((__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 = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__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 = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -55154,17 +55954,17 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_al = ((PyObject*)__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1559 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1565 * 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_11 = __Pyx_PyList_Append(__pyx_v_als, ((PyObject *)__pyx_v_al)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_als, ((PyObject *)__pyx_v_al)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1561 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1567 * als.append(al) * # check all source-side alignment constraints * met_constraints = 1 # <<<<<<<<<<<<<< @@ -55173,7 +55973,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1562 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1568 * # check all source-side alignment constraints * met_constraints = 1 * if self.require_aligned_terminal: # <<<<<<<<<<<<<< @@ -55183,7 +55983,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_self->require_aligned_terminal != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1563 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1569 * met_constraints = 1 * if self.require_aligned_terminal: * num_aligned_chunks = 0 # <<<<<<<<<<<<<< @@ -55192,7 +55992,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_num_aligned_chunks = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1564 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1570 * if self.require_aligned_terminal: * num_aligned_chunks = 0 * for i from 0 <= i < num_chunks: # <<<<<<<<<<<<<< @@ -55202,7 +56002,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = __pyx_v_num_chunks; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1565 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1571 * num_aligned_chunks = 0 * for i from 0 <= i < num_chunks: * for j from 0 <= j < chunklen[i]: # <<<<<<<<<<<<<< @@ -55212,7 +56012,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_4 = (__pyx_v_chunklen[__pyx_v_i]); for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1566 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1572 * 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: # <<<<<<<<<<<<<< @@ -55222,7 +56022,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1567 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1573 * 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 # <<<<<<<<<<<<<< @@ -55231,7 +56031,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_num_aligned_chunks = (__pyx_v_num_aligned_chunks + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1568 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1574 * if f_links_low[matching.arr[matching.start+i]+j-f_sent_start] > -1: * num_aligned_chunks = num_aligned_chunks + 1 * break # <<<<<<<<<<<<<< @@ -55246,7 +56046,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_L24_break:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1569 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1575 * num_aligned_chunks = num_aligned_chunks + 1 * break * if num_aligned_chunks == 0: # <<<<<<<<<<<<<< @@ -55256,18 +56056,18 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_num_aligned_chunks == 0) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1570 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1576 * break * if num_aligned_chunks == 0: * reason_for_failure = "No aligned terminals" # <<<<<<<<<<<<<< * met_constraints = 0 * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_132)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_133)); __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_132); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_133); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1571 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1577 * if num_aligned_chunks == 0: * reason_for_failure = "No aligned terminals" * met_constraints = 0 # <<<<<<<<<<<<<< @@ -55279,7 +56079,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L26:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1572 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1578 * reason_for_failure = "No aligned terminals" * met_constraints = 0 * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: # <<<<<<<<<<<<<< @@ -55294,18 +56094,18 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1573 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1579 * met_constraints = 0 * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: * reason_for_failure = "Unaligned chunk" # <<<<<<<<<<<<<< * met_constraints = 0 * */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_133)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_134)); __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_133); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_134); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1574 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1580 * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: * reason_for_failure = "Unaligned chunk" * met_constraints = 0 # <<<<<<<<<<<<<< @@ -55320,7 +56120,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L20:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1576 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1582 * met_constraints = 0 * * if met_constraints and self.tight_phrases: # <<<<<<<<<<<<<< @@ -55335,7 +56135,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1578 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1584 * if met_constraints and self.tight_phrases: * # outside edge constraints are checked later * for i from 0 <= i < num_chunks-1: # <<<<<<<<<<<<<< @@ -55345,7 +56145,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_12 = (__pyx_v_num_chunks - 1); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1579 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1585 * # 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: # <<<<<<<<<<<<<< @@ -55355,18 +56155,18 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1580 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1586 * 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 * break */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_134)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_135)); __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_134); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_135); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1581 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1587 * 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 # <<<<<<<<<<<<<< @@ -55375,7 +56175,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1582 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1588 * reason_for_failure = "Gaps are not tight phrases" * met_constraints = 0 * break # <<<<<<<<<<<<<< @@ -55387,7 +56187,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L31:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1583 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1589 * met_constraints = 0 * break * if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1: # <<<<<<<<<<<<<< @@ -55397,18 +56197,18 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1584 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1590 * 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 * break */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_134)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_135)); __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_134); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_135); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1585 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1591 * 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 # <<<<<<<<<<<<<< @@ -55417,7 +56217,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1586 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1592 * reason_for_failure = "Gaps are not tight phrases" * met_constraints = 0 * break # <<<<<<<<<<<<<< @@ -55434,7 +56234,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L28:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1588 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1594 * break * * f_low = matching.arr[matching.start] - f_sent_start # <<<<<<<<<<<<<< @@ -55443,7 +56243,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_low = ((__pyx_v_matching->arr[__pyx_v_matching->start]) - __pyx_v_f_sent_start); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1589 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1595 * * 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 # <<<<<<<<<<<<<< @@ -55452,7 +56252,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1590 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1596 * 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: # <<<<<<<<<<<<<< @@ -55462,28 +56262,28 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_met_constraints != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1592 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1598 * 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_10 = PyInt_FromLong(__pyx_v_f_high); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_v_f_high); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1596 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1602 * 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_9 = (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_low, __pyx_t_10, __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_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_10, __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_10); __pyx_t_10 = 0; if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1597 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1603 * self.train_min_gap_size, 0, * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): * gap_error = 0 # <<<<<<<<<<<<<< @@ -55492,7 +56292,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_error = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1598 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1604 * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): * gap_error = 0 * num_gaps = 0 # <<<<<<<<<<<<<< @@ -55501,7 +56301,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_num_gaps = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1600 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1606 * num_gaps = 0 * * if f_back_low < f_low: # <<<<<<<<<<<<<< @@ -55511,7 +56311,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1601 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1607 * * if f_back_low < f_low: * f_gap_low[0] = f_back_low # <<<<<<<<<<<<<< @@ -55520,7 +56320,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_gap_low[0]) = __pyx_v_f_back_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1602 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1608 * if f_back_low < f_low: * f_gap_low[0] = f_back_low * f_gap_high[0] = f_low # <<<<<<<<<<<<<< @@ -55529,7 +56329,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_gap_high[0]) = __pyx_v_f_low; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1603 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1609 * f_gap_low[0] = f_back_low * f_gap_high[0] = f_low * num_gaps = 1 # <<<<<<<<<<<<<< @@ -55538,7 +56338,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_num_gaps = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1604 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1610 * f_gap_high[0] = f_low * num_gaps = 1 * gap_start = 0 # <<<<<<<<<<<<<< @@ -55547,7 +56347,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_start = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1605 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1611 * num_gaps = 1 * gap_start = 0 * phrase_len = phrase_len+1 # <<<<<<<<<<<<<< @@ -55556,7 +56356,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_phrase_len = (__pyx_v_phrase_len + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1606 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1612 * gap_start = 0 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: # <<<<<<<<<<<<<< @@ -55566,7 +56366,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_phrase_len > __pyx_v_self->max_length) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1607 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1613 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: * gap_error = 1 # <<<<<<<<<<<<<< @@ -55578,7 +56378,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L36:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1608 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1614 * if phrase_len > self.max_length: * gap_error = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -55588,7 +56388,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_self->tight_phrases != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1609 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1615 * gap_error = 1 * if self.tight_phrases: * if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1: # <<<<<<<<<<<<<< @@ -55604,7 +56404,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1610 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1616 * if self.tight_phrases: * if f_links_low[f_back_low] == -1 or f_links_low[f_low-1] == -1: * gap_error = 1 # <<<<<<<<<<<<<< @@ -55613,16 +56413,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_error = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1611 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1617 * 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" # <<<<<<<<<<<<<< * else: * gap_start = 1 */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_135)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_136)); __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_135); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_136); goto __pyx_L38; } __pyx_L38:; @@ -55633,7 +56433,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1613 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1619 * reason_for_failure = "Inside edges of preceding subphrase are not tight" * else: * gap_start = 1 # <<<<<<<<<<<<<< @@ -55642,7 +56442,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_start = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1614 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1620 * else: * gap_start = 1 * if self.tight_phrases and f_links_low[f_low] == -1: # <<<<<<<<<<<<<< @@ -55657,7 +56457,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1617 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1623 * # 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 # <<<<<<<<<<<<<< @@ -55671,7 +56471,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L35:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1619 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1625 * met_constraints = 0 * * for i from 0 <= i < matching.size - 1: # <<<<<<<<<<<<<< @@ -55681,7 +56481,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_12 = (__pyx_v_matching->size - 1); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_12; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1620 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1626 * * for i from 0 <= i < matching.size - 1: * f_gap_low[1+i] = matching.arr[matching.start+i] + chunklen[i] - f_sent_start # <<<<<<<<<<<<<< @@ -55690,7 +56490,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1621 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1627 * 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 # <<<<<<<<<<<<<< @@ -55699,7 +56499,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__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); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1622 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1628 * 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 # <<<<<<<<<<<<<< @@ -55709,7 +56509,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_num_gaps = (__pyx_v_num_gaps + 1); } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1624 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1630 * num_gaps = num_gaps + 1 * * if f_high < f_back_high: # <<<<<<<<<<<<<< @@ -55719,7 +56519,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_f_high < __pyx_v_f_back_high) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1625 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1631 * * if f_high < f_back_high: * f_gap_low[gap_start+num_gaps] = f_high # <<<<<<<<<<<<<< @@ -55728,7 +56528,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_num_gaps)]) = __pyx_v_f_high; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1626 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1632 * 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 # <<<<<<<<<<<<<< @@ -55737,7 +56537,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ (__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_num_gaps)]) = __pyx_v_f_back_high; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1627 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1633 * f_gap_low[gap_start+num_gaps] = f_high * f_gap_high[gap_start+num_gaps] = f_back_high * num_gaps = num_gaps + 1 # <<<<<<<<<<<<<< @@ -55746,7 +56546,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_num_gaps = (__pyx_v_num_gaps + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1628 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1634 * f_gap_high[gap_start+num_gaps] = f_back_high * num_gaps = num_gaps + 1 * phrase_len = phrase_len+1 # <<<<<<<<<<<<<< @@ -55755,7 +56555,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_phrase_len = (__pyx_v_phrase_len + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1629 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1635 * num_gaps = num_gaps + 1 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: # <<<<<<<<<<<<<< @@ -55765,7 +56565,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_phrase_len > __pyx_v_self->max_length) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1630 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1636 * phrase_len = phrase_len+1 * if phrase_len > self.max_length: * gap_error = 1 # <<<<<<<<<<<<<< @@ -55777,7 +56577,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L43:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1631 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1637 * if phrase_len > self.max_length: * gap_error = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -55787,7 +56587,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_self->tight_phrases != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1632 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1638 * gap_error = 1 * if self.tight_phrases: * if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1: # <<<<<<<<<<<<<< @@ -55803,7 +56603,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1633 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1639 * if self.tight_phrases: * if f_links_low[f_back_high-1] == -1 or f_links_low[f_high] == -1: * gap_error = 1 # <<<<<<<<<<<<<< @@ -55812,16 +56612,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_error = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1634 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1640 * 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" # <<<<<<<<<<<<<< * else: * if self.tight_phrases and f_links_low[f_high-1] == -1: */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_136)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_137)); __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_136); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_137); goto __pyx_L45; } __pyx_L45:; @@ -55832,7 +56632,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1636 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1642 * reason_for_failure = "Inside edges of following subphrase are not tight" * else: * if self.tight_phrases and f_links_low[f_high-1] == -1: # <<<<<<<<<<<<<< @@ -55847,7 +56647,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1637 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1643 * else: * if self.tight_phrases and f_links_low[f_high-1] == -1: * met_constraints = 0 # <<<<<<<<<<<<<< @@ -55861,7 +56661,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L42:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1639 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1645 * met_constraints = 0 * * if gap_error == 0: # <<<<<<<<<<<<<< @@ -55871,7 +56671,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_gap_error == 0) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1640 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1646 * * if gap_error == 0: * e_word_count = e_high - e_low # <<<<<<<<<<<<<< @@ -55880,7 +56680,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_e_word_count = (__pyx_v_e_high - __pyx_v_e_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1641 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1647 * if gap_error == 0: * e_word_count = e_high - e_low * for i from 0 <= i < num_gaps: # check integrity of subphrases # <<<<<<<<<<<<<< @@ -55890,28 +56690,28 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = __pyx_v_num_gaps; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1642 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1648 * 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_10 = PyInt_FromLong((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1647 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1653 * f_gap_low+gap_start+i, f_gap_high+gap_start+i, * 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 */ - __pyx_t_9 = ((((struct __pyx_vtabstruct_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_10, __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_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_10, __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_10); __pyx_t_10 = 0; if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1649 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1655 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0) == 0: * gap_error = 1 # <<<<<<<<<<<<<< @@ -55920,18 +56720,18 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_gap_error = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1650 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1656 * 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_10 = PyInt_FromLong((__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong((__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = PyInt_FromLong((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1656; __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 = 1650; __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 = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); @@ -55939,14 +56739,14 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GIVEREF(__pyx_t_1); __pyx_t_10 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_137), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_138), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_reason_for_failure); __pyx_v_reason_for_failure = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1651 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1657 * 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 # <<<<<<<<<<<<<< @@ -55963,7 +56763,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L47:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1653 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1659 * break * * if gap_error == 0: # <<<<<<<<<<<<<< @@ -55973,7 +56773,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_gap_error == 0) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1654 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1660 * * if gap_error == 0: * i = 1 # <<<<<<<<<<<<<< @@ -55982,21 +56782,21 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1655 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1661 * 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 = 1655; __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 = 1661; __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[8]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1661; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1656 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1662 * i = 1 * self.findexes.reset() * if f_back_low < f_low: # <<<<<<<<<<<<<< @@ -56006,16 +56806,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1657 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1663 * self.findexes.reset() * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< * i = i+1 * self.findexes.append(sym_setindex(self.category, i)) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1658 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1664 * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -56024,16 +56824,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = (__pyx_v_i + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1659 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1665 * 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 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__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 = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __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 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1665; __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; @@ -56041,27 +56841,27 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L52:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1660 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1666 * 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_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 = 1660; __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 = 1666; __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 = 1660; __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 = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->findexes1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); - __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1661 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1667 * self.findexes.append(sym_setindex(self.category, i)) * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -56071,26 +56871,26 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1662 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1668 * 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_9 = (__pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); + __pyx_t_9 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1663 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1669 * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< * i = i + 1 * else: */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1664 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1670 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -56102,19 +56902,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1666 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1672 * i = i + 1 * else: * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< * if f_back_high > f_high: * fphr_arr._append(sym_setindex(self.category, i)) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j])); + ((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:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1667 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1673 * else: * fphr_arr._append(phrase.syms[j]) * if f_back_high > f_high: # <<<<<<<<<<<<<< @@ -56124,25 +56924,25 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_f_back_high > __pyx_v_f_high) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1668 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1674 * 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)) * */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1669 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1675 * 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_10 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -56150,25 +56950,25 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L56:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1671 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1677 * 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1671; __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 = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((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_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_10); + __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_10); __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1672 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1678 * * fphr = Phrase(fphr_arr) * if met_constraints: # <<<<<<<<<<<<<< @@ -56178,37 +56978,37 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_met_constraints != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1675 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1681 * 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) # <<<<<<<<<<<<<< * if len(phrase_list) > 0: * pair_count = 1.0 / len(phrase_list) */ - __pyx_t_10 = ((struct __pyx_vtabstruct_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_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = ((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_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_v_phrase_list = __pyx_t_10; __pyx_t_10 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1676 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1682 * 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 = 1676; __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 = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((__pyx_t_13 > 0) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1677 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1683 * 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 = 1677; __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 = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_t_13 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); @@ -56217,14 +57017,14 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_pair_count = (1.0 / __pyx_t_13); goto __pyx_L58; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1679 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1685 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -56233,22 +57033,22 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_pair_count = 0.0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1680 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1686 * 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_10 = PyInt_FromLong(__pyx_v_f_back_low); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_v_f_back_low); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyInt_FromLong(__pyx_v_e_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_e_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = PyInt_FromLong(__pyx_v_e_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyInt_FromLong(__pyx_v_e_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __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 = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); @@ -56262,7 +57062,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_14 = 0; - __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_138), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_139), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_14)); __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_v_reason_for_failure); @@ -56271,7 +57071,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L58:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1681 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1687 * 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: # <<<<<<<<<<<<<< @@ -56282,7 +57082,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_14 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_14); __pyx_t_13 = 0; __pyx_t_16 = 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 = 1681; __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 = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext; } @@ -56290,23 +57090,23 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj 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 = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1687; __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 = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1687; __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 = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1687; __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 = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_15 = __pyx_t_16(__pyx_t_14); if (unlikely(!__pyx_t_15)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -56322,7 +57122,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -56335,16 +57135,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1681; __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 = 1687; __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 = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } else { Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; @@ -56352,7 +57152,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L61_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L62_unpacking_done; @@ -56360,7 +57160,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_17 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L62_unpacking_done:; } __Pyx_XDECREF(__pyx_v_phrase2); @@ -56370,7 +57170,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_eindexes = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1682 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1688 * 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) # <<<<<<<<<<<<<< @@ -56379,32 +57179,32 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __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_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_3_sa_IntList *)__pyx_t_15), ((struct __pyx_obj_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1688; __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_15), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_als1)); - __pyx_v_als1 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); + __pyx_v_als1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1683 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1689 * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1683; __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 = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_als1)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_als1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_als1)); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__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 = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr)); @@ -56418,7 +57218,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -56428,7 +57228,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L57:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1684 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1690 * 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 # <<<<<<<<<<<<<< @@ -56438,7 +57238,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_num_gaps < __pyx_v_self->max_nonterminals) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1685 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1691 * extracts.append((fphr, phrase2, pair_count, tuple(als1))) * if (num_gaps < self.max_nonterminals and * phrase_len < self.max_length and # <<<<<<<<<<<<<< @@ -56448,7 +57248,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_phrase_len < __pyx_v_self->max_length) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1686 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1692 * 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): # <<<<<<<<<<<<<< @@ -56466,7 +57266,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1687 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1693 * 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 # <<<<<<<<<<<<<< @@ -56476,7 +57276,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_f_back_low == __pyx_v_f_low) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1688 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1694 * 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 # <<<<<<<<<<<<<< @@ -56486,7 +57286,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_f_low >= __pyx_v_self->train_min_gap_size) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1689 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1695 * 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))): # <<<<<<<<<<<<<< @@ -56516,7 +57316,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1690 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1696 * 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 # <<<<<<<<<<<<<< @@ -56525,7 +57325,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_x_low = (__pyx_v_f_low - __pyx_v_self->train_min_gap_size); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1691 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1697 * ((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 # <<<<<<<<<<<<<< @@ -56534,7 +57334,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1692 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1698 * f_x_low = f_low-self.train_min_gap_size * met_constraints = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -56544,7 +57344,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = (__pyx_v_self->tight_phrases != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1693 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1699 * met_constraints = 1 * if self.tight_phrases: * while f_x_low >= 0 and f_links_low[f_x_low] == -1: # <<<<<<<<<<<<<< @@ -56561,7 +57361,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (!__pyx_t_18) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1694 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1700 * if self.tight_phrases: * while f_x_low >= 0 and f_links_low[f_x_low] == -1: * f_x_low = f_x_low - 1 # <<<<<<<<<<<<<< @@ -56574,7 +57374,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L65:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1695 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1701 * 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: # <<<<<<<<<<<<<< @@ -56590,7 +57390,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1696 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1702 * 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 # <<<<<<<<<<<<<< @@ -56602,7 +57402,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L68:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1698 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1704 * met_constraints = 0 * * if (met_constraints and # <<<<<<<<<<<<<< @@ -56611,28 +57411,28 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if ((__pyx_v_met_constraints != 0)) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1699 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1705 * * 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 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1703 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1709 * 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, 1, 0, 1, 0) == 1) and * ((not self.tight_phrases) or f_links_low[f_x_low] != -1) and */ - __pyx_t_7 = (((struct __pyx_vtabstruct_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_t_7 = (((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_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1705 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1711 * 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 # <<<<<<<<<<<<<< @@ -56648,24 +57448,24 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1706 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1712 * 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 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1710 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1716 * -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_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_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_8; @@ -56680,16 +57480,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1712 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1718 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() # <<<<<<<<<<<<<< * i = 1 * self.findexes.reset() */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1713 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1719 * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() * i = 1 # <<<<<<<<<<<<<< @@ -56698,44 +57498,44 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1714 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1720 * 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 = 1714; __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 = 1720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1715 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1721 * 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_1 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1721; __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_14); __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1716 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1722 * self.findexes.reset() * self.findexes.append(sym_setindex(self.category, i)) * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< * i = i+1 * self.findexes.extend(self.findexes1) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1717 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1723 * self.findexes.append(sym_setindex(self.category, i)) * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -56744,27 +57544,27 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = (__pyx_v_i + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1718 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1724 * 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_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 = 1718; __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 = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1718; __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 = 1724; __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_15 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_1), NULL); 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_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1719 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1725 * i = i+1 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -56774,26 +57574,26 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1720 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1726 * 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_7 = (__pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); + __pyx_t_7 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1721 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1727 * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< * i = i + 1 * else: */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1722 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1728 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -56805,19 +57605,19 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1724 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1730 * i = i + 1 * else: * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< * if f_back_high > f_high: * fphr_arr._append(sym_setindex(self.category, i)) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j])); + ((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:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1725 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1731 * else: * fphr_arr._append(phrase.syms[j]) * if f_back_high > f_high: # <<<<<<<<<<<<<< @@ -56827,25 +57627,25 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_f_back_high > __pyx_v_f_high) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1726 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1732 * 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)) * fphr = Phrase(fphr_arr) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1727 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1733 * 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_15 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyInt_FromLong(__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 = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1733; __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_1); __pyx_t_1 = 0; @@ -56853,57 +57653,57 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L73:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1728 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1734 * 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1728; __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 = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fphr_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); - __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_fphr)); - __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_15); + __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1731 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1737 * 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) # <<<<<<<<<<<<<< * if len(phrase_list) > 0: * pair_count = 1.0 / len(phrase_list) */ - __pyx_t_15 = ((struct __pyx_vtabstruct_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_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = ((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_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_XDECREF(__pyx_v_phrase_list); __pyx_v_phrase_list = __pyx_t_15; __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1732 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1738 * 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 = 1732; __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 = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((__pyx_t_13 > 0) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1733 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1739 * 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 = 1733; __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 = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_t_13 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); @@ -56912,14 +57712,14 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_pair_count = (1.0 / __pyx_t_13); goto __pyx_L74; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1735 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1741 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -56930,7 +57730,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L74:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1736 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1742 * else: * pair_count = 0 * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<< @@ -56941,7 +57741,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_15 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_15); __pyx_t_13 = 0; __pyx_t_16 = NULL; } else { - __pyx_t_13 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext; } @@ -56949,23 +57749,23 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_15)) { if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_15)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_15)) { if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_15)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -56981,7 +57781,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -56994,16 +57794,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(__pyx_t_3); #else - __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; @@ -57011,7 +57811,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GOTREF(__pyx_t_14); index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L77_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L78_unpacking_done; @@ -57019,7 +57819,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_17 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L78_unpacking_done:; } __Pyx_XDECREF(__pyx_v_phrase2); @@ -57029,7 +57829,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_eindexes = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1737 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1743 * pair_count = 0 * for phrase2, eindexes in phrase_list: * als2 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<< @@ -57038,32 +57838,32 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_t_1 = ((PyObject *)__pyx_v_self->findexes); __Pyx_INCREF(__pyx_t_1); - if (!(likely(((__pyx_v_eindexes) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_eindexes, __pyx_ptype_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_3_sa_IntList *)__pyx_t_1), ((struct __pyx_obj_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1743; __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_1), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_als2)); - __pyx_v_als2 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); + __pyx_v_als2 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1738 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1744 * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __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 = 1738; __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 = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_als2)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_als2)); __Pyx_GIVEREF(((PyObject *)__pyx_v_als2)); - __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fphr)); @@ -57077,7 +57877,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GIVEREF(__pyx_t_14); __pyx_t_3 = 0; __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; @@ -57090,7 +57890,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L64:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1740 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1746 * extracts.append((fphr, phrase2, pair_count, tuple(als2))) * * if (f_back_high == f_high and # <<<<<<<<<<<<<< @@ -57100,7 +57900,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_f_back_high == __pyx_v_f_high) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1741 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1747 * * if (f_back_high == f_high and * f_sent_len - f_high >= self.train_min_gap_size and # <<<<<<<<<<<<<< @@ -57110,7 +57910,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_8 = (((__pyx_v_f_sent_len - __pyx_v_f_high) >= __pyx_v_self->train_min_gap_size) != 0); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1742 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1748 * 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))): # <<<<<<<<<<<<<< @@ -57140,7 +57940,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1743 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1749 * 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 # <<<<<<<<<<<<<< @@ -57149,7 +57949,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_x_high = (__pyx_v_f_high + __pyx_v_self->train_min_gap_size); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1744 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1750 * ((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 # <<<<<<<<<<<<<< @@ -57158,7 +57958,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1745 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1751 * f_x_high = f_high+self.train_min_gap_size * met_constraints = 1 * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -57168,7 +57968,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_8 = (__pyx_v_self->tight_phrases != 0); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1746 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1752 * met_constraints = 1 * if self.tight_phrases: * while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: # <<<<<<<<<<<<<< @@ -57185,7 +57985,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (!__pyx_t_18) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1747 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1753 * 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 # <<<<<<<<<<<<<< @@ -57198,7 +57998,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L80:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1748 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1754 * 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: # <<<<<<<<<<<<<< @@ -57214,7 +58014,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1749 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1755 * 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 # <<<<<<<<<<<<<< @@ -57226,7 +58026,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L83:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1751 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1757 * met_constraints = 0 * * if (met_constraints and # <<<<<<<<<<<<<< @@ -57235,27 +58035,27 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if ((__pyx_v_met_constraints != 0)) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1752 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1758 * * 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_15 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1756 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1762 * 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_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_back_low, __pyx_t_15, __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)) { + 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_15, __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_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1758 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1764 * 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 # <<<<<<<<<<<<<< @@ -57271,31 +58071,31 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1759 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1765 * 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_14 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1764 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1770 * 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_7 = (((struct __pyx_vtabstruct_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_t_7 = (((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; } else { __pyx_t_7 = __pyx_t_8; } __pyx_t_8 = __pyx_t_7; } else { - __pyx_t_8 = (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_back_low, __pyx_t_15, __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_t_8 = (((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_15, __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_15); __pyx_t_15 = 0; } __pyx_t_7 = __pyx_t_8; @@ -57304,16 +58104,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1766 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1772 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() # <<<<<<<<<<<<<< * i = 1 * self.findexes.reset() */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1767 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1773 * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() * i = 1 # <<<<<<<<<<<<<< @@ -57322,21 +58122,21 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1768 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1774 * fphr_arr._clear() * i = 1 * self.findexes.reset() # <<<<<<<<<<<<<< * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) */ - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_14 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1769 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1775 * i = 1 * self.findexes.reset() * if f_back_low < f_low: # <<<<<<<<<<<<<< @@ -57346,16 +58146,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1770 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1776 * self.findexes.reset() * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< * i = i+1 * self.findexes.append(sym_setindex(self.category, i)) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1771 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1777 * if f_back_low < f_low: * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -57364,16 +58164,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = (__pyx_v_i + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1772 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1778 * 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_14 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyInt_FromLong(__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 = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; @@ -57381,27 +58181,27 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L85:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1773 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1779 * 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_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 = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1779; __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 = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1779; __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_1 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1774 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1780 * self.findexes.append(sym_setindex(self.category, i)) * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -57411,26 +58211,26 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1775 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1781 * 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_7 = (__pyx_f_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); + __pyx_t_7 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1776 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1782 * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< * i = i + 1 * else: */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1777 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1783 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -57442,92 +58242,92 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1779 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1785 * i = i + 1 * else: * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< * fphr_arr._append(sym_setindex(self.category, i)) * self.findexes.append(sym_setindex(self.category, i)) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j])); + ((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:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1780 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1786 * else: * 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) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1781 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1787 * 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_1 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1787; __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_14); __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1782 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1788 * 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_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_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(((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_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_fphr)); - __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); + __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1785 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1791 * 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) # <<<<<<<<<<<<<< * if len(phrase_list) > 0: * pair_count = 1.0 / len(phrase_list) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_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_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1783; __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_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_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_phrase_list); __pyx_v_phrase_list = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1786 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1792 * 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 = 1786; __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 = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((__pyx_t_13 > 0) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1787 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1793 * 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 = 1787; __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 = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_t_13 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); @@ -57536,14 +58336,14 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_pair_count = (1.0 / __pyx_t_13); goto __pyx_L89; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1789 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1795 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -57554,7 +58354,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L89:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1790 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1796 * else: * pair_count = 0 * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<< @@ -57565,7 +58365,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_1 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0; __pyx_t_16 = NULL; } else { - __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -57573,23 +58373,23 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_14 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_14 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_14)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -57605,7 +58405,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -57618,16 +58418,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(__pyx_t_3); #else - __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } else { Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; @@ -57635,7 +58435,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GOTREF(__pyx_t_15); index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L92_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L93_unpacking_done; @@ -57643,7 +58443,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_17 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L93_unpacking_done:; } __Pyx_XDECREF(__pyx_v_phrase2); @@ -57653,7 +58453,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_eindexes = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1791 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1797 * pair_count = 0 * for phrase2, eindexes in phrase_list: * als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<< @@ -57662,32 +58462,32 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __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_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_3_sa_IntList *)__pyx_t_14), ((struct __pyx_obj_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1797; __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 = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_als3)); - __pyx_v_als3 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); + __pyx_v_als3 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1792 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1798 * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __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 = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(((PyObject *)__pyx_v_als3)); PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_als3)); __Pyx_GIVEREF(((PyObject *)__pyx_v_als3)); - __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(((PyObject *)__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 = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_fphr)); @@ -57701,7 +58501,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GIVEREF(__pyx_t_15); __pyx_t_3 = 0; __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; @@ -57714,7 +58514,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L79:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1793 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1799 * 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 # <<<<<<<<<<<<<< @@ -57724,7 +58524,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_7 = ((__pyx_v_num_gaps < (__pyx_v_self->max_nonterminals - 1)) != 0); if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1794 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1800 * extracts.append((fphr, phrase2, pair_count, tuple(als3))) * if (num_gaps < self.max_nonterminals - 1 and * phrase_len+1 < self.max_length and # <<<<<<<<<<<<<< @@ -57734,7 +58534,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_8 = (((__pyx_v_phrase_len + 1) < __pyx_v_self->max_length) != 0); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1795 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1801 * if (num_gaps < self.max_nonterminals - 1 and * phrase_len+1 < self.max_length and * f_back_high == f_high and # <<<<<<<<<<<<<< @@ -57744,7 +58544,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_18 = ((__pyx_v_f_back_high == __pyx_v_f_high) != 0); if (__pyx_t_18) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1796 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1802 * phrase_len+1 < self.max_length and * f_back_high == f_high and * f_back_low == f_low and # <<<<<<<<<<<<<< @@ -57754,7 +58554,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_9 = ((__pyx_v_f_back_low == __pyx_v_f_low) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1797 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1803 * 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 # <<<<<<<<<<<<<< @@ -57764,7 +58564,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1798 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1804 * 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 # <<<<<<<<<<<<<< @@ -57774,7 +58574,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_20 = ((__pyx_v_f_low >= __pyx_v_self->train_min_gap_size) != 0); if (__pyx_t_20) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1799 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1805 * 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 # <<<<<<<<<<<<<< @@ -57784,7 +58584,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_21 = ((__pyx_v_f_high <= (__pyx_v_f_sent_len - __pyx_v_self->train_min_gap_size)) != 0); if (__pyx_t_21) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1800 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1806 * 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))): # <<<<<<<<<<<<<< @@ -57834,7 +58634,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1802 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1808 * ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_high] != -1))): * * met_constraints = 1 # <<<<<<<<<<<<<< @@ -57843,7 +58643,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_met_constraints = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1803 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1809 * * met_constraints = 1 * f_x_low = f_low-self.train_min_gap_size # <<<<<<<<<<<<<< @@ -57852,7 +58652,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_x_low = (__pyx_v_f_low - __pyx_v_self->train_min_gap_size); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1804 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1810 * met_constraints = 1 * f_x_low = f_low-self.train_min_gap_size * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -57862,7 +58662,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_8 = (__pyx_v_self->tight_phrases != 0); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1805 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1811 * 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: # <<<<<<<<<<<<<< @@ -57879,7 +58679,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (!__pyx_t_18) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1806 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1812 * if self.tight_phrases: * while f_x_low >= 0 and f_links_low[f_x_low] == -1: * f_x_low = f_x_low - 1 # <<<<<<<<<<<<<< @@ -57892,7 +58692,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L95:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1807 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1813 * 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: # <<<<<<<<<<<<<< @@ -57902,7 +58702,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_18 = ((__pyx_v_f_x_low < 0) != 0); if (__pyx_t_18) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1808 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1814 * f_x_low = f_x_low - 1 * if f_x_low < 0: * met_constraints = 0 # <<<<<<<<<<<<<< @@ -57914,7 +58714,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L98:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1810 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1816 * met_constraints = 0 * * f_x_high = f_high+self.train_min_gap_size # <<<<<<<<<<<<<< @@ -57923,7 +58723,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_f_x_high = (__pyx_v_f_high + __pyx_v_self->train_min_gap_size); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1811 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1817 * * f_x_high = f_high+self.train_min_gap_size * if self.tight_phrases: # <<<<<<<<<<<<<< @@ -57933,7 +58733,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_18 = (__pyx_v_self->tight_phrases != 0); if (__pyx_t_18) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1812 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1818 * 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: # <<<<<<<<<<<<<< @@ -57950,7 +58750,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (!__pyx_t_7) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1813 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1819 * 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 # <<<<<<<<<<<<<< @@ -57963,7 +58763,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L99:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1814 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1820 * 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: # <<<<<<<<<<<<<< @@ -57979,7 +58779,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1815 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1821 * 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 # <<<<<<<<<<<<<< @@ -57991,7 +58791,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L102:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1817 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1823 * met_constraints = 0 * * if (met_constraints and # <<<<<<<<<<<<<< @@ -58000,28 +58800,28 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ if ((__pyx_v_met_constraints != 0)) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1818 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1824 * * 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_1 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1822 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1828 * 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, 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 */ - __pyx_t_8 = (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_1, __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_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_1, __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_1); __pyx_t_1 = 0; if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1824 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1830 * 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 # <<<<<<<<<<<<<< @@ -58043,45 +58843,45 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_18) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1825 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1831 * 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_1 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1829 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1835 * -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_7 = (((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_x_low, __pyx_t_1, __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_t_7 = (((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_1, __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_1); __pyx_t_1 = 0; if (__pyx_t_7) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1831 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1837 * 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_1 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1836 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1842 * 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_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_fixpoint(__pyx_v_self, __pyx_v_f_high, __pyx_t_1, __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_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_1, __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_1); __pyx_t_1 = 0; __pyx_t_9 = __pyx_t_19; } else { @@ -58101,16 +58901,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1838 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1844 * self.train_max_initial_size, self.train_max_initial_size, * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() # <<<<<<<<<<<<<< * i = 1 * self.findexes.reset() */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1839 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1845 * 0, 0, 0, 0, 0, 0, 0)): * fphr_arr._clear() * i = 1 # <<<<<<<<<<<<<< @@ -58119,44 +58919,44 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1840 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1846 * 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_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 = 1840; __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 = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1841 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1847 * 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 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyInt_FromLong(__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 = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1847; __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_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1842 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1848 * self.findexes.reset() * self.findexes.append(sym_setindex(self.category, i)) * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< * i = i+1 * self.findexes.extend(self.findexes1) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1843 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1849 * self.findexes.append(sym_setindex(self.category, i)) * fphr_arr._append(sym_setindex(self.category, i)) * i = i+1 # <<<<<<<<<<<<<< @@ -58165,27 +58965,27 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __pyx_v_i = (__pyx_v_i + 1); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1844 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1850 * 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_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 = 1844; __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 = 1850; __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 = 1844; __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 = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_self->findexes1)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); - __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1845 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1851 * i = i+1 * self.findexes.extend(self.findexes1) * for j from 0 <= j < phrase.n: # <<<<<<<<<<<<<< @@ -58195,26 +58995,26 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_2 = __pyx_v_phrase->n; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1846 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1852 * 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_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); + __pyx_t_8 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1847 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1853 * for j from 0 <= j < phrase.n: * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< * i = i + 1 * else: */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1848 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1854 * if sym_isvar(phrase.syms[j]): * fphr_arr._append(sym_setindex(self.category, i)) * i = i + 1 # <<<<<<<<<<<<<< @@ -58226,92 +59026,92 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1850 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1856 * i = i + 1 * else: * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< * fphr_arr._append(sym_setindex(self.category, i)) * self.findexes.append(sym_setindex(self.category, i)) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, (__pyx_v_phrase->syms[__pyx_v_j])); + ((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:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1851 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1857 * else: * 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) */ - ((struct __pyx_vtabstruct_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_append(__pyx_v_fphr_arr, __pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); + ((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)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1852 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1858 * 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_14 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyInt_FromLong(__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 = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1853 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1859 * 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_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1853; __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 = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); - __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_fphr)); - __pyx_v_fphr = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_14); + __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_14); __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1856 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1862 * 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) # <<<<<<<<<<<<<< * if len(phrase_list) > 0: * pair_count = 1.0 / len(phrase_list) */ - __pyx_t_14 = ((struct __pyx_vtabstruct_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 = 1854; __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 = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_XDECREF(__pyx_v_phrase_list); __pyx_v_phrase_list = __pyx_t_14; __pyx_t_14 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1857 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1863 * 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 = 1857; __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 = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((__pyx_t_13 > 0) != 0); if (__pyx_t_8) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1858 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1864 * 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 = 1858; __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 = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_t_13 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); @@ -58320,14 +59120,14 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_pair_count = (1.0 / __pyx_t_13); goto __pyx_L107; } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1860 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1866 * pair_count = 1.0 / len(phrase_list) * else: * pair_count = 0 # <<<<<<<<<<<<<< @@ -58338,7 +59138,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } __pyx_L107:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1861 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1867 * else: * pair_count = 0 * for phrase2, eindexes in phrase_list: # <<<<<<<<<<<<<< @@ -58349,7 +59149,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_t_14 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_14); __pyx_t_13 = 0; __pyx_t_16 = 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 = 1861; __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 = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext; } @@ -58357,23 +59157,23 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj 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 = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1867; __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 = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1867; __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 = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1867; __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 = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_15 = __pyx_t_16(__pyx_t_14); if (unlikely(!__pyx_t_15)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -58389,7 +59189,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -58402,16 +59202,16 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __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 = 1867; __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 = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } else { Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; @@ -58419,7 +59219,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L110_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L111_unpacking_done; @@ -58427,7 +59227,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_17 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L111_unpacking_done:; } __Pyx_XDECREF(__pyx_v_phrase2); @@ -58437,7 +59237,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __pyx_v_eindexes = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1862 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1868 * pair_count = 0 * for phrase2, eindexes in phrase_list: * als4 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) # <<<<<<<<<<<<<< @@ -58446,32 +59246,32 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ __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_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->create_alignments(__pyx_v_self, __pyx_v_sent_links, __pyx_v_num_links, ((struct __pyx_obj_3_sa_IntList *)__pyx_t_15), ((struct __pyx_obj_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1868; __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_15), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_als4)); - __pyx_v_als4 = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_3); + __pyx_v_als4 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1863 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1869 * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1863; __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 = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_als4)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_als4)); __Pyx_GIVEREF(((PyObject *)__pyx_v_als4)); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__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 = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr)); @@ -58485,7 +59285,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -58507,23 +59307,23 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1865 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1871 * extracts.append((fphr, phrase2, pair_count, tuple(als4))) * else: * reason_for_failure = "Unable to extract basic phrase" # <<<<<<<<<<<<<< * * free(sent_links) */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_139)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_140)); __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_139); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_140); } __pyx_L34:; goto __pyx_L33; } __pyx_L33:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1867 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1873 * reason_for_failure = "Unable to extract basic phrase" * * free(sent_links) # <<<<<<<<<<<<<< @@ -58532,7 +59332,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_sent_links); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1868 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1874 * * free(sent_links) * free(f_links_low) # <<<<<<<<<<<<<< @@ -58541,7 +59341,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_f_links_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1869 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1875 * free(sent_links) * free(f_links_low) * free(f_links_high) # <<<<<<<<<<<<<< @@ -58550,7 +59350,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_f_links_high); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1870 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1876 * free(f_links_low) * free(f_links_high) * free(e_links_low) # <<<<<<<<<<<<<< @@ -58559,7 +59359,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_e_links_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1871 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1877 * free(f_links_high) * free(e_links_low) * free(e_links_high) # <<<<<<<<<<<<<< @@ -58568,7 +59368,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_e_links_high); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1872 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1878 * free(e_links_low) * free(e_links_high) * free(f_gap_low) # <<<<<<<<<<<<<< @@ -58577,7 +59377,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_f_gap_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1873 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1879 * free(e_links_high) * free(f_gap_low) * free(f_gap_high) # <<<<<<<<<<<<<< @@ -58586,7 +59386,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_f_gap_high); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1874 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1880 * free(f_gap_low) * free(f_gap_high) * free(e_gap_low) # <<<<<<<<<<<<<< @@ -58595,7 +59395,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_e_gap_low); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1875 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1881 * free(f_gap_high) * free(e_gap_low) * free(e_gap_high) # <<<<<<<<<<<<<< @@ -58604,7 +59404,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj */ free(__pyx_v_e_gap_high); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1877 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1883 * free(e_gap_high) * * return extracts # <<<<<<<<<<<<<< @@ -58624,7 +59424,7 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_15); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_extracts); @@ -58647,11 +59447,12 @@ static PyObject *__pyx_f_3_sa_23HieroCachingRuleFactory_extract(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_26add_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_26add_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_f_words = 0; PyObject *__pyx_v_e_words = 0; PyObject *__pyx_v_alignment = 0; + PyObject *__pyx_v_ctx_name = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -58659,12 +59460,22 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_26add_instance(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_instance (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f_words,&__pyx_n_s__e_words,&__pyx_n_s__alignment,0}; - PyObject* values[3] = {0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f_words,&__pyx_n_s__e_words,&__pyx_n_s__alignment,&__pyx_n_s__ctx_name,0}; + PyObject* values[4] = {0,0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1891 + * # 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 + */ + values[3] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -58679,45 +59490,54 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_26add_instance(PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e_words)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_instance", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("add_instance", 0, 3, 4, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1891; __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", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("add_instance", 0, 3, 4, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx_name); + if (value) { values[3] = value; kw_args--; } } } 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 = 1885; __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 = 1891; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } __pyx_v_f_words = values[0]; __pyx_v_e_words = values[1]; __pyx_v_alignment = values[2]; + __pyx_v_ctx_name = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_instance", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1885; __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 = 1891; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.add_instance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_words, __pyx_v_e_words, __pyx_v_alignment); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instance(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_words, __pyx_v_e_words, __pyx_v_alignment, __pyx_v_ctx_name); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_12add_instance_1extract(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_12add_instance_1extract = {__Pyx_NAMESTR("extract"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_12add_instance_1extract, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_12add_instance_1extract(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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 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; PyObject *__pyx_v_e_i = 0; @@ -58760,46 +59580,46 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_12add_instance_1extract 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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 7); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 9, 9, 8); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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 = 1919; __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 = 1925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { goto __pyx_L5_argtuple_error; @@ -58826,18 +59646,18 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_12add_instance_1extract } 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 = 1919; __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 = 1925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.add_instance.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_self, __pyx_v_f_i, __pyx_v_f_j, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, __pyx_v_nt_open); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_self, __pyx_v_f_i, __pyx_v_f_j, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, __pyx_v_nt_open); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1919 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1925 * # 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): # <<<<<<<<<<<<<< @@ -58845,9 +59665,9 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_12add_instance_1extract * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: */ -static PyObject *__pyx_pf_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_3_sa___pyx_scope_struct_21_add_instance *__pyx_cur_scope; - struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *__pyx_outer_scope; +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; PyObject *__pyx_v_link_i = NULL; PyObject *__pyx_v_link_j = NULL; PyObject *__pyx_v_new_e_i = NULL; @@ -58879,36 +59699,36 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extract", 0); - __pyx_outer_scope = (struct __pyx_obj_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_21_add_instance *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1921 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1927 * 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 = 1921; __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 = 1921; __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 = 1927; __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 = 1927; __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 = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1927; __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 = 1921; __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 = 1927; __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 = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1927; __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 = 1921; __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 = 1927; __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 = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1921; __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 = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __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 = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1927; __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 = 1921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __pyx_t_5; } else { @@ -58916,7 +59736,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1922 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1928 * # Phrase extraction limits * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: * return # <<<<<<<<<<<<<< @@ -58930,41 +59750,41 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1924 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1930 * 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 = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_v_al)) { __Pyx_RaiseClosureNameError("al"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __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 = 1924; __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 = 1930; __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1926 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1932 * 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 = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_3) { - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __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 = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Subtract(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __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 = 1926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1932; __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 = 1926; __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 = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __pyx_t_6; } else { @@ -58972,80 +59792,80 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1927 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1933 * # 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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __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, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_7, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __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 = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetItemInt(__pyx_t_1, __pyx_t_7, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_1, __pyx_t_7, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1928 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1934 * 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 = 1928; __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 = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __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 = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __pyx_pf_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, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = __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, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __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_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1929 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1935 * 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_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__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_7 = 2; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, __pyx_t_7, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, __pyx_t_7, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_int_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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetItemInt(__pyx_t_4, __pyx_t_7, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_4, __pyx_t_7, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L5; } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1932 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1938 * # 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 = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_nt_open); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = (!__pyx_t_5); if (__pyx_t_3) { - __pyx_t_4 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_t_1 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__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 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_5; } else { @@ -59053,21 +59873,21 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1933 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1939 * # 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_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __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 = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __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 = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = __pyx_pf_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_t_4, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __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_1, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_t_4, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __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; @@ -59077,7 +59897,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L6:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1934 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1940 * 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 # <<<<<<<<<<<<<< @@ -59091,27 +59911,27 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1936 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1942 * 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 = 1936; __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 = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_8); __pyx_t_8 = 0; __pyx_v_link_i = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1937 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1943 * # Aligned word * link_i = fe_span[f_j][0] * link_j = fe_span[f_j][1] # <<<<<<<<<<<<<< @@ -59120,17 +59940,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( */ if (unlikely(((PyObject *)__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 = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f_j); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f_j); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_link_j = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1938 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1944 * link_i = fe_span[f_j][0] * link_j = fe_span[f_j][1] * new_e_i = min(link_i, e_i) # <<<<<<<<<<<<<< @@ -59141,8 +59961,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __pyx_t_8 = __pyx_v_e_i; __Pyx_INCREF(__pyx_v_link_i); __pyx_t_2 = __pyx_v_link_i; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __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 = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1944; __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 = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_8); @@ -59159,7 +59979,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __pyx_v_new_e_i = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1939 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1945 * link_j = fe_span[f_j][1] * new_e_i = min(link_i, e_i) * new_e_j = max(link_j, e_j) # <<<<<<<<<<<<<< @@ -59170,8 +59990,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __pyx_t_8 = __pyx_v_e_j; __Pyx_INCREF(__pyx_v_link_j); __pyx_t_4 = __pyx_v_link_j; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __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 = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __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 = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_8); @@ -59188,7 +60008,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __pyx_v_new_e_j = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1942 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1948 * # 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 # <<<<<<<<<<<<<< @@ -59198,58 +60018,58 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_INCREF(__pyx_v_min_bound); __pyx_v_new_min_bound = __pyx_v_min_bound; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1944 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1950 * 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_8 = PyObject_RichCompare(__pyx_v_e_j, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1944; __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 = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_v_e_j, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __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 = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1945 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1951 * # 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_AsInt(__pyx_v_new_e_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_new_e_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __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_8 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1946 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1952 * 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 = 1946; __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 = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __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 = 1946; __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 = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1947 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1953 * for i from new_e_i <= i <= new_e_j: * if ef_span[i][0] < f_i: * return # <<<<<<<<<<<<<< @@ -59263,7 +60083,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L10:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1948 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1954 * if ef_span[i][0] < f_i: * return * new_min_bound = max(new_min_bound, ef_span[i][1]) # <<<<<<<<<<<<<< @@ -59272,17 +60092,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( */ if (unlikely(((PyObject *)__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 = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_INCREF(__pyx_v_new_min_bound); __pyx_t_8 = __pyx_v_new_min_bound; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1948; __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 = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __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 = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_2); @@ -59299,17 +60119,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_DECREF(__pyx_v_new_min_bound); __pyx_v_new_min_bound = __pyx_t_2; __pyx_t_2 = 0; - __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1945 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1951 * # 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 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_2; @@ -59318,46 +60138,46 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } /*else*/ { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1951 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1957 * # 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_AsInt(__pyx_v_new_e_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_e_i); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_new_e_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_e_i); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __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 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1952 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1958 * 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 = 1952; __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 = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 1952; __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(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __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 = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1958; __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 = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1953 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1959 * for i from new_e_i <= i < e_i: * if ef_span[i][0] < f_i: * return # <<<<<<<<<<<<<< @@ -59371,7 +60191,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L13:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1954 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1960 * if ef_span[i][0] < f_i: * return * new_min_bound = max(new_min_bound, ef_span[i][1]) # <<<<<<<<<<<<<< @@ -59380,17 +60200,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( */ if (unlikely(((PyObject *)__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 = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_v_new_min_bound); __pyx_t_2 = __pyx_v_new_min_bound; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __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 = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __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 = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_4); @@ -59407,62 +60227,62 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_DECREF(__pyx_v_new_min_bound); __pyx_v_new_min_bound = __pyx_t_4; __pyx_t_4 = 0; - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1951 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1957 * # 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 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1955 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1961 * 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_AsInt(__pyx_v_e_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_e_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __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 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1956 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1962 * 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 = 1956; __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 = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1956; __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 = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1957 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1963 * for i from e_j < i <= new_e_j: * if ef_span[i][0] < f_i: * return # <<<<<<<<<<<<<< @@ -59476,7 +60296,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L16:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1958 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1964 * if ef_span[i][0] < f_i: * return * new_min_bound = max(new_min_bound, ef_span[i][1]) # <<<<<<<<<<<<<< @@ -59485,17 +60305,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( */ if (unlikely(((PyObject *)__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 = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_v_new_min_bound); __pyx_t_4 = __pyx_v_new_min_bound; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __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 = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __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 = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_8); @@ -59512,17 +60332,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_DECREF(__pyx_v_new_min_bound); __pyx_v_new_min_bound = __pyx_t_8; __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1955 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1961 * 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_8 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_8; @@ -59530,18 +60350,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L7:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1960 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1966 * 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 = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_nt_open); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = ((!__pyx_t_6) != 0); if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1961 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1967 * # Extract, extend with word (unless non-terminal open) * if not nt_open: * nt_collision = False # <<<<<<<<<<<<<< @@ -59550,20 +60370,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( */ __pyx_v_nt_collision = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1962 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1968 * if not nt_open: * nt_collision = False * for link in al[f_j]: # <<<<<<<<<<<<<< * if e_nt_cover[link]: * nt_collision = True */ - __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) { __pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; __pyx_t_12 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; } @@ -59572,23 +60392,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( 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_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __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_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_8 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_8)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -59598,25 +60418,25 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __pyx_v_link = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1963 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1969 * 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 = 1963; __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 = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover), __pyx_v_link); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover), __pyx_v_link); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 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_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1964 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1970 * for link in al[f_j]: * if e_nt_cover[link]: * nt_collision = True # <<<<<<<<<<<<<< @@ -59630,7 +60450,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1967 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1973 * # 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: # <<<<<<<<<<<<<< @@ -59639,11 +60459,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( */ __pyx_t_3 = (!(__pyx_v_nt_collision != 0)); if (__pyx_t_3) { - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_2, Py_LT); __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_8 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __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 = 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 = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = __pyx_t_6; } else { @@ -59651,32 +60471,32 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1968 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1974 * # 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_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_v_plus_links = ((PyObject*)__pyx_t_8); __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1969 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1975 * 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_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) { __pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; __pyx_t_12 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; } @@ -59685,23 +60505,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( 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_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __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_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_8 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_8)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -59711,14 +60531,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __pyx_v_link = __pyx_t_8; __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1970 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1976 * plus_links = [] * for link in al[f_j]: * plus_links.append((f_j, link)) # <<<<<<<<<<<<<< * cover[link] += 1 * links.append(plus_links) */ - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_f_j); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f_j); @@ -59726,20 +60546,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_INCREF(__pyx_v_link); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_link); __Pyx_GIVEREF(__pyx_v_link); - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_plus_links, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_plus_links, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1971 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1977 * 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 = 1971; __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 = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_cover) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); __pyx_t_14 = __pyx_cur_scope->__pyx_v_cover; @@ -59747,46 +60567,46 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __pyx_t_8 = __pyx_v_link; if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __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(((PyObject *)__pyx_t_14), __pyx_t_8); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_t_14), __pyx_t_8); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (PyObject_SetItem(((PyObject *)__pyx_t_14), __pyx_t_8, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_t_14), __pyx_t_8, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1972 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1978 * 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_2 = __Pyx_PyObject_Append(__pyx_v_links, ((PyObject *)__pyx_v_plus_links)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_links, ((PyObject *)__pyx_v_plus_links)); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1973 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1979 * 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 = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1979; __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 = 1973; __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 = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1979; __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 = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __pyx_t_3; } else { @@ -59794,33 +60614,33 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1974 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1980 * 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 = 1974; __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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __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 = 1974; __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 = 1980; __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 = 1974; __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 = 1974; __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 = 1980; __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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __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_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __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_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __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 = 1974; __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 = 1974; __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 = 1980; __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 = 1980; __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 = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1980; __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 = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_f_i); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f_i); @@ -59840,62 +60660,62 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_GIVEREF(__pyx_v_links); __pyx_t_1 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__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 = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L24; } __pyx_L24:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1975 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1981 * 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 = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __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 = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __pyx_pf_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_8, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __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_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_8, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __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_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1976 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1982 * 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_1 = __Pyx_PyObject_Pop(__pyx_v_links); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Pop(__pyx_v_links); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1977 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1983 * 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_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __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; __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 = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; } @@ -59904,23 +60724,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( 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 = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1983; __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 = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1983; __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 = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1983; __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 = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -59930,17 +60750,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __pyx_v_link = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1978 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1984 * 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 = 1978; __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 = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_cover) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); __pyx_t_14 = __pyx_cur_scope->__pyx_v_cover; @@ -59948,18 +60768,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __pyx_t_1 = __pyx_v_link; if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_t_14), __pyx_t_1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_t_14), __pyx_t_1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_t_8, __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_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (PyObject_SetItem(((PyObject *)__pyx_t_14), __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_t_14), __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __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; __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; @@ -59972,26 +60792,26 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L17:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1980 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1986 * 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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __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_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Subtract(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = __pyx_t_5; } else { @@ -59999,70 +60819,70 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1982 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1988 * 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_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_4, 0, 0, NULL, NULL, &__pyx_k_slice_140, 0, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_4, 0, 0, NULL, NULL, &__pyx_k_slice_141, 0, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_old_last_nt = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1983 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1989 * # 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(__pyx_t_2, 2, __pyx_v_f_j, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_2, 2, __pyx_v_f_j, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1984 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1990 * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __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_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __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 = 1984; __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 = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1985 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1991 * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_check); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_check); 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); - if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __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 = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_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 = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __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 = 1985; __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 = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); @@ -60073,25 +60893,25 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__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 = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = ((!__pyx_t_3) != 0); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1986 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1992 * 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 (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1987 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1993 * if not span_check(cover, link_i, nt[-1][3] - 1): * nt[-1] = old_last_nt * return # <<<<<<<<<<<<<< @@ -60105,24 +60925,24 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L29:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1988 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1994 * 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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __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_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); 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); __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 = 1988; __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 = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); @@ -60133,31 +60953,31 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); 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); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1989 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1995 * 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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __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 = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); 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); __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 = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); @@ -60168,64 +60988,64 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); 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); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1990 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1996 * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_v_link_i, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_v_link_i, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L28; } __pyx_L28:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1991 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1997 * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __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_v_link_j, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __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 = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1992 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1998 * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_check); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_check); 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_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __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 = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_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 = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __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 = 1992; __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 = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); @@ -60236,25 +61056,25 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__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 = 1992; __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 = 1998; __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1993 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1999 * 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 (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1994 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2000 * if not span_check(cover, nt[-1][4] + 1, link_j): * nt[-1] = old_last_nt * return # <<<<<<<<<<<<<< @@ -60268,24 +61088,24 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L31:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1995 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2001 * 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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __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_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __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 = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __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 = 1995; __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 = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); @@ -60296,31 +61116,31 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); 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); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1996 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2002 * 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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __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 = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __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 = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); @@ -60331,38 +61151,38 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __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_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1997 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2003 * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_v_link_j, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_v_link_j, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L30; } __pyx_L30:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1998 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2004 * 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 = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_3) { - __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 = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 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; __pyx_t_5 = __pyx_t_6; } else { @@ -60370,33 +61190,33 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1999 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2005 * 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 = 1999; __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 = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __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 = 1999; __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 = 2005; __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 = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __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 = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_f_words, 0, 0, &__pyx_v_f_i, &__pyx_t_4, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_f_words, 0, 0, &__pyx_v_f_i, &__pyx_t_4, NULL, 0, 0, 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_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __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 = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_e_words, 0, 0, &__pyx_v_new_e_i, &__pyx_t_4, NULL, 0, 0, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_e_words, 0, 0, &__pyx_v_new_e_i, &__pyx_t_4, NULL, 0, 0, 1); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_f_i); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f_i); @@ -60416,80 +61236,80 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_GIVEREF(__pyx_v_links); __pyx_t_1 = 0; __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_8); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_8); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L32; } __pyx_L32:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2000 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2006 * 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_8 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2000; __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 = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __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 = 2000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_8, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __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_8, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, __pyx_t_4); 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_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2001 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2007 * 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 (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2002 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2008 * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_5) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2003 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2009 * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __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 = 2009; __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 = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __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 = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_t_4 = PyNumber_Subtract(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Subtract(__pyx_t_8, __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); __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 = 2003; __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 = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); @@ -60500,31 +61320,31 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); 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); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2004 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2010 * 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 = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __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 = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __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 = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_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 = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __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 = 2004; __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 = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); @@ -60535,7 +61355,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -60544,43 +61364,43 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L33:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2005 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2011 * 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_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_2, Py_GT); __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_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2006 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2012 * 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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_8); - 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __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 = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __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 = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); 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_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); @@ -60591,31 +61411,31 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2007 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2013 * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __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 = 2013; __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 = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __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 = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_8, __pyx_int_1); 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); __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 = 2007; __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 = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); @@ -60626,7 +61446,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); 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); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; @@ -60638,41 +61458,41 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L27:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2009 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2015 * 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 = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_v_f_j, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Subtract(__pyx_v_f_j, __pyx_t_8); 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); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __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 = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_6 = __pyx_t_5; } else { __pyx_t_6 = __pyx_t_3; } if (__pyx_t_6) { - __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __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 = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Length(__pyx_v_nt); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __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 { @@ -60684,17 +61504,17 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2011 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2017 * 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 = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_check); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2017; __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 = 2011; __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 = 2011; __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 = 2017; __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 = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); @@ -60705,16 +61525,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_INCREF(__pyx_v_link_j); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), 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_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __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 = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = ((!__pyx_t_3) != 0); if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2012 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2018 * # Check for collisions * if not span_check(cover, link_i, link_j): * return # <<<<<<<<<<<<<< @@ -60728,16 +61548,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } __pyx_L36:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2013 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2019 * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __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_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); @@ -60748,23 +61568,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_INCREF(__pyx_v_link_j); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2014 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2020 * 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 = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); 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_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2014; __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 = 2014; __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 = 2020; __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 = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); @@ -60775,27 +61595,27 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_INCREF(__pyx_v_link_j); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2015 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2021 * 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 = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __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_8 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_8; @@ -60804,7 +61624,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_INCREF(__pyx_int_1); __pyx_t_2 = __pyx_int_1; } - __pyx_t_8 = PyList_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyList_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -60821,22 +61641,22 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( PyList_SET_ITEM(__pyx_t_8, 4, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_nt, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_nt, ((PyObject *)__pyx_t_8)); 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); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2017 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2023 * 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 = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_links); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { - __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 = 2017; __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 = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2023; __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 = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_15 = __pyx_t_3; } else { @@ -60844,33 +61664,33 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( } if (__pyx_t_15) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2018 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2024 * # 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 = 2018; __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 = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2024; __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 = 2018; __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 = 2024; __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 = 2018; __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 = 2018; __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 = 2024; __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 = 2024; __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 = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __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 = 2018; __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 = 2018; __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 = 2024; __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 = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __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_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __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_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_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(6); 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_INCREF(__pyx_v_f_i); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f_i); @@ -60890,58 +61710,58 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_GIVEREF(__pyx_v_links); __pyx_t_4 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); 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_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_1); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __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; goto __pyx_L37; } __pyx_L37:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2019 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2025 * 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_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __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 = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(0); 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_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_1, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_8, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = __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_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_8, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __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_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2020 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2026 * 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_4 = __Pyx_PyObject_Pop(__pyx_v_nt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Pop(__pyx_v_nt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2021 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2027 * 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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); 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_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __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 = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); @@ -60952,22 +61772,22 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_INCREF(__pyx_v_link_j); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2022 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2028 * 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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); 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_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2022; __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 = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); @@ -60978,7 +61798,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_INCREF(__pyx_v_link_j); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j); __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -60995,7 +61815,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(((PyObject *)__pyx_t_14)); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.add_instance.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_link_i); @@ -61012,21 +61832,22 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract( return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1885 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1891 * # Aggregate stats from a training instance * # (Extract rules, update counts) - * def add_instance(self, f_words, e_words, alignment): # <<<<<<<<<<<<<< + * def add_instance(self, f_words, e_words, alignment, ctx_name=None): # <<<<<<<<<<<<<< * * self.online = True */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_words, PyObject *__pyx_v_e_words, PyObject *__pyx_v_alignment) { - struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *__pyx_cur_scope; +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; PyObject *__pyx_v_e_len = NULL; PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_e = NULL; CYTHON_UNUSED PyObject *__pyx_v_f_nt_cover = NULL; long __pyx_v_f_i; + PyObject *__pyx_v_stats = NULL; CYTHON_UNUSED PyObject *__pyx_v_lex_i = NULL; CYTHON_UNUSED PyObject *__pyx_v_lex_j = NULL; PyObject *__pyx_v_rule = NULL; @@ -61057,7 +61878,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("add_instance", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *)__pyx_tp_new_3_sa___pyx_scope_struct_21_add_instance(__pyx_ptype_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_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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -61073,8 +61894,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_words); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_words); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1887 - * def add_instance(self, f_words, e_words, alignment): + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1893 + * def add_instance(self, f_words, e_words, alignment, ctx_name=None): * * self.online = True # <<<<<<<<<<<<<< * @@ -61082,20 +61903,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ */ __pyx_cur_scope->__pyx_v_self->online = 1; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1894 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1900 * # 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 = 1894; __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 = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_cur_scope->__pyx_v_rules = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1896 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1902 * rules = set() * * f_len = len(f_words) # <<<<<<<<<<<<<< @@ -61104,15 +61925,15 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ */ __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 = 1896; __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 = 1902; __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 = 1896; __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 = 1902; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1897 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1903 * * f_len = len(f_words) * e_len = len(e_words) # <<<<<<<<<<<<<< @@ -61121,35 +61942,35 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ */ __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 = 1897; __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 = 1903; __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 = 1897; __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 = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_e_len = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1900 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1906 * * # 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 = 1900; __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 = 1906; __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 = 1900; __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 = 1906; __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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__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_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 = 1900; __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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -61158,23 +61979,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ 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 = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1906; __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 = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1906; __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 = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1906; __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 = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -61183,9 +62004,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __Pyx_XDECREF(__pyx_v_i); __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 = 1900; __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 = 1906; __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 = 1900; __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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -61193,28 +62014,28 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_cur_scope->__pyx_v_al = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1901 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1907 * # 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 = 1901; __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 = 1907; __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 = 1901; __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 = 1907; __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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__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_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 = 1901; __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 = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -61223,23 +62044,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ 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 = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1907; __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 = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1907; __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 = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1907; __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 = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -61248,9 +62069,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __Pyx_XDECREF(__pyx_v_i); __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 = 1901; __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 = 1907; __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 = 1901; __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 = 1907; __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); @@ -61258,7 +62079,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ 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 = 1901; __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 = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -61266,28 +62087,28 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_cur_scope->__pyx_v_fe_span = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1902 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1908 * 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 = 1902; __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 = 1908; __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 = 1902; __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 = 1908; __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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; if (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 = 1902; __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 = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -61296,23 +62117,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ 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 = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1908; __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 = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1908; __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 = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1908; __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 = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_6 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_6)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -61321,9 +62142,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __Pyx_XDECREF(__pyx_v_i); __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 = 1902; __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 = 1908; __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 = 1902; __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 = 1908; __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); @@ -61331,7 +62152,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ 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 = 1902; __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 = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -61339,7 +62160,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_cur_scope->__pyx_v_ef_span = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1903 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1909 * 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: # <<<<<<<<<<<<<< @@ -61350,7 +62171,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __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 = 1903; __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 = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -61358,23 +62179,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ 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 = 1903; __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 = 1909; __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 = 1903; __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 = 1909; __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 = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1909; __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 = 1903; __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 = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -61390,7 +62211,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(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 = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -61403,16 +62224,16 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __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 = 1903; __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 = 1909; __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 = 1903; __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 = 1909; __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 = 1903; __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 = 1909; __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; @@ -61420,7 +62241,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __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 = 1903; __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 = 1909; __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; @@ -61428,7 +62249,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __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 = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L12_unpacking_done:; } __Pyx_XDECREF(__pyx_v_f); @@ -61438,21 +62259,21 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_v_e = __pyx_t_6; __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1904 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1910 * 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 (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_e); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_e); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __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_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1905 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1911 * for f, e in alignment: * al[f].append(e) * fe_span[f][0] = min(fe_span[f][0], e) # <<<<<<<<<<<<<< @@ -61461,13 +62282,13 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ */ __Pyx_INCREF(__pyx_v_e); __pyx_t_6 = __pyx_v_e; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_9) { __Pyx_INCREF(__pyx_t_6); @@ -61481,13 +62302,13 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1906 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1912 * al[f].append(e) * fe_span[f][0] = min(fe_span[f][0], e) * fe_span[f][1] = max(fe_span[f][1], e) # <<<<<<<<<<<<<< @@ -61496,13 +62317,13 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ */ __Pyx_INCREF(__pyx_v_e); __pyx_t_6 = __pyx_v_e; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_9) { __Pyx_INCREF(__pyx_t_6); @@ -61516,13 +62337,13 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1907 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1913 * 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) # <<<<<<<<<<<<<< @@ -61531,13 +62352,13 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ */ __Pyx_INCREF(__pyx_v_f); __pyx_t_6 = __pyx_v_f; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_9) { __Pyx_INCREF(__pyx_t_6); @@ -61551,13 +62372,13 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1908 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1914 * 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) # <<<<<<<<<<<<<< @@ -61566,13 +62387,13 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ */ __Pyx_INCREF(__pyx_v_f); __pyx_t_6 = __pyx_v_f; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_GT); __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_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_9) { __Pyx_INCREF(__pyx_t_6); @@ -61586,27 +62407,27 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1911 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1917 * * # 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 = 1911; __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 = 1917; __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 = 1911; __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 = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_temp); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = __pyx_temp; @@ -61615,19 +62436,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_cur_scope->__pyx_v_cover = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1913 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1919 * 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 = 1913; __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 = 1919; __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 = 1913; __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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_temp); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = __pyx_temp; @@ -61635,19 +62456,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_v_f_nt_cover = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1914 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1920 * # 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 = 1914; __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 = 1920; __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 = 1914; __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 = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_temp); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = __pyx_temp; @@ -61656,44 +62477,44 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_cur_scope->__pyx_v_e_nt_cover = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1919 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1925 * # 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_3_sa_23HieroCachingRuleFactory_12add_instance_1extract, 0, __pyx_n_s_144, ((PyObject*)__pyx_cur_scope), __pyx_n_s___sa, ((PyObject *)__pyx_k_codeobj_142)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1919; __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_145, ((PyObject*)__pyx_cur_scope), __pyx_n_s_102, ((PyObject *)__pyx_k_codeobj_143)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2025 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2031 * * # 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_10 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} for (__pyx_v_f_i = 0; __pyx_v_f_i < __pyx_t_10; __pyx_v_f_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2027 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2033 * 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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_i, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_11 = ((!__pyx_t_9) != 0); if (__pyx_t_11) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2028 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2034 * # Skip if phrases won't be tight on left side * if not al[f_i]: * continue # <<<<<<<<<<<<<< @@ -61705,28 +62526,28 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ } __pyx_L15:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2029 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2035 * if not al[f_i]: * continue * extract(f_i, f_i, f_len + 1, -1, f_i, 0, [], [], False) # <<<<<<<<<<<<<< * - * # Update possible phrases (samples) + * stats = self.online_stats[ctx_name] */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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 = 2029; __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 = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = __pyx_pf_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_6, __pyx_t_3, __pyx_int_neg_1, __pyx_t_4, __pyx_int_0, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_12), __pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2029; __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_6, __pyx_t_3, __pyx_int_neg_1, __pyx_t_4, __pyx_int_0, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_12), __pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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_6); __pyx_t_6 = 0; @@ -61739,21 +62560,33 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_L13_continue:; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2034 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2037 + * 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 (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_v_stats = __pyx_t_14; + __pyx_t_14 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2042 * # 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): # <<<<<<<<<<<<<< - * self.samples_f[f] += 1 + * 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 = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2042; __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 = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __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_12 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; @@ -61761,7 +62594,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_t_13 = __pyx_t_12; __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_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; } @@ -61770,23 +62603,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ 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_12 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __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_12 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_12 = __pyx_t_5(__pyx_t_13); if (unlikely(!__pyx_t_12)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -61802,7 +62635,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -61818,18 +62651,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __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 = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } else { Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; @@ -61839,7 +62672,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __Pyx_GOTREF(__pyx_t_7); index = 2; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L18_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 = 2034; __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 = 2042; __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; @@ -61847,7 +62680,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __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 = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L19_unpacking_done:; } __Pyx_XDECREF(__pyx_v_f); @@ -61860,37 +62693,37 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_v_lex_j = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2035 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2043 * # at the cost of readability * for f, lex_i, lex_j in self.get_f_phrases(f_words): - * self.samples_f[f] += 1 # <<<<<<<<<<<<<< + * stats.samples_f[f] += 1 # <<<<<<<<<<<<<< * * # Update phrase counts */ - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->samples_f); - __pyx_t_12 = __pyx_cur_scope->__pyx_v_self->samples_f; + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__samples_f); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_f); __pyx_t_4 = __pyx_v_f; - __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_t_4); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_t_4); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_14 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_t_4, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_12, __pyx_t_4, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2038 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2046 * * # Update phrase counts * for rule in rules: # <<<<<<<<<<<<<< * (f_ph, e_ph, al) = rule[:3] - * self.phrases_f[f_ph] += 1 + * stats.phrases_f[f_ph] += 1 */ - __pyx_t_13 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_rules)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_rules)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; for (;;) { @@ -61899,7 +62732,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ if (unlikely(!__pyx_t_12)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -61909,14 +62742,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_v_rule = __pyx_t_12; __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2039 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2047 * # Update phrase counts * for rule in rules: * (f_ph, e_ph, al) = rule[:3] # <<<<<<<<<<<<<< - * self.phrases_f[f_ph] += 1 - * self.phrases_e[e_ph] += 1 + * stats.phrases_f[f_ph] += 1 + * stats.phrases_e[e_ph] += 1 */ - __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_rule, 0, 3, NULL, NULL, &__pyx_k_slice_145, 0, 1, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_rule, 0, 3, NULL, NULL, &__pyx_k_slice_146, 0, 1, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); if ((likely(PyTuple_CheckExact(__pyx_t_12))) || (PyList_CheckExact(__pyx_t_12))) { PyObject* sequence = __pyx_t_12; @@ -61928,7 +62761,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -61944,18 +62777,18 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(__pyx_t_7); #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __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 = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); #endif __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } else { Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; @@ -61965,7 +62798,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __Pyx_GOTREF(__pyx_t_14); 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 = 2039; __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 = 2047; __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; @@ -61973,7 +62806,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __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 = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L23_unpacking_done:; } __Pyx_XDECREF(__pyx_v_f_ph); @@ -61988,115 +62821,124 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __pyx_cur_scope->__pyx_v_al = __pyx_t_7; __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2040 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2048 * for rule in rules: * (f_ph, e_ph, al) = rule[:3] - * self.phrases_f[f_ph] += 1 # <<<<<<<<<<<<<< - * self.phrases_e[e_ph] += 1 - * self.phrases_fe[f_ph][e_ph] += 1 + * stats.phrases_f[f_ph] += 1 # <<<<<<<<<<<<<< + * stats.phrases_e[e_ph] += 1 + * stats.phrases_fe[f_ph][e_ph] += 1 */ - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->phrases_f); - __pyx_t_12 = __pyx_cur_scope->__pyx_v_self->phrases_f; + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_f); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_f_ph); __pyx_t_7 = __pyx_v_f_ph; - __pyx_t_14 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __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_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2041 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2049 * (f_ph, e_ph, al) = rule[:3] - * self.phrases_f[f_ph] += 1 - * self.phrases_e[e_ph] += 1 # <<<<<<<<<<<<<< - * self.phrases_fe[f_ph][e_ph] += 1 - * if not self.phrases_al[f_ph][e_ph]: + * 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_INCREF(__pyx_cur_scope->__pyx_v_self->phrases_e); - __pyx_t_12 = __pyx_cur_scope->__pyx_v_self->phrases_e; + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_e); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_e_ph); __pyx_t_7 = __pyx_v_e_ph; - __pyx_t_4 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __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 = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2042 - * self.phrases_f[f_ph] += 1 - * self.phrases_e[e_ph] += 1 - * self.phrases_fe[f_ph][e_ph] += 1 # <<<<<<<<<<<<<< - * if not self.phrases_al[f_ph][e_ph]: - * self.phrases_al[f_ph][e_ph] = al + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2050 + * 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_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->phrases_fe, __pyx_v_f_ph); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_fe); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); + __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_v_f_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_INCREF(__pyx_v_e_ph); - __pyx_t_7 = __pyx_v_e_ph; - __pyx_t_14 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_v_e_ph; + __pyx_t_14 = PyObject_GetItem(__pyx_t_7, __pyx_t_12); if (!__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 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); 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_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_7, __pyx_t_12, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __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_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2043 - * self.phrases_e[e_ph] += 1 - * self.phrases_fe[f_ph][e_ph] += 1 - * if not self.phrases_al[f_ph][e_ph]: # <<<<<<<<<<<<<< - * self.phrases_al[f_ph][e_ph] = al + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2051 + * 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_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->phrases_al, __pyx_v_f_ph); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __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 = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_ph); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_v_e_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_v_e_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_9 = ((!__pyx_t_11) != 0); if (__pyx_t_9) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2044 - * self.phrases_fe[f_ph][e_ph] += 1 - * if not self.phrases_al[f_ph][e_ph]: - * self.phrases_al[f_ph][e_ph] = al # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2052 + * 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 counts */ - __pyx_t_7 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->phrases_al, __pyx_v_f_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2044; __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 = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - if (PyObject_SetItem(__pyx_t_7, __pyx_v_e_ph, __pyx_cur_scope->__pyx_v_al) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_ph); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyObject_SetItem(__pyx_t_12, __pyx_v_e_ph, __pyx_cur_scope->__pyx_v_al) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L24; } __pyx_L24:; } __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2047 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2055 * * # Update Bilexical counts * for e_w in e_words: # <<<<<<<<<<<<<< - * self.bilex_e[e_w] += 1 + * stats.bilex_e[e_w] += 1 * for f_w in f_words: */ if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_e_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_e_words)) { __pyx_t_13 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; } @@ -62104,67 +62946,67 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ 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 = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __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 = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __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 = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __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 = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __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_12 = __pyx_t_5(__pyx_t_13); + if (unlikely(!__pyx_t_12)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_12); } __Pyx_XDECREF(__pyx_v_e_w); - __pyx_v_e_w = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_e_w = __pyx_t_12; + __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2048 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2056 * # Update Bilexical counts * for e_w in e_words: - * self.bilex_e[e_w] += 1 # <<<<<<<<<<<<<< + * stats.bilex_e[e_w] += 1 # <<<<<<<<<<<<<< * for f_w in f_words: - * self.bilex_f[f_w] += 1 + * stats.bilex_f[f_w] += 1 */ - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->bilex_e); - __pyx_t_7 = __pyx_cur_scope->__pyx_v_self->bilex_e; + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_e); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_e_w); - __pyx_t_12 = __pyx_v_e_w; - __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_t_12); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_v_e_w; + __pyx_t_4 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __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 = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyObject_SetItem(__pyx_t_7, __pyx_t_12, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2049 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2057 * for e_w in e_words: - * self.bilex_e[e_w] += 1 + * stats.bilex_e[e_w] += 1 * for f_w in f_words: # <<<<<<<<<<<<<< - * self.bilex_f[f_w] += 1 + * stats.bilex_f[f_w] += 1 * for e_w in e_words: */ if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_f_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_f_words)) { __pyx_t_13 = __pyx_cur_scope->__pyx_v_f_words; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_f_words); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_f_words); 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; } @@ -62172,120 +63014,123 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ 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 = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __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_7 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __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 = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __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_7 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__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_12 = __pyx_t_5(__pyx_t_13); + if (unlikely(!__pyx_t_12)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(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 = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_12); } __Pyx_XDECREF(__pyx_v_f_w); - __pyx_v_f_w = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_f_w = __pyx_t_12; + __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2050 - * self.bilex_e[e_w] += 1 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2058 + * stats.bilex_e[e_w] += 1 * for f_w in f_words: - * self.bilex_f[f_w] += 1 # <<<<<<<<<<<<<< + * stats.bilex_f[f_w] += 1 # <<<<<<<<<<<<<< * for e_w in e_words: - * self.bilex_fe[f_w][e_w] += 1 + * stats.bilex_fe[f_w][e_w] += 1 */ - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->bilex_f); - __pyx_t_7 = __pyx_cur_scope->__pyx_v_self->bilex_f; + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_f); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_f_w); - __pyx_t_12 = __pyx_v_f_w; - __pyx_t_14 = PyObject_GetItem(__pyx_t_7, __pyx_t_12); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_v_f_w; + __pyx_t_14 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_14, __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_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyObject_SetItem(__pyx_t_7, __pyx_t_12, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __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; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2051 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2059 * for f_w in f_words: - * self.bilex_f[f_w] += 1 + * stats.bilex_f[f_w] += 1 * for e_w in e_words: # <<<<<<<<<<<<<< - * self.bilex_fe[f_w][e_w] += 1 + * stats.bilex_fe[f_w][e_w] += 1 * */ if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_e_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_e_words)) { - __pyx_t_7 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_7); __pyx_t_15 = 0; + __pyx_t_12 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_12); __pyx_t_15 = 0; __pyx_t_16 = NULL; } else { - __pyx_t_15 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); 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_t_16 = Py_TYPE(__pyx_t_7)->tp_iternext; + __pyx_t_15 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_16 = Py_TYPE(__pyx_t_12)->tp_iternext; } for (;;) { - if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_7)) { - if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_7)) break; + if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_12)) { + if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_12)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_12 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_15); __Pyx_INCREF(__pyx_t_12); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_15); __Pyx_INCREF(__pyx_t_7); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_7, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(__pyx_t_12, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_7)) { - if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_12)) { + if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_12)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_15); __Pyx_INCREF(__pyx_t_12); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_15); __Pyx_INCREF(__pyx_t_7); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_7, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(__pyx_t_12, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { - __pyx_t_12 = __pyx_t_16(__pyx_t_7); - if (unlikely(!__pyx_t_12)) { + __pyx_t_7 = __pyx_t_16(__pyx_t_12); + if (unlikely(!__pyx_t_7)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF(__pyx_v_e_w); - __pyx_v_e_w = __pyx_t_12; - __pyx_t_12 = 0; + __pyx_v_e_w = __pyx_t_7; + __pyx_t_7 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2052 - * self.bilex_f[f_w] += 1 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2060 + * stats.bilex_f[f_w] += 1 * for e_w in e_words: - * self.bilex_fe[f_w][e_w] += 1 # <<<<<<<<<<<<<< + * stats.bilex_fe[f_w][e_w] += 1 # <<<<<<<<<<<<<< * * # Create a rule from source, target, non-terminals, and alignments */ - __pyx_t_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->bilex_fe, __pyx_v_f_w); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_w); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_v_e_w); - __pyx_t_4 = __pyx_v_e_w; - __pyx_t_14 = PyObject_GetItem(__pyx_t_12, __pyx_t_4); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_v_e_w; + __pyx_t_14 = PyObject_GetItem(__pyx_t_4, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_t_4, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_4, __pyx_t_7, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __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_12); __pyx_t_12 = 0; } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; @@ -62300,13 +63145,14 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.add_instance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e_len); __Pyx_XDECREF(__pyx_v_f); __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_v_f_nt_cover); + __Pyx_XDECREF(__pyx_v_stats); __Pyx_XDECREF(__pyx_v_lex_i); __Pyx_XDECREF(__pyx_v_lex_j); __Pyx_XDECREF(__pyx_v_rule); @@ -62322,8 +63168,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_25add_instance(struct _ } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_f_i = 0; PyObject *__pyx_v_e_i = 0; PyObject *__pyx_v_f_span = 0; @@ -62360,31 +63206,31 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *_ 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 = 2055; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __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 = 2055; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __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 = 2055; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __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 = 2055; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __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 = 2055; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("form_rule", 1, 6, 6, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __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 = 2055; __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 = 2063; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { goto __pyx_L5_argtuple_error; @@ -62405,21 +63251,21 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *_ } 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 = 2055; __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 = 2063; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_i, __pyx_v_e_i, __pyx_v_f_span, __pyx_v_e_span, __pyx_v_nt, __pyx_v_al); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_i, __pyx_v_e_i, __pyx_v_f_span, __pyx_v_e_span, __pyx_v_nt, __pyx_v_al); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7 = {__Pyx_NAMESTR("lambda7"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7 = {__Pyx_NAMESTR("lambda7"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_x = 0; PyObject *__pyx_v_y = 0; int __pyx_lineno = 0; @@ -62448,11 +63294,11 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyOb 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 = 2058; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("lambda7", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __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 = 2058; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda7") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -62465,9 +63311,9 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyOb } 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 = 2058; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("lambda7", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; @@ -62476,7 +63322,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyOb return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2058 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2066 * * # Substitute in non-terminals * nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3])) # <<<<<<<<<<<<<< @@ -62495,11 +63341,11 @@ static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda7", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __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 = 2058; __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 = 2066; __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); @@ -62507,7 +63353,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 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -62520,7 +63366,7 @@ 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("_sa.HieroCachingRuleFactory.form_rule.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -62529,9 +63375,9 @@ static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8 = {__Pyx_NAMESTR("lambda8"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8 = {__Pyx_NAMESTR("lambda8"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_x = 0; PyObject *__pyx_v_y = 0; int __pyx_lineno = 0; @@ -62560,11 +63406,11 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyO case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda8") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __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 = 2090; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -62577,9 +63423,9 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __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 = 2090; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule.lambda8", __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:; @@ -62588,7 +63434,7 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyO return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2082 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2090 * # 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])) # <<<<<<<<<<<<<< @@ -62607,11 +63453,11 @@ static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self int __pyx_clineno = 0; __Pyx_RefNannySetupContext("lambda8", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __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 = 2082; __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 = 2090; __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); @@ -62619,7 +63465,7 @@ static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -62632,16 +63478,16 @@ static PyObject *__pyx_lambda_funcdef_lambda8(CYTHON_UNUSED PyObject *__pyx_self __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule.lambda8", __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); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_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_4generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2116 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2124 * f = Phrase(f_sym) * e = Phrase(e_sym) * a = tuple(self.alignment.link(i, j) for i, j in links) # <<<<<<<<<<<<<< @@ -62649,25 +63495,25 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15 * */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *__pyx_cur_scope; +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; 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_3_sa___pyx_scope_struct_23_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_23_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_23_genexpr, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_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_22_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_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __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_4generator15, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -62676,7 +63522,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(PyO __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -62685,9 +63531,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(PyO return __pyx_r; } -static PyObject *__pyx_gb_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_4generator15(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *)__pyx_generator->closure); + 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); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -62711,19 +63557,19 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15 return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __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 = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__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 = 2116; __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 = 2124; __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 = 2116; __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 = 2124; __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; @@ -62735,7 +63581,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15 if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -62748,16 +63594,16 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15 __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 = 2116; __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 = 2124; __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 = 2116; __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 = 2124; __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 = 2116; __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 = 2124; __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; @@ -62765,7 +63611,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15 __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 = 2116; __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 = 2124; __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; @@ -62773,7 +63619,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15 __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 = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L7_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i); @@ -62786,10 +63632,10 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15 __Pyx_GIVEREF(__pyx_t_5); __pyx_cur_scope->__pyx_v_j = __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 = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromLong(((struct __pyx_vtabstruct_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 = 2116; __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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(((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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -62806,7 +63652,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15 __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 = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyErr_SetNone(PyExc_StopIteration); @@ -62826,7 +63672,7 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15 return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2055 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2063 * * # Create a rule from source, target, non-terminals, and alignments * def form_rule(self, f_i, e_i, f_span, e_span, nt, al): # <<<<<<<<<<<<<< @@ -62834,8 +63680,8 @@ static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_9form_rule_4generator15 * # Substitute in non-terminals */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __pyx_obj_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_3_sa___pyx_scope_struct_22_form_rule *__pyx_cur_scope; +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; PyObject *__pyx_v_nt_inv = NULL; PyObject *__pyx_v_f_sym = NULL; PyObject *__pyx_v_off = NULL; @@ -62848,8 +63694,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py PyObject *__pyx_v_nt_i = NULL; PyObject *__pyx_v_lex_f_i = NULL; PyObject *__pyx_v_lex_f_j = NULL; - struct __pyx_obj_3_sa_Phrase *__pyx_v_f = NULL; - struct __pyx_obj_3_sa_Phrase *__pyx_v_e = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_f = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_e = NULL; PyObject *__pyx_v_a = NULL; PyObject *__pyx_v_sub = NULL; PyObject *__pyx_v_link = NULL; @@ -62873,7 +63719,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("form_rule", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *)__pyx_tp_new_3_sa___pyx_scope_struct_22_form_rule(__pyx_ptype_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_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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -62883,52 +63729,52 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2058 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2066 * * # 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 = 2058; __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 = 2066; __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 = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7, 0, __pyx_n_s_146, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7, 0, __pyx_n_s_147, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_nt_inv = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2059 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2067 * # 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_k_slice_147, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_f_span, 0, 0, NULL, NULL, &__pyx_k_slice_148, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __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 = 2059; __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 = 2067; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_f_sym = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2060 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2068 * nt_inv = sorted(nt, cmp=lambda x, y: cmp(x[3], y[3])) * f_sym = list(f_span[:]) * off = f_i # <<<<<<<<<<<<<< @@ -62938,7 +63784,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_INCREF(__pyx_v_f_i); __pyx_v_off = __pyx_v_f_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2061 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2069 * f_sym = list(f_span[:]) * off = f_i * for next_nt in nt: # <<<<<<<<<<<<<< @@ -62949,7 +63795,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __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 = 2061; __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 = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -62957,23 +63803,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py 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 = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2069; __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 = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2069; __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 = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2069; __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 = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -62983,29 +63829,29 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __pyx_v_next_nt = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2062 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2070 * 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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __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 = 2062; __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 = 2070; __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 = 2062; __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 = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_v_nt_len); __pyx_v_nt_len = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2063 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2071 * for next_nt in nt: * nt_len = (next_nt[2] - next_nt[1]) + 1 * i = 0 # <<<<<<<<<<<<<< @@ -63016,7 +63862,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2064 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2072 * nt_len = (next_nt[2] - next_nt[1]) + 1 * i = 0 * while i < nt_len: # <<<<<<<<<<<<<< @@ -63024,83 +63870,83 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py * 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 = 2064; __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 = 2064; __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 = 2072; __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 = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_7) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2065 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2073 * 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_PyObject_GetAttrStr(((PyObject *)__pyx_v_f_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_f_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __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 = 2065; __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 = 2073; __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); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __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_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2066 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2074 * 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_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __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 = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_i); __pyx_v_i = __pyx_t_2; __pyx_t_2 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2067 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2075 * 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_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 2067; __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 = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromLong(__pyx_f_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = PyList_Insert(__pyx_v_f_sym, __pyx_t_8, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyList_Insert(__pyx_v_f_sym, __pyx_t_8, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2068 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2076 * 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_6 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_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_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_6); 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_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_v_off); @@ -63109,27 +63955,27 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2069 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2077 * 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_k_slice_148, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_e_span, 0, 0, NULL, NULL, &__pyx_k_slice_149, 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 = 2069; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__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(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_e_sym = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2070 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2078 * off += (nt_len - 1) * e_sym = list(e_span[:]) * off = e_i # <<<<<<<<<<<<<< @@ -63140,7 +63986,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_DECREF(__pyx_v_off); __pyx_v_off = __pyx_v_e_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2071 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2079 * e_sym = list(e_span[:]) * off = e_i * for next_nt in nt_inv: # <<<<<<<<<<<<<< @@ -63151,7 +63997,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __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 = 2071; __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 = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -63159,23 +64005,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py 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 = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -63185,29 +64031,29 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __pyx_v_next_nt = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2072 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2080 * 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_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_6); 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_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_1, __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_Add(__pyx_t_1, __pyx_int_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_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_v_nt_len); __pyx_v_nt_len = __pyx_t_6; __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2073 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2081 * for next_nt in nt_inv: * nt_len = (next_nt[4] - next_nt[3]) + 1 * i = 0 # <<<<<<<<<<<<<< @@ -63218,7 +64064,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2074 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2082 * nt_len = (next_nt[4] - next_nt[3]) + 1 * i = 0 * while i < nt_len: # <<<<<<<<<<<<<< @@ -63226,83 +64072,83 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py * i += 1 */ while (1) { - __pyx_t_6 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; if (!__pyx_t_7) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2075 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2083 * 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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_e_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_e_sym), __pyx_n_s__pop); 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_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __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 = 2075; __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 = 2083; __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[8]; __pyx_lineno = 2075; __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 = 2083; __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(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2076 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2084 * 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 = 2076; __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 = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_i); __pyx_v_i = __pyx_t_2; __pyx_t_2 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2077 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2085 * 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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __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 = 2077; __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 = 2085; __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 = 2077; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_9 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__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 = PyInt_FromLong(__pyx_f_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 = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__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_e_sym, __pyx_t_8, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __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 = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2078 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2086 * 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 = 2078; __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_2 = PyNumber_InPlaceAdd(__pyx_v_off, __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_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_off); @@ -63311,20 +64157,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2081 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2089 * * # 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 = 2081; __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (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 = 2081; __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; } @@ -63332,23 +64178,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py 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 = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2089; __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 = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2089; __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 = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2089; __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 = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -63361,7 +64207,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __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 = 2081; __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -63369,23 +64215,23 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py 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 = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2089; __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 = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2089; __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 = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2089; __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 = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_6 = __pyx_t_11(__pyx_t_1); if (unlikely(!__pyx_t_6)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -63394,15 +64240,15 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_XDECREF(__pyx_v_link); __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 = 2081; __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 = 2089; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__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 = 2081; __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 = 2089; __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; @@ -63412,32 +64258,32 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __pyx_cur_scope->__pyx_v_links = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2082 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2090 * # 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 = 2082; __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 = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_links)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_links)); __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_links)); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8, 0, __pyx_n_s_146, NULL, __pyx_n_s___sa, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8, 0, __pyx_n_s_147, NULL, __pyx_n_s_102, NULL); 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); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_links_inv = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2083 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2091 * 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) # <<<<<<<<<<<<<< @@ -63448,30 +64294,30 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __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 = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __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 = 2083; __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 = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __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 = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_links_len = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2084 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2092 * 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 = 2084; __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 = 2084; __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 = 2092; __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 = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_nt_len); __pyx_v_nt_len = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2085 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2093 * links_len = len(links) * nt_len = len(nt) * nt_i = 0 # <<<<<<<<<<<<<< @@ -63481,7 +64327,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_INCREF(__pyx_int_0); __pyx_v_nt_i = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2086 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2094 * nt_len = len(nt) * nt_i = 0 * off = f_i # <<<<<<<<<<<<<< @@ -63492,7 +64338,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_DECREF(__pyx_v_off); __pyx_v_off = __pyx_v_f_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2087 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2095 * nt_i = 0 * off = f_i * i = 0 # <<<<<<<<<<<<<< @@ -63503,7 +64349,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2088 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2096 * off = f_i * i = 0 * while i < links_len: # <<<<<<<<<<<<<< @@ -63511,12 +64357,12 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py * off += (nt[nt_i][2] - nt[nt_i][1]) */ while (1) { - __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2088; __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 = 2088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __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 = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_7) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2089 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2097 * i = 0 * while i < links_len: * while nt_i < nt_len and links[i][0] > nt[nt_i][1]: # <<<<<<<<<<<<<< @@ -63524,24 +64370,24 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py * nt_i += 1 */ while (1) { - __pyx_t_1 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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 = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_7) { - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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_RichCompare(__pyx_t_2, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_14 = __pyx_t_13; } else { @@ -63549,82 +64395,82 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py } if (!__pyx_t_14) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2090 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2098 * 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_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __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_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __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_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __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_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __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 = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_off); __pyx_v_off = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2091 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2099 * 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_2 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); 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_DECREF(__pyx_v_nt_i); __pyx_v_nt_i = __pyx_t_2; __pyx_t_2 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2092 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2100 * off += (nt[nt_i][2] - nt[nt_i][1]) * nt_i += 1 * links[i][0] -= off # <<<<<<<<<<<<<< * i += 1 * nt_i = 0 */ - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__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_4 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_v_off); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_v_off); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetItemInt(__pyx_t_2, __pyx_t_4, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_2, __pyx_t_4, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2093 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2101 * nt_i += 1 * links[i][0] -= off * i += 1 # <<<<<<<<<<<<<< * nt_i = 0 * off = e_i */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2093; __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 = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_i); __pyx_v_i = __pyx_t_2; __pyx_t_2 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2094 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2102 * links[i][0] -= off * i += 1 * nt_i = 0 # <<<<<<<<<<<<<< @@ -63635,7 +64481,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_DECREF(__pyx_v_nt_i); __pyx_v_nt_i = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2095 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2103 * i += 1 * nt_i = 0 * off = e_i # <<<<<<<<<<<<<< @@ -63646,7 +64492,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_DECREF(__pyx_v_off); __pyx_v_off = __pyx_v_e_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2096 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2104 * nt_i = 0 * off = e_i * i = 0 # <<<<<<<<<<<<<< @@ -63657,7 +64503,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_DECREF(__pyx_v_i); __pyx_v_i = __pyx_int_0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2097 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2105 * off = e_i * i = 0 * while i < links_len: # <<<<<<<<<<<<<< @@ -63665,12 +64511,12 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py * off += (nt_inv[nt_i][4] - nt_inv[nt_i][3]) */ while (1) { - __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_14) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2098 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2106 * i = 0 * while i < links_len: * while nt_i < nt_len and links_inv[i][1] > nt_inv[nt_i][3]: # <<<<<<<<<<<<<< @@ -63678,24 +64524,24 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py * 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 = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __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 = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 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_14) { - __pyx_t_2 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __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_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __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_3, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_GT); __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_3); __pyx_t_3 = 0; __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 = 2098; __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; __pyx_t_13 = __pyx_t_7; } else { @@ -63703,82 +64549,82 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py } if (!__pyx_t_13) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2099 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2107 * 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_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__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, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__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_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__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, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__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 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __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 = 2107; __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_InPlaceAdd(__pyx_v_off, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__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_DECREF(__pyx_v_off); __pyx_v_off = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2100 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2108 * 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_3 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_nt_i); __pyx_v_nt_i = __pyx_t_3; __pyx_t_3 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2101 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2109 * off += (nt_inv[nt_i][4] - nt_inv[nt_i][3]) * nt_i += 1 * links_inv[i][1] -= off # <<<<<<<<<<<<<< * i += 1 * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 1; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_off); 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(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetItemInt(__pyx_t_3, __pyx_t_4, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_t_3, __pyx_t_4, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2102 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2110 * nt_i += 1 * links_inv[i][1] -= off * i += 1 # <<<<<<<<<<<<<< * * # Find lexical span */ - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); 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_v_i); __pyx_v_i = __pyx_t_3; __pyx_t_3 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2105 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2113 * * # Find lexical span * lex_f_i = f_i # <<<<<<<<<<<<<< @@ -63788,75 +64634,75 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_INCREF(__pyx_v_f_i); __pyx_v_lex_f_i = __pyx_v_f_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2106 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2114 * # 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 = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __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 = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Add(__pyx_v_f_i, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_v_f_i, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_lex_f_j = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2107 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2115 * 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 = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_nt); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_13) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2108 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2116 * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __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_RichCompare(__pyx_t_3, __pyx_v_lex_f_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_lex_f_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__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_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); 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_1); __pyx_t_1 = 0; if (__pyx_t_13) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2109 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2117 * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __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_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); 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(__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 = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __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_InPlaceAdd(__pyx_v_lex_f_i, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_lex_f_i, __pyx_t_2); 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_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_lex_f_i); @@ -63866,49 +64712,49 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py } __pyx_L24:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2110 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2118 * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __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_lex_f_j, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_lex_f_j, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_13) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2111 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2119 * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __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_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_lex_f_j, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_lex_f_j, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_lex_f_j); @@ -63921,63 +64767,63 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py } __pyx_L23:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2114 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2122 * * # 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __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 = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_f_sym)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f_sym)); __Pyx_GIVEREF(((PyObject *)__pyx_v_f_sym)); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_f = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_3); + __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2115 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2123 * # 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __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 = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_e_sym)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_e_sym)); __Pyx_GIVEREF(((PyObject *)__pyx_v_e_sym)); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_e = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); + __pyx_v_e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2116 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2124 * 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 = __pyx_pf_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(((PyObject*)__pyx_cur_scope)); 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_v_a = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2117 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2125 * 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) # <<<<<<<<<<<<<< @@ -63985,7 +64831,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py * # Rule string from rule */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_f)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f)); @@ -64014,7 +64860,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.form_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_nt_inv); @@ -64041,8 +64887,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_27form_rule(struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_f = 0; PyObject *__pyx_v_e = 0; PyObject *__pyx_v_a = 0; @@ -64073,16 +64919,16 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__ 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 = 2120; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __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 = 2120; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("fmt_rule", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __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 = 2120; __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 = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -64097,1282 +64943,292 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__ } 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 = 2120; __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 = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.fmt_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.fmt_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_29fmt_rule(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f, __pyx_v_e, __pyx_v_a); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2121 - * # 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) - * - */ - -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_25_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_25_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_24_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_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("_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_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f, __pyx_v_e, __pyx_v_a); __Pyx_RefNannyFinishContext(); return __pyx_r; -} - -static PyObject *__pyx_gb_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = 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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __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 = 2121; __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)) { - __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 = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - for (;;) { - if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #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 = 2121; __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 = 2121; __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 = 2121; __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 = 2121; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_packed); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_packed); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_packed = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_149), __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __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 = 2121; __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 = 2121; __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 = 2121; __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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__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 = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2120 - * - * # 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) - */ - -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_29fmt_rule(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_a) { - struct __pyx_obj_3_sa___pyx_scope_struct_24_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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fmt_rule", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *)__pyx_tp_new_3_sa___pyx_scope_struct_24_fmt_rule(__pyx_ptype_3_sa___pyx_scope_struct_24_fmt_rule, __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_a = __pyx_v_a; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_a); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a); +} +static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2121 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2129 * # 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_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_pf_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __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 = 2121; __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[8]; __pyx_lineno = 2121; __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_a_str = __pyx_t_2; - __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2122 - * 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) # <<<<<<<<<<<<<< - * - * # Debugging - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_150), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __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 = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f); - __Pyx_GIVEREF(__pyx_v_f); - __Pyx_INCREF(__pyx_v_e); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_e); - __Pyx_GIVEREF(__pyx_v_e); - __Pyx_INCREF(__pyx_v_a_str); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_a_str); - __Pyx_GIVEREF(__pyx_v_a_str); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; +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; + 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); + 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_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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.fmt_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.fmt_rule.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_a_str); __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_32dump_online_stats(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_32dump_online_stats(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("dump_online_stats (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_31dump_online_stats(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2125 - * - * # Debugging - * def dump_online_stats(self): # <<<<<<<<<<<<<< - * logger.info('------------------------------') - * logger.info(' Online Stats ') - */ - -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_31dump_online_stats(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self) { - PyObject *__pyx_v_w = NULL; - PyObject *__pyx_v_w2 = NULL; - PyObject *__pyx_v_ph = NULL; +static PyObject *__pyx_gb_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_2generator16(__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); PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - PyObject *__pyx_t_11 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dump_online_stats", 0); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2126 - * # Debugging - * def dump_online_stats(self): - * logger.info('------------------------------') # <<<<<<<<<<<<<< - * logger.info(' Online Stats ') - * logger.info('------------------------------') - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __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[8]; __pyx_lineno = 2126; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_152), NULL); if (unlikely(!__pyx_t_1)) {__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2127 - * def dump_online_stats(self): - * logger.info('------------------------------') - * logger.info(' Online Stats ') # <<<<<<<<<<<<<< - * logger.info('------------------------------') - * logger.info('f') - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __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[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_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_154), NULL); if (unlikely(!__pyx_t_1)) {__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2128 - * logger.info('------------------------------') - * logger.info(' Online Stats ') - * logger.info('------------------------------') # <<<<<<<<<<<<<< - * logger.info('f') - * for w in self.bilex_f: - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __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[8]; __pyx_lineno = 2128; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_155), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __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; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2129 - * logger.info(' Online Stats ') - * logger.info('------------------------------') - * logger.info('f') # <<<<<<<<<<<<<< - * for w in self.bilex_f: - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w])) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); 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_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_156), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2130 - * logger.info('------------------------------') - * logger.info('f') - * for w in self.bilex_f: # <<<<<<<<<<<<<< - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w])) - * logger.info('e') - */ - if (PyList_CheckExact(__pyx_v_self->bilex_f) || PyTuple_CheckExact(__pyx_v_self->bilex_f)) { - __pyx_t_1 = __pyx_v_self->bilex_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->bilex_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - 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[8]; __pyx_lineno = 2130; __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[8]; __pyx_lineno = 2130; __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[8]; __pyx_lineno = 2130; __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[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_2 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF(__pyx_v_w); - __pyx_v_w = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2131 - * logger.info('f') - * for w in self.bilex_f: - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w])) # <<<<<<<<<<<<<< - * logger.info('e') - * for w in self.bilex_e: - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_kp_s_157)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(__pyx_v_self->bilex_f, __pyx_v_w); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 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_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Add(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __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_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2132 - * for w in self.bilex_f: - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w])) - * logger.info('e') # <<<<<<<<<<<<<< - * for w in self.bilex_e: - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w])) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __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_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_158), 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_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2133 - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w])) - * logger.info('e') - * for w in self.bilex_e: # <<<<<<<<<<<<<< - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w])) - * logger.info('fe') - */ - if (PyList_CheckExact(__pyx_v_self->bilex_e) || PyTuple_CheckExact(__pyx_v_self->bilex_e)) { - __pyx_t_1 = __pyx_v_self->bilex_e; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __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 = 2129; __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)) { + __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_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->bilex_e); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; + 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_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2129; __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; + } 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_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { - __pyx_t_8 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_8)) { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_4); } - __Pyx_XDECREF(__pyx_v_w); - __pyx_v_w = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2134 - * logger.info('e') - * for w in self.bilex_e: - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w])) # <<<<<<<<<<<<<< - * logger.info('fe') - * for w in self.bilex_fe: - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__info); 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_8); __pyx_t_8 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_8), ((PyObject *)__pyx_kp_s_157)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_packed); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_packed); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_packed = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_150), __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __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 = 2129; __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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_GetItem(__pyx_v_self->bilex_e, __pyx_v_w); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __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 = 0; - __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __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 = 2129; __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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __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_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __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 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2135 - * for w in self.bilex_e: - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w])) - * logger.info('fe') # <<<<<<<<<<<<<< - * for w in self.bilex_fe: - * for w2 in self.bilex_fe[w]: - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_159), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __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_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2136 - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w])) - * logger.info('fe') - * for w in self.bilex_fe: # <<<<<<<<<<<<<< - * for w2 in self.bilex_fe[w]: - * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2])) - */ - if (PyList_CheckExact(__pyx_v_self->bilex_fe) || PyTuple_CheckExact(__pyx_v_self->bilex_fe)) { - __pyx_t_1 = __pyx_v_self->bilex_fe; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->bilex_fe); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - 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_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __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_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_7 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_7)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF(__pyx_v_w); - __pyx_v_w = __pyx_t_7; - __pyx_t_7 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2137 - * logger.info('fe') - * for w in self.bilex_fe: - * for w2 in self.bilex_fe[w]: # <<<<<<<<<<<<<< - * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2])) - * logger.info('F') - */ - __pyx_t_7 = PyObject_GetItem(__pyx_v_self->bilex_fe, __pyx_v_w); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) { - __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - for (;;) { - if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_8)) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_8)) { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_7 = __pyx_t_10(__pyx_t_8); - if (unlikely(!__pyx_t_7)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF(__pyx_v_w2); - __pyx_v_w2 = __pyx_t_7; - __pyx_t_7 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2138 - * for w in self.bilex_fe: - * for w2 in self.bilex_fe[w]: - * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2])) # <<<<<<<<<<<<<< - * logger.info('F') - * for ph in self.phrases_f: - */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_7), ((PyObject *)__pyx_kp_s_157)); 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(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_f_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_11 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_11, ((PyObject *)__pyx_kp_s_157)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_GetItem(__pyx_v_self->bilex_fe, __pyx_v_w); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_5 = PyObject_GetItem(__pyx_t_11, __pyx_v_w2); if (!__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_11); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_11), 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(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyNumber_Add(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __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_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2139 - * for w2 in self.bilex_fe[w]: - * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2])) - * logger.info('F') # <<<<<<<<<<<<<< - * for ph in self.phrases_f: - * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph])) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); 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); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_160), NULL); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2140 - * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2])) - * logger.info('F') - * for ph in self.phrases_f: # <<<<<<<<<<<<<< - * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph])) - * logger.info('E') - */ - if (PyList_CheckExact(__pyx_v_self->phrases_f) || PyTuple_CheckExact(__pyx_v_self->phrases_f)) { - __pyx_t_1 = __pyx_v_self->phrases_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->phrases_f); 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_4 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - 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_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __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_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_8); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_8 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_8)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF(__pyx_v_ph); - __pyx_v_ph = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2141 - * logger.info('F') - * for ph in self.phrases_f: - * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph])) # <<<<<<<<<<<<<< - * logger.info('E') - * for ph in self.phrases_e: - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __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 = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __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 = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_ph); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_ph); - __Pyx_GIVEREF(__pyx_v_ph); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetItem(__pyx_v_self->phrases_f, __pyx_v_ph); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __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_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __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 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(((PyObject *)__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; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2142 - * for ph in self.phrases_f: - * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph])) - * logger.info('E') # <<<<<<<<<<<<<< - * for ph in self.phrases_e: - * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph])) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2142; __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[8]; __pyx_lineno = 2142; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_161), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2142; __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; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2143 - * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph])) - * logger.info('E') - * for ph in self.phrases_e: # <<<<<<<<<<<<<< - * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph])) - * logger.info('FE') - */ - if (PyList_CheckExact(__pyx_v_self->phrases_e) || PyTuple_CheckExact(__pyx_v_self->phrases_e)) { - __pyx_t_1 = __pyx_v_self->phrases_e; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->phrases_e); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - 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[8]; __pyx_lineno = 2143; __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[8]; __pyx_lineno = 2143; __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[8]; __pyx_lineno = 2143; __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[8]; __pyx_lineno = 2143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_2 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF(__pyx_v_ph); - __pyx_v_ph = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2144 - * logger.info('E') - * for ph in self.phrases_e: - * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph])) # <<<<<<<<<<<<<< - * logger.info('FE') - * self.dump_online_rules() - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_ph); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ph); - __Pyx_GIVEREF(__pyx_v_ph); - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_11, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_GetItem(__pyx_v_self->phrases_e, __pyx_v_ph); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Add(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __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); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2145 - * for ph in self.phrases_e: - * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph])) - * logger.info('FE') # <<<<<<<<<<<<<< - * self.dump_online_rules() - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __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_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_162), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __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_1); __pyx_t_1 = 0; - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2146 - * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph])) - * logger.info('FE') - * self.dump_online_rules() # <<<<<<<<<<<<<< - * - * def dump_online_rules(self): - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__dump_online_rules); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2146; __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_8); __pyx_t_8 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + PyErr_SetNone(PyExc_StopIteration); 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_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.dump_online_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_w); - __Pyx_XDECREF(__pyx_v_w2); - __Pyx_XDECREF(__pyx_v_ph); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_34dump_online_rules(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_34dump_online_rules(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("dump_online_rules (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_rules(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self)); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); - return __pyx_r; + return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2148 - * self.dump_online_rules() +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2128 * - * def dump_online_rules(self): # <<<<<<<<<<<<<< - * for ph in self.phrases_fe: - * for ph2 in self.phrases_fe[ph]: + * # 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) */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_33dump_online_rules(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self) { - PyObject *__pyx_v_ph = NULL; - PyObject *__pyx_v_ph2 = NULL; +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; + PyObject *__pyx_v_a_str = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = 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("dump_online_rules", 0); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2149 - * - * def dump_online_rules(self): - * for ph in self.phrases_fe: # <<<<<<<<<<<<<< - * for ph2 in self.phrases_fe[ph]: - * logger.info(self.fmt_rule(str(ph), str(ph2), self.phrases_al[ph][ph2]) + ' ||| ' + str(self.phrases_fe[ph][ph2])) - */ - if (PyList_CheckExact(__pyx_v_self->phrases_fe) || PyTuple_CheckExact(__pyx_v_self->phrases_fe)) { - __pyx_t_1 = __pyx_v_self->phrases_fe; __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->phrases_fe); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + __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); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; } - 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 = 2149; __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 = 2149; __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 = 2149; __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 = 2149; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_ph); - __pyx_v_ph = __pyx_t_4; - __pyx_t_4 = 0; + __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_a = __pyx_v_a; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_a); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2150 - * def dump_online_rules(self): - * for ph in self.phrases_fe: - * for ph2 in self.phrases_fe[ph]: # <<<<<<<<<<<<<< - * logger.info(self.fmt_rule(str(ph), str(ph2), self.phrases_al[ph][ph2]) + ' ||| ' + str(self.phrases_fe[ph][ph2])) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2129 + * # 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_4 = PyObject_GetItem(__pyx_v_self->phrases_fe, __pyx_v_ph); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __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_5 = __pyx_t_4; __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_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __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_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_4 = __pyx_t_7(__pyx_t_5); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_ph2); - __pyx_v_ph2 = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); 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_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(((PyObject*)__pyx_cur_scope)); 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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __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[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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_a_str = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2151 - * for ph in self.phrases_fe: - * for ph2 in self.phrases_fe[ph]: - * logger.info(self.fmt_rule(str(ph), str(ph2), self.phrases_al[ph][ph2]) + ' ||| ' + str(self.phrases_fe[ph][ph2])) # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2130 + * 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) # <<<<<<<<<<<<<< * * # Lookup online stats for phrase pair (f, e). Return None if no match. */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__fmt_rule); 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_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_ph); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_ph); - __Pyx_GIVEREF(__pyx_v_ph); - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_ph2); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_ph2); - __Pyx_GIVEREF(__pyx_v_ph2); - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(__pyx_v_self->phrases_al, __pyx_v_ph); if (!__pyx_t_9) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = PyObject_GetItem(__pyx_t_9, __pyx_v_ph2); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_10 = 0; - __pyx_t_11 = 0; - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Add(__pyx_t_12, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_GetItem(__pyx_v_self->phrases_fe, __pyx_v_ph); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_4 = PyObject_GetItem(__pyx_t_12, __pyx_v_ph2); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __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 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_12), NULL); 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_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __pyx_t_12 = PyNumber_Add(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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 = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __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_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_151), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __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 = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __Pyx_INCREF(__pyx_v_e); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_e); + __Pyx_GIVEREF(__pyx_v_e); + __Pyx_INCREF(__pyx_v_a_str); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_a_str); + __Pyx_GIVEREF(__pyx_v_a_str); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.dump_online_rules", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.fmt_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_ph); - __Pyx_XDECREF(__pyx_v_ph2); + __Pyx_XDECREF(__pyx_v_a_str); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_36online_ctx_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_36online_ctx_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_f = 0; PyObject *__pyx_v_e = 0; + PyObject *__pyx_v_ctx_name = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -65380,12 +65236,22 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_36online_ctx_lookup(PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("online_ctx_lookup (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__e,0}; - PyObject* values[2] = {0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__ctx_name,0}; + PyObject* values[3] = {0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2134 + * # 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): # <<<<<<<<<<<<<< + * if self.online: + * stats = self.online_stats[ctx_name] + */ + values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; @@ -65399,43 +65265,45 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_36online_ctx_lookup(PyO case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx_name); + if (value) { values[2] = value; kw_args--; } } } 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 = 2155; __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 = 2134; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } __pyx_v_f = values[0]; __pyx_v_e = values[1]; + __pyx_v_ctx_name = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("online_ctx_lookup", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2155; __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 = 2134; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.online_ctx_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.online_ctx_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_35online_ctx_lookup(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f, __pyx_v_e); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_lookup(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f, __pyx_v_e, __pyx_v_ctx_name); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2155 - * # 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): # <<<<<<<<<<<<<< - * if self.online: - * fcount = self.phrases_f.get(f, 0) - */ - -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_35online_ctx_lookup(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_lookup(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_ctx_name) { + PyObject *__pyx_v_stats = NULL; PyObject *__pyx_v_fcount = NULL; PyObject *__pyx_v_fsample_count = NULL; PyObject *__pyx_v_d = NULL; @@ -65447,79 +65315,101 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_35online_ctx_lookup(str 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("online_ctx_lookup", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2156 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2135 * # IMPORTANT: use get() to avoid adding items to defaultdict - * def online_ctx_lookup(self, f, e): + * def online_ctx_lookup(self, f, e, ctx_name=None): * if self.online: # <<<<<<<<<<<<<< - * fcount = self.phrases_f.get(f, 0) - * fsample_count = self.samples_f.get(f, 0) + * stats = self.online_stats[ctx_name] + * fcount = stats.phrases_f.get(f, 0) */ __pyx_t_1 = (__pyx_v_self->online != 0); if (__pyx_t_1) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2157 - * def online_ctx_lookup(self, f, e): + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2136 + * 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 (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_stats = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2137 * if self.online: - * fcount = self.phrases_f.get(f, 0) # <<<<<<<<<<<<<< - * fsample_count = self.samples_f.get(f, 0) - * d = self.phrases_fe.get(f, None) + * 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_self->phrases_f, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2137; __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 = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2137; __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 = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f); __Pyx_GIVEREF(__pyx_v_f); __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __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; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_fcount = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2158 - * if self.online: - * fcount = self.phrases_f.get(f, 0) - * fsample_count = self.samples_f.get(f, 0) # <<<<<<<<<<<<<< - * d = self.phrases_fe.get(f, None) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2138 + * 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_self->samples_f, __pyx_n_s__get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __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 = 2138; __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 = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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 = 2138; __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[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f); __Pyx_GIVEREF(__pyx_v_f); __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_fsample_count = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_fsample_count = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2159 - * fcount = self.phrases_f.get(f, 0) - * fsample_count = self.samples_f.get(f, 0) - * d = self.phrases_fe.get(f, None) # <<<<<<<<<<<<<< + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2139 + * 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, self.bilex_f, self.bilex_e, self.bilex_fe) + * return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->phrases_fe, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __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 = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2139; __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 = 2139; __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 = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_f); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f); @@ -65527,89 +65417,95 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_35online_ctx_lookup(str __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None); __Pyx_GIVEREF(Py_None); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __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_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); 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_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_d = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_d = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2160 - * fsample_count = self.samples_f.get(f, 0) - * d = self.phrases_fe.get(f, None) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2140 + * 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, self.bilex_f, self.bilex_e, self.bilex_fe) + * return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe) * return None */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_d); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __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 = 2140; __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 = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); 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_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_e); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_e); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_e); __Pyx_GIVEREF(__pyx_v_e); __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); 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); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_t_5; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_t_5; __pyx_t_5 = 0; } else { __Pyx_INCREF(__pyx_int_0); - __pyx_t_4 = __pyx_int_0; + __pyx_t_2 = __pyx_int_0; } - __pyx_v_paircount = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_paircount = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2161 - * d = self.phrases_fe.get(f, None) + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2141 + * d = stats.phrases_fe.get(f, None) * paircount = d.get(e, 0) if d else 0 - * return OnlineFeatureContext(fcount, fsample_count, paircount, self.bilex_f, self.bilex_e, self.bilex_fe) # <<<<<<<<<<<<<< + * return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe) # <<<<<<<<<<<<<< * return None * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_163); 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); - __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_152); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __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_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_e); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_fcount); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_fcount); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fcount); __Pyx_GIVEREF(__pyx_v_fcount); __Pyx_INCREF(__pyx_v_fsample_count); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_fsample_count); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_fsample_count); __Pyx_GIVEREF(__pyx_v_fsample_count); __Pyx_INCREF(__pyx_v_paircount); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_paircount); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_paircount); __Pyx_GIVEREF(__pyx_v_paircount); - __Pyx_INCREF(__pyx_v_self->bilex_f); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_self->bilex_f); - __Pyx_GIVEREF(__pyx_v_self->bilex_f); - __Pyx_INCREF(__pyx_v_self->bilex_e); - PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_self->bilex_e); - __Pyx_GIVEREF(__pyx_v_self->bilex_e); - __Pyx_INCREF(__pyx_v_self->bilex_fe); - PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_v_self->bilex_fe); - __Pyx_GIVEREF(__pyx_v_self->bilex_fe); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2162 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2142 * paircount = d.get(e, 0) if d else 0 - * return OnlineFeatureContext(fcount, fsample_count, paircount, self.bilex_f, self.bilex_e, self.bilex_fe) + * return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe) * return None # <<<<<<<<<<<<<< * * # Find all phrases that we might try to extract @@ -65626,9 +65522,11 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_35online_ctx_lookup(str __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.online_ctx_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.online_ctx_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_stats); __Pyx_XDECREF(__pyx_v_fcount); __Pyx_XDECREF(__pyx_v_fsample_count); __Pyx_XDECREF(__pyx_v_d); @@ -65639,20 +65537,20 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_35online_ctx_lookup(str } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_38get_f_phrases(PyObject *__pyx_v_self, PyObject *__pyx_v_f_words); /*proto*/ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_38get_f_phrases(PyObject *__pyx_v_self, PyObject *__pyx_v_f_words) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_34get_f_phrases(PyObject *__pyx_v_self, PyObject *__pyx_v_f_words); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_34get_f_phrases(PyObject *__pyx_v_self, PyObject *__pyx_v_f_words) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_f_phrases (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_37get_f_phrases(((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_f_words)); + __pyx_r = __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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract = {__Pyx_NAMESTR("extract"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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 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; PyObject *__pyx_v_lex_i = 0; @@ -65691,36 +65589,36 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extrac 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 = 2172; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __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 = 2172; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __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 = 2172; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __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 = 2172; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __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 = 2172; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __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 = 2172; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("extract", 1, 7, 7, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __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 = 2172; __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 = 2152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -65743,18 +65641,18 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extrac } 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 = 2172; __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 = 2152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_f_phrases.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_f_phrases.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_self, __pyx_v_f_i, __pyx_v_f_j, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_v_ntc, __pyx_v_syms); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_self, __pyx_v_f_i, __pyx_v_f_j, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_v_ntc, __pyx_v_syms); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2172 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152 * phrases = set() # (fphrase, lex_i, lex_j) * * def extract(f_i, f_j, lex_i, lex_j, wc, ntc, syms): # <<<<<<<<<<<<<< @@ -65762,10 +65660,10 @@ static PyObject *__pyx_pw_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extrac * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: */ -static PyObject *__pyx_pf_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_3_sa___pyx_scope_struct_26_get_f_phrases *__pyx_cur_scope; - struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *__pyx_outer_scope; - struct __pyx_obj_3_sa_Phrase *__pyx_v_f = NULL; +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_Phrase *__pyx_v_f = NULL; PyObject *__pyx_v_new_lex_i = NULL; PyObject *__pyx_v_new_lex_j = NULL; PyObject *__pyx_r = NULL; @@ -65784,36 +65682,36 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("extract", 0); - __pyx_outer_scope = (struct __pyx_obj_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_26_get_f_phrases *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2174 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2154 * 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 */ - if (unlikely(!__pyx_cur_scope->__pyx_v_f_len)) { __Pyx_RaiseClosureNameError("f_len"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __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 = 2174; __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 = 2154; __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 = 2154; __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 = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2154; __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 = 2174; __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 = 2154; __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 = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2154; __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 = 2174; __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 = 2154; __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 = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __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 = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2154; __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 = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2154; __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 = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __pyx_t_5; } else { @@ -65821,7 +65719,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract } if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2175 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2155 * # Phrase extraction limits * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: * return # <<<<<<<<<<<<<< @@ -65835,58 +65733,58 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract } __pyx_L3:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2177 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2157 * 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 = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_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 = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 2157; __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_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2177; __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 = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2178 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2158 * # 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 = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __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 = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2179 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2159 * 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __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 = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_syms); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_syms); __Pyx_GIVEREF(__pyx_v_syms); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_f = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_1); + __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2180 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2160 * syms.append(f_words[f_j]) * f = Phrase(syms) * new_lex_i = min(lex_i, f_j) # <<<<<<<<<<<<<< @@ -65897,8 +65795,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract __pyx_t_1 = __pyx_v_f_j; __Pyx_INCREF(__pyx_v_lex_i); __pyx_t_2 = __pyx_v_lex_i; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_1); @@ -65915,7 +65813,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract __pyx_v_new_lex_i = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2181 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2161 * f = Phrase(syms) * new_lex_i = min(lex_i, f_j) * new_lex_j = max(lex_j, f_j) # <<<<<<<<<<<<<< @@ -65926,8 +65824,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract __pyx_t_1 = __pyx_v_f_j; __Pyx_INCREF(__pyx_v_lex_j); __pyx_t_4 = __pyx_v_lex_j; - __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[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_1); @@ -65944,19 +65842,19 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract __pyx_v_new_lex_j = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2182 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2162 * 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 = 2182; __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 = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __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 = 2182; __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 = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_f)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f)); @@ -65967,71 +65865,71 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract __Pyx_INCREF(__pyx_v_new_lex_j); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_new_lex_j); __Pyx_GIVEREF(__pyx_v_new_lex_j); - __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2183 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2163 * 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_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2183; __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 = 2163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2163; __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 = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_v_f_i, __pyx_t_1, __pyx_v_new_lex_i, __pyx_v_new_lex_j, __pyx_t_2, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2163; __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_1, __pyx_v_new_lex_i, __pyx_v_new_lex_j, __pyx_t_2, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2163; __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_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2184 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2164 * 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 = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2164; __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_L4:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2186 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2166 * 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 = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_syms); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = (__pyx_f_3_sa_sym_isvar(__pyx_t_9) != 0); + __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_9) != 0); } else { __pyx_t_3 = __pyx_t_6; } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2188 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2168 * 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 = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); 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); - if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __pyx_pf_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_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2168; __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_4, __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 = 2168; __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; @@ -66039,46 +65937,46 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2190 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2170 * 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_2 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __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 = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __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_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __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_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __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 = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2191 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2171 * # 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 = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_syms); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = (!__pyx_t_3); if (!__pyx_t_6) { - __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_ntc, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_v_ntc, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __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 = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__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_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = (!(__pyx_f_3_sa_sym_isvar(__pyx_t_9) != 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; @@ -66089,68 +65987,68 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract } if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2192 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2172 * 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: */ - __pyx_t_4 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __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 = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__pyx_f_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 = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__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 = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2193 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2173 * 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __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 = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_syms); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_syms); __Pyx_GIVEREF(__pyx_v_syms); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_f)); - __pyx_v_f = ((struct __pyx_obj_3_sa_Phrase *)__pyx_t_4); + __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2194 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2174 * 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_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2195 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2175 * 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 = 2195; __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 = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(((PyObject *)__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 = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_f)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_f)); @@ -66161,38 +66059,38 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract __Pyx_INCREF(__pyx_v_lex_j); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_lex_j); __Pyx_GIVEREF(__pyx_v_lex_j); - __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; goto __pyx_L8; } __pyx_L8:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2196 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2176 * 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_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __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 = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __pyx_pf_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_t_1, __pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_cur_scope->__pyx_v_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __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_4, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_t_1, __pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __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; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2197 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2177 * 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_2 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L7; @@ -66209,7 +66107,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_f_phrases.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_f_phrases.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_f); @@ -66220,7 +66118,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2167 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2147 * # (Used for EGivenFCoherent) * # Return set of (fphrase, lex_i, lex_j) * def get_f_phrases(self, f_words): # <<<<<<<<<<<<<< @@ -66228,8 +66126,8 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract * f_len = len(f_words) */ -static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_37get_f_phrases(struct __pyx_obj_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f_words) { - struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *__pyx_cur_scope; +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; long __pyx_v_f_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -66244,7 +66142,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_37get_f_phrases(struct const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_f_phrases", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *)__pyx_tp_new_3_sa___pyx_scope_struct_26_get_f_phrases(__pyx_ptype_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_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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -66257,7 +66155,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_37get_f_phrases(struct __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_words); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_words); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2169 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2149 * def get_f_phrases(self, f_words): * * f_len = len(f_words) # <<<<<<<<<<<<<< @@ -66266,66 +66164,66 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_37get_f_phrases(struct */ __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 = 2169; __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 = 2149; __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 = 2169; __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 = 2149; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2170 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150 * * 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 = 2170; __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 = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_cur_scope->__pyx_v_phrases = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2172 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152 * 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_3_sa_23HieroCachingRuleFactory_13get_f_phrases_1extract, 0, __pyx_n_s_166, ((PyObject*)__pyx_cur_scope), __pyx_n_s___sa, ((PyObject *)__pyx_k_codeobj_165)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __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_155, ((PyObject*)__pyx_cur_scope), __pyx_n_s_102, ((PyObject *)__pyx_k_codeobj_154)); 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_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_extract = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2200 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2180 * * # 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, []) * */ - __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} for (__pyx_v_f_i = 0; __pyx_v_f_i < __pyx_t_3; __pyx_v_f_i++) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2201 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2181 * # 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 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __pyx_cur_scope->__pyx_v_f_len; __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_pf_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_4, __pyx_t_5, __pyx_int_neg_1, __pyx_int_0, __pyx_int_0, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_4, __pyx_t_5, __pyx_int_neg_1, __pyx_int_0, __pyx_int_0, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __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_4); __pyx_t_4 = 0; @@ -66334,7 +66232,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_37get_f_phrases(struct __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2203 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2183 * extract(f_i, f_i, f_len, -1, 0, 0, []) * * return phrases # <<<<<<<<<<<<<< @@ -66354,7 +66252,7 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_37get_f_phrases(struct __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_sa.HieroCachingRuleFactory.get_f_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_f_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -66364,9 +66262,9 @@ static PyObject *__pyx_pf_3_sa_23HieroCachingRuleFactory_37get_f_phrases(struct } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_17span_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_17span_check = {__Pyx_NAMESTR("span_check"), (PyCFunction)__pyx_pw_3_sa_17span_check, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_17span_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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 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; PyObject *__pyx_v_j = 0; @@ -66397,16 +66295,16 @@ static PyObject *__pyx_pw_3_sa_17span_check(PyObject *__pyx_self, PyObject *__py 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 = 2206; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __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 = 2206; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __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 = 2206; __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 = 2186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -66421,18 +66319,18 @@ static PyObject *__pyx_pw_3_sa_17span_check(PyObject *__pyx_self, PyObject *__py } 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 = 2206; __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 = 2186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.span_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.span_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_16span_check(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16span_check(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2206 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2186 * * # Spans are _inclusive_ on both ends [i, j] * def span_check(vec, i, j): # <<<<<<<<<<<<<< @@ -66440,7 +66338,7 @@ static PyObject *__pyx_pw_3_sa_17span_check(PyObject *__pyx_self, PyObject *__py * while k <= j: */ -static PyObject *__pyx_pf_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { PyObject *__pyx_v_k = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -66451,7 +66349,7 @@ static PyObject *__pyx_pf_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_clineno = 0; __Pyx_RefNannySetupContext("span_check", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2207 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2187 * # Spans are _inclusive_ on both ends [i, j] * def span_check(vec, i, j): * k = i # <<<<<<<<<<<<<< @@ -66461,7 +66359,7 @@ static PyObject *__pyx_pf_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_INCREF(__pyx_v_i); __pyx_v_k = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2208 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2188 * def span_check(vec, i, j): * k = i * while k <= j: # <<<<<<<<<<<<<< @@ -66469,25 +66367,25 @@ static PyObject *__pyx_pf_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, * 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 = 2208; __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 = 2208; __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 = 2188; __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 = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_2) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2209 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2189 * k = i * while k <= j: * if vec[k]: # <<<<<<<<<<<<<< * return False * k += 1 */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2189; __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 = 2209; __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 = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2210 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190 * while k <= j: * if vec[k]: * return False # <<<<<<<<<<<<<< @@ -66495,7 +66393,7 @@ static PyObject *__pyx_pf_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, * return True */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -66504,21 +66402,21 @@ static PyObject *__pyx_pf_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, } __pyx_L5:; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2211 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2191 * 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 = 2211; __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 = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_k); __pyx_v_k = __pyx_t_1; __pyx_t_1 = 0; } - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2212 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2192 * return False * k += 1 * return True # <<<<<<<<<<<<<< @@ -66526,7 +66424,7 @@ static PyObject *__pyx_pf_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, * def span_inc(vec, i, j): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -66536,7 +66434,7 @@ static PyObject *__pyx_pf_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_sa.span_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.span_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_k); @@ -66546,9 +66444,9 @@ static PyObject *__pyx_pf_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_19span_inc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_19span_inc = {__Pyx_NAMESTR("span_inc"), (PyCFunction)__pyx_pw_3_sa_19span_inc, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_19span_inc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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 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; PyObject *__pyx_v_j = 0; @@ -66579,16 +66477,16 @@ static PyObject *__pyx_pw_3_sa_19span_inc(PyObject *__pyx_self, PyObject *__pyx_ 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 = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __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 = 2214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __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 = 2214; __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 = 2194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -66603,18 +66501,18 @@ static PyObject *__pyx_pw_3_sa_19span_inc(PyObject *__pyx_self, PyObject *__pyx_ } 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 = 2214; __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 = 2194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.span_inc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.span_inc", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_18span_inc(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_18span_inc(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2214 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2194 * return True * * def span_inc(vec, i, j): # <<<<<<<<<<<<<< @@ -66622,7 +66520,7 @@ static PyObject *__pyx_pw_3_sa_19span_inc(PyObject *__pyx_self, PyObject *__pyx_ * while k <= j: */ -static PyObject *__pyx_pf_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { PyObject *__pyx_v_k = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -66635,7 +66533,7 @@ static PyObject *__pyx_pf_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, Py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("span_inc", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2215 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2195 * * def span_inc(vec, i, j): * k = i # <<<<<<<<<<<<<< @@ -66645,7 +66543,7 @@ static PyObject *__pyx_pf_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, Py __Pyx_INCREF(__pyx_v_i); __pyx_v_k = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2216 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196 * def span_inc(vec, i, j): * k = i * while k <= j: # <<<<<<<<<<<<<< @@ -66653,12 +66551,12 @@ static PyObject *__pyx_pf_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, 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 = 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_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 = 2196; __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 = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_2) break; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2217 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2197 * k = i * while k <= j: * vec[k] += 1 # <<<<<<<<<<<<<< @@ -66667,23 +66565,23 @@ static PyObject *__pyx_pf_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, Py */ __Pyx_INCREF(__pyx_v_k); __pyx_t_1 = __pyx_v_k; - __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __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 = 2217; __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 = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (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;} + if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2218 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198 * 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 = 2218; __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 = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_k); __pyx_v_k = __pyx_t_1; @@ -66696,7 +66594,7 @@ static PyObject *__pyx_pf_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, Py __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.span_inc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.span_inc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_k); @@ -66706,9 +66604,9 @@ static PyObject *__pyx_pf_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, Py } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_21span_dec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_3_sa_21span_dec = {__Pyx_NAMESTR("span_dec"), (PyCFunction)__pyx_pw_3_sa_21span_dec, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_3_sa_21span_dec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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 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; PyObject *__pyx_v_j = 0; @@ -66739,16 +66637,16 @@ static PyObject *__pyx_pw_3_sa_21span_dec(PyObject *__pyx_self, PyObject *__pyx_ 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 = 2220; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_dec", 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_dec", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_dec", 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_dec") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __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 = 2200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -66763,18 +66661,18 @@ static PyObject *__pyx_pw_3_sa_21span_dec(PyObject *__pyx_self, PyObject *__pyx_ } 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 = 2220; __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 = 2200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.span_dec", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.span_dec", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_20span_dec(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_20span_dec(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2220 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2200 * k += 1 * * def span_dec(vec, i, j): # <<<<<<<<<<<<<< @@ -66782,7 +66680,7 @@ static PyObject *__pyx_pw_3_sa_21span_dec(PyObject *__pyx_self, PyObject *__pyx_ * while k <= j: */ -static PyObject *__pyx_pf_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { PyObject *__pyx_v_k = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -66795,7 +66693,7 @@ static PyObject *__pyx_pf_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, Py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("span_dec", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2221 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2201 * * def span_dec(vec, i, j): * k = i # <<<<<<<<<<<<<< @@ -66805,7 +66703,7 @@ static PyObject *__pyx_pf_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, Py __Pyx_INCREF(__pyx_v_i); __pyx_v_k = __pyx_v_i; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2222 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202 * def span_dec(vec, i, j): * k = i * while k <= j: # <<<<<<<<<<<<<< @@ -66813,12 +66711,12 @@ static PyObject *__pyx_pf_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, 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 = 2222; __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 = 2222; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2223 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2203 * k = i * while k <= j: * vec[k] -= 1 # <<<<<<<<<<<<<< @@ -66826,21 +66724,21 @@ static PyObject *__pyx_pf_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, Py */ __Pyx_INCREF(__pyx_v_k); __pyx_t_1 = __pyx_v_k; - __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2203; __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 = 2223; __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 = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2203; __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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2224 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204 * 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 = 2224; __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 = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_k); __pyx_v_k = __pyx_t_1; @@ -66853,7 +66751,7 @@ static PyObject *__pyx_pf_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, Py __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.span_dec", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.span_dec", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_k); @@ -66863,20 +66761,20 @@ static PyObject *__pyx_pf_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, Py } /* Python wrapper */ -static int __pyx_pw_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __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_3_sa_13FeatureVector___cinit__(((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":7 +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":7 * * cdef class FeatureVector: * def __cinit__(self): # <<<<<<<<<<<<<< @@ -66884,7 +66782,7 @@ static int __pyx_pw_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyOb * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) */ -static int __pyx_pf_3_sa_13FeatureVector___cinit__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self) { +static int __pyx_pf_4cdec_2sa_3_sa_13FeatureVector___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -66895,7 +66793,7 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(struct __pyx_obj_3_sa_Feature int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":8 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":8 * cdef class FeatureVector: * def __cinit__(self): * self.names = IntList(INITIAL_CAPACITY, INCREMENT) # <<<<<<<<<<<<<< @@ -66914,16 +66812,16 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(struct __pyx_obj_3_sa_Feature __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_IntList)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->names); __Pyx_DECREF(((PyObject *)__pyx_v_self->names)); - __pyx_v_self->names = ((struct __pyx_obj_3_sa_IntList *)__pyx_t_2); + __pyx_v_self->names = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":9 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":9 * def __cinit__(self): * self.names = IntList(INITIAL_CAPACITY, INCREMENT) * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) # <<<<<<<<<<<<<< @@ -66942,13 +66840,13 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(struct __pyx_obj_3_sa_Feature __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FloatList)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->values); __Pyx_DECREF(((PyObject *)__pyx_v_self->values)); - __pyx_v_self->values = ((struct __pyx_obj_3_sa_FloatList *)__pyx_t_3); + __pyx_v_self->values = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_3); __pyx_t_3 = 0; __pyx_r = 0; @@ -66957,7 +66855,7 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(struct __pyx_obj_3_sa_Feature __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.FeatureVector.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -66965,8 +66863,8 @@ static int __pyx_pf_3_sa_13FeatureVector___cinit__(struct __pyx_obj_3_sa_Feature } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { unsigned int __pyx_v_name; float __pyx_v_value; int __pyx_lineno = 0; @@ -67014,16 +66912,16 @@ static PyObject *__pyx_pw_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyOb __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_sa.FeatureVector.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_3_sa_13FeatureVector_2set(((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self), __pyx_v_name, __pyx_v_value); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self), __pyx_v_name, __pyx_v_value); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":11 +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":11 * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) * * def set(self, unsigned name, float value): # <<<<<<<<<<<<<< @@ -67031,7 +66929,7 @@ static PyObject *__pyx_pw_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyOb * self.values.append(value) */ -static PyObject *__pyx_pf_3_sa_13FeatureVector_2set(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self, unsigned int __pyx_v_name, float __pyx_v_value) { +static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self, unsigned int __pyx_v_name, float __pyx_v_value) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -67041,7 +66939,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_2set(struct __pyx_obj_3_sa_Featur int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":12 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":12 * * def set(self, unsigned name, float value): * self.names.append(name) # <<<<<<<<<<<<<< @@ -67055,7 +66953,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_2set(struct __pyx_obj_3_sa_Featur __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":13 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":13 * def set(self, unsigned name, float value): * self.names.append(name) * self.values.append(value) # <<<<<<<<<<<<<< @@ -67074,27 +66972,27 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_2set(struct __pyx_obj_3_sa_Featur __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_sa.FeatureVector.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_13FeatureVector_4__iter__(((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_4__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":15 +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":15 * self.values.append(value) * * def __iter__(self): # <<<<<<<<<<<<<< @@ -67102,15 +67000,15 @@ static PyObject *__pyx_pw_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self) * for i in range(self.names.len): */ -static PyObject *__pyx_pf_3_sa_13FeatureVector_4__iter__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *__pyx_cur_scope; +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; 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_3_sa___pyx_scope_struct_27___iter__ *)__pyx_tp_new_3_sa___pyx_scope_struct_27___iter__(__pyx_ptype_3_sa___pyx_scope_struct_27___iter__, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -67120,7 +67018,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_4__iter__(struct __pyx_obj_3_sa_F __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_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_6generator5, (PyObject *) __pyx_cur_scope); 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; @@ -67129,7 +67027,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_4__iter__(struct __pyx_obj_3_sa_F __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.FeatureVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -67138,9 +67036,9 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_4__iter__(struct __pyx_obj_3_sa_F return __pyx_r; } -static PyObject *__pyx_gb_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_4cdec_2sa_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *)__pyx_generator->closure); + 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); PyObject *__pyx_r = NULL; int __pyx_t_1; unsigned int __pyx_t_2; @@ -67163,7 +67061,7 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":17 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":17 * def __iter__(self): * cdef unsigned i * for i in range(self.names.len): # <<<<<<<<<<<<<< @@ -67174,7 +67072,7 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":18 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":18 * cdef unsigned i * for i in range(self.names.len): * yield (FD.word(self.names[i]), self.values[i]) # <<<<<<<<<<<<<< @@ -67185,7 +67083,7 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_3_sa_FD->__pyx_vtab)->word(__pyx_v_3_sa_FD, __pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_4cdec_2sa_3_sa_FD->__pyx_vtab)->word(__pyx_v_4cdec_2sa_3_sa_FD, __pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self->values), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); @@ -67227,18 +67125,18 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_6generator5(__pyx_GeneratorObject } /* Python wrapper */ -static PyObject *__pyx_pw_3_sa_13FeatureVector_8__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_3_sa_13FeatureVector_8__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_8__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_8__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_3_sa_13FeatureVector_7__str__(((struct __pyx_obj_3_sa_FeatureVector *)__pyx_v_self)); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str__(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_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___2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":21 +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":21 * * def __str__(self): * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< @@ -67246,25 +67144,25 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_7__str___2generator17(__pyx_Gener * cdef class Scorer: */ -static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str___genexpr(PyObject *__pyx_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *__pyx_cur_scope; +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; 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_3_sa___pyx_scope_struct_29_genexpr *)__pyx_tp_new_3_sa___pyx_scope_struct_29_genexpr(__pyx_ptype_3_sa___pyx_scope_struct_29_genexpr, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_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_28___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_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___2generator17, (PyObject *) __pyx_cur_scope); 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; @@ -67273,7 +67171,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str___genexpr(PyObject *__pyx_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_sa.FeatureVector.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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)); @@ -67282,9 +67180,9 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str___genexpr(PyObject *__pyx_ return __pyx_r; } -static PyObject *__pyx_gb_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___2generator17(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *__pyx_cur_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *)__pyx_generator->closure); + 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); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -67344,7 +67242,7 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_7__str___2generator17(__pyx_Gener __Pyx_GIVEREF(__pyx_t_4); __pyx_cur_scope->__pyx_v_feat = __pyx_t_4; __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_167), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_156), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; @@ -67380,7 +67278,7 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_7__str___2generator17(__pyx_Gener return NULL; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":20 +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":20 * yield (FD.word(self.names[i]), self.values[i]) * * def __str__(self): # <<<<<<<<<<<<<< @@ -67388,8 +67286,8 @@ static PyObject *__pyx_gb_3_sa_13FeatureVector_7__str___2generator17(__pyx_Gener * */ -static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str__(struct __pyx_obj_3_sa_FeatureVector *__pyx_v_self) { - struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *__pyx_cur_scope; +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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -67399,7 +67297,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str__(struct __pyx_obj_3_sa_Fe const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - __pyx_cur_scope = (struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *)__pyx_tp_new_3_sa___pyx_scope_struct_28___str__(__pyx_ptype_3_sa___pyx_scope_struct_28___str__, __pyx_empty_tuple, NULL); + __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); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -67409,7 +67307,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str__(struct __pyx_obj_3_sa_Fe __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":21 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":21 * * def __str__(self): * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< @@ -67419,7 +67317,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str__(struct __pyx_obj_3_sa_Fe __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); 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_2 = __pyx_pf_3_sa_13FeatureVector_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __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[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -67440,7 +67338,7 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str__(struct __pyx_obj_3_sa_Fe __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_sa.FeatureVector.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -67450,8 +67348,8 @@ static PyObject *__pyx_pf_3_sa_13FeatureVector_7__str__(struct __pyx_obj_3_sa_Fe } /* Python wrapper */ -static int __pyx_pw_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_4cdec_2sa_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_models = 0; int __pyx_r; __Pyx_RefNannyDeclarations @@ -67459,13 +67357,13 @@ static int __pyx_pw_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__p if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; __Pyx_INCREF(__pyx_args); __pyx_v_models = __pyx_args; - __pyx_r = __pyx_pf_3_sa_6Scorer___init__(((struct __pyx_obj_3_sa_Scorer *)__pyx_v_self), __pyx_v_models); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)__pyx_v_self), __pyx_v_models); __Pyx_XDECREF(__pyx_v_models); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":25 +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":25 * cdef class Scorer: * cdef models * def __init__(self, *models): # <<<<<<<<<<<<<< @@ -67473,7 +67371,7 @@ static int __pyx_pw_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__p * self.models = zip(names, models) */ -static int __pyx_pf_3_sa_6Scorer___init__(struct __pyx_obj_3_sa_Scorer *__pyx_v_self, PyObject *__pyx_v_models) { +static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_self, PyObject *__pyx_v_models) { PyObject *__pyx_v_names = NULL; PyObject *__pyx_v_model = NULL; int __pyx_r; @@ -67488,7 +67386,7 @@ static int __pyx_pf_3_sa_6Scorer___init__(struct __pyx_obj_3_sa_Scorer *__pyx_v_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":26 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":26 * cdef models * def __init__(self, *models): * names = [FD.index(model.__name__) for model in models] # <<<<<<<<<<<<<< @@ -67512,7 +67410,7 @@ static int __pyx_pf_3_sa_6Scorer___init__(struct __pyx_obj_3_sa_Scorer *__pyx_v_ __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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(((struct __pyx_vtabstruct_3_sa_StringMap *)__pyx_v_3_sa_FD->__pyx_vtab)->index(__pyx_v_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_t_4 = PyInt_FromLong(((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; @@ -67521,7 +67419,7 @@ static int __pyx_pf_3_sa_6Scorer___init__(struct __pyx_obj_3_sa_Scorer *__pyx_v_ __pyx_v_names = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":27 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":27 * def __init__(self, *models): * names = [FD.index(model.__name__) for model in models] * self.models = zip(names, models) # <<<<<<<<<<<<<< @@ -67551,7 +67449,7 @@ static int __pyx_pf_3_sa_6Scorer___init__(struct __pyx_obj_3_sa_Scorer *__pyx_v_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_sa.Scorer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Scorer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_names); @@ -67560,7 +67458,7 @@ static int __pyx_pf_3_sa_6Scorer___init__(struct __pyx_obj_3_sa_Scorer *__pyx_v_ return __pyx_r; } -/* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":29 +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":29 * self.models = zip(names, models) * * cdef FeatureVector score(self, ctx): # <<<<<<<<<<<<<< @@ -67568,11 +67466,11 @@ static int __pyx_pf_3_sa_6Scorer___init__(struct __pyx_obj_3_sa_Scorer *__pyx_v_ * for name, model in self.models: */ -static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __pyx_obj_3_sa_Scorer *__pyx_v_self, PyObject *__pyx_v_ctx) { - struct __pyx_obj_3_sa_FeatureVector *__pyx_v_scores = 0; +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) { + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_scores = 0; PyObject *__pyx_v_name = NULL; PyObject *__pyx_v_model = NULL; - struct __pyx_obj_3_sa_FeatureVector *__pyx_r = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -67587,19 +67485,19 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("score", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":30 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":30 * * cdef FeatureVector score(self, ctx): * cdef FeatureVector scores = FeatureVector() # <<<<<<<<<<<<<< * for name, model in self.models: * scores.set(name, model(ctx)) */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3_sa_FeatureVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FeatureVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_v_scores = ((struct __pyx_obj_3_sa_FeatureVector *)__pyx_t_1); + __pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":31 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":31 * cdef FeatureVector score(self, ctx): * cdef FeatureVector scores = FeatureVector() * for name, model in self.models: # <<<<<<<<<<<<<< @@ -67698,7 +67596,7 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ __pyx_v_model = __pyx_t_6; __pyx_t_6 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":32 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":32 * cdef FeatureVector scores = FeatureVector() * for name, model in self.models: * scores.set(name, model(ctx)) # <<<<<<<<<<<<<< @@ -67730,7 +67628,7 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/features.pxi":33 + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":33 * for name, model in self.models: * scores.set(name, model(ctx)) * return scores # <<<<<<<<<<<<<< @@ -67740,7 +67638,7 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ __pyx_r = __pyx_v_scores; goto __pyx_L0; - __pyx_r = ((struct __pyx_obj_3_sa_FeatureVector *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -67748,7 +67646,7 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("_sa.Scorer.score", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("cdec.sa._sa.Scorer.score", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_scores); @@ -67758,259 +67656,213 @@ static struct __pyx_obj_3_sa_FeatureVector *__pyx_f_3_sa_6Scorer_score(struct __ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_vtabstruct_3_sa_HieroCachingRuleFactory __pyx_vtable_3_sa_HieroCachingRuleFactory; -static PyObject *__pyx_tp_new_3_sa_HieroCachingRuleFactory(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_HieroCachingRuleFactory *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_FeatureVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_HieroCachingRuleFactory; - p->rules = ((struct __pyx_obj_3_sa_TrieTable *)Py_None); Py_INCREF(Py_None); - p->sampler = ((struct __pyx_obj_3_sa_Sampler *)Py_None); Py_INCREF(Py_None); - p->scorer = ((struct __pyx_obj_3_sa_Scorer *)Py_None); Py_INCREF(Py_None); - p->precomputed_index = Py_None; Py_INCREF(Py_None); - p->precomputed_collocations = Py_None; Py_INCREF(Py_None); - p->precompute_file = Py_None; Py_INCREF(Py_None); - p->max_rank = Py_None; Py_INCREF(Py_None); - p->prev_norm_prefix = Py_None; Py_INCREF(Py_None); - p->fsa = ((struct __pyx_obj_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); - p->fda = ((struct __pyx_obj_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - p->eda = ((struct __pyx_obj_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - p->alignment = ((struct __pyx_obj_3_sa_Alignment *)Py_None); Py_INCREF(Py_None); - p->eid2symid = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->fid2symid = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->findexes = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->findexes1 = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->samples_f = Py_None; Py_INCREF(Py_None); - p->phrases_f = Py_None; Py_INCREF(Py_None); - p->phrases_e = Py_None; Py_INCREF(Py_None); - p->phrases_fe = Py_None; Py_INCREF(Py_None); - p->phrases_al = Py_None; Py_INCREF(Py_None); - p->bilex_f = Py_None; Py_INCREF(Py_None); - p->bilex_e = Py_None; Py_INCREF(Py_None); - p->bilex_fe = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_23HieroCachingRuleFactory_1__cinit__(o, a, k) < 0)) { + p = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o); + p->names = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->values = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_3_sa_HieroCachingRuleFactory(PyObject *o) { - struct __pyx_obj_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_3_sa_HieroCachingRuleFactory *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_FeatureVector(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p = (struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->rules); - Py_CLEAR(p->sampler); - Py_CLEAR(p->scorer); - Py_CLEAR(p->precomputed_index); - Py_CLEAR(p->precomputed_collocations); - Py_CLEAR(p->precompute_file); - Py_CLEAR(p->max_rank); - Py_CLEAR(p->prev_norm_prefix); - Py_CLEAR(p->fsa); - Py_CLEAR(p->fda); - Py_CLEAR(p->eda); - Py_CLEAR(p->alignment); - Py_CLEAR(p->eid2symid); - Py_CLEAR(p->fid2symid); - Py_CLEAR(p->findexes); - Py_CLEAR(p->findexes1); - Py_CLEAR(p->samples_f); - Py_CLEAR(p->phrases_f); - Py_CLEAR(p->phrases_e); - Py_CLEAR(p->phrases_fe); - Py_CLEAR(p->phrases_al); - Py_CLEAR(p->bilex_f); - Py_CLEAR(p->bilex_e); - Py_CLEAR(p->bilex_fe); + Py_CLEAR(p->names); + Py_CLEAR(p->values); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa_HieroCachingRuleFactory(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_FeatureVector(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_3_sa_HieroCachingRuleFactory *)o; - if (p->rules) { - e = (*v)(((PyObject*)p->rules), a); if (e) return e; - } - if (p->sampler) { - e = (*v)(((PyObject*)p->sampler), a); if (e) return e; - } - if (p->scorer) { - e = (*v)(((PyObject*)p->scorer), a); if (e) return e; - } - if (p->precomputed_index) { - e = (*v)(p->precomputed_index, a); if (e) return e; - } - if (p->precomputed_collocations) { - e = (*v)(p->precomputed_collocations, a); if (e) return e; - } - if (p->precompute_file) { - e = (*v)(p->precompute_file, a); if (e) return e; - } - if (p->max_rank) { - e = (*v)(p->max_rank, a); if (e) return e; - } - if (p->prev_norm_prefix) { - e = (*v)(p->prev_norm_prefix, a); if (e) return e; - } - if (p->fsa) { - e = (*v)(((PyObject*)p->fsa), a); if (e) return e; - } - if (p->fda) { - e = (*v)(((PyObject*)p->fda), a); if (e) return e; - } - if (p->eda) { - e = (*v)(((PyObject*)p->eda), a); if (e) return e; - } - if (p->alignment) { - e = (*v)(((PyObject*)p->alignment), a); if (e) return e; - } - if (p->eid2symid) { - e = (*v)(((PyObject*)p->eid2symid), a); if (e) return e; - } - if (p->fid2symid) { - e = (*v)(((PyObject*)p->fid2symid), a); if (e) return e; - } - if (p->findexes) { - e = (*v)(((PyObject*)p->findexes), a); if (e) return e; - } - if (p->findexes1) { - e = (*v)(((PyObject*)p->findexes1), a); if (e) return e; - } - if (p->samples_f) { - e = (*v)(p->samples_f, a); if (e) return e; - } - if (p->phrases_f) { - e = (*v)(p->phrases_f, a); if (e) return e; - } - if (p->phrases_e) { - e = (*v)(p->phrases_e, a); if (e) return e; - } - if (p->phrases_fe) { - e = (*v)(p->phrases_fe, a); if (e) return e; - } - if (p->phrases_al) { - e = (*v)(p->phrases_al, a); if (e) return e; - } - if (p->bilex_f) { - e = (*v)(p->bilex_f, a); if (e) return e; - } - if (p->bilex_e) { - e = (*v)(p->bilex_e, a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p = (struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o; + if (p->names) { + e = (*v)(((PyObject*)p->names), a); if (e) return e; } - if (p->bilex_fe) { - e = (*v)(p->bilex_fe, a); if (e) return e; + if (p->values) { + e = (*v)(((PyObject*)p->values), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa_HieroCachingRuleFactory(PyObject *o) { - struct __pyx_obj_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_3_sa_HieroCachingRuleFactory *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_FeatureVector(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p = (struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o; PyObject* tmp; - tmp = ((PyObject*)p->rules); - p->rules = ((struct __pyx_obj_3_sa_TrieTable *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->sampler); - p->sampler = ((struct __pyx_obj_3_sa_Sampler *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->scorer); - p->scorer = ((struct __pyx_obj_3_sa_Scorer *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->precomputed_index); - p->precomputed_index = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->precomputed_collocations); - p->precomputed_collocations = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->precompute_file); - p->precompute_file = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->max_rank); - p->max_rank = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->prev_norm_prefix); - p->prev_norm_prefix = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->fsa); - p->fsa = ((struct __pyx_obj_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->fda); - p->fda = ((struct __pyx_obj_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->eda); - p->eda = ((struct __pyx_obj_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->alignment); - p->alignment = ((struct __pyx_obj_3_sa_Alignment *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->eid2symid); - p->eid2symid = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->fid2symid); - p->fid2symid = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->findexes); - p->findexes = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->findexes1); - p->findexes1 = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->samples_f); - p->samples_f = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->phrases_f); - p->phrases_f = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->phrases_e); - p->phrases_e = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->phrases_fe); - p->phrases_fe = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->names); + p->names = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->phrases_al); - p->phrases_al = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->values); + p->values = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->bilex_f); - p->bilex_f = Py_None; Py_INCREF(Py_None); + return 0; +} + +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)}, + {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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_FeatureVector, /*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_2sa_3_sa_13FeatureVector_8__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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_FeatureVector, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_FeatureVector, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_4cdec_2sa_3_sa_13FeatureVector_5__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_FeatureVector, /*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_FeatureVector, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray __pyx_vtable_4cdec_2sa_3_sa_SuffixArray; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_SuffixArray(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_SuffixArray; + p->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_SuffixArray(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->darray); + Py_CLEAR(p->sa); + Py_CLEAR(p->ha); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_SuffixArray(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o; + if (p->darray) { + e = (*v)(((PyObject*)p->darray), a); if (e) return e; + } + if (p->sa) { + e = (*v)(((PyObject*)p->sa), a); if (e) return e; + } + if (p->ha) { + e = (*v)(((PyObject*)p->ha), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_SuffixArray(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o; + PyObject* tmp; + tmp = ((PyObject*)p->darray); + p->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->bilex_e); - p->bilex_e = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->sa); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->bilex_fe); - p->bilex_fe = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->ha); + p->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } +static PyObject *__pyx_sq_item_4cdec_2sa_3_sa_SuffixArray(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_3_sa_HieroCachingRuleFactory[] = { - {__Pyx_NAMESTR("configure"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_3configure, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_23HieroCachingRuleFactory_2configure)}, - {__Pyx_NAMESTR("pattern2phrase"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_5pattern2phrase, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("pattern2phrase_plus"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("precompute"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_9precompute, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_precomputed_collocation"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("advance"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_13advance, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_all_nodes_isteps_away"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("reachable"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_17reachable, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("shortest"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_19shortest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_next_states"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_21get_next_states, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("input"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_23input, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_23HieroCachingRuleFactory_22input)}, - {__Pyx_NAMESTR("add_instance"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_26add_instance, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("form_rule"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_28form_rule, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("fmt_rule"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_30fmt_rule, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dump_online_stats"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_32dump_online_stats, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dump_online_rules"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_34dump_online_rules, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("online_ctx_lookup"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_36online_ctx_lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_f_phrases"), (PyCFunction)__pyx_pw_3_sa_23HieroCachingRuleFactory_38get_f_phrases, METH_O, __Pyx_DOCSTR(0)}, +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_HieroCachingRuleFactory = { +static PySequenceMethods __pyx_tp_as_sequence_SuffixArray = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4cdec_2sa_3_sa_SuffixArray, /*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_SuffixArray = { + 0, /*mp_length*/ + __pyx_pw_4cdec_2sa_3_sa_11SuffixArray_3__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_SuffixArray = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.HieroCachingRuleFactory"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_HieroCachingRuleFactory), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.SuffixArray"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_HieroCachingRuleFactory, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_SuffixArray, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -68021,8 +67873,8 @@ static PyTypeObject __pyx_type_3_sa_HieroCachingRuleFactory = { #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ + &__pyx_tp_as_sequence_SuffixArray, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SuffixArray, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ @@ -68030,14 +67882,14 @@ static PyTypeObject __pyx_type_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*/ - __pyx_tp_traverse_3_sa_HieroCachingRuleFactory, /*tp_traverse*/ - __pyx_tp_clear_3_sa_HieroCachingRuleFactory, /*tp_clear*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_SuffixArray, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_SuffixArray, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_HieroCachingRuleFactory, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_SuffixArray, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -68047,7 +67899,7 @@ static PyTypeObject __pyx_type_3_sa_HieroCachingRuleFactory = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_HieroCachingRuleFactory, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_SuffixArray, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -68061,65 +67913,73 @@ static PyTypeObject __pyx_type_3_sa_HieroCachingRuleFactory = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_freelist_3_sa___pyx_scope_struct_9_decode_sentence[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_9_decode_sentence = 0; +static 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[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice = 0; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_9_decode_sentence(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *p; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_9_decode_sentence > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_9_decode_sentence[--__pyx_freecount_3_sa___pyx_scope_struct_9_decode_sentence]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence)); + 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)))) { + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)o); - p->__pyx_v_lattice = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o); + p->__pyx_v_word_ids = 0; + p->__pyx_v_words = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *p = (struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_lattice); - if ((__pyx_freecount_3_sa___pyx_scope_struct_9_decode_sentence < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence))) { - __pyx_freelist_3_sa___pyx_scope_struct_9_decode_sentence[__pyx_freecount_3_sa___pyx_scope_struct_9_decode_sentence++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)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))) { + __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); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *p = (struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)o; - if (p->__pyx_v_lattice) { - e = (*v)(p->__pyx_v_lattice, a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o; + if (p->__pyx_v_word_ids) { + e = (*v)(p->__pyx_v_word_ids, a); if (e) return e; + } + if (p->__pyx_v_words) { + e = (*v)(p->__pyx_v_words, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *p = (struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_lattice); - p->__pyx_v_lattice = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_word_ids); + p->__pyx_v_word_ids = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_words); + p->__pyx_v_words = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_9_decode_sentence[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_9_decode_sentence = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_9_decode_sentence"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -68140,13 +68000,13 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_9_decode_sentence = { 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_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -68156,7 +68016,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_9_decode_sentence = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -68170,81 +68030,73 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_9_decode_sentence = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_17_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_17_genexpr = 0; +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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_17_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *p; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_17_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_17_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_17_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr)); + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *)o); - p->__pyx_outer_scope = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *)o); p->__pyx_v_a = 0; - p->__pyx_t_0 = 0; + p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_17_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *)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; 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_3_sa___pyx_scope_struct_17_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_17_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_17_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_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_24_fmt_rule(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return 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; if (p->__pyx_v_a) { e = (*v)(p->__pyx_v_a, 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_3_sa___pyx_scope_struct_17_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_16___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); 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_2sa_3_sa_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_17_genexpr[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_17_genexpr = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_17_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_17_genexpr), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_17_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -68265,13 +68117,13 @@ static PyTypeObject __pyx_type_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_3_sa___pyx_scope_struct_17_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_17_genexpr, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_17_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -68281,7 +68133,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_17_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_17_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -68295,81 +68147,63 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_17_genexpr = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_20_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_20_genexpr = 0; - -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_20_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_LCP(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_LCP *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_20_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_20_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_20_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); + p->lcp = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_3LCP_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_word = 0; - p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_20_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_LCP(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_LCP *p = (struct __pyx_obj_4cdec_2sa_3_sa_LCP *)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_3_sa___pyx_scope_struct_20_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_20_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_20_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } + Py_CLEAR(p->sa); + Py_CLEAR(p->lcp); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_20_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_LCP(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_word) { - e = (*v)(p->__pyx_v_word, a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_LCP *p = (struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o; + if (p->sa) { + e = (*v)(((PyObject*)p->sa), a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; + if (p->lcp) { + e = (*v)(((PyObject*)p->lcp), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_20_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_LCP(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_LCP *p = (struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_19_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); + tmp = ((PyObject*)p->sa); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)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->lcp); + p->lcp = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_20_genexpr[] = { +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_20_genexpr = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_LCP = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_20_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_20_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.LCP"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_LCP), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_20_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_LCP, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -68388,15 +68222,15 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_20_genexpr = { 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_3_sa___pyx_scope_struct_20_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_20_genexpr, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_LCP, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_LCP, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_20_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_LCP, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -68406,7 +68240,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_20_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_20_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_LCP, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -68420,105 +68254,81 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_20_genexpr = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *__pyx_freelist_3_sa___pyx_scope_struct_3_compute_stats[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_3_compute_stats = 0; +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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_3_compute_stats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_3_compute_stats > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_3_compute_stats[--__pyx_freecount_3_sa___pyx_scope_struct_3_compute_stats]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats)); + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o); - p->__pyx_v_ngram = 0; - p->__pyx_v_ngram_start = 0; - p->__pyx_v_ngram_starts = 0; - p->__pyx_v_run_start = 0; - p->__pyx_v_self = 0; - p->__pyx_v_veb = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_a = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)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; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_ngram); - Py_CLEAR(p->__pyx_v_ngram_start); - Py_CLEAR(p->__pyx_v_ngram_starts); - Py_CLEAR(p->__pyx_v_run_start); - Py_CLEAR(p->__pyx_v_self); - Py_CLEAR(p->__pyx_v_veb); - if ((__pyx_freecount_3_sa___pyx_scope_struct_3_compute_stats < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats))) { - __pyx_freelist_3_sa___pyx_scope_struct_3_compute_stats[__pyx_freecount_3_sa___pyx_scope_struct_3_compute_stats++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o; - if (p->__pyx_v_ngram) { - e = (*v)(p->__pyx_v_ngram, a); if (e) return e; - } - if (p->__pyx_v_ngram_start) { - e = (*v)(((PyObject*)p->__pyx_v_ngram_start), a); if (e) return e; - } - if (p->__pyx_v_ngram_starts) { - e = (*v)(p->__pyx_v_ngram_starts, a); if (e) return e; - } - if (p->__pyx_v_run_start) { - e = (*v)(((PyObject*)p->__pyx_v_run_start), a); if (e) return 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; + 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_a) { + e = (*v)(p->__pyx_v_a, a); if (e) return e; } - if (p->__pyx_v_veb) { - e = (*v)(((PyObject*)p->__pyx_v_veb), 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_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_ngram); - p->__pyx_v_ngram = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_ngram_start); - p->__pyx_v_ngram_start = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_ngram_starts); - p->__pyx_v_ngram_starts = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_run_start); - p->__pyx_v_run_start = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + 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); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_LCP *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_a); + p->__pyx_v_a = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_veb); - p->__pyx_v_veb = ((struct __pyx_obj_3_sa_VEB *)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_3_sa___pyx_scope_struct_3_compute_stats[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_3_compute_stats = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_3_compute_stats"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_3_compute_stats), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_3_compute_stats, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -68539,13 +68349,13 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_3_compute_stats = { 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_3_sa___pyx_scope_struct_3_compute_stats, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_3_compute_stats, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_3_compute_stats, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -68555,7 +68365,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_3_compute_stats = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_3_compute_stats, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -68569,81 +68379,226 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_3_compute_stats = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_12_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_12_genexpr = 0; - -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_12_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_OnlineStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_12_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_12_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_12_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o); + p->samples_f = Py_None; Py_INCREF(Py_None); + p->phrases_f = Py_None; Py_INCREF(Py_None); + p->phrases_e = Py_None; Py_INCREF(Py_None); + p->phrases_fe = Py_None; Py_INCREF(Py_None); + p->phrases_al = Py_None; Py_INCREF(Py_None); + p->bilex_f = Py_None; Py_INCREF(Py_None); + p->bilex_e = Py_None; Py_INCREF(Py_None); + p->bilex_fe = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_word = 0; - p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_12_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_OnlineStats(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p = (struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)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_3_sa___pyx_scope_struct_12_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_12_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_12_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } + Py_CLEAR(p->samples_f); + Py_CLEAR(p->phrases_f); + Py_CLEAR(p->phrases_e); + Py_CLEAR(p->phrases_fe); + Py_CLEAR(p->phrases_al); + Py_CLEAR(p->bilex_f); + Py_CLEAR(p->bilex_e); + Py_CLEAR(p->bilex_fe); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_12_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_OnlineStats(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p = (struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o; + if (p->samples_f) { + e = (*v)(p->samples_f, a); if (e) return e; } - if (p->__pyx_v_word) { - e = (*v)(p->__pyx_v_word, a); if (e) return e; + if (p->phrases_f) { + e = (*v)(p->phrases_f, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; + if (p->phrases_e) { + e = (*v)(p->phrases_e, a); if (e) return e; + } + if (p->phrases_fe) { + e = (*v)(p->phrases_fe, a); if (e) return e; + } + if (p->phrases_al) { + e = (*v)(p->phrases_al, a); if (e) return e; + } + if (p->bilex_f) { + e = (*v)(p->bilex_f, a); if (e) return e; + } + if (p->bilex_e) { + e = (*v)(p->bilex_e, a); if (e) return e; + } + if (p->bilex_fe) { + e = (*v)(p->bilex_fe, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_12_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_OnlineStats(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p = (struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->samples_f); + p->samples_f = 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); + tmp = ((PyObject*)p->phrases_f); + p->phrases_f = 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->phrases_e); + p->phrases_e = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->phrases_fe); + p->phrases_fe = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->phrases_al); + p->phrases_al = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->bilex_f); + p->bilex_f = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->bilex_e); + p->bilex_e = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->bilex_fe); + p->bilex_fe = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_12_genexpr[] = { +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_samples_f(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_samples_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_OnlineStats[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_12_genexpr = { +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_OnlineStats[] = { + {(char *)"samples_f", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_samples_f, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_samples_f, 0, 0}, + {(char *)"phrases_f", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f, 0, 0}, + {(char *)"phrases_e", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e, 0, 0}, + {(char *)"phrases_fe", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe, 0, 0}, + {(char *)"phrases_al", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al, 0, 0}, + {(char *)"bilex_f", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f, 0, 0}, + {(char *)"bilex_e", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e, 0, 0}, + {(char *)"bilex_fe", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_OnlineStats = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_12_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_12_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.OnlineStats"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_12_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_OnlineStats, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -68662,17 +68617,17 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_12_genexpr = { 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_3_sa___pyx_scope_struct_12_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_12_genexpr, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_OnlineStats, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_OnlineStats, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_12_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_OnlineStats, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_4cdec_2sa_3_sa_OnlineStats, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -68680,7 +68635,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_12_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_12_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_OnlineStats, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -68693,82 +68648,91 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_12_genexpr = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList __pyx_vtable_4cdec_2sa_3_sa_IntList; -static struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_29_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_29_genexpr = 0; - -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_29_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_IntList(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_IntList *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_29_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_29_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_29_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_IntList; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_7IntList_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_feat = 0; - p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_29_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_29_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_3_sa___pyx_scope_struct_29_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_29_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_29_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_IntList(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_7IntList_15__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_2sa_3_sa_IntList(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_3_sa___pyx_scope_struct_29_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_3_sa___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_feat) { - e = (*v)(p->__pyx_v_feat, a); if (e) return e; +static int __pyx_mp_ass_subscript_4cdec_2sa_3_sa_IntList(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_7IntList_22__setitem__(o, i, v); } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); + return -1; } - return 0; -} - -static int __pyx_tp_clear_3_sa___pyx_scope_struct_29_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_28___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_3_sa___pyx_scope_struct_29_genexpr[] = { +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_29_genexpr = { +static PySequenceMethods __pyx_tp_as_sequence_IntList = { + __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4cdec_2sa_3_sa_IntList, /*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_IntList = { + __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__, /*mp_length*/ + __pyx_pw_4cdec_2sa_3_sa_7IntList_20__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_4cdec_2sa_3_sa_IntList, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_IntList = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_29_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_29_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.IntList"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_IntList), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_29_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_IntList, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -68779,23 +68743,23 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_29_genexpr = { #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ + &__pyx_tp_as_sequence_IntList, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IntList, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_pw_4cdec_2sa_3_sa_7IntList_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_3_sa___pyx_scope_struct_29_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_29_genexpr, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ + __pyx_pw_4cdec_2sa_3_sa_7IntList_17__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_29_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_IntList, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -68805,7 +68769,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_29_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_29_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_IntList, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -68818,34 +68782,34 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_29_genexpr = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_IntList __pyx_vtable_3_sa_IntList; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase __pyx_vtable_4cdec_2sa_3_sa_Phrase; -static PyObject *__pyx_tp_new_3_sa_IntList(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_IntList *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Phrase(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_IntList *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_IntList; - if (unlikely(__pyx_pw_3_sa_7IntList_1__cinit__(o, a, k) < 0)) { + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Phrase; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_6Phrase_1__cinit__(o, a, k) < 0)) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_3_sa_IntList(PyObject *o) { +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Phrase(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_3_sa_7IntList_15__dealloc__(o); + __pyx_pw_4cdec_2sa_3_sa_6Phrase_3__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_3_sa_IntList(PyObject *o, Py_ssize_t i) { +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; r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); @@ -68853,36 +68817,32 @@ static PyObject *__pyx_sq_item_3_sa_IntList(PyObject *o, Py_ssize_t i) { return r; } -static int __pyx_mp_ass_subscript_3_sa_IntList(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_3_sa_7IntList_22__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_2sa_3_sa_6Phrase_words(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_6Phrase_5words_1__get__(o); } -static PyMethodDef __pyx_methods_3_sa_IntList[] = { - {__Pyx_NAMESTR("index"), (PyCFunction)__pyx_pw_3_sa_7IntList_5index, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("partition"), (PyCFunction)__pyx_pw_3_sa_7IntList_7partition, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_doquicksort"), (PyCFunction)__pyx_pw_3_sa_7IntList_9_doquicksort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("sort"), (PyCFunction)__pyx_pw_3_sa_7IntList_11sort, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pw_3_sa_7IntList_13reset, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pw_3_sa_7IntList_26get_size, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_3_sa_7IntList_28append, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("extend"), (PyCFunction)__pyx_pw_3_sa_7IntList_30extend, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_3_sa_7IntList_32write, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_3_sa_7IntList_34read, METH_O, __Pyx_DOCSTR(0)}, +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)}, {0, 0, 0, 0} }; -static PySequenceMethods __pyx_tp_as_sequence_IntList = { - __pyx_pw_3_sa_7IntList_24__len__, /*sq_length*/ +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Phrase[] = { + {(char *)"words", __pyx_getprop_4cdec_2sa_3_sa_6Phrase_words, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_Phrase = { + __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ - __pyx_sq_item_3_sa_IntList, /*sq_item*/ + __pyx_sq_item_4cdec_2sa_3_sa_Phrase, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ @@ -68891,33 +68851,33 @@ static PySequenceMethods __pyx_tp_as_sequence_IntList = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_IntList = { - __pyx_pw_3_sa_7IntList_24__len__, /*mp_length*/ - __pyx_pw_3_sa_7IntList_20__getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_3_sa_IntList, /*mp_ass_subscript*/ +static PyMappingMethods __pyx_tp_as_mapping_Phrase = { + __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__, /*mp_length*/ + __pyx_pw_4cdec_2sa_3_sa_6Phrase_27__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ }; -static PyTypeObject __pyx_type_3_sa_IntList = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Phrase = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.IntList"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_IntList), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.Phrase"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Phrase), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_IntList, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_Phrase, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ + __pyx_pw_4cdec_2sa_3_sa_6Phrase_21__cmp__, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_IntList, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_IntList, /*tp_as_mapping*/ - 0, /*tp_hash*/ + &__pyx_tp_as_sequence_Phrase, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Phrase, /*tp_as_mapping*/ + __pyx_pw_4cdec_2sa_3_sa_6Phrase_23__hash__, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_3_sa_7IntList_3__str__, /*tp_str*/ + __pyx_pw_4cdec_2sa_3_sa_6Phrase_5__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ @@ -68927,11 +68887,11 @@ static PyTypeObject __pyx_type_3_sa_IntList = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_3_sa_7IntList_17__iter__, /*tp_iter*/ + __pyx_pw_4cdec_2sa_3_sa_6Phrase_29__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_IntList, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_Phrase, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_4cdec_2sa_3_sa_Phrase, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -68939,7 +68899,7 @@ static PyTypeObject __pyx_type_3_sa_IntList = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_IntList, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_Phrase, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -68953,28 +68913,72 @@ static PyTypeObject __pyx_type_3_sa_IntList = { #endif }; -static PyObject *__pyx_tp_new_3_sa_VEBIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o); + p->children = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_8TrieNode_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } return o; } -static void __pyx_tp_dealloc_3_sa_VEBIterator(PyObject *o) { +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieNode(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->children); (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_3_sa_VEBIterator[] = { - {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_3_sa_11VEBIterator_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, +static int __pyx_tp_traverse_4cdec_2sa_3_sa_TrieNode(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o; + if (p->children) { + e = (*v)(p->children, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_TrieNode(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o; + PyObject* tmp; + tmp = ((PyObject*)p->children); + p->children = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_8TrieNode_children(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_8TrieNode_children(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_TrieNode[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_VEBIterator = { +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_TrieNode[] = { + {(char *)"children", __pyx_getprop_4cdec_2sa_3_sa_8TrieNode_children, __pyx_setprop_4cdec_2sa_3_sa_8TrieNode_children, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieNode = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.VEBIterator"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_VEBIterator), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.TrieNode"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_VEBIterator, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieNode, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -68993,17 +68997,17 @@ static PyTypeObject __pyx_type_3_sa_VEBIterator = { 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_TrieNode, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_TrieNode, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ - __pyx_pw_3_sa_11VEBIterator_1__next__, /*tp_iternext*/ - __pyx_methods_3_sa_VEBIterator, /*tp_methods*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_TrieNode, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_4cdec_2sa_3_sa_TrieNode, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -69011,7 +69015,7 @@ static PyTypeObject __pyx_type_3_sa_VEBIterator = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_VEBIterator, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_TrieNode, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -69024,121 +69028,82 @@ static PyTypeObject __pyx_type_3_sa_VEBIterator = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_BiLex __pyx_vtable_3_sa_BiLex; -static PyObject *__pyx_tp_new_3_sa_BiLex(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_BiLex *p; +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_BiLex *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_BiLex; - p->col1 = ((struct __pyx_obj_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - p->col2 = ((struct __pyx_obj_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - p->f_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->e_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->id2eword = Py_None; Py_INCREF(Py_None); - p->id2fword = Py_None; Py_INCREF(Py_None); - p->eword2id = Py_None; Py_INCREF(Py_None); - p->fword2id = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_5BiLex_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_2_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_line = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa_BiLex(PyObject *o) { - struct __pyx_obj_3_sa_BiLex *p = (struct __pyx_obj_3_sa_BiLex *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->col1); - Py_CLEAR(p->col2); - Py_CLEAR(p->f_index); - Py_CLEAR(p->e_index); - Py_CLEAR(p->id2eword); - Py_CLEAR(p->id2fword); - Py_CLEAR(p->eword2id); - Py_CLEAR(p->fword2id); - (*Py_TYPE(o)->tp_free)(o); + 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))) { + __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); + } } -static int __pyx_tp_traverse_3_sa_BiLex(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_BiLex *p = (struct __pyx_obj_3_sa_BiLex *)o; - if (p->col1) { - e = (*v)(((PyObject*)p->col1), a); if (e) return e; - } - if (p->col2) { - e = (*v)(((PyObject*)p->col2), a); if (e) return e; - } - if (p->f_index) { - e = (*v)(((PyObject*)p->f_index), a); if (e) return e; - } - if (p->e_index) { - e = (*v)(((PyObject*)p->e_index), a); if (e) return e; - } - if (p->id2eword) { - e = (*v)(p->id2eword, a); if (e) return e; - } - if (p->id2fword) { - e = (*v)(p->id2fword, a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - if (p->eword2id) { - e = (*v)(p->eword2id, a); if (e) return e; + if (p->__pyx_v_line) { + e = (*v)(p->__pyx_v_line, a); if (e) return e; } - if (p->fword2id) { - e = (*v)(p->fword2id, 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_3_sa_BiLex(PyObject *o) { - struct __pyx_obj_3_sa_BiLex *p = (struct __pyx_obj_3_sa_BiLex *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)o; PyObject* tmp; - tmp = ((PyObject*)p->col1); - p->col1 = ((struct __pyx_obj_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->col2); - p->col2 = ((struct __pyx_obj_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->f_index); - p->f_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->e_index); - p->e_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->id2eword); - p->id2eword = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->id2fword); - p->id2fword = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->eword2id); - p->eword2id = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_line); + p->__pyx_v_line = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->fword2id); - p->fword2id = 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_3_sa_BiLex[] = { - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_5BiLex_3write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_5BiLex_5read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_e_id"), (PyCFunction)__pyx_pw_3_sa_5BiLex_7get_e_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_f_id"), (PyCFunction)__pyx_pw_3_sa_5BiLex_9get_f_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_3_sa_5BiLex_11read_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_3_sa_5BiLex_13write_enhanced, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_score"), (PyCFunction)__pyx_pw_3_sa_5BiLex_15get_score, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_3_sa_5BiLex_17write_text, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_5BiLex_16write_text)}, +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_BiLex = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.BiLex"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_BiLex), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa_BiLex, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -69157,15 +69122,15 @@ static PyTypeObject __pyx_type_3_sa_BiLex = { 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_3_sa_BiLex, /*tp_traverse*/ - __pyx_tp_clear_3_sa_BiLex, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_BiLex, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -69175,7 +69140,7 @@ static PyTypeObject __pyx_type_3_sa_BiLex = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_BiLex, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -69188,65 +69153,66 @@ static PyTypeObject __pyx_type_3_sa_BiLex = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_VEB __pyx_vtable_3_sa_VEB; -static PyObject *__pyx_tp_new_3_sa_VEB(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_VEB *p; +static 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[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_VEB *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_VEB; - if (unlikely(__pyx_pw_3_sa_3VEB_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_1_read_bitext *)o); + p->__pyx_v_fp = 0; return o; } -static void __pyx_tp_dealloc_3_sa_VEB(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_3_sa_3VEB_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { + 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))) { + __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); } - (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_3_sa_VEB[] = { - {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_3_sa_3VEB_7insert, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("findsucc"), (PyCFunction)__pyx_pw_3_sa_3VEB_9findsucc, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o, visitproc v, void *a) { + int e; + 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; + if (p->__pyx_v_fp) { + e = (*v)(p->__pyx_v_fp, a); if (e) return e; + } + return 0; +} -static PySequenceMethods __pyx_tp_as_sequence_VEB = { - __pyx_pw_3_sa_3VEB_11__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - __pyx_pw_3_sa_3VEB_13__contains__, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { + 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* tmp; + tmp = ((PyObject*)p->__pyx_v_fp); + p->__pyx_v_fp = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} -static PyMappingMethods __pyx_tp_as_mapping_VEB = { - __pyx_pw_3_sa_3VEB_11__len__, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext[] = { + {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_VEB = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.VEB"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_VEB), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa_VEB, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -69257,23 +69223,23 @@ static PyTypeObject __pyx_type_3_sa_VEB = { #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_VEB, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_VEB, /*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_2sa_3_sa___pyx_scope_struct_1_read_bitext, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_3_sa_3VEB_5__iter__, /*tp_iter*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_VEB, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -69283,7 +69249,7 @@ static PyTypeObject __pyx_type_3_sa_VEB = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_VEB, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -69297,65 +69263,81 @@ static PyTypeObject __pyx_type_3_sa_VEB = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *__pyx_freelist_3_sa___pyx_scope_struct_11_encode_words[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_11_encode_words = 0; +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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_11_encode_words(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_11_encode_words > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_11_encode_words[--__pyx_freecount_3_sa___pyx_scope_struct_11_encode_words]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words)); + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *)o); - p->__pyx_v_words = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_feat = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_11_encode_words(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *p = (struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *)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; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_words); - if ((__pyx_freecount_3_sa___pyx_scope_struct_11_encode_words < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words))) { - __pyx_freelist_3_sa___pyx_scope_struct_11_encode_words[__pyx_freecount_3_sa___pyx_scope_struct_11_encode_words++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *)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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_11_encode_words(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *p = (struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *)o; - if (p->__pyx_v_words) { - e = (*v)(p->__pyx_v_words, a); if (e) return 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; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_feat) { + e = (*v)(p->__pyx_v_feat, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_11_encode_words(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *p = (struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_words); - p->__pyx_v_words = Py_None; Py_INCREF(Py_None); + 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); + 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_3_sa___pyx_scope_struct_11_encode_words[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_11_encode_words = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_11_encode_words"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_11_encode_words), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_11_encode_words, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -69376,13 +69358,13 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_11_encode_words = { 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_3_sa___pyx_scope_struct_11_encode_words, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_11_encode_words, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_11_encode_words, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -69392,7 +69374,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_11_encode_words = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_11_encode_words, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -69406,63 +69388,97 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_11_encode_words = { #endif }; -static PyObject *__pyx_tp_new_3_sa_LCP(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_LCP *p; +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 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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_LCP *)o); - p->sa = ((struct __pyx_obj_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); - p->lcp = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_3LCP_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; + 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)); + 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_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *)o); + p->__pyx_v_extract = 0; + p->__pyx_v_f_len = 0; + p->__pyx_v_f_words = 0; + p->__pyx_v_phrases = 0; + p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa_LCP(PyObject *o) { - struct __pyx_obj_3_sa_LCP *p = (struct __pyx_obj_3_sa_LCP *)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; PyObject_GC_UnTrack(o); - Py_CLEAR(p->sa); - Py_CLEAR(p->lcp); - (*Py_TYPE(o)->tp_free)(o); + Py_CLEAR(p->__pyx_v_extract); + Py_CLEAR(p->__pyx_v_f_len); + 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); + } else { + (*Py_TYPE(o)->tp_free)(o); + } } -static int __pyx_tp_traverse_3_sa_LCP(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_LCP *p = (struct __pyx_obj_3_sa_LCP *)o; - if (p->sa) { - e = (*v)(((PyObject*)p->sa), a); if (e) return 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; + if (p->__pyx_v_extract) { + e = (*v)(p->__pyx_v_extract, a); if (e) return e; } - if (p->lcp) { - e = (*v)(((PyObject*)p->lcp), a); if (e) return e; + if (p->__pyx_v_f_len) { + e = (*v)(p->__pyx_v_f_len, a); if (e) return e; + } + if (p->__pyx_v_f_words) { + e = (*v)(p->__pyx_v_f_words, a); if (e) return e; + } + if (p->__pyx_v_phrases) { + e = (*v)(p->__pyx_v_phrases, 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_3_sa_LCP(PyObject *o) { - struct __pyx_obj_3_sa_LCP *p = (struct __pyx_obj_3_sa_LCP *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->sa); - p->sa = ((struct __pyx_obj_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_extract); + p->__pyx_v_extract = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->lcp); - p->lcp = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_f_len); + p->__pyx_v_f_len = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_f_words); + p->__pyx_v_f_words = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_phrases); + p->__pyx_v_phrases = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa_LCP[] = { - {__Pyx_NAMESTR("compute_stats"), (PyCFunction)__pyx_pw_3_sa_3LCP_3compute_stats, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_3LCP_2compute_stats)}, +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_LCP = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.LCP"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_LCP), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_LCP, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -69481,15 +69497,15 @@ static PyTypeObject __pyx_type_3_sa_LCP = { 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_3_sa_LCP, /*tp_traverse*/ - __pyx_tp_clear_3_sa_LCP, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_LCP, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -69499,7 +69515,7 @@ static PyTypeObject __pyx_type_3_sa_LCP = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_LCP, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -69512,201 +69528,119 @@ static PyTypeObject __pyx_type_3_sa_LCP = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_DataArray __pyx_vtable_3_sa_DataArray; -static PyObject *__pyx_tp_new_3_sa_DataArray(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_DataArray *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_ExtendedTrieNode(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p; + PyObject *o = __pyx_tp_new_4cdec_2sa_3_sa_TrieNode(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_DataArray *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_DataArray; - p->word2id = Py_None; Py_INCREF(Py_None); - p->id2word = Py_None; Py_INCREF(Py_None); - p->data = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->sent_id = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->sent_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_9DataArray_1__cinit__(o, a, k) < 0)) { + p = ((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o); + p->phrase = Py_None; Py_INCREF(Py_None); + p->phrase_location = Py_None; Py_INCREF(Py_None); + p->suffix_link = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_1__cinit__(o, a, k) < 0)) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_3_sa_DataArray(PyObject *o) { - struct __pyx_obj_3_sa_DataArray *p = (struct __pyx_obj_3_sa_DataArray *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_ExtendedTrieNode(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->word2id); - Py_CLEAR(p->id2word); - Py_CLEAR(p->data); - Py_CLEAR(p->sent_id); - Py_CLEAR(p->sent_index); - (*Py_TYPE(o)->tp_free)(o); + Py_CLEAR(p->phrase); + Py_CLEAR(p->phrase_location); + Py_CLEAR(p->suffix_link); + PyObject_GC_Track(o); + __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieNode(o); } -static int __pyx_tp_traverse_3_sa_DataArray(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_ExtendedTrieNode(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_DataArray *p = (struct __pyx_obj_3_sa_DataArray *)o; - if (p->word2id) { - e = (*v)(p->word2id, a); if (e) return e; - } - if (p->id2word) { - e = (*v)(p->id2word, a); if (e) return e; - } - if (p->data) { - e = (*v)(((PyObject*)p->data), a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o; + e = __pyx_tp_traverse_4cdec_2sa_3_sa_TrieNode(o, v, a); if (e) return e; + if (p->phrase) { + e = (*v)(p->phrase, a); if (e) return e; } - if (p->sent_id) { - e = (*v)(((PyObject*)p->sent_id), a); if (e) return e; + if (p->phrase_location) { + e = (*v)(p->phrase_location, a); if (e) return e; } - if (p->sent_index) { - e = (*v)(((PyObject*)p->sent_index), a); if (e) return e; + if (p->suffix_link) { + e = (*v)(p->suffix_link, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa_DataArray(PyObject *o) { - struct __pyx_obj_3_sa_DataArray *p = (struct __pyx_obj_3_sa_DataArray *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_ExtendedTrieNode(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o; PyObject* tmp; - tmp = ((PyObject*)p->word2id); - p->word2id = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->id2word); - p->id2word = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->data); - p->data = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + __pyx_tp_clear_4cdec_2sa_3_sa_TrieNode(o); + tmp = ((PyObject*)p->phrase); + p->phrase = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->sent_id); - p->sent_id = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->phrase_location); + p->phrase_location = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->sent_index); - p->sent_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->suffix_link); + p->suffix_link = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyObject *__pyx_sq_item_3_sa_DataArray(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_3_sa_9DataArray_word2id(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_9DataArray_7word2id_1__get__(o); -} - -static int __pyx_setprop_3_sa_9DataArray_word2id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3_sa_9DataArray_7word2id_3__set__(o, v); - } - else { - return __pyx_pw_3_sa_9DataArray_7word2id_5__del__(o); - } -} -static PyObject *__pyx_getprop_3_sa_9DataArray_id2word(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_9DataArray_7id2word_1__get__(o); +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_1__get__(o); } -static int __pyx_setprop_3_sa_9DataArray_id2word(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { +static int __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_3_sa_9DataArray_7id2word_3__set__(o, v); + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_3__set__(o, v); } else { - return __pyx_pw_3_sa_9DataArray_7id2word_5__del__(o); + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_5__del__(o); } } -static PyObject *__pyx_getprop_3_sa_9DataArray_data(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_9DataArray_4data_1__get__(o); +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(o); } -static int __pyx_setprop_3_sa_9DataArray_data(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { +static int __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_3_sa_9DataArray_4data_3__set__(o, v); + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(o, v); } else { - return __pyx_pw_3_sa_9DataArray_4data_5__del__(o); + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(o); } } -static PyObject *__pyx_getprop_3_sa_9DataArray_sent_id(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_9DataArray_7sent_id_1__get__(o); +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(o); } -static int __pyx_setprop_3_sa_9DataArray_sent_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { +static int __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_3_sa_9DataArray_7sent_id_3__set__(o, v); + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(o, v); } else { - return __pyx_pw_3_sa_9DataArray_7sent_id_5__del__(o); + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(o); } } -static PyObject *__pyx_getprop_3_sa_9DataArray_sent_index(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_9DataArray_10sent_index_1__get__(o); -} - -static int __pyx_setprop_3_sa_9DataArray_sent_index(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3_sa_9DataArray_10sent_index_3__set__(o, v); - } - else { - return __pyx_pw_3_sa_9DataArray_10sent_index_5__del__(o); - } -} - -static PyMethodDef __pyx_methods_3_sa_DataArray[] = { - {__Pyx_NAMESTR("get_sentence_id"), (PyCFunction)__pyx_pw_3_sa_9DataArray_5get_sentence_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_sentence"), (PyCFunction)__pyx_pw_3_sa_9DataArray_7get_sentence, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_id"), (PyCFunction)__pyx_pw_3_sa_9DataArray_9get_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_sentence_bounds"), (PyCFunction)__pyx_pw_3_sa_9DataArray_13get_sentence_bounds, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_3_sa_9DataArray_15write_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_3_sa_9DataArray_17read_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_bitext"), (PyCFunction)__pyx_pw_3_sa_9DataArray_19read_bitext, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text_data"), (PyCFunction)__pyx_pw_3_sa_9DataArray_21read_text_data, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_9DataArray_23read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_9DataArray_25write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced_handle"), (PyCFunction)__pyx_pw_3_sa_9DataArray_27write_enhanced_handle, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_3_sa_9DataArray_29write_enhanced, METH_O, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_ExtendedTrieNode[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_3_sa_DataArray[] = { - {(char *)"word2id", __pyx_getprop_3_sa_9DataArray_word2id, __pyx_setprop_3_sa_9DataArray_word2id, 0, 0}, - {(char *)"id2word", __pyx_getprop_3_sa_9DataArray_id2word, __pyx_setprop_3_sa_9DataArray_id2word, 0, 0}, - {(char *)"data", __pyx_getprop_3_sa_9DataArray_data, __pyx_setprop_3_sa_9DataArray_data, 0, 0}, - {(char *)"sent_id", __pyx_getprop_3_sa_9DataArray_sent_id, __pyx_setprop_3_sa_9DataArray_sent_id, 0, 0}, - {(char *)"sent_index", __pyx_getprop_3_sa_9DataArray_sent_index, __pyx_setprop_3_sa_9DataArray_sent_index, 0, 0}, +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_ExtendedTrieNode[] = { + {(char *)"phrase", __pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase, __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase, 0, 0}, + {(char *)"phrase_location", __pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location, __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location, 0, 0}, + {(char *)"suffix_link", __pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link, __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link, 0, 0}, {0, 0, 0, 0, 0} }; -static PySequenceMethods __pyx_tp_as_sequence_DataArray = { - __pyx_pw_3_sa_9DataArray_3__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_3_sa_DataArray, /*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_DataArray = { - __pyx_pw_3_sa_9DataArray_3__len__, /*mp_length*/ - __pyx_pw_3_sa_9DataArray_11__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_3_sa_DataArray = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.DataArray"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_DataArray), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.ExtendedTrieNode"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_DataArray, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -69717,8 +69651,8 @@ static PyTypeObject __pyx_type_3_sa_DataArray = { #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_DataArray, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_DataArray, /*tp_as_mapping*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ @@ -69727,15 +69661,15 @@ static PyTypeObject __pyx_type_3_sa_DataArray = { 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_3_sa_DataArray, /*tp_traverse*/ - __pyx_tp_clear_3_sa_DataArray, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_DataArray, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_3_sa_DataArray, /*tp_getset*/ + __pyx_getsets_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -69743,7 +69677,7 @@ static PyTypeObject __pyx_type_3_sa_DataArray = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_DataArray, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -69756,29 +69690,73 @@ static PyTypeObject __pyx_type_3_sa_DataArray = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment __pyx_vtable_4cdec_2sa_3_sa_Alignment; -static PyObject *__pyx_tp_new_3_sa_BitSetIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Alignment(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Alignment; + p->links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9Alignment_5__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } return o; } -static void __pyx_tp_dealloc_3_sa_BitSetIterator(PyObject *o) { +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Alignment(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->links); + Py_CLEAR(p->sent_index); (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_3_sa_BitSetIterator[] = { - {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pw_3_sa_14BitSetIterator_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Alignment(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o; + if (p->links) { + e = (*v)(((PyObject*)p->links), a); if (e) return e; + } + if (p->sent_index) { + e = (*v)(((PyObject*)p->sent_index), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_Alignment(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o; + PyObject* tmp; + tmp = ((PyObject*)p->links); + p->links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sent_index); + p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_BitSetIterator = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Alignment = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.BitSetIterator"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_BitSetIterator), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.Alignment"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Alignment), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_BitSetIterator, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_Alignment, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -69797,15 +69775,15 @@ static PyTypeObject __pyx_type_3_sa_BitSetIterator = { 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_Alignment, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Alignment, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ - __pyx_pw_3_sa_14BitSetIterator_1__next__, /*tp_iternext*/ - __pyx_methods_3_sa_BitSetIterator, /*tp_methods*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_Alignment, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -69815,7 +69793,7 @@ static PyTypeObject __pyx_type_3_sa_BitSetIterator = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_BitSetIterator, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_Alignment, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -69829,200 +69807,529 @@ static PyTypeObject __pyx_type_3_sa_BitSetIterator = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_23_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_23_genexpr = 0; +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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_23_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_23_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_23_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_23_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr)); + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_i = 0; - p->__pyx_v_j = 0; - p->__pyx_t_0 = 0; - return o; -} - -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_23_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_23_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_3_sa___pyx_scope_struct_23_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_23_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_23_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *)o); + p->__pyx_v_alignment = 0; + p->__pyx_v_als = 0; + p->__pyx_v_alslist = 0; + p->__pyx_v_chunklen = 0; + p->__pyx_v_count = 0; + p->__pyx_v_ctx_name = 0; + p->__pyx_v_e = 0; + p->__pyx_v_elist = 0; + p->__pyx_v_extract = 0; + p->__pyx_v_extract_start = 0; + p->__pyx_v_extract_stop = 0; + p->__pyx_v_extracts = 0; + p->__pyx_v_f = 0; + p->__pyx_v_f_syms = 0; + p->__pyx_v_fcount = 0; + p->__pyx_v_fphrases = 0; + p->__pyx_v_frontier = 0; + p->__pyx_v_frontier_nodes = 0; + p->__pyx_v_fwords = 0; + p->__pyx_v_genexpr = 0; + p->__pyx_v_hiero_phrase = 0; + p->__pyx_v_input_match = 0; + p->__pyx_v_intersect_start_time = 0; + p->__pyx_v_intersect_stop_time = 0; + p->__pyx_v_is_shadow_path = 0; + p->__pyx_v_key = 0; + p->__pyx_v_lex_i = 0; + p->__pyx_v_lex_j = 0; + p->__pyx_v_loc = 0; + p->__pyx_v_locs = 0; + p->__pyx_v_max_locs = 0; + p->__pyx_v_meta = 0; + p->__pyx_v_new_frontier = 0; + p->__pyx_v_new_node = 0; + p->__pyx_v_next_states = 0; + p->__pyx_v_node = 0; + p->__pyx_v_nodes_isteps_away_buffer = 0; + p->__pyx_v_pathlen = 0; + p->__pyx_v_phrase = 0; + p->__pyx_v_phrase_location = 0; + p->__pyx_v_prefix = 0; + p->__pyx_v_reachable_buffer = 0; + p->__pyx_v_sa_range = 0; + p->__pyx_v_sample = 0; + p->__pyx_v_scores = 0; + p->__pyx_v_seen_phrases = 0; + p->__pyx_v_self = 0; + p->__pyx_v_spanlen = 0; + p->__pyx_v_stats = 0; + p->__pyx_v_stop_time = 0; + p->__pyx_v_suffix_link = 0; + p->__pyx_v_suffix_link_xcat_index = 0; + p->__pyx_v_word_id = 0; + p->__pyx_v_xcat_index = 0; + p->__pyx_v_xnode = 0; + p->__pyx_v_xroot = 0; + p->__pyx_t_3 = 0; + p->__pyx_t_4 = 0; + p->__pyx_t_5 = 0; + 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; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_alignment); + Py_CLEAR(p->__pyx_v_als); + Py_CLEAR(p->__pyx_v_alslist); + Py_CLEAR(p->__pyx_v_chunklen); + Py_CLEAR(p->__pyx_v_count); + Py_CLEAR(p->__pyx_v_ctx_name); + Py_CLEAR(p->__pyx_v_e); + Py_CLEAR(p->__pyx_v_elist); + Py_CLEAR(p->__pyx_v_extract); + Py_CLEAR(p->__pyx_v_extract_start); + Py_CLEAR(p->__pyx_v_extract_stop); + Py_CLEAR(p->__pyx_v_extracts); + Py_CLEAR(p->__pyx_v_f); + Py_CLEAR(p->__pyx_v_f_syms); + Py_CLEAR(p->__pyx_v_fcount); + Py_CLEAR(p->__pyx_v_fphrases); + Py_CLEAR(p->__pyx_v_frontier); + Py_CLEAR(p->__pyx_v_frontier_nodes); + Py_CLEAR(p->__pyx_v_fwords); + Py_CLEAR(p->__pyx_v_genexpr); + Py_CLEAR(p->__pyx_v_hiero_phrase); + Py_CLEAR(p->__pyx_v_input_match); + Py_CLEAR(p->__pyx_v_intersect_start_time); + Py_CLEAR(p->__pyx_v_intersect_stop_time); + Py_CLEAR(p->__pyx_v_is_shadow_path); + Py_CLEAR(p->__pyx_v_key); + Py_CLEAR(p->__pyx_v_lex_i); + Py_CLEAR(p->__pyx_v_lex_j); + Py_CLEAR(p->__pyx_v_loc); + Py_CLEAR(p->__pyx_v_locs); + Py_CLEAR(p->__pyx_v_max_locs); + Py_CLEAR(p->__pyx_v_meta); + Py_CLEAR(p->__pyx_v_new_frontier); + Py_CLEAR(p->__pyx_v_new_node); + Py_CLEAR(p->__pyx_v_next_states); + Py_CLEAR(p->__pyx_v_node); + Py_CLEAR(p->__pyx_v_nodes_isteps_away_buffer); + Py_CLEAR(p->__pyx_v_pathlen); + Py_CLEAR(p->__pyx_v_phrase); + Py_CLEAR(p->__pyx_v_phrase_location); + Py_CLEAR(p->__pyx_v_prefix); + Py_CLEAR(p->__pyx_v_reachable_buffer); + Py_CLEAR(p->__pyx_v_sa_range); + Py_CLEAR(p->__pyx_v_sample); + Py_CLEAR(p->__pyx_v_scores); + Py_CLEAR(p->__pyx_v_seen_phrases); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_spanlen); + Py_CLEAR(p->__pyx_v_stats); + Py_CLEAR(p->__pyx_v_stop_time); + Py_CLEAR(p->__pyx_v_suffix_link); + Py_CLEAR(p->__pyx_v_suffix_link_xcat_index); + Py_CLEAR(p->__pyx_v_word_id); + 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_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); + } 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) { + 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; + if (p->__pyx_v_alignment) { + e = (*v)(p->__pyx_v_alignment, a); if (e) return e; + } + if (p->__pyx_v_als) { + e = (*v)(p->__pyx_v_als, a); if (e) return e; + } + if (p->__pyx_v_alslist) { + e = (*v)(p->__pyx_v_alslist, a); if (e) return e; + } + if (p->__pyx_v_chunklen) { + e = (*v)(((PyObject*)p->__pyx_v_chunklen), a); if (e) return e; + } + if (p->__pyx_v_count) { + e = (*v)(p->__pyx_v_count, a); if (e) return e; + } + if (p->__pyx_v_ctx_name) { + e = (*v)(p->__pyx_v_ctx_name, a); if (e) return e; + } + if (p->__pyx_v_e) { + e = (*v)(p->__pyx_v_e, a); if (e) return e; + } + if (p->__pyx_v_elist) { + e = (*v)(p->__pyx_v_elist, a); if (e) return e; + } + if (p->__pyx_v_extract) { + e = (*v)(p->__pyx_v_extract, a); if (e) return e; + } + if (p->__pyx_v_extract_start) { + e = (*v)(p->__pyx_v_extract_start, a); if (e) return e; + } + if (p->__pyx_v_extract_stop) { + e = (*v)(p->__pyx_v_extract_stop, a); if (e) return e; + } + if (p->__pyx_v_extracts) { + e = (*v)(p->__pyx_v_extracts, a); if (e) return e; + } + if (p->__pyx_v_f) { + e = (*v)(p->__pyx_v_f, a); if (e) return e; + } + if (p->__pyx_v_f_syms) { + e = (*v)(p->__pyx_v_f_syms, a); if (e) return e; + } + if (p->__pyx_v_fcount) { + e = (*v)(p->__pyx_v_fcount, a); if (e) return e; + } + if (p->__pyx_v_fphrases) { + e = (*v)(p->__pyx_v_fphrases, a); if (e) return e; + } + if (p->__pyx_v_frontier) { + e = (*v)(p->__pyx_v_frontier, a); if (e) return e; + } + if (p->__pyx_v_frontier_nodes) { + e = (*v)(p->__pyx_v_frontier_nodes, a); if (e) return e; + } + if (p->__pyx_v_fwords) { + e = (*v)(p->__pyx_v_fwords, a); if (e) return e; + } + if (p->__pyx_v_genexpr) { + e = (*v)(p->__pyx_v_genexpr, a); if (e) return e; + } + if (p->__pyx_v_hiero_phrase) { + e = (*v)(((PyObject*)p->__pyx_v_hiero_phrase), a); if (e) return e; + } + if (p->__pyx_v_input_match) { + e = (*v)(p->__pyx_v_input_match, a); if (e) return e; + } + if (p->__pyx_v_intersect_start_time) { + e = (*v)(p->__pyx_v_intersect_start_time, a); if (e) return e; + } + if (p->__pyx_v_intersect_stop_time) { + e = (*v)(p->__pyx_v_intersect_stop_time, a); if (e) return e; + } + if (p->__pyx_v_is_shadow_path) { + e = (*v)(p->__pyx_v_is_shadow_path, a); if (e) return e; + } + if (p->__pyx_v_key) { + e = (*v)(p->__pyx_v_key, a); if (e) return e; } -} - -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_23_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + if (p->__pyx_v_lex_i) { + e = (*v)(p->__pyx_v_lex_i, 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_lex_j) { + e = (*v)(p->__pyx_v_lex_j, a); if (e) return e; } - if (p->__pyx_v_j) { - e = (*v)(p->__pyx_v_j, a); if (e) return e; + if (p->__pyx_v_loc) { + e = (*v)(p->__pyx_v_loc, 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_locs) { + e = (*v)(p->__pyx_v_locs, a); if (e) return e; + } + if (p->__pyx_v_max_locs) { + e = (*v)(p->__pyx_v_max_locs, a); if (e) return e; + } + if (p->__pyx_v_meta) { + e = (*v)(p->__pyx_v_meta, a); if (e) return e; + } + if (p->__pyx_v_new_frontier) { + e = (*v)(p->__pyx_v_new_frontier, a); if (e) return e; + } + if (p->__pyx_v_new_node) { + e = (*v)(p->__pyx_v_new_node, a); if (e) return e; + } + if (p->__pyx_v_next_states) { + e = (*v)(p->__pyx_v_next_states, a); if (e) return e; + } + if (p->__pyx_v_node) { + e = (*v)(p->__pyx_v_node, a); if (e) return e; + } + if (p->__pyx_v_nodes_isteps_away_buffer) { + e = (*v)(p->__pyx_v_nodes_isteps_away_buffer, a); if (e) return e; + } + if (p->__pyx_v_pathlen) { + e = (*v)(p->__pyx_v_pathlen, a); if (e) return e; + } + if (p->__pyx_v_phrase) { + e = (*v)(p->__pyx_v_phrase, a); if (e) return e; + } + if (p->__pyx_v_phrase_location) { + e = (*v)(((PyObject*)p->__pyx_v_phrase_location), a); if (e) return e; + } + if (p->__pyx_v_prefix) { + e = (*v)(p->__pyx_v_prefix, a); if (e) return e; + } + if (p->__pyx_v_reachable_buffer) { + e = (*v)(p->__pyx_v_reachable_buffer, a); if (e) return e; + } + if (p->__pyx_v_sa_range) { + e = (*v)(p->__pyx_v_sa_range, a); if (e) return e; + } + if (p->__pyx_v_sample) { + e = (*v)(((PyObject*)p->__pyx_v_sample), a); if (e) return e; + } + if (p->__pyx_v_scores) { + e = (*v)(((PyObject*)p->__pyx_v_scores), a); if (e) return e; + } + if (p->__pyx_v_seen_phrases) { + e = (*v)(p->__pyx_v_seen_phrases, 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_spanlen) { + e = (*v)(p->__pyx_v_spanlen, a); if (e) return e; + } + if (p->__pyx_v_stats) { + e = (*v)(p->__pyx_v_stats, a); if (e) return e; + } + if (p->__pyx_v_stop_time) { + e = (*v)(p->__pyx_v_stop_time, a); if (e) return e; + } + if (p->__pyx_v_suffix_link) { + e = (*v)(p->__pyx_v_suffix_link, a); if (e) return e; + } + if (p->__pyx_v_suffix_link_xcat_index) { + e = (*v)(p->__pyx_v_suffix_link_xcat_index, a); if (e) return e; + } + if (p->__pyx_v_word_id) { + e = (*v)(p->__pyx_v_word_id, a); if (e) return e; + } + if (p->__pyx_v_xcat_index) { + e = (*v)(p->__pyx_v_xcat_index, a); if (e) return e; + } + if (p->__pyx_v_xnode) { + e = (*v)(p->__pyx_v_xnode, a); if (e) return e; + } + 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_4) { + e = (*v)(p->__pyx_t_4, a); if (e) return e; + } + if (p->__pyx_t_5) { + e = (*v)(p->__pyx_t_5, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_23_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_alignment); + p->__pyx_v_alignment = 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); + tmp = ((PyObject*)p->__pyx_v_als); + p->__pyx_v_als = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_j); - p->__pyx_v_j = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_alslist); + p->__pyx_v_alslist = 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_chunklen); + p->__pyx_v_chunklen = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_23_genexpr[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_23_genexpr = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_23_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_23_genexpr), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_23_genexpr, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 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_3_sa___pyx_scope_struct_23_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_23_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_23_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_23_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_3_sa_Precomputation __pyx_vtable_3_sa_Precomputation; - -static PyObject *__pyx_tp_new_3_sa_Precomputation(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_Precomputation *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_Precomputation *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_Precomputation; - p->precomputed_index = Py_None; Py_INCREF(Py_None); - p->precomputed_collocations = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_14Precomputation_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_3_sa_Precomputation(PyObject *o) { - struct __pyx_obj_3_sa_Precomputation *p = (struct __pyx_obj_3_sa_Precomputation *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->precomputed_index); - Py_CLEAR(p->precomputed_collocations); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_3_sa_Precomputation(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_3_sa_Precomputation *p = (struct __pyx_obj_3_sa_Precomputation *)o; - if (p->precomputed_index) { - e = (*v)(p->precomputed_index, a); if (e) return e; - } - if (p->precomputed_collocations) { - e = (*v)(p->precomputed_collocations, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_3_sa_Precomputation(PyObject *o) { - struct __pyx_obj_3_sa_Precomputation *p = (struct __pyx_obj_3_sa_Precomputation *)o; - PyObject* tmp; - tmp = ((PyObject*)p->precomputed_index); - p->precomputed_index = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_count); + p->__pyx_v_count = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->precomputed_collocations); - p->precomputed_collocations = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_ctx_name); + p->__pyx_v_ctx_name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_e); + p->__pyx_v_e = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_elist); + p->__pyx_v_elist = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_extract); + p->__pyx_v_extract = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_extract_start); + p->__pyx_v_extract_start = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_extract_stop); + p->__pyx_v_extract_stop = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_extracts); + p->__pyx_v_extracts = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_f); + p->__pyx_v_f = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_f_syms); + p->__pyx_v_f_syms = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_fcount); + p->__pyx_v_fcount = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_fphrases); + p->__pyx_v_fphrases = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_frontier); + p->__pyx_v_frontier = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_frontier_nodes); + p->__pyx_v_frontier_nodes = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_fwords); + p->__pyx_v_fwords = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_genexpr); + p->__pyx_v_genexpr = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_hiero_phrase); + p->__pyx_v_hiero_phrase = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_input_match); + p->__pyx_v_input_match = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_intersect_start_time); + p->__pyx_v_intersect_start_time = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_intersect_stop_time); + p->__pyx_v_intersect_stop_time = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_is_shadow_path); + p->__pyx_v_is_shadow_path = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_key); + p->__pyx_v_key = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_lex_i); + p->__pyx_v_lex_i = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_lex_j); + p->__pyx_v_lex_j = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_loc); + p->__pyx_v_loc = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_locs); + p->__pyx_v_locs = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_max_locs); + p->__pyx_v_max_locs = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_meta); + p->__pyx_v_meta = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_new_frontier); + p->__pyx_v_new_frontier = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_new_node); + p->__pyx_v_new_node = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_next_states); + p->__pyx_v_next_states = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_node); + p->__pyx_v_node = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_nodes_isteps_away_buffer); + p->__pyx_v_nodes_isteps_away_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_pathlen); + p->__pyx_v_pathlen = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_phrase); + p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_phrase_location); + p->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_prefix); + p->__pyx_v_prefix = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_reachable_buffer); + p->__pyx_v_reachable_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sa_range); + p->__pyx_v_sa_range = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sample); + p->__pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_scores); + p->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_seen_phrases); + p->__pyx_v_seen_phrases = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_spanlen); + p->__pyx_v_spanlen = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_stats); + p->__pyx_v_stats = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_stop_time); + p->__pyx_v_stop_time = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_suffix_link); + p->__pyx_v_suffix_link = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_suffix_link_xcat_index); + p->__pyx_v_suffix_link_xcat_index = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_word_id); + p->__pyx_v_word_id = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_xcat_index); + p->__pyx_v_xcat_index = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_xnode); + p->__pyx_v_xnode = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + 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); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_4); + p->__pyx_t_4 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_5); + p->__pyx_t_5 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa_Precomputation[] = { - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_14Precomputation_3read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_14Precomputation_5write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("precompute"), (PyCFunction)__pyx_pw_3_sa_14Precomputation_7precompute, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_19_input[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_Precomputation = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.Precomputation"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_Precomputation), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_Precomputation, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -70041,15 +70348,15 @@ static PyTypeObject __pyx_type_3_sa_Precomputation = { 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_3_sa_Precomputation, /*tp_traverse*/ - __pyx_tp_clear_3_sa_Precomputation, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_Precomputation, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -70059,7 +70366,7 @@ static PyTypeObject __pyx_type_3_sa_Precomputation = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_Precomputation, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -70073,81 +70380,65 @@ static PyTypeObject __pyx_type_3_sa_Precomputation = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *__pyx_freelist_3_sa___pyx_scope_struct_18_alignments[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_18_alignments = 0; +static 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[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words = 0; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_18_alignments(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *p; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_18_alignments > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_18_alignments[--__pyx_freecount_3_sa___pyx_scope_struct_18_alignments]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments)); + 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)))) { + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *)o); - p->__pyx_v_point = 0; - p->__pyx_v_self = 0; - p->__pyx_t_0 = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *)o); + p->__pyx_v_syms = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_18_alignments(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *p = (struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyObject *o) { + 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_point); - Py_CLEAR(p->__pyx_v_self); - Py_CLEAR(p->__pyx_t_0); - if ((__pyx_freecount_3_sa___pyx_scope_struct_18_alignments < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments))) { - __pyx_freelist_3_sa___pyx_scope_struct_18_alignments[__pyx_freecount_3_sa___pyx_scope_struct_18_alignments++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *)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))) { + __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); } } -static int __pyx_tp_traverse_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_13_decode_words(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *p = (struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *)o; - if (p->__pyx_v_point) { - e = (*v)(p->__pyx_v_point, 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_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; + 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; + if (p->__pyx_v_syms) { + e = (*v)(p->__pyx_v_syms, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_18_alignments(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *p = (struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyObject *o) { + 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* tmp; - tmp = ((PyObject*)p->__pyx_v_point); - p->__pyx_v_point = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_Rule *)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_syms); + p->__pyx_v_syms = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_18_alignments[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_18_alignments = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_18_alignments"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_18_alignments), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa___pyx_scope_struct_18_alignments, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -70168,13 +70459,13 @@ static PyTypeObject __pyx_type_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_3_sa___pyx_scope_struct_18_alignments, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_18_alignments, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_18_alignments, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -70184,7 +70475,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_18_alignments = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_18_alignments, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -70198,49 +70489,54 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_18_alignments = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_14_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_14_genexpr = 0; +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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_14_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_14_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_14_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_14_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr)); + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *)o); + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *)o); p->__pyx_outer_scope = 0; - p->__pyx_v_sym = 0; + p->__pyx_v_i = 0; + p->__pyx_v_j = 0; p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_14_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *)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; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_sym); + Py_CLEAR(p->__pyx_v_i); + Py_CLEAR(p->__pyx_v_j); Py_CLEAR(p->__pyx_t_0); - if ((__pyx_freecount_3_sa___pyx_scope_struct_14_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_14_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_14_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_14_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *)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; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - if (p->__pyx_v_sym) { - e = (*v)(p->__pyx_v_sym, 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_j) { + e = (*v)(p->__pyx_v_j, a); if (e) return e; } if (p->__pyx_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; @@ -70248,14 +70544,17 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_14_genexpr(PyObject *o, vis return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_14_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr *)o; +static int __pyx_tp_clear_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; PyObject* tmp; tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *)Py_None); Py_INCREF(Py_None); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_sym); - p->__pyx_v_sym = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_i); + p->__pyx_v_i = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_j); + p->__pyx_v_j = 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); @@ -70263,16 +70562,16 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_14_genexpr(PyObject *o) { return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_14_genexpr[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_14_genexpr = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_14_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_14_genexpr), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_14_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -70293,13 +70592,13 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_14_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_3_sa___pyx_scope_struct_14_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_14_genexpr, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_14_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -70309,7 +70608,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_14_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_14_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -70322,135 +70621,125 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_14_genexpr = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_SuffixArray __pyx_vtable_3_sa_SuffixArray; -static PyObject *__pyx_tp_new_3_sa_SuffixArray(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_SuffixArray *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Rule(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Rule *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_SuffixArray *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_SuffixArray; - p->darray = ((struct __pyx_obj_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - p->sa = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->ha = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_11SuffixArray_1__cinit__(o, a, k) < 0)) { + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o); + p->f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); + p->e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); + p->scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); + p->word_alignments = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(o, a, k) < 0)) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_3_sa_SuffixArray(PyObject *o) { - struct __pyx_obj_3_sa_SuffixArray *p = (struct __pyx_obj_3_sa_SuffixArray *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Rule(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Rule *p = (struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->darray); - Py_CLEAR(p->sa); - Py_CLEAR(p->ha); + Py_CLEAR(p->f); + Py_CLEAR(p->e); + Py_CLEAR(p->scores); + Py_CLEAR(p->word_alignments); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa_SuffixArray(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Rule(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_SuffixArray *p = (struct __pyx_obj_3_sa_SuffixArray *)o; - if (p->darray) { - e = (*v)(((PyObject*)p->darray), a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_Rule *p = (struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o; + if (p->f) { + e = (*v)(((PyObject*)p->f), a); if (e) return e; } - if (p->sa) { - e = (*v)(((PyObject*)p->sa), a); if (e) return e; + if (p->e) { + e = (*v)(((PyObject*)p->e), a); if (e) return e; } - if (p->ha) { - e = (*v)(((PyObject*)p->ha), a); if (e) return e; + if (p->scores) { + e = (*v)(((PyObject*)p->scores), a); if (e) return e; + } + if (p->word_alignments) { + e = (*v)(p->word_alignments, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa_SuffixArray(PyObject *o) { - struct __pyx_obj_3_sa_SuffixArray *p = (struct __pyx_obj_3_sa_SuffixArray *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_Rule(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Rule *p = (struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o; PyObject* tmp; - tmp = ((PyObject*)p->darray); - p->darray = ((struct __pyx_obj_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->f); + p->f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->sa); - p->sa = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->e); + p->e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->ha); - p->ha = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->scores); + p->scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->word_alignments); + p->word_alignments = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyObject *__pyx_sq_item_3_sa_SuffixArray(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_2sa_3_sa_4Rule_f(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_4Rule_1f_1__get__(o); } -static PyMethodDef __pyx_methods_3_sa_SuffixArray[] = { - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_5read_text, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_11SuffixArray_4read_text)}, - {__Pyx_NAMESTR("q3sort"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_7q3sort, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3_sa_11SuffixArray_6q3sort)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_9write_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_11read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_13write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_15write_enhanced, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("lookup"), (PyCFunction)__pyx_pw_3_sa_11SuffixArray_17lookup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_4Rule_e(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_4Rule_1e_1__get__(o); +} -static PySequenceMethods __pyx_tp_as_sequence_SuffixArray = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_3_sa_SuffixArray, /*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 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)}, + {0, 0, 0, 0} }; -static PyMappingMethods __pyx_tp_as_mapping_SuffixArray = { - 0, /*mp_length*/ - __pyx_pw_3_sa_11SuffixArray_3__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Rule[] = { + {(char *)"f", __pyx_getprop_4cdec_2sa_3_sa_4Rule_f, 0, 0, 0}, + {(char *)"e", __pyx_getprop_4cdec_2sa_3_sa_4Rule_e, 0, 0, 0}, + {0, 0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_SuffixArray = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Rule = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.SuffixArray"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_SuffixArray), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.Rule"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Rule), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_SuffixArray, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_Rule, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ + __pyx_pw_4cdec_2sa_3_sa_4Rule_5__cmp__, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_SuffixArray, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_SuffixArray, /*tp_as_mapping*/ - 0, /*tp_hash*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + __pyx_pw_4cdec_2sa_3_sa_4Rule_3__hash__, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_pw_4cdec_2sa_3_sa_4Rule_11__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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa_SuffixArray, /*tp_traverse*/ - __pyx_tp_clear_3_sa_SuffixArray, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_Rule, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Rule, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_SuffixArray, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_Rule, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_4cdec_2sa_3_sa_Rule, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -70458,7 +70747,7 @@ static PyTypeObject __pyx_type_3_sa_SuffixArray = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_SuffixArray, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_Rule, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -70472,65 +70761,81 @@ static PyTypeObject __pyx_type_3_sa_SuffixArray = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *__pyx_freelist_3_sa___pyx_scope_struct_16___str__[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_16___str__ = 0; +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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_16___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_16___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_16___str__)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_16___str__[--__pyx_freecount_3_sa___pyx_scope_struct_16___str__]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_16___str__)); + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *)o); - p->__pyx_v_self = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_word = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_16___str__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *)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; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_3_sa___pyx_scope_struct_16___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_16___str__))) { - __pyx_freelist_3_sa___pyx_scope_struct_16___str__[__pyx_freecount_3_sa___pyx_scope_struct_16___str__++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *)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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_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_20_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return 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; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_word) { + e = (*v)(p->__pyx_v_word, 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_3_sa___pyx_scope_struct_16___str__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_16___str__ *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_Rule *)Py_None); Py_INCREF(Py_None); + 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); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_word); + p->__pyx_v_word = 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_3_sa___pyx_scope_struct_16___str__[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_16___str__ = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_16___str__"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_16___str__), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_16___str__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -70551,13 +70856,13 @@ static PyTypeObject __pyx_type_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_3_sa___pyx_scope_struct_16___str__, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_16___str__, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_16___str__, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -70567,7 +70872,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_16___str__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_16___str__, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -70580,96 +70885,68 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_16___str__ = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_Alphabet __pyx_vtable_3_sa_Alphabet; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation __pyx_vtable_4cdec_2sa_3_sa_Precomputation; -static PyObject *__pyx_tp_new_3_sa_Alphabet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa_Alphabet *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Precomputation(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_Alphabet *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_Alphabet; - p->terminals = ((struct __pyx_obj_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); - p->nonterminals = ((struct __pyx_obj_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); - p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_8Alphabet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Precomputation; + p->precomputed_index = Py_None; Py_INCREF(Py_None); + p->precomputed_collocations = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_14Precomputation_1__cinit__(o, a, k) < 0)) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_3_sa_Alphabet(PyObject *o) { - struct __pyx_obj_3_sa_Alphabet *p = (struct __pyx_obj_3_sa_Alphabet *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Precomputation(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p = (struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o; PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_3_sa_8Alphabet_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->terminals); - Py_CLEAR(p->nonterminals); - Py_CLEAR(p->id2sym); + Py_CLEAR(p->precomputed_index); + Py_CLEAR(p->precomputed_collocations); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa_Alphabet(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Precomputation(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_Alphabet *p = (struct __pyx_obj_3_sa_Alphabet *)o; - if (p->terminals) { - e = (*v)(((PyObject*)p->terminals), a); if (e) return e; - } - if (p->nonterminals) { - e = (*v)(((PyObject*)p->nonterminals), a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p = (struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o; + if (p->precomputed_index) { + e = (*v)(p->precomputed_index, a); if (e) return e; } - if (p->id2sym) { - e = (*v)(p->id2sym, a); if (e) return e; + if (p->precomputed_collocations) { + e = (*v)(p->precomputed_collocations, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa_Alphabet(PyObject *o) { - struct __pyx_obj_3_sa_Alphabet *p = (struct __pyx_obj_3_sa_Alphabet *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_Precomputation(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p = (struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o; PyObject* tmp; - tmp = ((PyObject*)p->terminals); - p->terminals = ((struct __pyx_obj_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->nonterminals); - p->nonterminals = ((struct __pyx_obj_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->precomputed_index); + p->precomputed_index = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->id2sym); - p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->precomputed_collocations); + p->precomputed_collocations = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyObject *__pyx_getprop_3_sa_8Alphabet_terminals(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_8Alphabet_9terminals_1__get__(o); -} - -static PyObject *__pyx_getprop_3_sa_8Alphabet_nonterminals(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_8Alphabet_12nonterminals_1__get__(o); -} - -static PyMethodDef __pyx_methods_3_sa_Alphabet[] = { +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)}, {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_3_sa_Alphabet[] = { - {(char *)"terminals", __pyx_getprop_3_sa_8Alphabet_terminals, 0, 0, 0}, - {(char *)"nonterminals", __pyx_getprop_3_sa_8Alphabet_nonterminals, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_3_sa_Alphabet = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Precomputation = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.Alphabet"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_Alphabet), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.Precomputation"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_Alphabet, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_Precomputation, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -70690,154 +70967,15 @@ static PyTypeObject __pyx_type_3_sa_Alphabet = { 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_3_sa_Alphabet, /*tp_traverse*/ - __pyx_tp_clear_3_sa_Alphabet, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3_sa_Alphabet, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_3_sa_Alphabet, /*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_3_sa_Alphabet, /*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_3_sa_Rule(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_Rule *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_Rule *)o); - p->f = ((struct __pyx_obj_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); - p->e = ((struct __pyx_obj_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); - p->scores = ((struct __pyx_obj_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); - p->word_alignments = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_4Rule_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_3_sa_Rule(PyObject *o) { - struct __pyx_obj_3_sa_Rule *p = (struct __pyx_obj_3_sa_Rule *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->f); - Py_CLEAR(p->e); - Py_CLEAR(p->scores); - Py_CLEAR(p->word_alignments); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_3_sa_Rule(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_3_sa_Rule *p = (struct __pyx_obj_3_sa_Rule *)o; - if (p->f) { - e = (*v)(((PyObject*)p->f), a); if (e) return e; - } - if (p->e) { - e = (*v)(((PyObject*)p->e), a); if (e) return e; - } - if (p->scores) { - e = (*v)(((PyObject*)p->scores), a); if (e) return e; - } - if (p->word_alignments) { - e = (*v)(p->word_alignments, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_3_sa_Rule(PyObject *o) { - struct __pyx_obj_3_sa_Rule *p = (struct __pyx_obj_3_sa_Rule *)o; - PyObject* tmp; - tmp = ((PyObject*)p->f); - p->f = ((struct __pyx_obj_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->e); - p->e = ((struct __pyx_obj_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->scores); - p->scores = ((struct __pyx_obj_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->word_alignments); - p->word_alignments = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_3_sa_4Rule_f(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_4Rule_1f_1__get__(o); -} - -static PyObject *__pyx_getprop_3_sa_4Rule_e(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_4Rule_1e_1__get__(o); -} - -static PyMethodDef __pyx_methods_3_sa_Rule[] = { - {__Pyx_NAMESTR("fmerge"), (PyCFunction)__pyx_pw_3_sa_4Rule_7fmerge, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pw_3_sa_4Rule_9arity, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("alignments"), (PyCFunction)__pyx_pw_3_sa_4Rule_13alignments, METH_NOARGS, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_3_sa_Rule[] = { - {(char *)"f", __pyx_getprop_3_sa_4Rule_f, 0, 0, 0}, - {(char *)"e", __pyx_getprop_3_sa_4Rule_e, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_3_sa_Rule = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.Rule"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_Rule), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_Rule, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - __pyx_pw_3_sa_4Rule_5__cmp__, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - __pyx_pw_3_sa_4Rule_3__hash__, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_3_sa_4Rule_11__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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa_Rule, /*tp_traverse*/ - __pyx_tp_clear_3_sa_Rule, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_Precomputation, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Precomputation, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_Rule, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_Precomputation, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_3_sa_Rule, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -70845,7 +70983,7 @@ static PyTypeObject __pyx_type_3_sa_Rule = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_Rule, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_Precomputation, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -70859,81 +70997,65 @@ static PyTypeObject __pyx_type_3_sa_Rule = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_6_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_6_genexpr = 0; +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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_6_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_6_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_6_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr)); + 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__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_word = 0; - p->__pyx_t_0 = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *)o); + p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)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; 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_3_sa___pyx_scope_struct_6_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_6_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_3_sa___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_word) { - e = (*v)(p->__pyx_v_word, 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_2sa_3_sa___pyx_scope_struct_27___iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___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_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)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); - 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_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_6_genexpr[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_6_genexpr = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_6_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_6_genexpr), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_6_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -70954,13 +71076,13 @@ static PyTypeObject __pyx_type_3_sa___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_3_sa___pyx_scope_struct_6_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_6_genexpr, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_6_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -70970,7 +71092,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_6_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_6_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -70984,22 +71106,22 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_6_genexpr = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *__pyx_freelist_3_sa___pyx_scope_struct_21_add_instance[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_21_add_instance = 0; +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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_21_add_instance(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *p; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_21_add_instance > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_21_add_instance[--__pyx_freecount_3_sa___pyx_scope_struct_21_add_instance]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance)); + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *)o); + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *)o); p->__pyx_v_al = 0; p->__pyx_v_cover = 0; p->__pyx_v_e_nt_cover = 0; @@ -71014,8 +71136,8 @@ static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_21_add_instance(PyTypeObje return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_21_add_instance(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *p = (struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *)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; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_al); Py_CLEAR(p->__pyx_v_cover); @@ -71028,16 +71150,16 @@ static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_21_add_instance(PyObject *o Py_CLEAR(p->__pyx_v_fe_span); Py_CLEAR(p->__pyx_v_rules); Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_3_sa___pyx_scope_struct_21_add_instance < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance))) { - __pyx_freelist_3_sa___pyx_scope_struct_21_add_instance[__pyx_freecount_3_sa___pyx_scope_struct_21_add_instance++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_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_21_add_instance(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *p = (struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *)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; if (p->__pyx_v_al) { e = (*v)(p->__pyx_v_al, a); if (e) return e; } @@ -71074,8 +71196,8 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_21_add_instance(PyObject *o return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_21_add_instance(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *p = (struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance *)o; +static int __pyx_tp_clear_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; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_al); p->__pyx_v_al = Py_None; Py_INCREF(Py_None); @@ -71108,21 +71230,21 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_21_add_instance(PyObject *o) { p->__pyx_v_rules = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_21_add_instance[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_21_add_instance = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_21_add_instance"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_21_add_instance), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_21_add_instance, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -71143,13 +71265,13 @@ static PyTypeObject __pyx_type_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_3_sa___pyx_scope_struct_21_add_instance, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_21_add_instance, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_21_add_instance, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -71159,7 +71281,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_21_add_instance = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_21_add_instance, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -71172,50 +71294,140 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_21_add_instance = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap __pyx_vtable_4cdec_2sa_3_sa_TrieMap; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieMap(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_TrieMap; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_7TrieMap_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieMap(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_7TrieMap_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} -static struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_2_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_2_genexpr = 0; +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)}, + {0, 0, 0, 0} +}; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p; +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieMap = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_TrieMap, /*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_TrieMap, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_2_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_2_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr)); + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_line = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *)o); + p->__pyx_v_point = 0; + p->__pyx_v_self = 0; p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)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; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_line); + Py_CLEAR(p->__pyx_v_point); + Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_t_0); - if ((__pyx_freecount_3_sa___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_2_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return 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; + if (p->__pyx_v_point) { + e = (*v)(p->__pyx_v_point, a); if (e) return e; } - if (p->__pyx_v_line) { - e = (*v)(p->__pyx_v_line, 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_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; @@ -71223,14 +71435,14 @@ static int __pyx_tp_traverse_3_sa___pyx_scope_struct_2_genexpr(PyObject *o, visi return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_point); + p->__pyx_v_point = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_line); - p->__pyx_v_line = Py_None; Py_INCREF(Py_None); + 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); tmp = ((PyObject*)p->__pyx_t_0); p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); @@ -71238,16 +71450,16 @@ static int __pyx_tp_clear_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_2_genexpr[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_2_genexpr = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_2_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_2_genexpr), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_2_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -71268,13 +71480,13 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_2_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_3_sa___pyx_scope_struct_2_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_2_genexpr, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_2_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -71284,7 +71496,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_2_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_2_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -71297,57 +71509,29 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_2_genexpr = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_PhraseLocation __pyx_vtable_3_sa_PhraseLocation; -static PyObject *__pyx_tp_new_3_sa_PhraseLocation(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_PhraseLocation *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_VEBIterator(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_3_sa_PhraseLocation *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_PhraseLocation; - p->arr = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_14PhraseLocation_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } return o; } -static void __pyx_tp_dealloc_3_sa_PhraseLocation(PyObject *o) { - struct __pyx_obj_3_sa_PhraseLocation *p = (struct __pyx_obj_3_sa_PhraseLocation *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->arr); +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_VEBIterator(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa_PhraseLocation(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_3_sa_PhraseLocation *p = (struct __pyx_obj_3_sa_PhraseLocation *)o; - if (p->arr) { - e = (*v)(((PyObject*)p->arr), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_3_sa_PhraseLocation(PyObject *o) { - struct __pyx_obj_3_sa_PhraseLocation *p = (struct __pyx_obj_3_sa_PhraseLocation *)o; - PyObject* tmp; - tmp = ((PyObject*)p->arr); - p->arr = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_3_sa_PhraseLocation[] = { +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_PhraseLocation = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_VEBIterator = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.PhraseLocation"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_PhraseLocation), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.VEBIterator"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_PhraseLocation, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_VEBIterator, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -71366,15 +71550,15 @@ static PyTypeObject __pyx_type_3_sa_PhraseLocation = { 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_3_sa_PhraseLocation, /*tp_traverse*/ - __pyx_tp_clear_3_sa_PhraseLocation, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3_sa_PhraseLocation, /*tp_methods*/ + __pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_VEBIterator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -71384,7 +71568,7 @@ static PyTypeObject __pyx_type_3_sa_PhraseLocation = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_PhraseLocation, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_VEBIterator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -71398,65 +71582,81 @@ static PyTypeObject __pyx_type_3_sa_PhraseLocation = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *__pyx_freelist_3_sa___pyx_scope_struct_15___iter__[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_15___iter__ = 0; +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = 0; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_15___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_15___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_15___iter__[--__pyx_freecount_3_sa___pyx_scope_struct_15___iter__]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__)); + 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)))) { + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *)o); - p->__pyx_v_self = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_word = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_15___iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_3_sa___pyx_scope_struct_15___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__))) { - __pyx_freelist_3_sa___pyx_scope_struct_15___iter__[__pyx_freecount_3_sa___pyx_scope_struct_15___iter__++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *)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_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); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_15___iter__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_word) { + e = (*v)(p->__pyx_v_word, 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_3_sa___pyx_scope_struct_15___iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__ *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)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); + 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_3_sa___pyx_scope_struct_15___iter__[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_15___iter__ = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_15___iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_15___iter__), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa___pyx_scope_struct_15___iter__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -71477,13 +71677,13 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_15___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_3_sa___pyx_scope_struct_15___iter__, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_15___iter__, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_15___iter__, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -71493,7 +71693,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_15___iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_15___iter__, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -71506,74 +71706,84 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_15___iter__ = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList __pyx_vtable_4cdec_2sa_3_sa_FloatList; -static struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *__pyx_freelist_3_sa___pyx_scope_struct_22_form_rule[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_22_form_rule = 0; - -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_22_form_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_FloatList(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_FloatList *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_22_form_rule > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_22_form_rule[--__pyx_freecount_3_sa___pyx_scope_struct_22_form_rule]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_FloatList; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9FloatList_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *)o); - p->__pyx_v_links = 0; - p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_22_form_rule(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_links); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_3_sa___pyx_scope_struct_22_form_rule < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule))) { - __pyx_freelist_3_sa___pyx_scope_struct_22_form_rule[__pyx_freecount_3_sa___pyx_scope_struct_22_form_rule++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_FloatList(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_9FloatList_3__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_2sa_3_sa_FloatList(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_3_sa___pyx_scope_struct_22_form_rule(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *)o; - if (p->__pyx_v_links) { - e = (*v)(p->__pyx_v_links, a); if (e) return e; +static int __pyx_mp_ass_subscript_4cdec_2sa_3_sa_FloatList(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9FloatList_7__setitem__(o, i, v); } - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); + return -1; } - return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_22_form_rule(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_links); - p->__pyx_v_links = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_22_form_rule[] = { +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_22_form_rule = { +static PySequenceMethods __pyx_tp_as_sequence_FloatList = { + __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4cdec_2sa_3_sa_FloatList, /*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_FloatList = { + __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__, /*mp_length*/ + __pyx_pw_4cdec_2sa_3_sa_9FloatList_5__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_4cdec_2sa_3_sa_FloatList, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_FloatList = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_22_form_rule"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_22_form_rule), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.FloatList"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FloatList), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_22_form_rule, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_FloatList, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -71584,23 +71794,23 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_22_form_rule = { #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ + &__pyx_tp_as_sequence_FloatList, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_FloatList, /*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_3_sa___pyx_scope_struct_22_form_rule, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_22_form_rule, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_22_form_rule, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_FloatList, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -71610,7 +71820,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_22_form_rule = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_22_form_rule, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_FloatList, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -71623,82 +71833,44 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_22_form_rule = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap __pyx_vtable_4cdec_2sa_3_sa_StringMap; -static struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_25_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_25_genexpr = 0; - -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_StringMap(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_StringMap *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_25_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_25_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_25_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_StringMap; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9StringMap_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_packed = 0; - p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_25_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_25_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_3_sa___pyx_scope_struct_25_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_25_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_25_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_25_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_packed) { - e = (*v)(p->__pyx_v_packed, 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_2sa_3_sa_StringMap(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_9StringMap_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); } - return 0; -} - -static int __pyx_tp_clear_3_sa___pyx_scope_struct_25_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_24_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); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; + (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_25_genexpr[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_StringMap[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_25_genexpr = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_StringMap = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_25_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_25_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.StringMap"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_StringMap), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_25_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_StringMap, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -71717,15 +71889,15 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_25_genexpr = { 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_3_sa___pyx_scope_struct_25_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_25_genexpr, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_25_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_StringMap, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -71735,7 +71907,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_25_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_25_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_StringMap, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -71749,73 +71921,65 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_25_genexpr = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *__pyx_freelist_3_sa___pyx_scope_struct_24_fmt_rule[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_24_fmt_rule = 0; +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ = 0; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_24_fmt_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_24_fmt_rule > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_24_fmt_rule[--__pyx_freecount_3_sa___pyx_scope_struct_24_fmt_rule]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule)); + 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__)))) { + 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__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *)o); - p->__pyx_v_a = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_24_fmt_rule(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyObject *o) { + 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_a); Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_3_sa___pyx_scope_struct_24_fmt_rule < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule))) { - __pyx_freelist_3_sa___pyx_scope_struct_24_fmt_rule[__pyx_freecount_3_sa___pyx_scope_struct_24_fmt_rule++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *)o); + 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__))) { + __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); } } -static int __pyx_tp_traverse_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_15___iter__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *)o; - if (p->__pyx_v_a) { - e = (*v)(p->__pyx_v_a, a); if (e) return e; - } + 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; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_24_fmt_rule(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *p = (struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyObject *o) { + 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* tmp; - tmp = ((PyObject*)p->__pyx_v_a); - p->__pyx_v_a = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_24_fmt_rule[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_24_fmt_rule = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_24_fmt_rule"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_24_fmt_rule), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -71836,13 +72000,13 @@ static PyTypeObject __pyx_type_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_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -71852,7 +72016,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_24_fmt_rule = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -71866,65 +72030,65 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_24_fmt_rule = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *__pyx_freelist_3_sa___pyx_scope_struct_28___str__[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_28___str__ = 0; +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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_28___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_28___str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_28___str__)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_28___str__[--__pyx_freecount_3_sa___pyx_scope_struct_28___str__]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_28___str__)); + 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__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *)o); + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_28___str__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *)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; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_3_sa___pyx_scope_struct_28___str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_28___str__))) { - __pyx_freelist_3_sa___pyx_scope_struct_28___str__[__pyx_freecount_3_sa___pyx_scope_struct_28___str__++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *)o); + 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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_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_16___str__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *)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; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_28___str__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_28___str__ *)o; +static int __pyx_tp_clear_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; PyObject* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_28___str__[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_16___str__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_28___str__ = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_28___str__"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_28___str__), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_28___str__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -71945,13 +72109,13 @@ static PyTypeObject __pyx_type_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_3_sa___pyx_scope_struct_28___str__, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_28___str__, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_28___str__, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -71961,7 +72125,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_28___str__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_28___str__, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -71975,65 +72139,102 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_28___str__ = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *__pyx_freelist_3_sa___pyx_scope_struct_1_read_bitext[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_1_read_bitext = 0; - -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_1_read_bitext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieTable(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_1_read_bitext > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_1_read_bitext[--__pyx_freecount_3_sa___pyx_scope_struct_1_read_bitext]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o); + p->root = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9TrieTable_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o); - p->__pyx_v_fp = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieTable(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_fp); - if ((__pyx_freecount_3_sa___pyx_scope_struct_1_read_bitext < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext))) { - __pyx_freelist_3_sa___pyx_scope_struct_1_read_bitext[__pyx_freecount_3_sa___pyx_scope_struct_1_read_bitext++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } + Py_CLEAR(p->root); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_TrieTable(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o; - if (p->__pyx_v_fp) { - e = (*v)(p->__pyx_v_fp, a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o; + if (p->root) { + e = (*v)(p->root, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *p = (struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_TrieTable(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_fp); - p->__pyx_v_fp = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->root); + p->root = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_1_read_bitext[] = { +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9TrieTable_extended(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_extended(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9TrieTable_count(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_count(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9TrieTable_root(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_root(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_TrieTable[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_1_read_bitext = { +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_TrieTable[] = { + {(char *)"extended", __pyx_getprop_4cdec_2sa_3_sa_9TrieTable_extended, __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_extended, 0, 0}, + {(char *)"count", __pyx_getprop_4cdec_2sa_3_sa_9TrieTable_count, __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_count, 0, 0}, + {(char *)"root", __pyx_getprop_4cdec_2sa_3_sa_9TrieTable_root, __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_root, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieTable = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_1_read_bitext"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_1_read_bitext), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.TrieTable"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_1_read_bitext, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieTable, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -72052,17 +72253,17 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_1_read_bitext = { 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_3_sa___pyx_scope_struct_1_read_bitext, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_1_read_bitext, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_TrieTable, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_TrieTable, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_1_read_bitext, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_TrieTable, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_4cdec_2sa_3_sa_TrieTable, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -72070,7 +72271,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_1_read_bitext = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_1_read_bitext, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_TrieTable, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -72084,65 +72285,65 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_1_read_bitext = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *__pyx_freelist_3_sa___pyx_scope_struct_13_decode_words[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_13_decode_words = 0; +static 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[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words = 0; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_13_decode_words(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *p; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_13_decode_words > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_13_decode_words[--__pyx_freecount_3_sa___pyx_scope_struct_13_decode_words]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words)); + 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)))) { + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *)o); - p->__pyx_v_syms = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *)o); + p->__pyx_v_words = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_13_decode_words(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *p = (struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyObject *o) { + 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_syms); - if ((__pyx_freecount_3_sa___pyx_scope_struct_13_decode_words < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words))) { - __pyx_freelist_3_sa___pyx_scope_struct_13_decode_words[__pyx_freecount_3_sa___pyx_scope_struct_13_decode_words++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *)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))) { + __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); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_13_decode_words(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *p = (struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *)o; - if (p->__pyx_v_syms) { - e = (*v)(p->__pyx_v_syms, a); if (e) return e; + 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; + if (p->__pyx_v_words) { + e = (*v)(p->__pyx_v_words, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_13_decode_words(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *p = (struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyObject *o) { + 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* tmp; - tmp = ((PyObject*)p->__pyx_v_syms); - p->__pyx_v_syms = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_words); + p->__pyx_v_words = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_13_decode_words[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_13_decode_words = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_13_decode_words"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_13_decode_words), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa___pyx_scope_struct_13_decode_words, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -72163,13 +72364,13 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_13_decode_words = { 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_3_sa___pyx_scope_struct_13_decode_words, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_13_decode_words, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_13_decode_words, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -72179,7 +72380,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_13_decode_words = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_13_decode_words, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -72193,63 +72394,81 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_13_decode_words = { #endif }; -static PyObject *__pyx_tp_new_3_sa_FeatureVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa_FeatureVector *p; +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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_FeatureVector *)o); - p->names = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->values = ((struct __pyx_obj_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_13FeatureVector_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; + 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)); + 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_2sa_3_sa___pyx_scope_struct_25_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_packed = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa_FeatureVector(PyObject *o) { - struct __pyx_obj_3_sa_FeatureVector *p = (struct __pyx_obj_3_sa_FeatureVector *)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; PyObject_GC_UnTrack(o); - Py_CLEAR(p->names); - Py_CLEAR(p->values); - (*Py_TYPE(o)->tp_free)(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); + } else { + (*Py_TYPE(o)->tp_free)(o); + } } -static int __pyx_tp_traverse_3_sa_FeatureVector(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_FeatureVector *p = (struct __pyx_obj_3_sa_FeatureVector *)o; - if (p->names) { - e = (*v)(((PyObject*)p->names), a); if (e) return 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; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - if (p->values) { - e = (*v)(((PyObject*)p->values), a); if (e) return e; + if (p->__pyx_v_packed) { + e = (*v)(p->__pyx_v_packed, 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_3_sa_FeatureVector(PyObject *o) { - struct __pyx_obj_3_sa_FeatureVector *p = (struct __pyx_obj_3_sa_FeatureVector *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->names); - p->names = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + 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); Py_XDECREF(tmp); - tmp = ((PyObject*)p->values); - p->values = ((struct __pyx_obj_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_packed); + p->__pyx_v_packed = 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_3_sa_FeatureVector[] = { - {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pw_3_sa_13FeatureVector_3set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_FeatureVector = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.FeatureVector"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_FeatureVector), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_FeatureVector, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -72264,19 +72483,19 @@ static PyTypeObject __pyx_type_3_sa_FeatureVector = { 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_3_sa_13FeatureVector_8__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_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_3_sa_FeatureVector, /*tp_traverse*/ - __pyx_tp_clear_3_sa_FeatureVector, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_3_sa_13FeatureVector_5__iter__, /*tp_iter*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_FeatureVector, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -72286,7 +72505,7 @@ static PyTypeObject __pyx_type_3_sa_FeatureVector = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_FeatureVector, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -72300,65 +72519,81 @@ static PyTypeObject __pyx_type_3_sa_FeatureVector = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_freelist_3_sa___pyx_scope_struct_7_decode_lattice[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_7_decode_lattice = 0; +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr = 0; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_7_decode_lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_7_decode_lattice > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_7_decode_lattice[--__pyx_freecount_3_sa___pyx_scope_struct_7_decode_lattice]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice)); + 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)))) { + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)o); - p->__pyx_v_lattice = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_word = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_lattice); - if ((__pyx_freecount_3_sa___pyx_scope_struct_7_decode_lattice < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice))) { - __pyx_freelist_3_sa___pyx_scope_struct_7_decode_lattice[__pyx_freecount_3_sa___pyx_scope_struct_7_decode_lattice++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)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_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); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)o; - if (p->__pyx_v_lattice) { - e = (*v)(p->__pyx_v_lattice, a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_word) { + e = (*v)(p->__pyx_v_word, 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_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_lattice); - p->__pyx_v_lattice = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *)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); + 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_3_sa___pyx_scope_struct_7_decode_lattice[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_7_decode_lattice = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_7_decode_lattice"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -72379,13 +72614,13 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_7_decode_lattice = { 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_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -72395,527 +72630,95 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_7_decode_lattice = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_3_sa___pyx_scope_struct_19_input *__pyx_freelist_3_sa___pyx_scope_struct_19_input[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_19_input = 0; - -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_19_input(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_19_input *p; - PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_19_input > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_19_input)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_19_input[--__pyx_freecount_3_sa___pyx_scope_struct_19_input]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_19_input)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_19_input *)o); - p->__pyx_v_alignment = 0; - p->__pyx_v_als = 0; - p->__pyx_v_alslist = 0; - p->__pyx_v_chunklen = 0; - p->__pyx_v_count = 0; - p->__pyx_v_e = 0; - p->__pyx_v_elist = 0; - p->__pyx_v_extract = 0; - p->__pyx_v_extract_start = 0; - p->__pyx_v_extract_stop = 0; - p->__pyx_v_extracts = 0; - p->__pyx_v_f = 0; - p->__pyx_v_f_syms = 0; - p->__pyx_v_fcount = 0; - p->__pyx_v_fphrases = 0; - p->__pyx_v_frontier = 0; - p->__pyx_v_frontier_nodes = 0; - p->__pyx_v_fwords = 0; - p->__pyx_v_genexpr = 0; - p->__pyx_v_hiero_phrase = 0; - p->__pyx_v_input_match = 0; - p->__pyx_v_intersect_start_time = 0; - p->__pyx_v_intersect_stop_time = 0; - p->__pyx_v_is_shadow_path = 0; - p->__pyx_v_key = 0; - p->__pyx_v_lex_i = 0; - p->__pyx_v_lex_j = 0; - p->__pyx_v_loc = 0; - p->__pyx_v_locs = 0; - p->__pyx_v_max_locs = 0; - p->__pyx_v_meta = 0; - p->__pyx_v_new_frontier = 0; - p->__pyx_v_new_node = 0; - p->__pyx_v_next_states = 0; - p->__pyx_v_node = 0; - p->__pyx_v_nodes_isteps_away_buffer = 0; - p->__pyx_v_pathlen = 0; - p->__pyx_v_phrase = 0; - p->__pyx_v_phrase_location = 0; - p->__pyx_v_prefix = 0; - p->__pyx_v_reachable_buffer = 0; - p->__pyx_v_sa_range = 0; - p->__pyx_v_sample = 0; - p->__pyx_v_scores = 0; - p->__pyx_v_seen_phrases = 0; - p->__pyx_v_self = 0; - p->__pyx_v_spanlen = 0; - p->__pyx_v_stop_time = 0; - p->__pyx_v_suffix_link = 0; - p->__pyx_v_suffix_link_xcat_index = 0; - p->__pyx_v_word_id = 0; - p->__pyx_v_xcat_index = 0; - p->__pyx_v_xnode = 0; - p->__pyx_v_xroot = 0; - p->__pyx_t_3 = 0; - p->__pyx_t_4 = 0; - p->__pyx_t_5 = 0; - return o; -} - -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_19_input(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_19_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_19_input *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_alignment); - Py_CLEAR(p->__pyx_v_als); - Py_CLEAR(p->__pyx_v_alslist); - Py_CLEAR(p->__pyx_v_chunklen); - Py_CLEAR(p->__pyx_v_count); - Py_CLEAR(p->__pyx_v_e); - Py_CLEAR(p->__pyx_v_elist); - Py_CLEAR(p->__pyx_v_extract); - Py_CLEAR(p->__pyx_v_extract_start); - Py_CLEAR(p->__pyx_v_extract_stop); - Py_CLEAR(p->__pyx_v_extracts); - Py_CLEAR(p->__pyx_v_f); - Py_CLEAR(p->__pyx_v_f_syms); - Py_CLEAR(p->__pyx_v_fcount); - Py_CLEAR(p->__pyx_v_fphrases); - Py_CLEAR(p->__pyx_v_frontier); - Py_CLEAR(p->__pyx_v_frontier_nodes); - Py_CLEAR(p->__pyx_v_fwords); - Py_CLEAR(p->__pyx_v_genexpr); - Py_CLEAR(p->__pyx_v_hiero_phrase); - Py_CLEAR(p->__pyx_v_input_match); - Py_CLEAR(p->__pyx_v_intersect_start_time); - Py_CLEAR(p->__pyx_v_intersect_stop_time); - Py_CLEAR(p->__pyx_v_is_shadow_path); - Py_CLEAR(p->__pyx_v_key); - Py_CLEAR(p->__pyx_v_lex_i); - Py_CLEAR(p->__pyx_v_lex_j); - Py_CLEAR(p->__pyx_v_loc); - Py_CLEAR(p->__pyx_v_locs); - Py_CLEAR(p->__pyx_v_max_locs); - Py_CLEAR(p->__pyx_v_meta); - Py_CLEAR(p->__pyx_v_new_frontier); - Py_CLEAR(p->__pyx_v_new_node); - Py_CLEAR(p->__pyx_v_next_states); - Py_CLEAR(p->__pyx_v_node); - Py_CLEAR(p->__pyx_v_nodes_isteps_away_buffer); - Py_CLEAR(p->__pyx_v_pathlen); - Py_CLEAR(p->__pyx_v_phrase); - Py_CLEAR(p->__pyx_v_phrase_location); - Py_CLEAR(p->__pyx_v_prefix); - Py_CLEAR(p->__pyx_v_reachable_buffer); - Py_CLEAR(p->__pyx_v_sa_range); - Py_CLEAR(p->__pyx_v_sample); - Py_CLEAR(p->__pyx_v_scores); - Py_CLEAR(p->__pyx_v_seen_phrases); - Py_CLEAR(p->__pyx_v_self); - Py_CLEAR(p->__pyx_v_spanlen); - Py_CLEAR(p->__pyx_v_stop_time); - Py_CLEAR(p->__pyx_v_suffix_link); - Py_CLEAR(p->__pyx_v_suffix_link_xcat_index); - Py_CLEAR(p->__pyx_v_word_id); - 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_4); - Py_CLEAR(p->__pyx_t_5); - if ((__pyx_freecount_3_sa___pyx_scope_struct_19_input < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_19_input))) { - __pyx_freelist_3_sa___pyx_scope_struct_19_input[__pyx_freecount_3_sa___pyx_scope_struct_19_input++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_19_input *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_19_input(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_3_sa___pyx_scope_struct_19_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_19_input *)o; - if (p->__pyx_v_alignment) { - e = (*v)(p->__pyx_v_alignment, a); if (e) return e; - } - if (p->__pyx_v_als) { - e = (*v)(p->__pyx_v_als, a); if (e) return e; - } - if (p->__pyx_v_alslist) { - e = (*v)(p->__pyx_v_alslist, a); if (e) return e; - } - if (p->__pyx_v_chunklen) { - e = (*v)(((PyObject*)p->__pyx_v_chunklen), a); if (e) return e; - } - if (p->__pyx_v_count) { - e = (*v)(p->__pyx_v_count, a); if (e) return e; - } - if (p->__pyx_v_e) { - e = (*v)(p->__pyx_v_e, a); if (e) return e; - } - if (p->__pyx_v_elist) { - e = (*v)(p->__pyx_v_elist, a); if (e) return e; - } - if (p->__pyx_v_extract) { - e = (*v)(p->__pyx_v_extract, a); if (e) return e; - } - if (p->__pyx_v_extract_start) { - e = (*v)(p->__pyx_v_extract_start, a); if (e) return e; - } - if (p->__pyx_v_extract_stop) { - e = (*v)(p->__pyx_v_extract_stop, a); if (e) return e; - } - if (p->__pyx_v_extracts) { - e = (*v)(p->__pyx_v_extracts, a); if (e) return e; - } - if (p->__pyx_v_f) { - e = (*v)(p->__pyx_v_f, a); if (e) return e; - } - if (p->__pyx_v_f_syms) { - e = (*v)(p->__pyx_v_f_syms, a); if (e) return e; - } - if (p->__pyx_v_fcount) { - e = (*v)(p->__pyx_v_fcount, a); if (e) return e; - } - if (p->__pyx_v_fphrases) { - e = (*v)(p->__pyx_v_fphrases, a); if (e) return e; - } - if (p->__pyx_v_frontier) { - e = (*v)(p->__pyx_v_frontier, a); if (e) return e; - } - if (p->__pyx_v_frontier_nodes) { - e = (*v)(p->__pyx_v_frontier_nodes, a); if (e) return e; - } - if (p->__pyx_v_fwords) { - e = (*v)(p->__pyx_v_fwords, a); if (e) return e; - } - if (p->__pyx_v_genexpr) { - e = (*v)(p->__pyx_v_genexpr, a); if (e) return e; - } - if (p->__pyx_v_hiero_phrase) { - e = (*v)(((PyObject*)p->__pyx_v_hiero_phrase), a); if (e) return e; - } - if (p->__pyx_v_input_match) { - e = (*v)(p->__pyx_v_input_match, a); if (e) return e; - } - if (p->__pyx_v_intersect_start_time) { - e = (*v)(p->__pyx_v_intersect_start_time, a); if (e) return e; - } - if (p->__pyx_v_intersect_stop_time) { - e = (*v)(p->__pyx_v_intersect_stop_time, a); if (e) return e; - } - if (p->__pyx_v_is_shadow_path) { - e = (*v)(p->__pyx_v_is_shadow_path, 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_lex_i) { - e = (*v)(p->__pyx_v_lex_i, a); if (e) return e; - } - if (p->__pyx_v_lex_j) { - e = (*v)(p->__pyx_v_lex_j, a); if (e) return e; - } - if (p->__pyx_v_loc) { - e = (*v)(p->__pyx_v_loc, a); if (e) return e; - } - if (p->__pyx_v_locs) { - e = (*v)(p->__pyx_v_locs, a); if (e) return e; - } - if (p->__pyx_v_max_locs) { - e = (*v)(p->__pyx_v_max_locs, a); if (e) return e; - } - if (p->__pyx_v_meta) { - e = (*v)(p->__pyx_v_meta, a); if (e) return e; - } - if (p->__pyx_v_new_frontier) { - e = (*v)(p->__pyx_v_new_frontier, a); if (e) return e; - } - if (p->__pyx_v_new_node) { - e = (*v)(p->__pyx_v_new_node, a); if (e) return e; - } - if (p->__pyx_v_next_states) { - e = (*v)(p->__pyx_v_next_states, a); if (e) return e; - } - if (p->__pyx_v_node) { - e = (*v)(p->__pyx_v_node, a); if (e) return e; - } - if (p->__pyx_v_nodes_isteps_away_buffer) { - e = (*v)(p->__pyx_v_nodes_isteps_away_buffer, a); if (e) return e; - } - if (p->__pyx_v_pathlen) { - e = (*v)(p->__pyx_v_pathlen, a); if (e) return e; - } - if (p->__pyx_v_phrase) { - e = (*v)(p->__pyx_v_phrase, a); if (e) return e; - } - if (p->__pyx_v_phrase_location) { - e = (*v)(((PyObject*)p->__pyx_v_phrase_location), a); if (e) return e; - } - if (p->__pyx_v_prefix) { - e = (*v)(p->__pyx_v_prefix, a); if (e) return e; - } - if (p->__pyx_v_reachable_buffer) { - e = (*v)(p->__pyx_v_reachable_buffer, a); if (e) return e; - } - if (p->__pyx_v_sa_range) { - e = (*v)(p->__pyx_v_sa_range, a); if (e) return e; - } - if (p->__pyx_v_sample) { - e = (*v)(((PyObject*)p->__pyx_v_sample), a); if (e) return e; - } - if (p->__pyx_v_scores) { - e = (*v)(((PyObject*)p->__pyx_v_scores), a); if (e) return e; - } - if (p->__pyx_v_seen_phrases) { - e = (*v)(p->__pyx_v_seen_phrases, 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_spanlen) { - e = (*v)(p->__pyx_v_spanlen, a); if (e) return e; - } - if (p->__pyx_v_stop_time) { - e = (*v)(p->__pyx_v_stop_time, a); if (e) return e; - } - if (p->__pyx_v_suffix_link) { - e = (*v)(p->__pyx_v_suffix_link, a); if (e) return e; - } - if (p->__pyx_v_suffix_link_xcat_index) { - e = (*v)(p->__pyx_v_suffix_link_xcat_index, a); if (e) return e; - } - if (p->__pyx_v_word_id) { - e = (*v)(p->__pyx_v_word_id, a); if (e) return e; - } - if (p->__pyx_v_xcat_index) { - e = (*v)(p->__pyx_v_xcat_index, a); if (e) return e; - } - if (p->__pyx_v_xnode) { - e = (*v)(p->__pyx_v_xnode, a); if (e) return e; - } - 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_4) { - e = (*v)(p->__pyx_t_4, a); if (e) return e; - } - if (p->__pyx_t_5) { - e = (*v)(p->__pyx_t_5, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_3_sa___pyx_scope_struct_19_input(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_19_input *p = (struct __pyx_obj_3_sa___pyx_scope_struct_19_input *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_alignment); - p->__pyx_v_alignment = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_als); - p->__pyx_v_als = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_alslist); - p->__pyx_v_alslist = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_chunklen); - p->__pyx_v_chunklen = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_count); - p->__pyx_v_count = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_e); - p->__pyx_v_e = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_elist); - p->__pyx_v_elist = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_extract); - p->__pyx_v_extract = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_extract_start); - p->__pyx_v_extract_start = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_extract_stop); - p->__pyx_v_extract_stop = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_extracts); - p->__pyx_v_extracts = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f); - p->__pyx_v_f = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f_syms); - p->__pyx_v_f_syms = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_fcount); - p->__pyx_v_fcount = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_fphrases); - p->__pyx_v_fphrases = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_frontier); - p->__pyx_v_frontier = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_frontier_nodes); - p->__pyx_v_frontier_nodes = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_fwords); - p->__pyx_v_fwords = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_genexpr); - p->__pyx_v_genexpr = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_hiero_phrase); - p->__pyx_v_hiero_phrase = ((struct __pyx_obj_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_input_match); - p->__pyx_v_input_match = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_intersect_start_time); - p->__pyx_v_intersect_start_time = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_intersect_stop_time); - p->__pyx_v_intersect_stop_time = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_is_shadow_path); - p->__pyx_v_is_shadow_path = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_key); - p->__pyx_v_key = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_lex_i); - p->__pyx_v_lex_i = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_lex_j); - p->__pyx_v_lex_j = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_loc); - p->__pyx_v_loc = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_locs); - p->__pyx_v_locs = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_max_locs); - p->__pyx_v_max_locs = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_meta); - p->__pyx_v_meta = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_new_frontier); - p->__pyx_v_new_frontier = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_new_node); - p->__pyx_v_new_node = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_next_states); - p->__pyx_v_next_states = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_node); - p->__pyx_v_node = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_nodes_isteps_away_buffer); - p->__pyx_v_nodes_isteps_away_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_pathlen); - p->__pyx_v_pathlen = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_phrase); - p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_phrase_location); - p->__pyx_v_phrase_location = ((struct __pyx_obj_3_sa_PhraseLocation *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_prefix); - p->__pyx_v_prefix = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_reachable_buffer); - p->__pyx_v_reachable_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_sa_range); - p->__pyx_v_sa_range = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_sample); - p->__pyx_v_sample = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_scores); - p->__pyx_v_scores = ((struct __pyx_obj_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_seen_phrases); - p->__pyx_v_seen_phrases = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_spanlen); - p->__pyx_v_spanlen = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_stop_time); - p->__pyx_v_stop_time = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_suffix_link); - p->__pyx_v_suffix_link = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_suffix_link_xcat_index); - p->__pyx_v_suffix_link_xcat_index = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_word_id); - p->__pyx_v_word_id = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_xcat_index); - p->__pyx_v_xcat_index = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_xnode); - p->__pyx_v_xnode = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - 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); + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_6_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_word = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_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_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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___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_word) { + e = (*v)(p->__pyx_v_word, 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_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)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); + tmp = ((PyObject*)p->__pyx_v_word); + p->__pyx_v_word = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_5); - p->__pyx_t_5 = 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_3_sa___pyx_scope_struct_19_input[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_19_input = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_19_input"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_19_input), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa___pyx_scope_struct_19_input, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -72936,13 +72739,13 @@ static PyTypeObject __pyx_type_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_3_sa___pyx_scope_struct_19_input, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_19_input, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_19_input, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -72952,7 +72755,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_19_input = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_19_input, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -72965,54 +72768,74 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_19_input = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_Scorer __pyx_vtable_3_sa_Scorer; -static PyObject *__pyx_tp_new_3_sa_Scorer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa_Scorer *p; +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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_Scorer *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_Scorer; - p->models = Py_None; Py_INCREF(Py_None); + 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)); + 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_2sa_3_sa___pyx_scope_struct_22_form_rule *)o); + p->__pyx_v_links = 0; + p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa_Scorer(PyObject *o) { - struct __pyx_obj_3_sa_Scorer *p = (struct __pyx_obj_3_sa_Scorer *)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; PyObject_GC_UnTrack(o); - Py_CLEAR(p->models); - (*Py_TYPE(o)->tp_free)(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); + } else { + (*Py_TYPE(o)->tp_free)(o); + } } -static int __pyx_tp_traverse_3_sa_Scorer(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_Scorer *p = (struct __pyx_obj_3_sa_Scorer *)o; - if (p->models) { - e = (*v)(p->models, a); if (e) return 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; + if (p->__pyx_v_links) { + e = (*v)(p->__pyx_v_links, 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_3_sa_Scorer(PyObject *o) { - struct __pyx_obj_3_sa_Scorer *p = (struct __pyx_obj_3_sa_Scorer *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->models); - p->models = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_links); + p->__pyx_v_links = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa_Scorer[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_Scorer = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.Scorer"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_Scorer), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_Scorer, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -73031,15 +72854,15 @@ static PyTypeObject __pyx_type_3_sa_Scorer = { 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_3_sa_Scorer, /*tp_traverse*/ - __pyx_tp_clear_3_sa_Scorer, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_Scorer, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -73047,9 +72870,9 @@ static PyTypeObject __pyx_type_3_sa_Scorer = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_3_sa_6Scorer_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_Scorer, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -73062,73 +72885,90 @@ static PyTypeObject __pyx_type_3_sa_Scorer = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_Alignment __pyx_vtable_3_sa_Alignment; -static PyObject *__pyx_tp_new_3_sa_Alignment(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_Alignment *p; +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_Alignment *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_Alignment; - p->links = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->sent_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_9Alignment_5__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_10_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v__ = 0; + p->__pyx_v_sym = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa_Alignment(PyObject *o) { - struct __pyx_obj_3_sa_Alignment *p = (struct __pyx_obj_3_sa_Alignment *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->links); - Py_CLEAR(p->sent_index); - (*Py_TYPE(o)->tp_free)(o); + Py_CLEAR(p->__pyx_outer_scope); + 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))) { + __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); + } } -static int __pyx_tp_traverse_3_sa_Alignment(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_Alignment *p = (struct __pyx_obj_3_sa_Alignment *)o; - if (p->links) { - e = (*v)(((PyObject*)p->links), a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - if (p->sent_index) { - e = (*v)(((PyObject*)p->sent_index), a); if (e) return e; + if (p->__pyx_v__) { + e = (*v)(p->__pyx_v__, a); if (e) return e; + } + if (p->__pyx_v_sym) { + e = (*v)(p->__pyx_v_sym, 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_3_sa_Alignment(PyObject *o) { - struct __pyx_obj_3_sa_Alignment *p = (struct __pyx_obj_3_sa_Alignment *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)o; PyObject* tmp; - tmp = ((PyObject*)p->links); - p->links = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->sent_index); - p->sent_index = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v__); + p->__pyx_v__ = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sym); + p->__pyx_v_sym = 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_3_sa_Alignment[] = { - {__Pyx_NAMESTR("unlink"), (PyCFunction)__pyx_pw_3_sa_9Alignment_1unlink, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_9Alignment_unlink)}, - {__Pyx_NAMESTR("get_sent_links"), (PyCFunction)__pyx_pw_3_sa_9Alignment_3get_sent_links, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_3_sa_9Alignment_7read_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_binary"), (PyCFunction)__pyx_pw_3_sa_9Alignment_9read_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_3_sa_9Alignment_11write_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_binary"), (PyCFunction)__pyx_pw_3_sa_9Alignment_13write_binary, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_3_sa_9Alignment_15write_enhanced, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("alignment"), (PyCFunction)__pyx_pw_3_sa_9Alignment_17alignment, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_9Alignment_16alignment)}, +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_Alignment = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.Alignment"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_Alignment), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa_Alignment, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -73147,15 +72987,15 @@ static PyTypeObject __pyx_type_3_sa_Alignment = { 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_3_sa_Alignment, /*tp_traverse*/ - __pyx_tp_clear_3_sa_Alignment, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_Alignment, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -73165,7 +73005,7 @@ static PyTypeObject __pyx_type_3_sa_Alignment = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_Alignment, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -73178,23 +73018,27 @@ static PyTypeObject __pyx_type_3_sa_Alignment = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB __pyx_vtable_4cdec_2sa_3_sa_VEB; -static PyObject *__pyx_tp_new_3_sa_BitSet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_VEB(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_VEB *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - if (unlikely(__pyx_pw_3_sa_6BitSet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + p = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_VEB; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_3VEB_1__cinit__(o, a, k) < 0)) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_3_sa_BitSet(PyObject *o) { +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_VEB(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pw_3_sa_6BitSet_3__dealloc__(o); + __pyx_pw_4cdec_2sa_3_sa_3VEB_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -73202,39 +73046,37 @@ static void __pyx_tp_dealloc_3_sa_BitSet(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_3_sa_BitSet[] = { - {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_3_sa_6BitSet_7insert, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("findsucc"), (PyCFunction)__pyx_pw_3_sa_6BitSet_9findsucc, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("min"), (PyCFunction)__pyx_pw_3_sa_6BitSet_13min, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("max"), (PyCFunction)__pyx_pw_3_sa_6BitSet_15max, METH_NOARGS, __Pyx_DOCSTR(0)}, +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)}, {0, 0, 0, 0} }; -static PySequenceMethods __pyx_tp_as_sequence_BitSet = { - __pyx_pw_3_sa_6BitSet_17__len__, /*sq_length*/ +static PySequenceMethods __pyx_tp_as_sequence_VEB = { + __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ - __pyx_pw_3_sa_6BitSet_19__contains__, /*sq_contains*/ + __pyx_pw_4cdec_2sa_3_sa_3VEB_13__contains__, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_BitSet = { - __pyx_pw_3_sa_6BitSet_17__len__, /*mp_length*/ +static PyMappingMethods __pyx_tp_as_mapping_VEB = { + __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyTypeObject __pyx_type_3_sa_BitSet = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_VEB = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.BitSet"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_BitSet), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.VEB"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_VEB), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_BitSet, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_VEB, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -73245,11 +73087,11 @@ static PyTypeObject __pyx_type_3_sa_BitSet = { #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_BitSet, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BitSet, /*tp_as_mapping*/ + &__pyx_tp_as_sequence_VEB, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_VEB, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_3_sa_6BitSet_11__str__, /*tp_str*/ + 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ @@ -73259,9 +73101,118 @@ static PyTypeObject __pyx_type_3_sa_BitSet = { 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_3_sa_6BitSet_5__iter__, /*tp_iter*/ + __pyx_pw_4cdec_2sa_3_sa_3VEB_5__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_VEB, /*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_VEB, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice = 0; + +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)o); + p->__pyx_v_lattice = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o) { + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o, visitproc v, void *a) { + int e; + 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; + if (p->__pyx_v_lattice) { + e = (*v)(p->__pyx_v_lattice, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o) { + 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* tmp; + tmp = ((PyObject*)p->__pyx_v_lattice); + p->__pyx_v_lattice = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_7_decode_lattice, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_BitSet, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -73271,7 +73222,7 @@ static PyTypeObject __pyx_type_3_sa_BitSet = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_BitSet, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -73284,56 +73235,57 @@ static PyTypeObject __pyx_type_3_sa_BitSet = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_PhraseLocation __pyx_vtable_4cdec_2sa_3_sa_PhraseLocation; -static PyObject *__pyx_tp_new_3_sa_Sampler(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_Sampler *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_PhraseLocation(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_Sampler *)o); - p->sa = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_7Sampler_1__cinit__(o, a, k) < 0)) { + p = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_PhraseLocation; + p->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(o, a, k) < 0)) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_3_sa_Sampler(PyObject *o) { - struct __pyx_obj_3_sa_Sampler *p = (struct __pyx_obj_3_sa_Sampler *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_PhraseLocation(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->sa); + Py_CLEAR(p->arr); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa_Sampler(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_PhraseLocation(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_Sampler *p = (struct __pyx_obj_3_sa_Sampler *)o; - if (p->sa) { - e = (*v)(((PyObject*)p->sa), a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o; + if (p->arr) { + e = (*v)(((PyObject*)p->arr), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa_Sampler(PyObject *o) { - struct __pyx_obj_3_sa_Sampler *p = (struct __pyx_obj_3_sa_Sampler *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_PhraseLocation(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o; PyObject* tmp; - tmp = ((PyObject*)p->sa); - p->sa = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->arr); + p->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa_Sampler[] = { - {__Pyx_NAMESTR("sample"), (PyCFunction)__pyx_pw_3_sa_7Sampler_3sample, METH_O, __Pyx_DOCSTR(__pyx_doc_3_sa_7Sampler_2sample)}, +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_PhraseLocation[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_Sampler = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_PhraseLocation = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.Sampler"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_Sampler), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.PhraseLocation"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_Sampler, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_PhraseLocation, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -73353,14 +73305,14 @@ static PyTypeObject __pyx_type_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*/ - __pyx_tp_traverse_3_sa_Sampler, /*tp_traverse*/ - __pyx_tp_clear_3_sa_Sampler, /*tp_clear*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_PhraseLocation, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_PhraseLocation, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_Sampler, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_PhraseLocation, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -73370,7 +73322,7 @@ static PyTypeObject __pyx_type_3_sa_Sampler = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_Sampler, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_PhraseLocation, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -73383,44 +73335,54 @@ static PyTypeObject __pyx_type_3_sa_Sampler = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_StringMap __pyx_vtable_3_sa_StringMap; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer __pyx_vtable_4cdec_2sa_3_sa_Scorer; -static PyObject *__pyx_tp_new_3_sa_StringMap(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa_StringMap *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Scorer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_StringMap *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_StringMap; - if (unlikely(__pyx_pw_3_sa_9StringMap_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; - } + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Scorer; + p->models = Py_None; Py_INCREF(Py_None); return o; } -static void __pyx_tp_dealloc_3_sa_StringMap(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_3_sa_9StringMap_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Scorer(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p = (struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->models); (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_3_sa_StringMap[] = { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Scorer(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p = (struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o; + if (p->models) { + e = (*v)(p->models, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_Scorer(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p = (struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o; + PyObject* tmp; + tmp = ((PyObject*)p->models); + p->models = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Scorer[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_StringMap = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Scorer = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.StringMap"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_StringMap), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.Scorer"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Scorer), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_StringMap, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_Scorer, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -73439,15 +73401,15 @@ static PyTypeObject __pyx_type_3_sa_StringMap = { 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_Scorer, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Scorer, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_StringMap, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_Scorer, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -73455,9 +73417,9 @@ static PyTypeObject __pyx_type_3_sa_StringMap = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_4cdec_2sa_3_sa_6Scorer_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_StringMap, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_Scorer, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -73471,97 +73433,55 @@ static PyTypeObject __pyx_type_3_sa_StringMap = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *__pyx_freelist_3_sa___pyx_scope_struct_26_get_f_phrases[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_26_get_f_phrases = 0; - -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_26_get_f_phrases(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Sampler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_26_get_f_phrases > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_26_get_f_phrases[--__pyx_freecount_3_sa___pyx_scope_struct_26_get_f_phrases]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_7Sampler_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *)o); - p->__pyx_v_extract = 0; - p->__pyx_v_f_len = 0; - p->__pyx_v_f_words = 0; - p->__pyx_v_phrases = 0; - p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_26_get_f_phrases(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *p = (struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Sampler(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p = (struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_extract); - Py_CLEAR(p->__pyx_v_f_len); - Py_CLEAR(p->__pyx_v_f_words); - Py_CLEAR(p->__pyx_v_phrases); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_3_sa___pyx_scope_struct_26_get_f_phrases < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases))) { - __pyx_freelist_3_sa___pyx_scope_struct_26_get_f_phrases[__pyx_freecount_3_sa___pyx_scope_struct_26_get_f_phrases++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } + Py_CLEAR(p->sa); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_26_get_f_phrases(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Sampler(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *p = (struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *)o; - if (p->__pyx_v_extract) { - e = (*v)(p->__pyx_v_extract, a); if (e) return e; - } - if (p->__pyx_v_f_len) { - e = (*v)(p->__pyx_v_f_len, a); if (e) return e; - } - if (p->__pyx_v_f_words) { - e = (*v)(p->__pyx_v_f_words, a); if (e) return e; - } - if (p->__pyx_v_phrases) { - e = (*v)(p->__pyx_v_phrases, a); if (e) return e; - } - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p = (struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o; + if (p->sa) { + e = (*v)(((PyObject*)p->sa), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_26_get_f_phrases(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *p = (struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_Sampler(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p = (struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_extract); - p->__pyx_v_extract = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f_len); - p->__pyx_v_f_len = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f_words); - p->__pyx_v_f_words = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_phrases); - p->__pyx_v_phrases = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->sa); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_26_get_f_phrases[] = { +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_26_get_f_phrases = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Sampler = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_26_get_f_phrases"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_26_get_f_phrases), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.Sampler"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Sampler), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_Sampler, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -73580,15 +73500,15 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_26_get_f_phrases = { 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_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_clear*/ + 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*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_Sampler, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Sampler, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_Sampler, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -73598,7 +73518,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_26_get_f_phrases = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_Sampler, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -73611,73 +73531,96 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_26_get_f_phrases = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet __pyx_vtable_4cdec_2sa_3_sa_Alphabet; -static PyObject *__pyx_tp_new_3_sa_TrieNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa_TrieNode *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Alphabet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_TrieNode *)o); - p->children = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_8TrieNode_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Alphabet; + p->terminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + p->nonterminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_8Alphabet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_3_sa_TrieNode(PyObject *o) { - struct __pyx_obj_3_sa_TrieNode *p = (struct __pyx_obj_3_sa_TrieNode *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Alphabet(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->children); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_8Alphabet_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->terminals); + Py_CLEAR(p->nonterminals); + Py_CLEAR(p->id2sym); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa_TrieNode(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Alphabet(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_TrieNode *p = (struct __pyx_obj_3_sa_TrieNode *)o; - if (p->children) { - e = (*v)(p->children, a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o; + if (p->terminals) { + e = (*v)(((PyObject*)p->terminals), a); if (e) return e; + } + if (p->nonterminals) { + e = (*v)(((PyObject*)p->nonterminals), a); if (e) return e; + } + if (p->id2sym) { + e = (*v)(p->id2sym, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa_TrieNode(PyObject *o) { - struct __pyx_obj_3_sa_TrieNode *p = (struct __pyx_obj_3_sa_TrieNode *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_Alphabet(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o; PyObject* tmp; - tmp = ((PyObject*)p->children); - p->children = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->terminals); + p->terminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->nonterminals); + p->nonterminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->id2sym); + p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyObject *__pyx_getprop_3_sa_8TrieNode_children(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_8TrieNode_8children_1__get__(o); +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_8Alphabet_terminals(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_8Alphabet_9terminals_1__get__(o); } -static int __pyx_setprop_3_sa_8TrieNode_children(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3_sa_8TrieNode_8children_3__set__(o, v); - } - else { - return __pyx_pw_3_sa_8TrieNode_8children_5__del__(o); - } +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_8Alphabet_nonterminals(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_8Alphabet_12nonterminals_1__get__(o); } -static PyMethodDef __pyx_methods_3_sa_TrieNode[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Alphabet[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_3_sa_TrieNode[] = { - {(char *)"children", __pyx_getprop_3_sa_8TrieNode_children, __pyx_setprop_3_sa_8TrieNode_children, 0, 0}, +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Alphabet[] = { + {(char *)"terminals", __pyx_getprop_4cdec_2sa_3_sa_8Alphabet_terminals, 0, 0, 0}, + {(char *)"nonterminals", __pyx_getprop_4cdec_2sa_3_sa_8Alphabet_nonterminals, 0, 0, 0}, {0, 0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_TrieNode = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Alphabet = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.TrieNode"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_TrieNode), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.Alphabet"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_TrieNode, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_Alphabet, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -73698,15 +73641,15 @@ static PyTypeObject __pyx_type_3_sa_TrieNode = { 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_3_sa_TrieNode, /*tp_traverse*/ - __pyx_tp_clear_3_sa_TrieNode, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_Alphabet, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Alphabet, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_TrieNode, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_Alphabet, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_3_sa_TrieNode, /*tp_getset*/ + __pyx_getsets_4cdec_2sa_3_sa_Alphabet, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -73714,7 +73657,7 @@ static PyTypeObject __pyx_type_3_sa_TrieNode = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_TrieNode, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_Alphabet, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -73727,119 +73670,365 @@ static PyTypeObject __pyx_type_3_sa_TrieNode = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex __pyx_vtable_4cdec_2sa_3_sa_BiLex; -static PyObject *__pyx_tp_new_3_sa_ExtendedTrieNode(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_ExtendedTrieNode *p; - PyObject *o = __pyx_tp_new_3_sa_TrieNode(t, a, k); +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BiLex(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_ExtendedTrieNode *)o); - p->phrase = Py_None; Py_INCREF(Py_None); - p->phrase_location = Py_None; Py_INCREF(Py_None); - p->suffix_link = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_16ExtendedTrieNode_1__cinit__(o, a, k) < 0)) { + p = ((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_BiLex; + p->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + p->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + p->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->id2eword = Py_None; Py_INCREF(Py_None); + p->id2fword = Py_None; Py_INCREF(Py_None); + p->eword2id = Py_None; Py_INCREF(Py_None); + p->fword2id = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(o, a, k) < 0)) { Py_DECREF(o); o = 0; } return o; } -static void __pyx_tp_dealloc_3_sa_ExtendedTrieNode(PyObject *o) { - struct __pyx_obj_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_3_sa_ExtendedTrieNode *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_BiLex(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p = (struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->phrase); - Py_CLEAR(p->phrase_location); - Py_CLEAR(p->suffix_link); - PyObject_GC_Track(o); - __pyx_tp_dealloc_3_sa_TrieNode(o); + Py_CLEAR(p->col1); + Py_CLEAR(p->col2); + Py_CLEAR(p->f_index); + Py_CLEAR(p->e_index); + Py_CLEAR(p->id2eword); + Py_CLEAR(p->id2fword); + Py_CLEAR(p->eword2id); + Py_CLEAR(p->fword2id); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_BiLex(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p = (struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o; + if (p->col1) { + e = (*v)(((PyObject*)p->col1), a); if (e) return e; + } + if (p->col2) { + e = (*v)(((PyObject*)p->col2), a); if (e) return e; + } + if (p->f_index) { + e = (*v)(((PyObject*)p->f_index), a); if (e) return e; + } + if (p->e_index) { + e = (*v)(((PyObject*)p->e_index), a); if (e) return e; + } + if (p->id2eword) { + e = (*v)(p->id2eword, a); if (e) return e; + } + if (p->id2fword) { + e = (*v)(p->id2fword, a); if (e) return e; + } + if (p->eword2id) { + e = (*v)(p->eword2id, a); if (e) return e; + } + if (p->fword2id) { + e = (*v)(p->fword2id, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_BiLex(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p = (struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o; + PyObject* tmp; + tmp = ((PyObject*)p->col1); + p->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->col2); + p->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->f_index); + p->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->e_index); + p->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->id2eword); + p->id2eword = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->id2fword); + p->id2fword = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->eword2id); + p->eword2id = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->fword2id); + p->fword2id = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +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("get_e_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_f_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_score"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_5BiLex_16write_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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_BiLex), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_BiLex, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_BiLex, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_BiLex, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_BiLex, /*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_BiLex, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray __pyx_vtable_4cdec_2sa_3_sa_DataArray; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_DataArray(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_DataArray; + p->word2id = Py_None; Py_INCREF(Py_None); + p->id2word = Py_None; Py_INCREF(Py_None); + p->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9DataArray_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_DataArray(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->word2id); + Py_CLEAR(p->id2word); + Py_CLEAR(p->data); + Py_CLEAR(p->sent_id); + Py_CLEAR(p->sent_index); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa_ExtendedTrieNode(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_DataArray(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_3_sa_ExtendedTrieNode *)o; - e = __pyx_tp_traverse_3_sa_TrieNode(o, v, a); if (e) return e; - if (p->phrase) { - e = (*v)(p->phrase, a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o; + if (p->word2id) { + e = (*v)(p->word2id, a); if (e) return e; } - if (p->phrase_location) { - e = (*v)(p->phrase_location, a); if (e) return e; + if (p->id2word) { + e = (*v)(p->id2word, a); if (e) return e; } - if (p->suffix_link) { - e = (*v)(p->suffix_link, a); if (e) return e; + if (p->data) { + e = (*v)(((PyObject*)p->data), a); if (e) return e; + } + if (p->sent_id) { + e = (*v)(((PyObject*)p->sent_id), a); if (e) return e; + } + if (p->sent_index) { + e = (*v)(((PyObject*)p->sent_index), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa_ExtendedTrieNode(PyObject *o) { - struct __pyx_obj_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_3_sa_ExtendedTrieNode *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_DataArray(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o; PyObject* tmp; - __pyx_tp_clear_3_sa_TrieNode(o); - tmp = ((PyObject*)p->phrase); - p->phrase = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->word2id); + p->word2id = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->phrase_location); - p->phrase_location = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->id2word); + p->id2word = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->suffix_link); - p->suffix_link = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->data); + p->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sent_id); + p->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sent_index); + p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } +static PyObject *__pyx_sq_item_4cdec_2sa_3_sa_DataArray(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_2sa_3_sa_9DataArray_word2id(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_word2id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_5__del__(o); + } +} -static PyObject *__pyx_getprop_3_sa_16ExtendedTrieNode_phrase(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_1__get__(o); +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_id2word(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_1__get__(o); } -static int __pyx_setprop_3_sa_16ExtendedTrieNode_phrase(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { +static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_id2word(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_3__set__(o, v); + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_3__set__(o, v); } else { - return __pyx_pw_3_sa_16ExtendedTrieNode_6phrase_5__del__(o); + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_5__del__(o); } } -static PyObject *__pyx_getprop_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(o); +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_data(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_1__get__(o); } -static int __pyx_setprop_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { +static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_data(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(o, v); + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_3__set__(o, v); } else { - return __pyx_pw_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(o); + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_5__del__(o); } } -static PyObject *__pyx_getprop_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(o); +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_id(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_1__get__(o); } -static int __pyx_setprop_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { +static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { - return __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(o, v); + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_3__set__(o, v); } else { - return __pyx_pw_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(o); + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_5__del__(o); } } -static PyMethodDef __pyx_methods_3_sa_ExtendedTrieNode[] = { +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_index(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_index(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_5__del__(o); + } +} + +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)}, {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_3_sa_ExtendedTrieNode[] = { - {(char *)"phrase", __pyx_getprop_3_sa_16ExtendedTrieNode_phrase, __pyx_setprop_3_sa_16ExtendedTrieNode_phrase, 0, 0}, - {(char *)"phrase_location", __pyx_getprop_3_sa_16ExtendedTrieNode_phrase_location, __pyx_setprop_3_sa_16ExtendedTrieNode_phrase_location, 0, 0}, - {(char *)"suffix_link", __pyx_getprop_3_sa_16ExtendedTrieNode_suffix_link, __pyx_setprop_3_sa_16ExtendedTrieNode_suffix_link, 0, 0}, +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_DataArray[] = { + {(char *)"word2id", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_word2id, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_word2id, 0, 0}, + {(char *)"id2word", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_id2word, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_id2word, 0, 0}, + {(char *)"data", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_data, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_data, 0, 0}, + {(char *)"sent_id", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_id, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_id, 0, 0}, + {(char *)"sent_index", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_index, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_index, 0, 0}, {0, 0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_ExtendedTrieNode = { +static PySequenceMethods __pyx_tp_as_sequence_DataArray = { + __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4cdec_2sa_3_sa_DataArray, /*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_DataArray = { + __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__, /*mp_length*/ + __pyx_pw_4cdec_2sa_3_sa_9DataArray_11__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_DataArray = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.ExtendedTrieNode"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_ExtendedTrieNode), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.DataArray"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_DataArray), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_ExtendedTrieNode, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_DataArray, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -73850,8 +74039,8 @@ static PyTypeObject __pyx_type_3_sa_ExtendedTrieNode = { #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ + &__pyx_tp_as_sequence_DataArray, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_DataArray, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ @@ -73860,15 +74049,15 @@ static PyTypeObject __pyx_type_3_sa_ExtendedTrieNode = { 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_3_sa_ExtendedTrieNode, /*tp_traverse*/ - __pyx_tp_clear_3_sa_ExtendedTrieNode, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_DataArray, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_DataArray, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_ExtendedTrieNode, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_DataArray, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_3_sa_ExtendedTrieNode, /*tp_getset*/ + __pyx_getsets_4cdec_2sa_3_sa_DataArray, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -73876,7 +74065,7 @@ static PyTypeObject __pyx_type_3_sa_ExtendedTrieNode = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_ExtendedTrieNode, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_DataArray, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -73889,47 +74078,29 @@ static PyTypeObject __pyx_type_3_sa_ExtendedTrieNode = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_TrieMap __pyx_vtable_3_sa_TrieMap; -static PyObject *__pyx_tp_new_3_sa_TrieMap(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_TrieMap *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BitSetIterator(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_3_sa_TrieMap *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_TrieMap; - if (unlikely(__pyx_pw_3_sa_7TrieMap_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } return o; } -static void __pyx_tp_dealloc_3_sa_TrieMap(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_3_sa_7TrieMap_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_BitSetIterator(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_3_sa_TrieMap[] = { - {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_3_sa_7TrieMap_5insert, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("contains"), (PyCFunction)__pyx_pw_3_sa_7TrieMap_7contains, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("toMap"), (PyCFunction)__pyx_pw_3_sa_7TrieMap_9toMap, METH_O, __Pyx_DOCSTR(0)}, +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_TrieMap = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BitSetIterator = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.TrieMap"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_TrieMap), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.BitSetIterator"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_TrieMap, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_BitSetIterator, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -73955,8 +74126,8 @@ static PyTypeObject __pyx_type_3_sa_TrieMap = { 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3_sa_TrieMap, /*tp_methods*/ + __pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_BitSetIterator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -73966,7 +74137,7 @@ static PyTypeObject __pyx_type_3_sa_TrieMap = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_TrieMap, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_BitSetIterator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -73979,130 +74150,201 @@ static PyTypeObject __pyx_type_3_sa_TrieMap = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory; -static struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_8_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_8_genexpr = 0; - -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_8_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_8_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_8_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_8_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_HieroCachingRuleFactory; + p->rules = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)Py_None); Py_INCREF(Py_None); + p->sampler = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)Py_None); Py_INCREF(Py_None); + p->scorer = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)Py_None); Py_INCREF(Py_None); + p->precomputed_index = Py_None; Py_INCREF(Py_None); + p->precomputed_collocations = Py_None; Py_INCREF(Py_None); + p->precompute_file = Py_None; Py_INCREF(Py_None); + p->max_rank = Py_None; Py_INCREF(Py_None); + p->prev_norm_prefix = Py_None; Py_INCREF(Py_None); + p->fsa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); + p->fda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + p->eda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + p->alignment = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)Py_None); Py_INCREF(Py_None); + p->eid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->fid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->findexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->findexes1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->online_stats = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_arc = 0; - p->__pyx_v_dist = 0; - p->__pyx_v_node = 0; - p->__pyx_v_sym = 0; - p->__pyx_v_weight = 0; - p->__pyx_t_0 = 0; - p->__pyx_t_3 = 0; - p->__pyx_t_4 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_8_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_arc); - Py_CLEAR(p->__pyx_v_dist); - Py_CLEAR(p->__pyx_v_node); - Py_CLEAR(p->__pyx_v_sym); - Py_CLEAR(p->__pyx_v_weight); - Py_CLEAR(p->__pyx_t_0); - Py_CLEAR(p->__pyx_t_3); - Py_CLEAR(p->__pyx_t_4); - if ((__pyx_freecount_3_sa___pyx_scope_struct_8_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_8_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_8_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } + Py_CLEAR(p->rules); + Py_CLEAR(p->sampler); + Py_CLEAR(p->scorer); + Py_CLEAR(p->precomputed_index); + Py_CLEAR(p->precomputed_collocations); + Py_CLEAR(p->precompute_file); + Py_CLEAR(p->max_rank); + Py_CLEAR(p->prev_norm_prefix); + Py_CLEAR(p->fsa); + Py_CLEAR(p->fda); + Py_CLEAR(p->eda); + Py_CLEAR(p->alignment); + Py_CLEAR(p->eid2symid); + Py_CLEAR(p->fid2symid); + Py_CLEAR(p->findexes); + Py_CLEAR(p->findexes1); + Py_CLEAR(p->online_stats); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o; + if (p->rules) { + e = (*v)(((PyObject*)p->rules), a); if (e) return e; } - if (p->__pyx_v_arc) { - e = (*v)(p->__pyx_v_arc, a); if (e) return e; + if (p->sampler) { + e = (*v)(((PyObject*)p->sampler), a); if (e) return e; } - if (p->__pyx_v_dist) { - e = (*v)(p->__pyx_v_dist, a); if (e) return e; + if (p->scorer) { + e = (*v)(((PyObject*)p->scorer), a); if (e) return e; } - if (p->__pyx_v_node) { - e = (*v)(p->__pyx_v_node, a); if (e) return e; + if (p->precomputed_index) { + e = (*v)(p->precomputed_index, a); if (e) return e; } - if (p->__pyx_v_sym) { - e = (*v)(p->__pyx_v_sym, a); if (e) return e; + if (p->precomputed_collocations) { + e = (*v)(p->precomputed_collocations, a); if (e) return e; } - if (p->__pyx_v_weight) { - e = (*v)(p->__pyx_v_weight, a); if (e) return e; + if (p->precompute_file) { + e = (*v)(p->precompute_file, a); if (e) return e; } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; + if (p->max_rank) { + e = (*v)(p->max_rank, a); if (e) return e; } - if (p->__pyx_t_3) { - e = (*v)(p->__pyx_t_3, a); if (e) return e; + if (p->prev_norm_prefix) { + e = (*v)(p->prev_norm_prefix, a); if (e) return e; } - if (p->__pyx_t_4) { - e = (*v)(p->__pyx_t_4, a); if (e) return e; + if (p->fsa) { + e = (*v)(((PyObject*)p->fsa), a); if (e) return e; + } + if (p->fda) { + e = (*v)(((PyObject*)p->fda), a); if (e) return e; + } + if (p->eda) { + e = (*v)(((PyObject*)p->eda), a); if (e) return e; + } + if (p->alignment) { + e = (*v)(((PyObject*)p->alignment), a); if (e) return e; + } + if (p->eid2symid) { + e = (*v)(((PyObject*)p->eid2symid), a); if (e) return e; + } + if (p->fid2symid) { + e = (*v)(((PyObject*)p->fid2symid), a); if (e) return e; + } + if (p->findexes) { + e = (*v)(((PyObject*)p->findexes), a); if (e) return e; + } + if (p->findexes1) { + e = (*v)(((PyObject*)p->findexes1), a); if (e) return e; + } + if (p->online_stats) { + e = (*v)(p->online_stats, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_8_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_7_decode_lattice *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->rules); + p->rules = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_arc); - p->__pyx_v_arc = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->sampler); + p->sampler = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_dist); - p->__pyx_v_dist = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->scorer); + p->scorer = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_node); - p->__pyx_v_node = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->precomputed_index); + p->precomputed_index = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_sym); - p->__pyx_v_sym = Py_None; Py_INCREF(Py_None); + tmp = ((PyObject*)p->precomputed_collocations); + p->precomputed_collocations = 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); + tmp = ((PyObject*)p->precompute_file); + p->precompute_file = 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->max_rank); + p->max_rank = 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->prev_norm_prefix); + p->prev_norm_prefix = 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); + tmp = ((PyObject*)p->fsa); + p->fsa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->fda); + p->fda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->eda); + p->eda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->alignment); + p->alignment = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->eid2symid); + p->eid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->fid2symid); + p->fid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->findexes); + p->findexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->findexes1); + p->findexes1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->online_stats); + p->online_stats = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_8_genexpr[] = { +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)}, {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_8_genexpr = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_8_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_8_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.HieroCachingRuleFactory"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_8_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -74121,15 +74363,15 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_8_genexpr = { 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_3_sa___pyx_scope_struct_8_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_8_genexpr, /*tp_clear*/ + 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*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_8_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -74139,7 +74381,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_8_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_8_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -74153,73 +74395,65 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_8_genexpr = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *__pyx_freelist_3_sa___pyx_scope_struct_4_make_lattice[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_4_make_lattice = 0; +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 PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_4_make_lattice(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_4_make_lattice > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_4_make_lattice[--__pyx_freecount_3_sa___pyx_scope_struct_4_make_lattice]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice)); + 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__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)o); - p->__pyx_v_word_ids = 0; - p->__pyx_v_words = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *)o); + p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)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; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_word_ids); - Py_CLEAR(p->__pyx_v_words); - if ((__pyx_freecount_3_sa___pyx_scope_struct_4_make_lattice < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice))) { - __pyx_freelist_3_sa___pyx_scope_struct_4_make_lattice[__pyx_freecount_3_sa___pyx_scope_struct_4_make_lattice++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)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); } else { (*Py_TYPE(o)->tp_free)(o); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)o; - if (p->__pyx_v_word_ids) { - e = (*v)(p->__pyx_v_word_ids, a); if (e) return e; - } - if (p->__pyx_v_words) { - e = (*v)(p->__pyx_v_words, a); if (e) return 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; + if (p->__pyx_v_self) { + e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)o; +static int __pyx_tp_clear_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; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_word_ids); - p->__pyx_v_word_ids = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_words); - p->__pyx_v_words = Py_None; Py_INCREF(Py_None); + 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 PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_4_make_lattice[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_28___str__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_4_make_lattice = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_4_make_lattice"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice), /*tp_basicsize*/ + __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*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_4_make_lattice, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -74240,13 +74474,13 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_4_make_lattice = { 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_3_sa___pyx_scope_struct_4_make_lattice, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_4_make_lattice, /*tp_clear*/ + __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*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_4_make_lattice, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -74256,7 +74490,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_4_make_lattice = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_4_make_lattice, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -74269,116 +74503,135 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_4_make_lattice = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_3_sa_Phrase __pyx_vtable_3_sa_Phrase; -static PyObject *__pyx_tp_new_3_sa_Phrase(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_Phrase *p; +static 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[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_Phrase *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_Phrase; - if (unlikely(__pyx_pw_3_sa_6Phrase_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o); + p->__pyx_v_ngram = 0; + p->__pyx_v_ngram_start = 0; + p->__pyx_v_ngram_starts = 0; + p->__pyx_v_run_start = 0; + p->__pyx_v_self = 0; + p->__pyx_v_veb = 0; return o; } -static void __pyx_tp_dealloc_3_sa_Phrase(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_3_sa_6Phrase_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_ngram); + Py_CLEAR(p->__pyx_v_ngram_start); + Py_CLEAR(p->__pyx_v_ngram_starts); + 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))) { + __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); } - (*Py_TYPE(o)->tp_free)(o); } -static PyObject *__pyx_sq_item_3_sa_Phrase(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_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o; + if (p->__pyx_v_ngram) { + e = (*v)(p->__pyx_v_ngram, a); if (e) return e; + } + if (p->__pyx_v_ngram_start) { + e = (*v)(((PyObject*)p->__pyx_v_ngram_start), a); if (e) return e; + } + if (p->__pyx_v_ngram_starts) { + e = (*v)(p->__pyx_v_ngram_starts, a); if (e) return e; + } + if (p->__pyx_v_run_start) { + e = (*v)(((PyObject*)p->__pyx_v_run_start), 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_veb) { + e = (*v)(((PyObject*)p->__pyx_v_veb), a); if (e) return e; + } + return 0; } -static PyObject *__pyx_getprop_3_sa_6Phrase_words(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_6Phrase_5words_1__get__(o); +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_ngram); + p->__pyx_v_ngram = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_ngram_start); + p->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_ngram_starts); + p->__pyx_v_ngram_starts = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_run_start); + p->__pyx_v_run_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)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_LCP *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_veb); + p->__pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; } -static PyMethodDef __pyx_methods_3_sa_Phrase[] = { - {__Pyx_NAMESTR("handle"), (PyCFunction)__pyx_pw_3_sa_6Phrase_7handle, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3_sa_6Phrase_6handle)}, - {__Pyx_NAMESTR("strhandle"), (PyCFunction)__pyx_pw_3_sa_6Phrase_9strhandle, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("arity"), (PyCFunction)__pyx_pw_3_sa_6Phrase_11arity, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getvarpos"), (PyCFunction)__pyx_pw_3_sa_6Phrase_13getvarpos, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getvar"), (PyCFunction)__pyx_pw_3_sa_6Phrase_15getvar, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("clen"), (PyCFunction)__pyx_pw_3_sa_6Phrase_17clen, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("getchunk"), (PyCFunction)__pyx_pw_3_sa_6Phrase_19getchunk, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("subst"), (PyCFunction)__pyx_pw_3_sa_6Phrase_32subst, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats[] = { {0, 0, 0, 0} }; -static struct PyGetSetDef __pyx_getsets_3_sa_Phrase[] = { - {(char *)"words", __pyx_getprop_3_sa_6Phrase_words, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_Phrase = { - __pyx_pw_3_sa_6Phrase_25__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_3_sa_Phrase, /*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_Phrase = { - __pyx_pw_3_sa_6Phrase_25__len__, /*mp_length*/ - __pyx_pw_3_sa_6Phrase_27__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_3_sa_Phrase = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.Phrase"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_Phrase), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa_Phrase, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - __pyx_pw_3_sa_6Phrase_21__cmp__, /*tp_compare*/ + 0, /*tp_compare*/ #else 0, /*reserved*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_Phrase, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_Phrase, /*tp_as_mapping*/ - __pyx_pw_3_sa_6Phrase_23__hash__, /*tp_hash*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_3_sa_6Phrase_5__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_2sa_3_sa___pyx_scope_struct_3_compute_stats, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_3_sa_6Phrase_29__iter__, /*tp_iter*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_Phrase, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_3_sa_Phrase, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -74386,7 +74639,7 @@ static PyTypeObject __pyx_type_3_sa_Phrase = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_Phrase, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -74400,65 +74653,81 @@ static PyTypeObject __pyx_type_3_sa_Phrase = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *__pyx_freelist_3_sa___pyx_scope_struct_27___iter__[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_27___iter__ = 0; +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr = 0; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_27___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_27___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_27___iter__[--__pyx_freecount_3_sa___pyx_scope_struct_27___iter__]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__)); + 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)))) { + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *)o); - p->__pyx_v_self = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_sym = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_27___iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_self); - if ((__pyx_freecount_3_sa___pyx_scope_struct_27___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__))) { - __pyx_freelist_3_sa___pyx_scope_struct_27___iter__[__pyx_freecount_3_sa___pyx_scope_struct_27___iter__++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *)o); + 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))) { + __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); } } -static int __pyx_tp_traverse_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_14_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *)o; - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_sym) { + e = (*v)(p->__pyx_v_sym, 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_3_sa___pyx_scope_struct_27___iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__ *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sym); + p->__pyx_v_sym = 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_3_sa___pyx_scope_struct_27___iter__[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_27___iter__ = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_27___iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_27___iter__), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa___pyx_scope_struct_27___iter__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -74479,13 +74748,13 @@ static PyTypeObject __pyx_type_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_3_sa___pyx_scope_struct_27___iter__, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_27___iter__, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_27___iter__, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -74495,7 +74764,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_27___iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_27___iter__, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -74509,65 +74778,65 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_27___iter__ = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *__pyx_freelist_3_sa___pyx_scope_struct____iter__[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct____iter__ = 0; +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct____iter__[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct____iter__ = 0; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct____iter__)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct____iter__[--__pyx_freecount_3_sa___pyx_scope_struct____iter__]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct____iter__)); + 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__)))) { + 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__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o); + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *)o); p->__pyx_v_self = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct____iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyObject *o) { + 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_3_sa___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct____iter__))) { - __pyx_freelist_3_sa___pyx_scope_struct____iter__[__pyx_freecount_3_sa___pyx_scope_struct____iter__++] = ((struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o); + 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__))) { + __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); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___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_3_sa___pyx_scope_struct____iter__(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_3_sa___pyx_scope_struct____iter__ *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyObject *o) { + 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* tmp; tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->__pyx_v_self = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct____iter__[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct____iter__[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct____iter__ = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct____iter__ = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct____iter__"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct____iter__), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa___pyx_scope_struct____iter__, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct____iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -74588,13 +74857,13 @@ static PyTypeObject __pyx_type_3_sa___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_3_sa___pyx_scope_struct____iter__, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct____iter__, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct____iter__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct____iter__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct____iter__, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct____iter__, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -74604,7 +74873,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct____iter__ = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct____iter__, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct____iter__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -74618,102 +74887,129 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct____iter__ = { #endif }; -static PyObject *__pyx_tp_new_3_sa_TrieTable(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_TrieTable *p; +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_TrieTable *)o); - p->root = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_3_sa_9TrieTable_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_8_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_arc = 0; + p->__pyx_v_dist = 0; + p->__pyx_v_node = 0; + p->__pyx_v_sym = 0; + p->__pyx_v_weight = 0; + p->__pyx_t_0 = 0; + p->__pyx_t_3 = 0; + p->__pyx_t_4 = 0; return o; } -static void __pyx_tp_dealloc_3_sa_TrieTable(PyObject *o) { - struct __pyx_obj_3_sa_TrieTable *p = (struct __pyx_obj_3_sa_TrieTable *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->root); - (*Py_TYPE(o)->tp_free)(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_arc); + Py_CLEAR(p->__pyx_v_dist); + Py_CLEAR(p->__pyx_v_node); + Py_CLEAR(p->__pyx_v_sym); + Py_CLEAR(p->__pyx_v_weight); + 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))) { + __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); + } } -static int __pyx_tp_traverse_3_sa_TrieTable(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa_TrieTable *p = (struct __pyx_obj_3_sa_TrieTable *)o; - if (p->root) { - e = (*v)(p->root, a); if (e) return e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } - return 0; -} - -static int __pyx_tp_clear_3_sa_TrieTable(PyObject *o) { - struct __pyx_obj_3_sa_TrieTable *p = (struct __pyx_obj_3_sa_TrieTable *)o; - PyObject* tmp; - tmp = ((PyObject*)p->root); - p->root = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_3_sa_9TrieTable_extended(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_9TrieTable_8extended_1__get__(o); -} - -static int __pyx_setprop_3_sa_9TrieTable_extended(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3_sa_9TrieTable_8extended_3__set__(o, v); + if (p->__pyx_v_arc) { + e = (*v)(p->__pyx_v_arc, a); if (e) return e; } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; + if (p->__pyx_v_dist) { + e = (*v)(p->__pyx_v_dist, a); if (e) return e; } -} - -static PyObject *__pyx_getprop_3_sa_9TrieTable_count(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_9TrieTable_5count_1__get__(o); -} - -static int __pyx_setprop_3_sa_9TrieTable_count(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3_sa_9TrieTable_5count_3__set__(o, v); + if (p->__pyx_v_node) { + e = (*v)(p->__pyx_v_node, a); if (e) return e; } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; + if (p->__pyx_v_sym) { + e = (*v)(p->__pyx_v_sym, a); if (e) return e; } -} - -static PyObject *__pyx_getprop_3_sa_9TrieTable_root(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_3_sa_9TrieTable_4root_1__get__(o); -} - -static int __pyx_setprop_3_sa_9TrieTable_root(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_3_sa_9TrieTable_4root_3__set__(o, v); + if (p->__pyx_v_weight) { + e = (*v)(p->__pyx_v_weight, a); if (e) return e; } - else { - return __pyx_pw_3_sa_9TrieTable_4root_5__del__(o); + 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; + } + if (p->__pyx_t_4) { + e = (*v)(p->__pyx_t_4, a); if (e) return e; + } + return 0; } -static PyMethodDef __pyx_methods_3_sa_TrieTable[] = { - {0, 0, 0, 0} -}; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_arc); + p->__pyx_v_arc = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_dist); + p->__pyx_v_dist = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_node); + p->__pyx_v_node = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sym); + p->__pyx_v_sym = 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_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); + tmp = ((PyObject*)p->__pyx_t_4); + p->__pyx_t_4 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} -static struct PyGetSetDef __pyx_getsets_3_sa_TrieTable[] = { - {(char *)"extended", __pyx_getprop_3_sa_9TrieTable_extended, __pyx_setprop_3_sa_9TrieTable_extended, 0, 0}, - {(char *)"count", __pyx_getprop_3_sa_9TrieTable_count, __pyx_setprop_3_sa_9TrieTable_count, 0, 0}, - {(char *)"root", __pyx_getprop_3_sa_9TrieTable_root, __pyx_setprop_3_sa_9TrieTable_root, 0, 0}, - {0, 0, 0, 0, 0} +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr[] = { + {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa_TrieTable = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.TrieTable"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_TrieTable), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa_TrieTable, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -74732,17 +75028,17 @@ static PyTypeObject __pyx_type_3_sa_TrieTable = { 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_3_sa_TrieTable, /*tp_traverse*/ - __pyx_tp_clear_3_sa_TrieTable, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa_TrieTable, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_methods*/ 0, /*tp_members*/ - __pyx_getsets_3_sa_TrieTable, /*tp_getset*/ + 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -74750,7 +75046,7 @@ static PyTypeObject __pyx_type_3_sa_TrieTable = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa_TrieTable, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -74764,81 +75060,62 @@ static PyTypeObject __pyx_type_3_sa_TrieTable = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_5_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_5_genexpr = 0; - -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *p; +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BitSet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_5_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_5_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_6BitSet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_word = 0; - p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_5_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_5_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_3_sa___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_5_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_BitSet(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_6BitSet_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); } + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_word) { - e = (*v)(p->__pyx_v_word, a); if (e) return e; - } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } - return 0; -} +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)}, + {0, 0, 0, 0} +}; -static int __pyx_tp_clear_3_sa___pyx_scope_struct_5_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_4_make_lattice *)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); - 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 PySequenceMethods __pyx_tp_as_sequence_BitSet = { + __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + __pyx_pw_4cdec_2sa_3_sa_6BitSet_19__contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_5_genexpr[] = { - {0, 0, 0, 0} +static PyMappingMethods __pyx_tp_as_mapping_BitSet = { + __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_5_genexpr = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BitSet = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_5_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_5_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("cdec.sa._sa.BitSet"), /*tp_name*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_BitSet), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa___pyx_scope_struct_5_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_BitSet, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -74849,23 +75126,23 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_5_genexpr = { #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ + &__pyx_tp_as_sequence_BitSet, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BitSet, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_pw_4cdec_2sa_3_sa_6BitSet_11__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_3_sa___pyx_scope_struct_5_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_5_genexpr, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ + __pyx_pw_4cdec_2sa_3_sa_6BitSet_5__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_5_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa_BitSet, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -74875,7 +75152,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_5_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_5_genexpr, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa_BitSet, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -74889,89 +75166,65 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_5_genexpr = { #endif }; -static struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *__pyx_freelist_3_sa___pyx_scope_struct_10_genexpr[8]; -static int __pyx_freecount_3_sa___pyx_scope_struct_10_genexpr = 0; +static 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[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence = 0; -static PyObject *__pyx_tp_new_3_sa___pyx_scope_struct_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *p; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *p; PyObject *o; - if (likely((__pyx_freecount_3_sa___pyx_scope_struct_10_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr)))) { - o = (PyObject*)__pyx_freelist_3_sa___pyx_scope_struct_10_genexpr[--__pyx_freecount_3_sa___pyx_scope_struct_10_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr)); + 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)))) { + 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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } - p = ((struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v__ = 0; - p->__pyx_v_sym = 0; - p->__pyx_t_0 = 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)o); + p->__pyx_v_lattice = 0; return o; } -static void __pyx_tp_dealloc_3_sa___pyx_scope_struct_10_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)o; +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o) { + 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_outer_scope); - Py_CLEAR(p->__pyx_v__); - Py_CLEAR(p->__pyx_v_sym); - Py_CLEAR(p->__pyx_t_0); - if ((__pyx_freecount_3_sa___pyx_scope_struct_10_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr))) { - __pyx_freelist_3_sa___pyx_scope_struct_10_genexpr[__pyx_freecount_3_sa___pyx_scope_struct_10_genexpr++] = ((struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)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))) { + __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); } } -static int __pyx_tp_traverse_3_sa___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v__) { - e = (*v)(p->__pyx_v__, a); if (e) return e; - } - if (p->__pyx_v_sym) { - e = (*v)(p->__pyx_v_sym, 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_2sa_3_sa___pyx_scope_struct_9_decode_sentence *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)o; + if (p->__pyx_v_lattice) { + e = (*v)(p->__pyx_v_lattice, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_3_sa___pyx_scope_struct_10_genexpr(PyObject *o) { - struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr *)o; +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o) { + 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* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_3_sa___pyx_scope_struct_9_decode_sentence *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v__); - p->__pyx_v__ = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_sym); - p->__pyx_v_sym = 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_lattice); + p->__pyx_v_lattice = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_3_sa___pyx_scope_struct_10_genexpr[] = { +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence[] = { {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_10_genexpr = { +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.__pyx_scope_struct_10_genexpr"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa___pyx_scope_struct_10_genexpr), /*tp_basicsize*/ + __Pyx_NAMESTR("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_3_sa___pyx_scope_struct_10_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -74992,13 +75245,13 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_10_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_3_sa___pyx_scope_struct_10_genexpr, /*tp_traverse*/ - __pyx_tp_clear_3_sa___pyx_scope_struct_10_genexpr, /*tp_clear*/ + __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_3_sa___pyx_scope_struct_10_genexpr, /*tp_methods*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -75008,134 +75261,7 @@ static PyTypeObject __pyx_type_3_sa___pyx_scope_struct_10_genexpr = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_3_sa___pyx_scope_struct_10_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_3_sa_FloatList __pyx_vtable_3_sa_FloatList; - -static PyObject *__pyx_tp_new_3_sa_FloatList(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_3_sa_FloatList *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_3_sa_FloatList *)o); - p->__pyx_vtab = __pyx_vtabptr_3_sa_FloatList; - if (unlikely(__pyx_pw_3_sa_9FloatList_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_3_sa_FloatList(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_3_sa_9FloatList_3__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_3_sa_FloatList(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_3_sa_FloatList(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_3_sa_9FloatList_7__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_3_sa_FloatList[] = { - {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_3_sa_9FloatList_11append, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pw_3_sa_9FloatList_13write, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_3_sa_9FloatList_15read, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_FloatList = { - __pyx_pw_3_sa_9FloatList_9__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_3_sa_FloatList, /*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_FloatList = { - __pyx_pw_3_sa_9FloatList_9__len__, /*mp_length*/ - __pyx_pw_3_sa_9FloatList_5__getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_3_sa_FloatList, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_3_sa_FloatList = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_sa.FloatList"), /*tp_name*/ - sizeof(struct __pyx_obj_3_sa_FloatList), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_3_sa_FloatList, /*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_FloatList, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_FloatList, /*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*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_3_sa_FloatList, /*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_3_sa_FloatList, /*tp_new*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -75174,13 +75300,13 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, - {&__pyx_kp_s_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 1, 0}, - {&__pyx_kp_s_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 0, 1, 0}, - {&__pyx_n_s_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 0, 1, 1}, - {&__pyx_n_s_106, __pyx_k_106, sizeof(__pyx_k_106), 0, 0, 1, 1}, - {&__pyx_kp_s_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 0, 1, 0}, - {&__pyx_n_s_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 0, 1, 1}, - {&__pyx_kp_s_111, __pyx_k_111, sizeof(__pyx_k_111), 0, 0, 1, 0}, + {&__pyx_n_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 1}, + {&__pyx_n_s_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 1, 1}, + {&__pyx_kp_s_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 0, 1, 0}, + {&__pyx_kp_s_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 0, 1, 0}, + {&__pyx_n_s_107, __pyx_k_107, sizeof(__pyx_k_107), 0, 0, 1, 1}, + {&__pyx_n_s_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 0, 1, 1}, + {&__pyx_kp_s_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 0, 1, 0}, {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0}, {&__pyx_kp_s_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 0, 1, 0}, {&__pyx_kp_s_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 0, 1, 0}, @@ -75191,13 +75317,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_119, __pyx_k_119, sizeof(__pyx_k_119), 0, 0, 1, 0}, {&__pyx_kp_s_120, __pyx_k_120, sizeof(__pyx_k_120), 0, 0, 1, 0}, {&__pyx_kp_s_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 0, 1, 0}, - {&__pyx_n_s_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 0, 1, 1}, - {&__pyx_kp_s_123, __pyx_k_123, sizeof(__pyx_k_123), 0, 0, 1, 0}, - {&__pyx_n_s_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 0, 1, 1}, - {&__pyx_kp_s_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 0, 1, 0}, - {&__pyx_n_s_127, __pyx_k_127, sizeof(__pyx_k_127), 0, 0, 1, 1}, + {&__pyx_kp_s_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 0, 1, 0}, + {&__pyx_n_s_123, __pyx_k_123, sizeof(__pyx_k_123), 0, 0, 1, 1}, + {&__pyx_kp_s_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 0, 1, 0}, + {&__pyx_n_s_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 0, 1, 1}, + {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0}, {&__pyx_n_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 1}, - {&__pyx_kp_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 0}, + {&__pyx_n_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 1}, {&__pyx_kp_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 0}, {&__pyx_kp_s_131, __pyx_k_131, sizeof(__pyx_k_131), 0, 0, 1, 0}, {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0}, @@ -75209,21 +75335,19 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0}, {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0}, {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, - {&__pyx_kp_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 0}, - {&__pyx_n_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 1}, - {&__pyx_n_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 1}, - {&__pyx_kp_s_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 0, 1, 0}, + {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0}, + {&__pyx_kp_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0}, + {&__pyx_n_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 1}, + {&__pyx_n_s_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 0, 1, 1}, {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, {&__pyx_kp_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 0}, {&__pyx_kp_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 0}, - {&__pyx_kp_s_153, __pyx_k_153, sizeof(__pyx_k_153), 0, 0, 1, 0}, - {&__pyx_kp_s_157, __pyx_k_157, sizeof(__pyx_k_157), 0, 0, 1, 0}, - {&__pyx_n_s_163, __pyx_k_163, sizeof(__pyx_k_163), 0, 0, 1, 1}, - {&__pyx_n_s_166, __pyx_k_166, sizeof(__pyx_k_166), 0, 0, 1, 1}, - {&__pyx_kp_s_167, __pyx_k_167, sizeof(__pyx_k_167), 0, 0, 1, 0}, - {&__pyx_kp_s_169, __pyx_k_169, sizeof(__pyx_k_169), 0, 0, 1, 0}, - {&__pyx_kp_s_172, __pyx_k_172, sizeof(__pyx_k_172), 0, 0, 1, 0}, - {&__pyx_kp_s_176, __pyx_k_176, sizeof(__pyx_k_176), 0, 0, 1, 0}, + {&__pyx_n_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 1}, + {&__pyx_n_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 1}, + {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0}, + {&__pyx_kp_s_158, __pyx_k_158, sizeof(__pyx_k_158), 0, 0, 1, 0}, + {&__pyx_kp_s_161, __pyx_k_161, sizeof(__pyx_k_161), 0, 0, 1, 0}, + {&__pyx_kp_s_165, __pyx_k_165, sizeof(__pyx_k_165), 0, 0, 1, 0}, {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, @@ -75276,12 +75400,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s__0, __pyx_k__0, sizeof(__pyx_k__0), 0, 0, 1, 0}, {&__pyx_kp_s__1, __pyx_k__1, sizeof(__pyx_k__1), 0, 0, 1, 0}, {&__pyx_n_s__Counter, __pyx_k__Counter, sizeof(__pyx_k__Counter), 0, 0, 1, 1}, - {&__pyx_n_s__E, __pyx_k__E, sizeof(__pyx_k__E), 0, 0, 1, 1}, {&__pyx_n_s__END_OF_FILE, __pyx_k__END_OF_FILE, sizeof(__pyx_k__END_OF_FILE), 0, 0, 1, 1}, {&__pyx_n_s__END_OF_LINE, __pyx_k__END_OF_LINE, sizeof(__pyx_k__END_OF_LINE), 0, 0, 1, 1}, {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1}, - {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1}, - {&__pyx_n_s__FE, __pyx_k__FE, sizeof(__pyx_k__FE), 0, 0, 1, 1}, {&__pyx_n_s__FeatureContext, __pyx_k__FeatureContext, sizeof(__pyx_k__FeatureContext), 0, 0, 1, 1}, {&__pyx_n_s__GzipFile, __pyx_k__GzipFile, sizeof(__pyx_k__GzipFile), 0, 0, 1, 1}, {&__pyx_n_s__INCREMENT, __pyx_k__INCREMENT, sizeof(__pyx_k__INCREMENT), 0, 0, 1, 1}, @@ -75301,7 +75422,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s___columns, __pyx_k___columns, sizeof(__pyx_k___columns), 0, 0, 1, 1}, {&__pyx_n_s___doquicksort, __pyx_k___doquicksort, sizeof(__pyx_k___doquicksort), 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__advance, __pyx_k__advance, sizeof(__pyx_k__advance), 0, 0, 1, 1}, {&__pyx_n_s__al, __pyx_k__al, sizeof(__pyx_k__al), 0, 0, 1, 1}, @@ -75326,6 +75446,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__col, __pyx_k__col, sizeof(__pyx_k__col), 0, 0, 1, 1}, {&__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__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_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}, @@ -75333,7 +75454,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__decode_words, __pyx_k__decode_words, sizeof(__pyx_k__decode_words), 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__dump_online_rules, __pyx_k__dump_online_rules, sizeof(__pyx_k__dump_online_rules), 0, 0, 1, 1}, {&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1}, {&__pyx_n_s__e_i, __pyx_k__e_i, sizeof(__pyx_k__e_i), 0, 0, 1, 1}, {&__pyx_n_s__e_j, __pyx_k__e_j, sizeof(__pyx_k__e_j), 0, 0, 1, 1}, @@ -75357,9 +75477,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__f_text, __pyx_k__f_text, sizeof(__pyx_k__f_text), 0, 0, 1, 1}, {&__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__fe, __pyx_k__fe, sizeof(__pyx_k__fe), 0, 0, 1, 1}, {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1}, - {&__pyx_n_s__fmt_rule, __pyx_k__fmt_rule, sizeof(__pyx_k__fmt_rule), 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__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}, @@ -75462,6 +75580,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__pattern2phrase_plus, __pyx_k__pattern2phrase_plus, sizeof(__pyx_k__pattern2phrase_plus), 0, 0, 1, 1}, {&__pyx_n_s__phrase, __pyx_k__phrase, sizeof(__pyx_k__phrase), 0, 0, 1, 1}, {&__pyx_n_s__phrase_location, __pyx_k__phrase_location, sizeof(__pyx_k__phrase_location), 0, 0, 1, 1}, + {&__pyx_n_s__phrases_al, __pyx_k__phrases_al, sizeof(__pyx_k__phrases_al), 0, 0, 1, 1}, + {&__pyx_n_s__phrases_e, __pyx_k__phrases_e, sizeof(__pyx_k__phrases_e), 0, 0, 1, 1}, + {&__pyx_n_s__phrases_f, __pyx_k__phrases_f, sizeof(__pyx_k__phrases_f), 0, 0, 1, 1}, + {&__pyx_n_s__phrases_fe, __pyx_k__phrases_fe, sizeof(__pyx_k__phrases_fe), 0, 0, 1, 1}, {&__pyx_n_s__plus_links, __pyx_k__plus_links, sizeof(__pyx_k__plus_links), 0, 0, 1, 1}, {&__pyx_n_s__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1}, {&__pyx_n_s__precompute, __pyx_k__precompute, sizeof(__pyx_k__precompute), 0, 0, 1, 1}, @@ -75487,6 +75609,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__sample, __pyx_k__sample, sizeof(__pyx_k__sample), 0, 0, 1, 1}, {&__pyx_n_s__sample_size, __pyx_k__sample_size, sizeof(__pyx_k__sample_size), 0, 0, 1, 1}, {&__pyx_n_s__sampler, __pyx_k__sampler, sizeof(__pyx_k__sampler), 0, 0, 1, 1}, + {&__pyx_n_s__samples_f, __pyx_k__samples_f, sizeof(__pyx_k__samples_f), 0, 0, 1, 1}, {&__pyx_n_s__sarray, __pyx_k__sarray, sizeof(__pyx_k__sarray), 0, 0, 1, 1}, {&__pyx_n_s__scorer, __pyx_k__scorer, sizeof(__pyx_k__scorer), 0, 0, 1, 1}, {&__pyx_n_s__scores, __pyx_k__scores, sizeof(__pyx_k__scores), 0, 0, 1, 1}, @@ -75547,9 +75670,9 @@ static int __Pyx_InitCachedBuiltins(void) { __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 = 363; __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 = 173; __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 = 971; __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 = 1148; __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_sorted = __Pyx_GetBuiltinName(__pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 976; __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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -75559,7 +75682,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":20 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -75570,7 +75693,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":21 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -75581,7 +75704,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":22 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":22 * self.data = IntList(1000,1000) * self.sent_id = IntList(1000,1000) * self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -75592,7 +75715,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":66 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":66 * f.write("%s " % self.get_word(w_id)) * if w_id == 1: * f.write("\n") # <<<<<<<<<<<<<< @@ -75603,7 +75726,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_16); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -75614,7 +75737,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":69 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69 * * def read_text(self, char* filename): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -75625,7 +75748,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_18); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":74 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -75636,7 +75759,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_20); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73 * * def read_bitext(self, char* filename, int side): * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< @@ -75647,7 +75770,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_21); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":130 + /* "/home/mdenkows/cdec/python/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:]: # <<<<<<<<<<<<<< @@ -75658,7 +75781,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_slice_22); __Pyx_GIVEREF(__pyx_k_slice_22); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":144 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":144 * for i in self.data: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -75669,7 +75792,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":147 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":147 * for i in self.sent_index: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -75680,7 +75803,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":150 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":150 * for i in self.sent_id: * f.write("%d " %i) * f.write("\n") # <<<<<<<<<<<<<< @@ -75691,7 +75814,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_26); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":153 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":153 * for word in self.id2word: * f.write("%s %d " % (word, self.word2id[word])) * f.write("\n") # <<<<<<<<<<<<<< @@ -75702,7 +75825,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_28); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/data_array.pxi":156 + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -75712,7 +75835,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_30); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":48 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":48 * * def __cinit__(self, from_binary=None, from_text=None): * self.links = IntList(1000,1000) # <<<<<<<<<<<<<< @@ -75723,7 +75846,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_31); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":49 + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< @@ -75734,7 +75857,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_32); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":61 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":61 * pairs = line.split() * for pair in pairs: * (i, j) = map(int, pair.split('-')) # <<<<<<<<<<<<<< @@ -75745,7 +75868,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_34); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":56 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56 * * def read_text(self, char* filename): * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -75756,7 +75879,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_35); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":77 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":77 * for i, link in enumerate(self.links): * while i >= self.sent_index[sent_num]: * f.write("\n") # <<<<<<<<<<<<<< @@ -75767,7 +75890,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_36); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":80 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":80 * sent_num = sent_num + 1 * f.write("%d-%d " % self.unlink(link)) * f.write("\n") # <<<<<<<<<<<<<< @@ -75778,7 +75901,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_38); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":73 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73 * * def write_text(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -75789,40 +75912,40 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_39); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":94 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":93 * for link in self.links: * f.write("%d " % link) * f.write("\n") # <<<<<<<<<<<<<< * for i in self.sent_index: * f.write("%d " % i) */ - __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_40); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":97 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":96 * for i in self.sent_index: * f.write("%d " % i) * f.write("\n") # <<<<<<<<<<<<<< * * def alignment(self, i): */ - __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_41); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":90 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * sent_num = 1 * for link in self.links: + * f.write("%d " % link) */ __pyx_k_tuple_42 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_42); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":297 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":297 * * # Re-read file, placing words into buckets * f.seek(0) # <<<<<<<<<<<<<< @@ -75833,7 +75956,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_45); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":273 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273 * * fcount = IntList() * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< @@ -75844,7 +75967,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_46); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":339 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":339 * * if i > j: * raise Exception("Sort error in CLex") # <<<<<<<<<<<<<< @@ -75855,7 +75978,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_49); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":362 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":362 * for i in self.f_index: * f.write("%d " % i) * f.write("\n") # <<<<<<<<<<<<<< @@ -75866,7 +75989,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_51); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":365 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":365 * for i, s1, s2 in zip(self.e_index, self.col1, self.col2): * f.write("%d %f %f " % (i, s1, s2)) * f.write("\n") # <<<<<<<<<<<<<< @@ -75877,7 +76000,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_53); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":368 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":368 * for i, w in enumerate(self.id2fword): * f.write("%d %s " % (i, w)) * f.write("\n") # <<<<<<<<<<<<<< @@ -75888,7 +76011,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_55); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":371 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":371 * for i, w in enumerate(self.id2eword): * f.write("%d %s " % (i, w)) * f.write("\n") # <<<<<<<<<<<<<< @@ -75899,7 +76022,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_56); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":359 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -75910,7 +76033,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_57); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":404 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404 * cdef i, N, e_id, f_id * * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -75921,7 +76044,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_59); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":13 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":13 * cdef IntList rank * * logger.info("Constructing LCP array") # <<<<<<<<<<<<<< @@ -75932,7 +76055,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_63); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/lcp.pxi":34 + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":34 * if h > 0: * h = h-1 * logger.info("LCP array completed") # <<<<<<<<<<<<<< @@ -75943,7 +76066,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_65); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":297 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":297 * pattern_rank = {} * * logger.info("Precomputing frequent intersections") # <<<<<<<<<<<<<< @@ -75954,7 +76077,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_75); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":314 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":314 * queue = IntList(increment=1000) * * logger.info(" Computing inverted indexes...") # <<<<<<<<<<<<<< @@ -75965,7 +76088,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_77); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":329 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":329 * trie_node_data_append(node, i) * * logger.info(" Computing collocations...") # <<<<<<<<<<<<<< @@ -75976,7 +76099,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_79); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":393 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":393 * for pattern2 in J_set: * if len(pattern1) + len(pattern2) + 1 < self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -75987,7 +76110,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_81); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":400 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":400 * x = x+1 * if len(pattern1) + len(pattern2) + 1 <= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -75998,7 +76121,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_82); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":407 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":407 * x = x+2 * if len(pattern1) + len(pattern2) + 1<= self.max_length: * combined_pattern = pattern1 + (-1,) + pattern2 # <<<<<<<<<<<<<< @@ -76009,7 +76132,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_83); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/precomputation.pxi":409 + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":409 * combined_pattern = pattern1 + (-1,) + pattern2 * IJ_set.add(combined_pattern) * combined_pattern = pattern2 + (-1,) + pattern1 # <<<<<<<<<<<<<< @@ -76020,7 +76143,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_84); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":94 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":94 * * '''Step 3: read off suffix array from inverse suffix array''' * logger.info(" Finalizing sort...") # <<<<<<<<<<<<<< @@ -76031,7 +76154,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_95); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":193 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":193 * for a_i in self.sa: * f.write("%d " % a_i) * f.write("\n") # <<<<<<<<<<<<<< @@ -76042,7 +76165,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_98); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":196 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":196 * for w_i in self.ha: * f.write("%d " % w_i) * f.write("\n") # <<<<<<<<<<<<<< @@ -76053,7 +76176,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_99); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/suffix_array.pxi":189 + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189 * * def write_enhanced(self, char* filename): * with open(filename, "w") as f: # <<<<<<<<<<<<<< @@ -76064,344 +76187,245 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_100); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":119 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":144 * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) * else: * logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<< * * def sample(self, PhraseLocation phrase_location): */ - __pyx_k_tuple_104 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_103)); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_104); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104)); + __pyx_k_tuple_106 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_105)); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_106); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":339 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":357 * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) * if alignment is None: * raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<< * self.alignment = alignment * */ - __pyx_k_tuple_109 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_108)); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_109); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109)); + __pyx_k_tuple_111 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_110)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_111); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1064 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1069 * else: * #ERROR: We never get here * raise Exception("Keyword trie error") # <<<<<<<<<<<<<< * # checking whether lookup_required * if lookup_required: */ - __pyx_k_tuple_126 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_125)); if (unlikely(!__pyx_k_tuple_126)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_126); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_126)); + __pyx_k_tuple_127 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_126)); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_127); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_127)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1982 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1988 * 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_k_slice_140 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_140)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_140); - __Pyx_GIVEREF(__pyx_k_slice_140); + __pyx_k_slice_141 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_141)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_141); + __Pyx_GIVEREF(__pyx_k_slice_141); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":1919 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1925 * # 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_k_tuple_141 = PyTuple_Pack(19, ((PyObject *)__pyx_n_s__f_i), ((PyObject *)__pyx_n_s__f_j), ((PyObject *)__pyx_n_s__e_i), ((PyObject *)__pyx_n_s__e_j), ((PyObject *)__pyx_n_s__min_bound), ((PyObject *)__pyx_n_s__wc), ((PyObject *)__pyx_n_s__links), ((PyObject *)__pyx_n_s__nt), ((PyObject *)__pyx_n_s__nt_open), ((PyObject *)__pyx_n_s__link_i), ((PyObject *)__pyx_n_s__link_j), ((PyObject *)__pyx_n_s__new_e_i), ((PyObject *)__pyx_n_s__new_e_j), ((PyObject *)__pyx_n_s__new_min_bound), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__nt_collision), ((PyObject *)__pyx_n_s__link), ((PyObject *)__pyx_n_s__plus_links), ((PyObject *)__pyx_n_s__old_last_nt)); if (unlikely(!__pyx_k_tuple_141)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_141); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_141)); - __pyx_k_codeobj_142 = (PyObject*)__Pyx_PyCode_New(9, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_141, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_143, __pyx_n_s__extract, 1919, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_142)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_142 = PyTuple_Pack(19, ((PyObject *)__pyx_n_s__f_i), ((PyObject *)__pyx_n_s__f_j), ((PyObject *)__pyx_n_s__e_i), ((PyObject *)__pyx_n_s__e_j), ((PyObject *)__pyx_n_s__min_bound), ((PyObject *)__pyx_n_s__wc), ((PyObject *)__pyx_n_s__links), ((PyObject *)__pyx_n_s__nt), ((PyObject *)__pyx_n_s__nt_open), ((PyObject *)__pyx_n_s__link_i), ((PyObject *)__pyx_n_s__link_j), ((PyObject *)__pyx_n_s__new_e_i), ((PyObject *)__pyx_n_s__new_e_j), ((PyObject *)__pyx_n_s__new_min_bound), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__nt_collision), ((PyObject *)__pyx_n_s__link), ((PyObject *)__pyx_n_s__plus_links), ((PyObject *)__pyx_n_s__old_last_nt)); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_142); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_142)); + __pyx_k_codeobj_143 = (PyObject*)__Pyx_PyCode_New(9, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__extract, 1925, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_143)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2039 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2047 * # Update phrase counts * for rule in rules: * (f_ph, e_ph, al) = rule[:3] # <<<<<<<<<<<<<< - * self.phrases_f[f_ph] += 1 - * self.phrases_e[e_ph] += 1 + * stats.phrases_f[f_ph] += 1 + * stats.phrases_e[e_ph] += 1 */ - __pyx_k_slice_145 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_k_slice_145)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_145); - __Pyx_GIVEREF(__pyx_k_slice_145); + __pyx_k_slice_146 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_k_slice_146)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_146); + __Pyx_GIVEREF(__pyx_k_slice_146); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2059 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2067 * # 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_k_slice_147 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_147)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_147); - __Pyx_GIVEREF(__pyx_k_slice_147); + __pyx_k_slice_148 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_148)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_148); + __Pyx_GIVEREF(__pyx_k_slice_148); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2069 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2077 * 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_k_slice_148 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_148)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_148); - __Pyx_GIVEREF(__pyx_k_slice_148); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2126 - * # Debugging - * def dump_online_stats(self): - * logger.info('------------------------------') # <<<<<<<<<<<<<< - * logger.info(' Online Stats ') - * logger.info('------------------------------') - */ - __pyx_k_tuple_152 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_151)); if (unlikely(!__pyx_k_tuple_152)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_152); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_152)); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2127 - * def dump_online_stats(self): - * logger.info('------------------------------') - * logger.info(' Online Stats ') # <<<<<<<<<<<<<< - * logger.info('------------------------------') - * logger.info('f') - */ - __pyx_k_tuple_154 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_153)); if (unlikely(!__pyx_k_tuple_154)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_154); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_154)); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2128 - * logger.info('------------------------------') - * logger.info(' Online Stats ') - * logger.info('------------------------------') # <<<<<<<<<<<<<< - * logger.info('f') - * for w in self.bilex_f: - */ - __pyx_k_tuple_155 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_151)); if (unlikely(!__pyx_k_tuple_155)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_155); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_155)); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2129 - * logger.info(' Online Stats ') - * logger.info('------------------------------') - * logger.info('f') # <<<<<<<<<<<<<< - * for w in self.bilex_f: - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w])) - */ - __pyx_k_tuple_156 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__f)); if (unlikely(!__pyx_k_tuple_156)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_156); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_156)); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2132 - * for w in self.bilex_f: - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w])) - * logger.info('e') # <<<<<<<<<<<<<< - * for w in self.bilex_e: - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w])) - */ - __pyx_k_tuple_158 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__e)); if (unlikely(!__pyx_k_tuple_158)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_158); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_158)); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2135 - * for w in self.bilex_e: - * logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w])) - * logger.info('fe') # <<<<<<<<<<<<<< - * for w in self.bilex_fe: - * for w2 in self.bilex_fe[w]: - */ - __pyx_k_tuple_159 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__fe)); if (unlikely(!__pyx_k_tuple_159)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_159); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_159)); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2139 - * for w2 in self.bilex_fe[w]: - * logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2])) - * logger.info('F') # <<<<<<<<<<<<<< - * for ph in self.phrases_f: - * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph])) - */ - __pyx_k_tuple_160 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__F)); if (unlikely(!__pyx_k_tuple_160)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_160); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_160)); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2142 - * for ph in self.phrases_f: - * logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph])) - * logger.info('E') # <<<<<<<<<<<<<< - * for ph in self.phrases_e: - * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph])) - */ - __pyx_k_tuple_161 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__E)); if (unlikely(!__pyx_k_tuple_161)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_161); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_161)); - - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2145 - * for ph in self.phrases_e: - * logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph])) - * logger.info('FE') # <<<<<<<<<<<<<< - * self.dump_online_rules() - * - */ - __pyx_k_tuple_162 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__FE)); if (unlikely(!__pyx_k_tuple_162)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_162); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_162)); + __pyx_k_slice_149 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_149)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_149); + __Pyx_GIVEREF(__pyx_k_slice_149); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2172 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152 * 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_k_tuple_164 = PyTuple_Pack(10, ((PyObject *)__pyx_n_s__f_i), ((PyObject *)__pyx_n_s__f_j), ((PyObject *)__pyx_n_s__lex_i), ((PyObject *)__pyx_n_s__lex_j), ((PyObject *)__pyx_n_s__wc), ((PyObject *)__pyx_n_s__ntc), ((PyObject *)__pyx_n_s__syms), ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__new_lex_i), ((PyObject *)__pyx_n_s__new_lex_j)); if (unlikely(!__pyx_k_tuple_164)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_164); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_164)); - __pyx_k_codeobj_165 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_164, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_143, __pyx_n_s__extract, 2172, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_165)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_153 = PyTuple_Pack(10, ((PyObject *)__pyx_n_s__f_i), ((PyObject *)__pyx_n_s__f_j), ((PyObject *)__pyx_n_s__lex_i), ((PyObject *)__pyx_n_s__lex_j), ((PyObject *)__pyx_n_s__wc), ((PyObject *)__pyx_n_s__ntc), ((PyObject *)__pyx_n_s__syms), ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__new_lex_i), ((PyObject *)__pyx_n_s__new_lex_j)); if (unlikely(!__pyx_k_tuple_153)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_153); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_153)); + __pyx_k_codeobj_154 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__extract, 2152, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_154)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_sa.pyx":5 + /* "cdec/sa/_sa.pyx":5 * import gzip * * def monitor_cpu(): # <<<<<<<<<<<<<< * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ * resource.getrusage(resource.RUSAGE_SELF).ru_stime) */ - __pyx_k_codeobj_168 = (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_169, __pyx_n_s__monitor_cpu, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_168)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_157 = (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_158, __pyx_n_s__monitor_cpu, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_157)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_sa.pyx":9 + /* "cdec/sa/_sa.pyx":9 * resource.getrusage(resource.RUSAGE_SELF).ru_stime) * * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< * if filename.endswith('.gz'): * return gzip.GzipFile(filename) */ - __pyx_k_tuple_170 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__filename), ((PyObject *)__pyx_n_s__filename)); if (unlikely(!__pyx_k_tuple_170)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_170); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_170)); - __pyx_k_codeobj_171 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_169, __pyx_n_s__gzip_or_text, 9, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_171)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_159 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__filename), ((PyObject *)__pyx_n_s__filename)); if (unlikely(!__pyx_k_tuple_159)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_159); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_159)); + __pyx_k_codeobj_160 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_159, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__gzip_or_text, 9, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_160)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_sa.pyx":15 + /* "cdec/sa/_sa.pyx":15 * return open(filename) * * logger = logging.getLogger('cdec.sa') # <<<<<<<<<<<<<< * * include "float_list.pxi" */ - __pyx_k_tuple_173 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_172)); if (unlikely(!__pyx_k_tuple_173)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_173); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_173)); + __pyx_k_tuple_162 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_161)); if (unlikely(!__pyx_k_tuple_162)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_162); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_162)); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":107 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107 * return ALPHABET.fromstring(string, terminal) * * def isvar(sym): # <<<<<<<<<<<<<< * return sym_isvar(sym) * */ - __pyx_k_tuple_174 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__sym)); if (unlikely(!__pyx_k_tuple_174)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_174); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_174)); - __pyx_k_codeobj_175 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_176, __pyx_n_s__isvar, 107, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_175)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_163 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__sym)); if (unlikely(!__pyx_k_tuple_163)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_163); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_163)); + __pyx_k_codeobj_164 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__isvar, 107, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_164)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":110 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110 * return sym_isvar(sym) * * def make_lattice(words): # <<<<<<<<<<<<<< * word_ids = (sym_fromstring(word, True) for word in words) * return tuple(((word, None, 1), ) for word in word_ids) */ - __pyx_k_tuple_177 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__words), ((PyObject *)__pyx_n_s__word_ids), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_177)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_177); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_177)); - __pyx_k_codeobj_178 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_176, __pyx_n_s__make_lattice, 110, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_178)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_166 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__words), ((PyObject *)__pyx_n_s__word_ids), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_166)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_166); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_166)); + __pyx_k_codeobj_167 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__make_lattice, 110, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_167)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":114 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114 * return tuple(((word, None, 1), ) for word in word_ids) * * 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_k_tuple_179 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__lattice), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_179); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_179)); - __pyx_k_codeobj_180 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_176, __pyx_n_s__decode_lattice, 114, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_180)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_168 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__lattice), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_168)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_168); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_168)); + __pyx_k_codeobj_169 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_lattice, 114, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_169)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":118 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118 * for arc in node for node in lattice) * * def decode_sentence(lattice): # <<<<<<<<<<<<<< * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) * */ - __pyx_k_tuple_181 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__lattice), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_181); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_181)); - __pyx_k_codeobj_182 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_176, __pyx_n_s__decode_sentence, 118, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_182)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_170 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__lattice), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_170)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_170); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_170)); + __pyx_k_codeobj_171 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_sentence, 118, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_171)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":121 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121 * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) * * def encode_words(words): # <<<<<<<<<<<<<< * return tuple(sym_fromstring(word, True) for word in words) * */ - __pyx_k_tuple_183 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__words), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_183)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_183); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_183)); - __pyx_k_codeobj_184 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_183, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_176, __pyx_n_s__encode_words, 121, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_184)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_172 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__words), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_172)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_172); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_172)); + __pyx_k_codeobj_173 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__encode_words, 121, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_173)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":124 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124 * return tuple(sym_fromstring(word, True) for word in words) * * def decode_words(syms): # <<<<<<<<<<<<<< * return tuple(sym_tostring(sym) for sym in syms) */ - __pyx_k_tuple_185 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__syms), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_185)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_185); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_185)); - __pyx_k_codeobj_186 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_185, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_176, __pyx_n_s__decode_words, 124, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_186)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_174 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__syms), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_174)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_174); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_174)); + __pyx_k_codeobj_175 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_words, 124, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_175)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2206 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2186 * * # Spans are _inclusive_ on both ends [i, j] * def span_check(vec, i, j): # <<<<<<<<<<<<<< * k = i * while k <= j: */ - __pyx_k_tuple_188 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_188)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_188); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_188)); - __pyx_k_codeobj_189 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_143, __pyx_n_s__span_check, 2206, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_189)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_177 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_177)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_177); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_177)); + __pyx_k_codeobj_178 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_check, 2186, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_178)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2214 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2194 * return True * * def span_inc(vec, i, j): # <<<<<<<<<<<<<< * k = i * while k <= j: */ - __pyx_k_tuple_190 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_190)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_190); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_190)); - __pyx_k_codeobj_191 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_143, __pyx_n_s__span_inc, 2214, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_191)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_179 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_179); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_179)); + __pyx_k_codeobj_180 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_inc, 2194, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_180)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/rulefactory.pxi":2220 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2200 * k += 1 * * def span_dec(vec, i, j): # <<<<<<<<<<<<<< * k = i * while k <= j: */ - __pyx_k_tuple_192 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_192)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_192); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_192)); - __pyx_k_codeobj_193 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_192, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_143, __pyx_n_s__span_dec, 2220, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_193)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_181 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_181); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_181)); + __pyx_k_codeobj_182 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_dec, 2200, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_182)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -76482,8 +76506,8 @@ PyMODINIT_FUNC PyInit__sa(void) #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, "_sa")) { - if (unlikely(PyDict_SetItemString(modules, "_sa", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "cdec.sa._sa")) { + if (unlikely(PyDict_SetItemString(modules, "cdec.sa._sa", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif @@ -76497,7 +76521,7 @@ PyMODINIT_FUNC PyInit__sa(void) #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__sa) { + 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;}; } /*--- Builtin init code ---*/ @@ -76505,250 +76529,253 @@ PyMODINIT_FUNC PyInit__sa(void) /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ - __pyx_v_3_sa_ALPHABET = ((struct __pyx_obj_3_sa_Alphabet *)Py_None); Py_INCREF(Py_None); - __pyx_v_3_sa_FD = ((struct __pyx_obj_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + __pyx_v_4cdec_2sa_3_sa_ALPHABET = ((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)Py_None); Py_INCREF(Py_None); + __pyx_v_4cdec_2sa_3_sa_FD = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); /*--- Variable export code ---*/ /*--- Function export code ---*/ - if (__Pyx_ExportFunction("sym_tostring", (void (*)(void))__pyx_f_3_sa_sym_tostring, "char *(int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("sym_tocat", (void (*)(void))__pyx_f_3_sa_sym_tocat, "char *(int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("sym_isvar", (void (*)(void))__pyx_f_3_sa_sym_isvar, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("sym_getindex", (void (*)(void))__pyx_f_3_sa_sym_getindex, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("sym_tostring", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_tostring, "char *(int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("sym_tocat", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_tocat, "char *(int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("sym_isvar", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_isvar, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("sym_getindex", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_getindex, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Type init code ---*/ - __pyx_vtabptr_3_sa_HieroCachingRuleFactory = &__pyx_vtable_3_sa_HieroCachingRuleFactory; - __pyx_vtable_3_sa_HieroCachingRuleFactory.set_idmap = (PyObject *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_3_sa_DataArray *))__pyx_f_3_sa_23HieroCachingRuleFactory_set_idmap; - __pyx_vtable_3_sa_HieroCachingRuleFactory.baeza_yates_helper = (int *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *))__pyx_f_3_sa_23HieroCachingRuleFactory_baeza_yates_helper; - __pyx_vtable_3_sa_HieroCachingRuleFactory.compare_matchings_set = (long (*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, int, int *, int, struct __pyx_t_3_sa_Matching *, int, int))__pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings_set; - __pyx_vtable_3_sa_HieroCachingRuleFactory.compare_matchings = (long (*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_t_3_sa_Matching *, struct __pyx_t_3_sa_Matching *, int, int))__pyx_f_3_sa_23HieroCachingRuleFactory_compare_matchings; - __pyx_vtable_3_sa_HieroCachingRuleFactory.merge_helper = (int *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *))__pyx_f_3_sa_23HieroCachingRuleFactory_merge_helper; - __pyx_vtable_3_sa_HieroCachingRuleFactory.sort_phrase_loc = (void (*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_3_sa_IntList *, struct __pyx_obj_3_sa_PhraseLocation *, struct __pyx_obj_3_sa_Phrase *))__pyx_f_3_sa_23HieroCachingRuleFactory_sort_phrase_loc; - __pyx_vtable_3_sa_HieroCachingRuleFactory.intersect_helper = (PyObject *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_3_sa_Phrase *, struct __pyx_obj_3_sa_Phrase *, struct __pyx_obj_3_sa_PhraseLocation *, struct __pyx_obj_3_sa_PhraseLocation *, int))__pyx_f_3_sa_23HieroCachingRuleFactory_intersect_helper; - __pyx_vtable_3_sa_HieroCachingRuleFactory.loc2str = (PyObject *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_3_sa_PhraseLocation *))__pyx_f_3_sa_23HieroCachingRuleFactory_loc2str; - __pyx_vtable_3_sa_HieroCachingRuleFactory.intersect = (struct __pyx_obj_3_sa_PhraseLocation *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, PyObject *, PyObject *, struct __pyx_obj_3_sa_Phrase *))__pyx_f_3_sa_23HieroCachingRuleFactory_intersect; - __pyx_vtable_3_sa_HieroCachingRuleFactory.find_fixpoint = (int (*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, PyObject *, int *, int *, int *, int *, int, int, int *, int *, int *, int *, int, int, int, int, int, int, int, int, int, int, int))__pyx_f_3_sa_23HieroCachingRuleFactory_find_fixpoint; - __pyx_vtable_3_sa_HieroCachingRuleFactory.find_projection = (PyObject *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int *))__pyx_f_3_sa_23HieroCachingRuleFactory_find_projection; - __pyx_vtable_3_sa_HieroCachingRuleFactory.int_arr_extend = (int *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int *, int *, int *, int))__pyx_f_3_sa_23HieroCachingRuleFactory_int_arr_extend; - __pyx_vtable_3_sa_HieroCachingRuleFactory.extract_phrases = (PyObject *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int, int, int, int *, int *, int *, int, int, int))__pyx_f_3_sa_23HieroCachingRuleFactory_extract_phrases; - __pyx_vtable_3_sa_HieroCachingRuleFactory.create_alignments = (struct __pyx_obj_3_sa_IntList *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, int *, int, struct __pyx_obj_3_sa_IntList *, struct __pyx_obj_3_sa_IntList *))__pyx_f_3_sa_23HieroCachingRuleFactory_create_alignments; - __pyx_vtable_3_sa_HieroCachingRuleFactory.extract = (PyObject *(*)(struct __pyx_obj_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_3_sa_Phrase *, struct __pyx_t_3_sa_Matching *, int *, int))__pyx_f_3_sa_23HieroCachingRuleFactory_extract; - if (PyType_Ready(&__pyx_type_3_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_HieroCachingRuleFactory.tp_dict, __pyx_vtabptr_3_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "HieroCachingRuleFactory", (PyObject *)&__pyx_type_3_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_HieroCachingRuleFactory = &__pyx_type_3_sa_HieroCachingRuleFactory; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_9_decode_sentence) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_9_decode_sentence = &__pyx_type_3_sa___pyx_scope_struct_9_decode_sentence; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_17_genexpr) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_17_genexpr = &__pyx_type_3_sa___pyx_scope_struct_17_genexpr; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_20_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_20_genexpr = &__pyx_type_3_sa___pyx_scope_struct_20_genexpr; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_3_compute_stats) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_3_compute_stats = &__pyx_type_3_sa___pyx_scope_struct_3_compute_stats; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_12_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_12_genexpr = &__pyx_type_3_sa___pyx_scope_struct_12_genexpr; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_29_genexpr) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_29_genexpr = &__pyx_type_3_sa___pyx_scope_struct_29_genexpr; - __pyx_vtabptr_3_sa_IntList = &__pyx_vtable_3_sa_IntList; - __pyx_vtable_3_sa_IntList.set = (void (*)(struct __pyx_obj_3_sa_IntList *, int, int))__pyx_f_3_sa_7IntList_set; - __pyx_vtable_3_sa_IntList._append = (void (*)(struct __pyx_obj_3_sa_IntList *, int))__pyx_f_3_sa_7IntList__append; - __pyx_vtable_3_sa_IntList._extend = (void (*)(struct __pyx_obj_3_sa_IntList *, struct __pyx_obj_3_sa_IntList *))__pyx_f_3_sa_7IntList__extend; - __pyx_vtable_3_sa_IntList._extend_arr = (void (*)(struct __pyx_obj_3_sa_IntList *, int *, int))__pyx_f_3_sa_7IntList__extend_arr; - __pyx_vtable_3_sa_IntList._clear = (void (*)(struct __pyx_obj_3_sa_IntList *))__pyx_f_3_sa_7IntList__clear; - __pyx_vtable_3_sa_IntList.write_handle = (void (*)(struct __pyx_obj_3_sa_IntList *, FILE *))__pyx_f_3_sa_7IntList_write_handle; - __pyx_vtable_3_sa_IntList.read_handle = (void (*)(struct __pyx_obj_3_sa_IntList *, FILE *))__pyx_f_3_sa_7IntList_read_handle; - if (PyType_Ready(&__pyx_type_3_sa_IntList) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_IntList.tp_dict, __pyx_vtabptr_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_3_sa_IntList) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_IntList = &__pyx_type_3_sa_IntList; - if (PyType_Ready(&__pyx_type_3_sa_VEBIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "VEBIterator", (PyObject *)&__pyx_type_3_sa_VEBIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_VEBIterator = &__pyx_type_3_sa_VEBIterator; - __pyx_vtabptr_3_sa_BiLex = &__pyx_vtable_3_sa_BiLex; - __pyx_vtable_3_sa_BiLex.compute_from_data = (PyObject *(*)(struct __pyx_obj_3_sa_BiLex *, struct __pyx_obj_3_sa_SuffixArray *, struct __pyx_obj_3_sa_DataArray *, struct __pyx_obj_3_sa_Alignment *))__pyx_f_3_sa_5BiLex_compute_from_data; - __pyx_vtable_3_sa_BiLex._add_node = (PyObject *(*)(struct __pyx_obj_3_sa_BiLex *, struct __pyx_t_3_sa__node *, int *, float, int *))__pyx_f_3_sa_5BiLex__add_node; - __pyx_vtable_3_sa_BiLex.write_wordlist = (PyObject *(*)(struct __pyx_obj_3_sa_BiLex *, PyObject *, FILE *))__pyx_f_3_sa_5BiLex_write_wordlist; - __pyx_vtable_3_sa_BiLex.read_wordlist = (PyObject *(*)(struct __pyx_obj_3_sa_BiLex *, PyObject *, PyObject *, FILE *))__pyx_f_3_sa_5BiLex_read_wordlist; - __pyx_vtable_3_sa_BiLex.swap = (PyObject *(*)(struct __pyx_obj_3_sa_BiLex *, int, int))__pyx_f_3_sa_5BiLex_swap; - __pyx_vtable_3_sa_BiLex.qsort = (PyObject *(*)(struct __pyx_obj_3_sa_BiLex *, int, int, PyObject *))__pyx_f_3_sa_5BiLex_qsort; - if (PyType_Ready(&__pyx_type_3_sa_BiLex) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_BiLex.tp_dict, __pyx_vtabptr_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_3_sa_BiLex) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_BiLex = &__pyx_type_3_sa_BiLex; - __pyx_vtabptr_3_sa_VEB = &__pyx_vtable_3_sa_VEB; - __pyx_vtable_3_sa_VEB._findsucc = (int (*)(struct __pyx_obj_3_sa_VEB *, int))__pyx_f_3_sa_3VEB__findsucc; - __pyx_vtable_3_sa_VEB._insert = (int (*)(struct __pyx_obj_3_sa_VEB *, int))__pyx_f_3_sa_3VEB__insert; - __pyx_vtable_3_sa_VEB._first = (int (*)(struct __pyx_obj_3_sa_VEB *))__pyx_f_3_sa_3VEB__first; - if (PyType_Ready(&__pyx_type_3_sa_VEB) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_VEB.tp_dict, __pyx_vtabptr_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_3_sa_VEB) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_VEB = &__pyx_type_3_sa_VEB; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_11_encode_words) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_11_encode_words = &__pyx_type_3_sa___pyx_scope_struct_11_encode_words; - if (PyType_Ready(&__pyx_type_3_sa_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "LCP", (PyObject *)&__pyx_type_3_sa_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_LCP = &__pyx_type_3_sa_LCP; - __pyx_vtabptr_3_sa_DataArray = &__pyx_vtable_3_sa_DataArray; - __pyx_vtable_3_sa_DataArray.read_handle = (void (*)(struct __pyx_obj_3_sa_DataArray *, FILE *))__pyx_f_3_sa_9DataArray_read_handle; - __pyx_vtable_3_sa_DataArray.write_handle = (void (*)(struct __pyx_obj_3_sa_DataArray *, FILE *))__pyx_f_3_sa_9DataArray_write_handle; - if (PyType_Ready(&__pyx_type_3_sa_DataArray) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_DataArray.tp_dict, __pyx_vtabptr_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_3_sa_DataArray) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_DataArray = &__pyx_type_3_sa_DataArray; - if (PyType_Ready(&__pyx_type_3_sa_BitSetIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BitSetIterator", (PyObject *)&__pyx_type_3_sa_BitSetIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_BitSetIterator = &__pyx_type_3_sa_BitSetIterator; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_23_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_23_genexpr = &__pyx_type_3_sa___pyx_scope_struct_23_genexpr; - __pyx_vtabptr_3_sa_Precomputation = &__pyx_vtable_3_sa_Precomputation; - __pyx_vtable_3_sa_Precomputation.read_map = (PyObject *(*)(struct __pyx_obj_3_sa_Precomputation *, FILE *))__pyx_f_3_sa_14Precomputation_read_map; - __pyx_vtable_3_sa_Precomputation.write_map = (PyObject *(*)(struct __pyx_obj_3_sa_Precomputation *, PyObject *, FILE *))__pyx_f_3_sa_14Precomputation_write_map; - if (PyType_Ready(&__pyx_type_3_sa_Precomputation) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_Precomputation.tp_dict, __pyx_vtabptr_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_3_sa_Precomputation) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_Precomputation = &__pyx_type_3_sa_Precomputation; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_18_alignments) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_18_alignments = &__pyx_type_3_sa___pyx_scope_struct_18_alignments; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_14_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_14_genexpr = &__pyx_type_3_sa___pyx_scope_struct_14_genexpr; - __pyx_vtabptr_3_sa_SuffixArray = &__pyx_vtable_3_sa_SuffixArray; - __pyx_vtable_3_sa_SuffixArray.__pyx___search_high = (int (*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int))__pyx_f_3_sa_11SuffixArray___search_high; - __pyx_vtable_3_sa_SuffixArray.__pyx___search_low = (int (*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int))__pyx_f_3_sa_11SuffixArray___search_low; - __pyx_vtable_3_sa_SuffixArray.__pyx___get_range = (PyObject *(*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int, int))__pyx_f_3_sa_11SuffixArray___get_range; - __pyx_vtable_3_sa_SuffixArray.__pyx___lookup_helper = (PyObject *(*)(struct __pyx_obj_3_sa_SuffixArray *, int, int, int, int))__pyx_f_3_sa_11SuffixArray___lookup_helper; - if (PyType_Ready(&__pyx_type_3_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_SuffixArray.tp_dict, __pyx_vtabptr_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_3_sa_SuffixArray) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_SuffixArray = &__pyx_type_3_sa_SuffixArray; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_16___str__) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_16___str__ = &__pyx_type_3_sa___pyx_scope_struct_16___str__; - __pyx_vtabptr_3_sa_Alphabet = &__pyx_vtable_3_sa_Alphabet; - __pyx_vtable_3_sa_Alphabet.isvar = (int (*)(struct __pyx_obj_3_sa_Alphabet *, int))__pyx_f_3_sa_8Alphabet_isvar; - __pyx_vtable_3_sa_Alphabet.isword = (int (*)(struct __pyx_obj_3_sa_Alphabet *, int))__pyx_f_3_sa_8Alphabet_isword; - __pyx_vtable_3_sa_Alphabet.getindex = (int (*)(struct __pyx_obj_3_sa_Alphabet *, int))__pyx_f_3_sa_8Alphabet_getindex; - __pyx_vtable_3_sa_Alphabet.setindex = (int (*)(struct __pyx_obj_3_sa_Alphabet *, int, int))__pyx_f_3_sa_8Alphabet_setindex; - __pyx_vtable_3_sa_Alphabet.clearindex = (int (*)(struct __pyx_obj_3_sa_Alphabet *, int))__pyx_f_3_sa_8Alphabet_clearindex; - __pyx_vtable_3_sa_Alphabet.match = (int (*)(struct __pyx_obj_3_sa_Alphabet *, int, int))__pyx_f_3_sa_8Alphabet_match; - __pyx_vtable_3_sa_Alphabet.tocat = (char *(*)(struct __pyx_obj_3_sa_Alphabet *, int))__pyx_f_3_sa_8Alphabet_tocat; - __pyx_vtable_3_sa_Alphabet.fromcat = (int (*)(struct __pyx_obj_3_sa_Alphabet *, char *))__pyx_f_3_sa_8Alphabet_fromcat; - __pyx_vtable_3_sa_Alphabet.tostring = (char *(*)(struct __pyx_obj_3_sa_Alphabet *, int))__pyx_f_3_sa_8Alphabet_tostring; - __pyx_vtable_3_sa_Alphabet.fromstring = (int (*)(struct __pyx_obj_3_sa_Alphabet *, char *, int))__pyx_f_3_sa_8Alphabet_fromstring; - if (PyType_Ready(&__pyx_type_3_sa_Alphabet) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_Alphabet.tp_dict, __pyx_vtabptr_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_3_sa_Alphabet) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_Alphabet = &__pyx_type_3_sa_Alphabet; - if (PyType_Ready(&__pyx_type_3_sa_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Rule", (PyObject *)&__pyx_type_3_sa_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_Rule = &__pyx_type_3_sa_Rule; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_6_genexpr = &__pyx_type_3_sa___pyx_scope_struct_6_genexpr; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_21_add_instance) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_21_add_instance = &__pyx_type_3_sa___pyx_scope_struct_21_add_instance; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_2_genexpr) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_2_genexpr = &__pyx_type_3_sa___pyx_scope_struct_2_genexpr; - __pyx_vtabptr_3_sa_PhraseLocation = &__pyx_vtable_3_sa_PhraseLocation; - __pyx_vtable_3_sa_PhraseLocation.contains = (int (*)(struct __pyx_obj_3_sa_PhraseLocation *, int))__pyx_f_3_sa_14PhraseLocation_contains; - if (PyType_Ready(&__pyx_type_3_sa_PhraseLocation) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_PhraseLocation.tp_dict, __pyx_vtabptr_3_sa_PhraseLocation) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PhraseLocation", (PyObject *)&__pyx_type_3_sa_PhraseLocation) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_PhraseLocation = &__pyx_type_3_sa_PhraseLocation; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_15___iter__) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_15___iter__ = &__pyx_type_3_sa___pyx_scope_struct_15___iter__; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_22_form_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_22_form_rule = &__pyx_type_3_sa___pyx_scope_struct_22_form_rule; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_25_genexpr = &__pyx_type_3_sa___pyx_scope_struct_25_genexpr; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_24_fmt_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_24_fmt_rule = &__pyx_type_3_sa___pyx_scope_struct_24_fmt_rule; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_28___str__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_28___str__ = &__pyx_type_3_sa___pyx_scope_struct_28___str__; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_1_read_bitext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_1_read_bitext = &__pyx_type_3_sa___pyx_scope_struct_1_read_bitext; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_13_decode_words) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_13_decode_words = &__pyx_type_3_sa___pyx_scope_struct_13_decode_words; - if (PyType_Ready(&__pyx_type_3_sa_FeatureVector) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "FeatureVector", (PyObject *)&__pyx_type_3_sa_FeatureVector) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_FeatureVector = &__pyx_type_3_sa_FeatureVector; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_7_decode_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_7_decode_lattice = &__pyx_type_3_sa___pyx_scope_struct_7_decode_lattice; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_19_input) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_19_input = &__pyx_type_3_sa___pyx_scope_struct_19_input; - __pyx_vtabptr_3_sa_Scorer = &__pyx_vtable_3_sa_Scorer; - __pyx_vtable_3_sa_Scorer.score = (struct __pyx_obj_3_sa_FeatureVector *(*)(struct __pyx_obj_3_sa_Scorer *, PyObject *))__pyx_f_3_sa_6Scorer_score; - if (PyType_Ready(&__pyx_type_3_sa_Scorer) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_Scorer.tp_dict, __pyx_vtabptr_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_3_sa_Scorer) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_Scorer = &__pyx_type_3_sa_Scorer; - __pyx_vtabptr_3_sa_Alignment = &__pyx_vtable_3_sa_Alignment; - __pyx_vtable_3_sa_Alignment.link = (int (*)(struct __pyx_obj_3_sa_Alignment *, int, int))__pyx_f_3_sa_9Alignment_link; - __pyx_vtable_3_sa_Alignment._unlink = (PyObject *(*)(struct __pyx_obj_3_sa_Alignment *, int, int *, int *))__pyx_f_3_sa_9Alignment__unlink; - __pyx_vtable_3_sa_Alignment._get_sent_links = (int *(*)(struct __pyx_obj_3_sa_Alignment *, int, int *))__pyx_f_3_sa_9Alignment__get_sent_links; - if (PyType_Ready(&__pyx_type_3_sa_Alignment) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_Alignment.tp_dict, __pyx_vtabptr_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_3_sa_Alignment) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_Alignment = &__pyx_type_3_sa_Alignment; - if (PyType_Ready(&__pyx_type_3_sa_BitSet) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BitSet", (PyObject *)&__pyx_type_3_sa_BitSet) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_BitSet = &__pyx_type_3_sa_BitSet; - if (PyType_Ready(&__pyx_type_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Sampler", (PyObject *)&__pyx_type_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_Sampler = &__pyx_type_3_sa_Sampler; - __pyx_vtabptr_3_sa_StringMap = &__pyx_vtable_3_sa_StringMap; - __pyx_vtable_3_sa_StringMap.word = (char *(*)(struct __pyx_obj_3_sa_StringMap *, int))__pyx_f_3_sa_9StringMap_word; - __pyx_vtable_3_sa_StringMap.index = (int (*)(struct __pyx_obj_3_sa_StringMap *, char *))__pyx_f_3_sa_9StringMap_index; - if (PyType_Ready(&__pyx_type_3_sa_StringMap) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_StringMap.tp_dict, __pyx_vtabptr_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_3_sa_StringMap) < 0) {__pyx_filename = __pyx_f[14]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_StringMap = &__pyx_type_3_sa_StringMap; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_26_get_f_phrases) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_26_get_f_phrases = &__pyx_type_3_sa___pyx_scope_struct_26_get_f_phrases; - if (PyType_Ready(&__pyx_type_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "TrieNode", (PyObject *)&__pyx_type_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_TrieNode = &__pyx_type_3_sa_TrieNode; - __pyx_type_3_sa_ExtendedTrieNode.tp_base = __pyx_ptype_3_sa_TrieNode; - if (PyType_Ready(&__pyx_type_3_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ExtendedTrieNode", (PyObject *)&__pyx_type_3_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_ExtendedTrieNode = &__pyx_type_3_sa_ExtendedTrieNode; - __pyx_vtabptr_3_sa_TrieMap = &__pyx_vtable_3_sa_TrieMap; - __pyx_vtable_3_sa_TrieMap._insert = (struct __pyx_t_3_sa__Trie_Node *(*)(struct __pyx_obj_3_sa_TrieMap *, int *, int))__pyx_f_3_sa_7TrieMap__insert; - __pyx_vtable_3_sa_TrieMap._contains = (struct __pyx_t_3_sa__Trie_Node *(*)(struct __pyx_obj_3_sa_TrieMap *, int *, int))__pyx_f_3_sa_7TrieMap__contains; - if (PyType_Ready(&__pyx_type_3_sa_TrieMap) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_TrieMap.tp_dict, __pyx_vtabptr_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_3_sa_TrieMap) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_TrieMap = &__pyx_type_3_sa_TrieMap; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_8_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_8_genexpr = &__pyx_type_3_sa___pyx_scope_struct_8_genexpr; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_4_make_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_4_make_lattice = &__pyx_type_3_sa___pyx_scope_struct_4_make_lattice; - __pyx_vtabptr_3_sa_Phrase = &__pyx_vtable_3_sa_Phrase; - __pyx_vtable_3_sa_Phrase.chunkpos = (int (*)(struct __pyx_obj_3_sa_Phrase *, int))__pyx_f_3_sa_6Phrase_chunkpos; - __pyx_vtable_3_sa_Phrase.chunklen = (int (*)(struct __pyx_obj_3_sa_Phrase *, int))__pyx_f_3_sa_6Phrase_chunklen; - if (PyType_Ready(&__pyx_type_3_sa_Phrase) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_Phrase.tp_dict, __pyx_vtabptr_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_3_sa_Phrase) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_Phrase = &__pyx_type_3_sa_Phrase; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_27___iter__) < 0) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_27___iter__ = &__pyx_type_3_sa___pyx_scope_struct_27___iter__; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct____iter__) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct____iter__ = &__pyx_type_3_sa___pyx_scope_struct____iter__; - if (PyType_Ready(&__pyx_type_3_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "TrieTable", (PyObject *)&__pyx_type_3_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_TrieTable = &__pyx_type_3_sa_TrieTable; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_5_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_5_genexpr = &__pyx_type_3_sa___pyx_scope_struct_5_genexpr; - if (PyType_Ready(&__pyx_type_3_sa___pyx_scope_struct_10_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa___pyx_scope_struct_10_genexpr = &__pyx_type_3_sa___pyx_scope_struct_10_genexpr; - __pyx_vtabptr_3_sa_FloatList = &__pyx_vtable_3_sa_FloatList; - __pyx_vtable_3_sa_FloatList.set = (void (*)(struct __pyx_obj_3_sa_FloatList *, int, float))__pyx_f_3_sa_9FloatList_set; - __pyx_vtable_3_sa_FloatList.write_handle = (void (*)(struct __pyx_obj_3_sa_FloatList *, FILE *))__pyx_f_3_sa_9FloatList_write_handle; - __pyx_vtable_3_sa_FloatList.read_handle = (void (*)(struct __pyx_obj_3_sa_FloatList *, FILE *))__pyx_f_3_sa_9FloatList_read_handle; - if (PyType_Ready(&__pyx_type_3_sa_FloatList) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_3_sa_FloatList.tp_dict, __pyx_vtabptr_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_3_sa_FloatList) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_3_sa_FloatList = &__pyx_type_3_sa_FloatList; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_FeatureVector = &__pyx_type_4cdec_2sa_3_sa_FeatureVector; + __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; + __pyx_vtable_4cdec_2sa_3_sa_SuffixArray.__pyx___search_low = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low; + __pyx_vtable_4cdec_2sa_3_sa_SuffixArray.__pyx___get_range = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, int, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_11SuffixArray___get_range; + __pyx_vtable_4cdec_2sa_3_sa_SuffixArray.__pyx___lookup_helper = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_SuffixArray = &__pyx_type_4cdec_2sa_3_sa_SuffixArray; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_LCP = &__pyx_type_4cdec_2sa_3_sa_LCP; + 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_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_OnlineStats) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_OnlineStats = &__pyx_type_4cdec_2sa_3_sa_OnlineStats; + __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; + __pyx_vtable_4cdec_2sa_3_sa_IntList._append = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, int))__pyx_f_4cdec_2sa_3_sa_7IntList__append; + __pyx_vtable_4cdec_2sa_3_sa_IntList._extend = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, struct __pyx_obj_4cdec_2sa_3_sa_IntList *))__pyx_f_4cdec_2sa_3_sa_7IntList__extend; + __pyx_vtable_4cdec_2sa_3_sa_IntList._extend_arr = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, int *, int))__pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr; + __pyx_vtable_4cdec_2sa_3_sa_IntList._clear = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *))__pyx_f_4cdec_2sa_3_sa_7IntList__clear; + __pyx_vtable_4cdec_2sa_3_sa_IntList.write_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, FILE *))__pyx_f_4cdec_2sa_3_sa_7IntList_write_handle; + __pyx_vtable_4cdec_2sa_3_sa_IntList.read_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, FILE *))__pyx_f_4cdec_2sa_3_sa_7IntList_read_handle; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_IntList = &__pyx_type_4cdec_2sa_3_sa_IntList; + __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; + __pyx_vtable_4cdec_2sa_3_sa_Phrase.chunklen = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, int))__pyx_f_4cdec_2sa_3_sa_6Phrase_chunklen; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Phrase = &__pyx_type_4cdec_2sa_3_sa_Phrase; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "TrieNode", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_TrieNode = &__pyx_type_4cdec_2sa_3_sa_TrieNode; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext; + 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_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_26_get_f_phrases) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; + __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 = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ExtendedTrieNode", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode = &__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode; + __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; + __pyx_vtable_4cdec_2sa_3_sa_Alignment._unlink = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *, int, int *, int *))__pyx_f_4cdec_2sa_3_sa_9Alignment__unlink; + __pyx_vtable_4cdec_2sa_3_sa_Alignment._get_sent_links = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *, int, int *))__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Alignment = &__pyx_type_4cdec_2sa_3_sa_Alignment; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_13_decode_words) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Rule = &__pyx_type_4cdec_2sa_3_sa_Rule; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr; + __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; + __pyx_vtable_4cdec_2sa_3_sa_Precomputation.write_map = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *, PyObject *, FILE *))__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Precomputation = &__pyx_type_4cdec_2sa_3_sa_Precomputation; + 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_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_21_add_instance) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance; + __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; + __pyx_vtable_4cdec_2sa_3_sa_TrieMap._contains = (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__contains; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_TrieMap = &__pyx_type_4cdec_2sa_3_sa_TrieMap; + 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_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_VEBIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_VEBIterator = &__pyx_type_4cdec_2sa_3_sa_VEBIterator; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr; + __pyx_vtabptr_4cdec_2sa_3_sa_FloatList = &__pyx_vtable_4cdec_2sa_3_sa_FloatList; + __pyx_vtable_4cdec_2sa_3_sa_FloatList.set = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, int, float))__pyx_f_4cdec_2sa_3_sa_9FloatList_set; + __pyx_vtable_4cdec_2sa_3_sa_FloatList.write_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *))__pyx_f_4cdec_2sa_3_sa_9FloatList_write_handle; + __pyx_vtable_4cdec_2sa_3_sa_FloatList.read_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *))__pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_FloatList = &__pyx_type_4cdec_2sa_3_sa_FloatList; + __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; + __pyx_vtable_4cdec_2sa_3_sa_StringMap.index = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *, char *))__pyx_f_4cdec_2sa_3_sa_9StringMap_index; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_StringMap = &__pyx_type_4cdec_2sa_3_sa_StringMap; + 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_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_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_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "TrieTable", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_TrieTable = &__pyx_type_4cdec_2sa_3_sa_TrieTable; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_12_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_10_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr; + __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; + __pyx_vtable_4cdec_2sa_3_sa_VEB._insert = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_VEB *, int))__pyx_f_4cdec_2sa_3_sa_3VEB__insert; + __pyx_vtable_4cdec_2sa_3_sa_VEB._first = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_VEB *))__pyx_f_4cdec_2sa_3_sa_3VEB__first; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_VEB = &__pyx_type_4cdec_2sa_3_sa_VEB; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice; + __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 109; __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation = &__pyx_type_4cdec_2sa_3_sa_PhraseLocation; + __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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Scorer = &__pyx_type_4cdec_2sa_3_sa_Scorer; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Sampler", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 131; __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_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; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.isword = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_isword; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.getindex = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_getindex; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.setindex = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_setindex; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.clearindex = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_clearindex; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.match = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_match; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.tocat = (char *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_tocat; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.fromcat = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, char *))__pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.tostring = (char *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.fromstring = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, char *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Alphabet = &__pyx_type_4cdec_2sa_3_sa_Alphabet; + __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; + __pyx_vtable_4cdec_2sa_3_sa_BiLex._add_node = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, struct __pyx_t_4cdec_2sa_3_sa__node *, int *, float, int *))__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node; + __pyx_vtable_4cdec_2sa_3_sa_BiLex.write_wordlist = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, PyObject *, FILE *))__pyx_f_4cdec_2sa_3_sa_5BiLex_write_wordlist; + __pyx_vtable_4cdec_2sa_3_sa_BiLex.read_wordlist = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, PyObject *, PyObject *, FILE *))__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist; + __pyx_vtable_4cdec_2sa_3_sa_BiLex.swap = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, int, int))__pyx_f_4cdec_2sa_3_sa_5BiLex_swap; + __pyx_vtable_4cdec_2sa_3_sa_BiLex.qsort = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, int, int, PyObject *))__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_BiLex = &__pyx_type_4cdec_2sa_3_sa_BiLex; + __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; + __pyx_vtable_4cdec_2sa_3_sa_DataArray.write_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *, FILE *))__pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_DataArray = &__pyx_type_4cdec_2sa_3_sa_DataArray; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_BitSetIterator = &__pyx_type_4cdec_2sa_3_sa_BitSetIterator; + __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; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.baeza_yates_helper = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.compare_matchings_set = (long (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_set; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.compare_matchings = (long (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.merge_helper = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.sort_phrase_loc = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_IntList *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.intersect_helper = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_helper; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.loc2str = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.intersect = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, PyObject *, PyObject *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.find_fixpoint = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, PyObject *, int *, int *, int *, int *, int, int, int *, int *, int *, int *, int, int, int, int, int, int, int, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.find_projection = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_projection; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.int_arr_extend = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int *, int *, int *, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.extract_phrases = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int, int, int, int *, int *, int *, int, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrases; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.create_alignments = (struct __pyx_obj_4cdec_2sa_3_sa_IntList *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int *, int, struct __pyx_obj_4cdec_2sa_3_sa_IntList *, struct __pyx_obj_4cdec_2sa_3_sa_IntList *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_create_alignments; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.extract = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int *, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 253; __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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_HieroCachingRuleFactory = &__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory; + 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_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_3_compute_stats) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr; + 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_ptype_4cdec_2sa_3_sa___pyx_scope_struct____iter__ = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct____iter__; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_BitSet = &__pyx_type_4cdec_2sa_3_sa_BitSet; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence; /*--- Type import code ---*/ /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "_sa.pyx":1 + /* "cdec/sa/_sa.pyx":1 * import logging # <<<<<<<<<<<<<< * import resource * import gzip @@ -76758,7 +76785,7 @@ PyMODINIT_FUNC PyInit__sa(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__logging, __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; - /* "_sa.pyx":2 + /* "cdec/sa/_sa.pyx":2 * import logging * import resource # <<<<<<<<<<<<<< * import gzip @@ -76769,7 +76796,7 @@ PyMODINIT_FUNC PyInit__sa(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__resource, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_sa.pyx":3 + /* "cdec/sa/_sa.pyx":3 * import logging * import resource * import gzip # <<<<<<<<<<<<<< @@ -76781,31 +76808,31 @@ PyMODINIT_FUNC PyInit__sa(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__gzip, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_sa.pyx":5 + /* "cdec/sa/_sa.pyx":5 * import gzip * * def monitor_cpu(): # <<<<<<<<<<<<<< * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ * resource.getrusage(resource.RUSAGE_SELF).ru_stime) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_1monitor_cpu, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_1monitor_cpu, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s__monitor_cpu, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_sa.pyx":9 + /* "cdec/sa/_sa.pyx":9 * resource.getrusage(resource.RUSAGE_SELF).ru_stime) * * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< * if filename.endswith('.gz'): * return gzip.GzipFile(filename) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3_sa_3gzip_or_text, NULL, __pyx_n_s___sa); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_3gzip_or_text, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s__gzip_or_text, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_sa.pyx":15 + /* "cdec/sa/_sa.pyx":15 * return open(filename) * * logger = logging.getLogger('cdec.sa') # <<<<<<<<<<<<<< @@ -76817,22 +76844,22 @@ PyMODINIT_FUNC PyInit__sa(void) __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_173), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_162), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 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; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/alignment.pxi":8 + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":8 * # May need to revisit if things get really tight, though. * * cdef int ALIGNMENT_CODE = 1 << 16 # <<<<<<<<<<<<<< * * cdef class Alignment: */ - __pyx_v_3_sa_ALIGNMENT_CODE = 65536; + __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE = 65536; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/bilex.pxi":54 + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54 * cdef id2eword, id2fword, eword2id, fword2id * * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< @@ -76845,138 +76872,138 @@ PyMODINIT_FUNC PyInit__sa(void) __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":17 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":17 * from libc.string cimport memset * * cdef int MIN_BOTTOM_SIZE = 32 # <<<<<<<<<<<<<< * cdef int MIN_BOTTOM_BITS = 5 * cdef int LOWER_MASK[32] */ - __pyx_v_3_sa_MIN_BOTTOM_SIZE = 32; + __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE = 32; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":18 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":18 * * cdef int MIN_BOTTOM_SIZE = 32 * cdef int MIN_BOTTOM_BITS = 5 # <<<<<<<<<<<<<< * cdef int LOWER_MASK[32] * */ - __pyx_v_3_sa_MIN_BOTTOM_BITS = 5; + __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS = 5; - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/veb.pxi":28 + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":28 * LOWER_MASK[i] = mask * * _init_lower_mask() # <<<<<<<<<<<<<< * * cdef struct _BitSet: */ - __pyx_f_3_sa__init_lower_mask(); + __pyx_f_4cdec_2sa_3_sa__init_lower_mask(); - /* "/Users/vchahun/Sandbox/cdec/python/src/sa/sym.pxi":4 + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":4 * from libc.stdlib cimport malloc, realloc, strtol * * cdef int INDEX_SHIFT = 3 # <<<<<<<<<<<<<< * cdef int INDEX_MASK = (1<',), sentence.split(), ('',))) meta = cdec.sa.annotate(words) cnet = cdec.sa.make_lattice(words) - return self.factory.input(cnet, meta) + return self.factory.input(cnet, meta, ctx_name) # Add training instance to data - def add_instance(self, sentence, reference, alignment): + def add_instance(self, sentence, reference, alignment, ctx_name=None): f_words = cdec.sa.encode_words(sentence.split()) e_words = cdec.sa.encode_words(reference.split()) al = sorted(tuple(int(i) for i in pair.split('-')) for pair in alignment.split()) - self.factory.add_instance(f_words, e_words, al) - - # Debugging - def dump_online_stats(self): - self.factory.dump_online_stats() - def dump_online_rules(self): - self.factory.dump_online_rules() \ No newline at end of file + self.factory.add_instance(f_words, e_words, al, ctx_name) diff --git a/python/cdec/sa/rulefactory.pxi b/python/cdec/sa/rulefactory.pxi index 10bb9737..a96b01e7 100644 --- a/python/cdec/sa/rulefactory.pxi +++ b/python/cdec/sa/rulefactory.pxi @@ -36,6 +36,31 @@ OnlineFeatureContext = namedtuple('OnlineFeatureContext', 'bilex_fe' ]) +cdef class OnlineStats: + cdef public samples_f + cdef public phrases_f + cdef public phrases_e + cdef public phrases_fe + cdef public phrases_al + cdef public bilex_f + cdef public bilex_e + cdef public bilex_fe + + def __cinit__(self): + # Keep track of everything that can be sampled: + self.samples_f = defaultdict(int) + + # 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)) + + # Bilexical counts + self.bilex_f = defaultdict(int) + self.bilex_e = defaultdict(int) + self.bilex_fe = defaultdict(lambda: defaultdict(int)) + cdef int PRECOMPUTE = 0 cdef int MERGE = 1 cdef int BAEZA_YATES = 2 @@ -276,14 +301,7 @@ cdef class HieroCachingRuleFactory: cdef IntList findexes1 cdef bint online - cdef samples_f - cdef phrases_f - cdef phrases_e - cdef phrases_fe - cdef phrases_al - cdef bilex_f - cdef bilex_e - cdef bilex_fe + cdef online_stats def __cinit__(self, # compiled alignment object (REQUIRED) @@ -396,21 +414,8 @@ cdef class HieroCachingRuleFactory: # True after data is added self.online = False + self.online_stats = defaultdict(OnlineStats) - # Keep track of everything that can be sampled: - self.samples_f = defaultdict(int) - - # 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)) - - # Bilexical counts - self.bilex_f = defaultdict(int) - self.bilex_e = defaultdict(int) - self.bilex_fe = defaultdict(lambda: defaultdict(int)) - def configure(self, SuffixArray fsarray, DataArray edarray, Sampler sampler, Scorer scorer): '''This gives the RuleFactory access to the Context object. @@ -970,7 +975,7 @@ cdef class HieroCachingRuleFactory: candidate.append([next_id,curr[1]+jump]) return sorted(result); - def input(self, fwords, meta): + 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 the input sentence''' @@ -1154,7 +1159,7 @@ cdef class HieroCachingRuleFactory: fwords, self.fda, self.eda, meta, # Include online stats. None if none. - self.online_ctx_lookup(f, e))) + self.online_ctx_lookup(f, e, ctx_name))) # Phrase pair processed if self.online: seen_phrases.add((f, e)) @@ -1184,6 +1189,7 @@ cdef class HieroCachingRuleFactory: # 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): spanlen = (lex_j - lex_i) + 1 @@ -1191,7 +1197,7 @@ cdef class HieroCachingRuleFactory: spanlen += 1 if not sym_isvar(f[1]): spanlen += 1 - for e in self.phrases_fe.get(f, ()): + 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)) @@ -1200,8 +1206,8 @@ cdef class HieroCachingRuleFactory: spanlen, None, None, fwords, self.fda, self.eda, meta, - self.online_ctx_lookup(f, e))) - alignment = self.phrases_al[f][e] + 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() @@ -1882,7 +1888,7 @@ cdef class HieroCachingRuleFactory: # Aggregate stats from a training instance # (Extract rules, update counts) - def add_instance(self, f_words, e_words, alignment): + def add_instance(self, f_words, e_words, alignment, ctx_name=None): self.online = True @@ -2028,28 +2034,30 @@ cdef class HieroCachingRuleFactory: continue extract(f_i, f_i, f_len + 1, -1, f_i, 0, [], [], False) + stats = self.online_stats[ctx_name] + # Update possible phrases (samples) # 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): - self.samples_f[f] += 1 + stats.samples_f[f] += 1 # Update phrase counts for rule in rules: (f_ph, e_ph, al) = rule[:3] - self.phrases_f[f_ph] += 1 - self.phrases_e[e_ph] += 1 - self.phrases_fe[f_ph][e_ph] += 1 - if not self.phrases_al[f_ph][e_ph]: - self.phrases_al[f_ph][e_ph] = al + 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 # Update Bilexical counts for e_w in e_words: - self.bilex_e[e_w] += 1 + stats.bilex_e[e_w] += 1 for f_w in f_words: - self.bilex_f[f_w] += 1 + stats.bilex_f[f_w] += 1 for e_w in e_words: - self.bilex_fe[f_w][e_w] += 1 + stats.bilex_fe[f_w][e_w] += 1 # Create a rule from source, target, non-terminals, and alignments def form_rule(self, f_i, e_i, f_span, e_span, nt, al): @@ -2121,44 +2129,16 @@ cdef class HieroCachingRuleFactory: a_str = ' '.join('{0}-{1}'.format(*self.alignment.unlink(packed)) for packed in a) return '[X] ||| {0} ||| {1} ||| {2}'.format(f, e, a_str) - # Debugging - def dump_online_stats(self): - logger.info('------------------------------') - logger.info(' Online Stats ') - logger.info('------------------------------') - logger.info('f') - for w in self.bilex_f: - logger.info(sym_tostring(w) + ' : ' + str(self.bilex_f[w])) - logger.info('e') - for w in self.bilex_e: - logger.info(sym_tostring(w) + ' : ' + str(self.bilex_e[w])) - logger.info('fe') - for w in self.bilex_fe: - for w2 in self.bilex_fe[w]: - logger.info(sym_tostring(w) + ' : ' + sym_tostring(w2) + ' : ' + str(self.bilex_fe[w][w2])) - logger.info('F') - for ph in self.phrases_f: - logger.info(str(ph) + ' ||| ' + str(self.phrases_f[ph])) - logger.info('E') - for ph in self.phrases_e: - logger.info(str(ph) + ' ||| ' + str(self.phrases_e[ph])) - logger.info('FE') - self.dump_online_rules() - - def dump_online_rules(self): - for ph in self.phrases_fe: - for ph2 in self.phrases_fe[ph]: - logger.info(self.fmt_rule(str(ph), str(ph2), self.phrases_al[ph][ph2]) + ' ||| ' + str(self.phrases_fe[ph][ph2])) - # 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): + def online_ctx_lookup(self, f, e, ctx_name=None): if self.online: - fcount = self.phrases_f.get(f, 0) - fsample_count = self.samples_f.get(f, 0) - d = self.phrases_fe.get(f, None) + 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 - return OnlineFeatureContext(fcount, fsample_count, paircount, self.bilex_f, self.bilex_e, self.bilex_fe) + return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe) return None # Find all phrases that we might try to extract -- cgit v1.2.3 From 5684942eadd5b4c3fd54f4871d13975793a1f067 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Tue, 24 Sep 2013 13:46:01 -0700 Subject: Support clearning context --- python/cdec/_cdec.cpp | 2 +- python/cdec/sa/_sa.c | 249 ++++++++++++++++++++++++++++++----------- python/cdec/sa/extractor.py | 4 + python/cdec/sa/rulefactory.pxi | 4 + 4 files changed, 190 insertions(+), 69 deletions(-) diff --git a/python/cdec/_cdec.cpp b/python/cdec/_cdec.cpp index ca693bcd..4ef9bdba 100644 --- a/python/cdec/_cdec.cpp +++ b/python/cdec/_cdec.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Mon Sep 23 08:04:01 2013 */ +/* Generated by Cython 0.19.1 on Tue Sep 24 13:39:57 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/python/cdec/sa/_sa.c b/python/cdec/sa/_sa.c index 0352a202..a9f7855e 100644 --- a/python/cdec/sa/_sa.c +++ b/python/cdec/sa/_sa.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Mon Sep 23 08:03:57 2013 */ +/* Generated by Cython 0.19.1 on Tue Sep 24 13:39:51 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -2836,6 +2836,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(st static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_lookup(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_ctx_name); /* proto */ 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); /* proto */ 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); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_ctx_name); /* proto */ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ @@ -66237,7 +66238,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras * * return phrases # <<<<<<<<<<<<<< * - * # Spans are _inclusive_ on both ends [i, j] + * # Drop online stats for a context */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrases)); @@ -66261,6 +66262,117 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_33get_f_phras return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_ctx_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("drop_ctx (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctx_name,0}; + PyObject* values[1] = {0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2186 + * + * # Drop online stats for a context + * def drop_ctx(self, ctx_name=None): # <<<<<<<<<<<<<< + * self.online_stats.pop(ctx_name, None) + * + */ + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + 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__ctx_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, "drop_ctx") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ctx_name = values[0]; + } + 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 = 2186; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_ctx_name); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_ctx_name) { + 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("drop_ctx", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2187 + * # 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 = 2187; __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 = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_ctx_name); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ctx_name); + __Pyx_GIVEREF(__pyx_v_ctx_name); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.drop_ctx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* Python wrapper */ static PyObject *__pyx_pw_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)}; @@ -66295,16 +66407,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 = 2186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __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 = 2186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_check", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __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 = 2186; __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 = 2190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -66319,7 +66431,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 = 2186; __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 = 2190; __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(); @@ -66330,7 +66442,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_17span_check(PyObject *__pyx_self, PyOb return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2186 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190 * * # Spans are _inclusive_ on both ends [i, j] * def span_check(vec, i, j): # <<<<<<<<<<<<<< @@ -66349,7 +66461,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("span_check", 0); - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2187 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2191 * # Spans are _inclusive_ on both ends [i, j] * def span_check(vec, i, j): * k = i # <<<<<<<<<<<<<< @@ -66359,7 +66471,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; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2188 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2192 * def span_check(vec, i, j): * k = i * while k <= j: # <<<<<<<<<<<<<< @@ -66367,25 +66479,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 = 2188; __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 = 2188; __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 = 2192; __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 = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_2) break; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2189 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2193 * k = i * while k <= j: * if vec[k]: # <<<<<<<<<<<<<< * return False * k += 1 */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __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 = 2189; __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 = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2194 * while k <= j: * if vec[k]: * return False # <<<<<<<<<<<<<< @@ -66393,7 +66505,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__ * return True */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -66402,21 +66514,21 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__ } __pyx_L5:; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2191 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2195 * 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 = 2191; __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 = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_k); __pyx_v_k = __pyx_t_1; __pyx_t_1 = 0; } - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2192 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196 * return False * k += 1 * return True # <<<<<<<<<<<<<< @@ -66424,7 +66536,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__ * def span_inc(vec, i, j): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -66477,16 +66589,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 = 2194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __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 = 2194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_inc", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __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 = 2194; __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 = 2198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -66501,7 +66613,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 = 2194; __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 = 2198; __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(); @@ -66512,7 +66624,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_19span_inc(PyObject *__pyx_self, PyObje return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2194 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198 * return True * * def span_inc(vec, i, j): # <<<<<<<<<<<<<< @@ -66533,7 +66645,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("span_inc", 0); - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2195 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2199 * * def span_inc(vec, i, j): * k = i # <<<<<<<<<<<<<< @@ -66543,7 +66655,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; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2200 * def span_inc(vec, i, j): * k = i * while k <= j: # <<<<<<<<<<<<<< @@ -66551,12 +66663,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 = 2196; __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 = 2196; __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 = 2200; __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 = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_2) break; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2197 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2201 * k = i * while k <= j: * vec[k] += 1 # <<<<<<<<<<<<<< @@ -66565,23 +66677,23 @@ 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 (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __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 = 2197; __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 = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __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; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202 * 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 = 2198; __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 = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_k); __pyx_v_k = __pyx_t_1; @@ -66637,16 +66749,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 = 2200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __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 = 2200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("span_dec", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __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 = 2200; __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 = 2204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -66661,7 +66773,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 = 2200; __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 = 2204; __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(); @@ -66672,7 +66784,7 @@ static PyObject *__pyx_pw_4cdec_2sa_3_sa_21span_dec(PyObject *__pyx_self, PyObje return __pyx_r; } -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2200 +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204 * k += 1 * * def span_dec(vec, i, j): # <<<<<<<<<<<<<< @@ -66693,7 +66805,7 @@ static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("span_dec", 0); - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2201 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2205 * * def span_dec(vec, i, j): * k = i # <<<<<<<<<<<<<< @@ -66703,7 +66815,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; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2206 * def span_dec(vec, i, j): * k = i * while k <= j: # <<<<<<<<<<<<<< @@ -66711,12 +66823,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 = 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_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 = 2206; __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 = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_2) break; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2203 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2207 * k = i * while k <= j: * vec[k] -= 1 # <<<<<<<<<<<<<< @@ -66724,21 +66836,21 @@ 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 (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2207; __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 = 2203; __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 = 2207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2207; __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; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2208 * 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 = 2204; __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 = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_k); __pyx_v_k = __pyx_t_1; @@ -74336,6 +74448,7 @@ static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_HieroCachingRuleFactory[] = { {__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)}, {0, 0, 0, 0} }; @@ -76391,41 +76504,41 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_174)); __pyx_k_codeobj_175 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_words, 124, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_175)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2186 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190 * * # Spans are _inclusive_ on both ends [i, j] * def span_check(vec, i, j): # <<<<<<<<<<<<<< * k = i * while k <= j: */ - __pyx_k_tuple_177 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_177)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_177 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_177)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_177); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_177)); - __pyx_k_codeobj_178 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_check, 2186, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_178)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_178 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_check, 2190, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_178)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2194 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198 * return True * * def span_inc(vec, i, j): # <<<<<<<<<<<<<< * k = i * while k <= j: */ - __pyx_k_tuple_179 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_179 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_179); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_179)); - __pyx_k_codeobj_180 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_inc, 2194, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_180)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_180 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_inc, 2198, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_180)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2200 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204 * k += 1 * * def span_dec(vec, i, j): # <<<<<<<<<<<<<< * k = i * while k <= j: */ - __pyx_k_tuple_181 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_181 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_181); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_181)); - __pyx_k_codeobj_182 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_dec, 2200, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_182)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_182 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_dec, 2204, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_182)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -77236,40 +77349,40 @@ PyMODINIT_FUNC PyInit__sa(void) __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2186 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190 * * # 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_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_17span_check, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __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 = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__span_check, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2194 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198 * 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_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_19span_inc, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __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 = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__span_inc, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2200 + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204 * 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_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_21span_dec, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __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 = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__span_dec, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":1 diff --git a/python/cdec/sa/extractor.py b/python/cdec/sa/extractor.py index 23534712..5a95ded8 100644 --- a/python/cdec/sa/extractor.py +++ b/python/cdec/sa/extractor.py @@ -98,3 +98,7 @@ class GrammarExtractor: e_words = cdec.sa.encode_words(reference.split()) al = sorted(tuple(int(i) for i in pair.split('-')) for pair in alignment.split()) self.factory.add_instance(f_words, e_words, al, ctx_name) + + # Remove all incremental data for a context + def drop_ctx(self, ctx_name=None): + self.factory.drop_ctx(ctx_name) diff --git a/python/cdec/sa/rulefactory.pxi b/python/cdec/sa/rulefactory.pxi index a96b01e7..2be5cad6 100644 --- a/python/cdec/sa/rulefactory.pxi +++ b/python/cdec/sa/rulefactory.pxi @@ -2181,6 +2181,10 @@ cdef class HieroCachingRuleFactory: extract(f_i, f_i, f_len, -1, 0, 0, []) return phrases + + # 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] def span_check(vec, i, j): -- cgit v1.2.3 From 5866bdb0541bf136d897cc8ecc72c5ed4b6a93ee Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Wed, 25 Sep 2013 16:20:51 -0700 Subject: Super multi-user thread safety update --- realtime/realtime.py | 43 +++++---- realtime/rt/aligner.py | 11 ++- realtime/rt/decoder.py | 32 ++++++- realtime/rt/rt.py | 250 +++++++++++++++++++++++++++++++++++-------------- 4 files changed, 241 insertions(+), 95 deletions(-) diff --git a/realtime/realtime.py b/realtime/realtime.py index 3c384fa2..282d3311 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -2,7 +2,9 @@ import argparse import logging +import signal import sys +import threading import rt @@ -22,34 +24,37 @@ def main(): parser.add_argument('-T', '--temp', help='Temp directory (default /tmp)', default='/tmp') parser.add_argument('-a', '--cache', help='Grammar cache size (default 5)', default='5') parser.add_argument('-v', '--verbose', help='Info to stderr', action='store_true') + parser.add_argument('-D', '--debug-test', help='Test thread safety (debug use only)', action='store_true') args = parser.parse_args() if args.verbose: logging.basicConfig(level=logging.INFO) - with rt.RealtimeDecoder(args.config, tmpdir=args.temp, cache_size=int(args.cache), norm=args.normalize) as rtd: + with rt.RealtimeTranslator(args.config, tmpdir=args.temp, cache_size=int(args.cache), norm=args.normalize) as translator: - try: # Load state if given if args.state: with open(args.state) as input: rtd.load_state(input) - # Read lines and commands - while True: - line = sys.stdin.readline() - if not line: - break - line = line.strip() - if '|||' in line: - rtd.command_line(line) - else: - hyp = rtd.decode(line) - sys.stdout.write('{}\n'.format(hyp)) - sys.stdout.flush() - - # Clean exit on ctrl+c - except KeyboardInterrupt: - logging.info('Caught KeyboardInterrupt, exiting') - + if not args.debug_test: + run(translator) + else: + # TODO: write test + run(translator) + +def run(translator, input=sys.stdin, output=sys.stdout, ctx_name=None): + # Read lines and commands + while True: + line = input.readline() + if not line: + break + line = line.strip() + if '|||' in line: + translator.command_line(line, ctx_name) + else: + hyp = translator.decode(line, ctx_name) + output.write('{}\n'.format(hyp)) + output.flush() + if __name__ == '__main__': main() diff --git a/realtime/rt/aligner.py b/realtime/rt/aligner.py index 80835412..a14121db 100644 --- a/realtime/rt/aligner.py +++ b/realtime/rt/aligner.py @@ -2,6 +2,7 @@ import logging import os import sys import subprocess +import threading import util @@ -29,10 +30,16 @@ class ForceAligner: logging.info('Executing: {}'.format(' '.join(tools_cmd))) self.tools = util.popen_io(tools_cmd) + # Used to guarantee thread safety + self.semaphore = threading.Semaphore() + def align(self, source, target): + '''Threadsafe''' return self.align_formatted('{} ||| {}'.format(source, target)) def align_formatted(self, line): + '''Threadsafe''' + self.semaphore.acquire() self.fwd_align.stdin.write('{}\n'.format(line)) self.rev_align.stdin.write('{}\n'.format(line)) # f words ||| e words ||| links ||| score @@ -40,7 +47,9 @@ class ForceAligner: rev_line = self.rev_align.stdout.readline().split('|||')[2].strip() self.tools.stdin.write('{}\n'.format(fwd_line)) self.tools.stdin.write('{}\n'.format(rev_line)) - return self.tools.stdout.readline().strip() + al_line = self.tools.stdout.readline().strip() + self.semaphore.release() + return al_line def close(self): self.fwd_align.stdin.close() diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py index aa6db64d..72b5b959 100644 --- a/realtime/rt/decoder.py +++ b/realtime/rt/decoder.py @@ -1,27 +1,37 @@ import logging import os import subprocess +import threading import util class Decoder: - def close(self): + def close(self, force=False): + if not force: + self.semaphore.acquire() self.decoder.stdin.close() + if not force: + self.semaphore.release() def decode(self, sentence, grammar=None): + '''Threadsafe''' input = '{s}\n'.format(s=sentence, g=grammar) if grammar else '{}\n'.format(sentence) + self.semaphore.acquire() self.decoder.stdin.write(input) - return self.decoder.stdout.readline().strip() + hyp = self.decoder.stdout.readline().strip() + self.semaphore.release() + return hyp class CdecDecoder(Decoder): - + def __init__(self, config, weights): cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) decoder = os.path.join(cdec_root, 'decoder', 'cdec') decoder_cmd = [decoder, '-c', config, '-w', weights] logging.info('Executing: {}'.format(' '.join(decoder_cmd))) self.decoder = util.popen_io(decoder_cmd) + self.semaphore = threading.Semaphore() class MIRADecoder(Decoder): @@ -32,15 +42,27 @@ class MIRADecoder(Decoder): mira_cmd = [mira, '-c', config, '-w', weights, '-o', '2', '-C', '0.001', '-b', '500', '-k', '500', '-u', '-t'] logging.info('Executing: {}'.format(' '.join(mira_cmd))) self.decoder = util.popen_io(mira_cmd) + self.semaphore = threading.Semaphore() def get_weights(self): + '''Threadsafe''' + self.semaphore.acquire() self.decoder.stdin.write('WEIGHTS ||| WRITE\n') - return self.decoder.stdout.readline().strip() + weights = self.decoder.stdout.readline().strip() + self.semaphore.release() + return weights def set_weights(self, w_line): + '''Threadsafe''' + self.semaphore.acquire() self.decoder.stdin.write('WEIGHTS ||| {}\n'.format(w_line)) + self.semaphore.release() def update(self, sentence, grammar, reference): + '''Threadsafe''' input = 'LEARN ||| {s} ||| {r}\n'.format(s=sentence, g=grammar, r=reference) + self.semaphore.acquire() self.decoder.stdin.write(input) - return self.decoder.stdout.readline().strip() + log = self.decoder.stdout.readline().strip() + self.semaphore.release() + return log diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 033ed790..6f1fb70f 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -8,6 +8,7 @@ import shutil import sys import subprocess import tempfile +import threading import time import cdec @@ -15,18 +16,56 @@ import aligner import decoder import util -LIKELY_OOV = '("OOV")' +# Dummy input token that is unlikely to appear in normalized data (but no fatal errors if it does) +LIKELY_OOV = '(OOV)' class RealtimeDecoder: + '''Do not use directly unless you know what you're doing. Use RealtimeTranslator.''' + + def __init__(self, configdir, tmpdir): + + cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + + self.tmp = tmpdir + os.mkdir(self.tmp) + + # HPYPLM reference stream + ref_fifo_file = os.path.join(self.tmp, 'ref.fifo') + os.mkfifo(ref_fifo_file) + self.ref_fifo = open(ref_fifo_file, 'w+') + # Start with empty line (do not learn prior to first input) + self.ref_fifo.write('\n') + self.ref_fifo.flush() + + # Decoder + decoder_config = [[f.strip() for f in line.split('=')] for line in open(os.path.join(configdir, 'cdec.ini'))] + util.cdec_ini_for_realtime(decoder_config, os.path.abspath(configdir), ref_fifo_file) + decoder_config_file = os.path.join(self.tmp, 'cdec.ini') + with open(decoder_config_file, 'w') as output: + for (k, v) in decoder_config: + output.write('{}={}\n'.format(k, v)) + decoder_weights = os.path.join(configdir, 'weights.final') + self.decoder = decoder.MIRADecoder(decoder_config_file, decoder_weights) + + def close(self, force=False): + logging.info('Closing decoder and removing {}'.format(self.tmp)) + self.decoder.close(force) + self.ref_fifo.close() + shutil.rmtree(self.tmp) + +class RealtimeTranslator: + '''Main entry point into API: serves translations to any number of concurrent users''' def __init__(self, configdir, tmpdir='/tmp', cache_size=5, norm=False, state=None): + # TODO: save/load self.commands = {'LEARN': self.learn, 'SAVE': self.save_state, 'LOAD': self.load_state} cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - self.inc_data = [] # instances of (source, target) + ### Single instance for all contexts + self.config = configdir # Temporary work dir self.tmp = tempfile.mkdtemp(dir=tmpdir, prefix='realtime.') logging.info('Using temp dir {}'.format(self.tmp)) @@ -35,7 +74,9 @@ class RealtimeDecoder: self.norm = norm if self.norm: self.tokenizer = util.popen_io([os.path.join(cdec_root, 'corpus', 'tokenize-anything.sh'), '-u']) + self.tokenizer_sem = threading.Semaphore() self.detokenizer = util.popen_io([os.path.join(cdec_root, 'corpus', 'untok.pl')]) + self.detokenizer_sem = threading.Semaphore() # Word aligner fwd_params = os.path.join(configdir, 'a.fwd_params') @@ -50,28 +91,24 @@ class RealtimeDecoder: util.sa_ini_for_realtime(sa_config, os.path.abspath(configdir)) sa_config.write() self.extractor = cdec.sa.GrammarExtractor(sa_config.filename, online=True) - self.grammar_files = collections.deque() - self.grammar_dict = {} self.cache_size = cache_size - # HPYPLM reference stream - ref_fifo_file = os.path.join(self.tmp, 'ref.fifo') - os.mkfifo(ref_fifo_file) - self.ref_fifo = open(ref_fifo_file, 'w+') - # Start with empty line (do not learn prior to first input) - self.ref_fifo.write('\n') - self.ref_fifo.flush() + ### One instance per context - # Decoder - decoder_config = [[f.strip() for f in line.split('=')] for line in open(os.path.join(configdir, 'cdec.ini'))] - util.cdec_ini_for_realtime(decoder_config, os.path.abspath(configdir), ref_fifo_file) - decoder_config_file = os.path.join(self.tmp, 'cdec.ini') - with open(decoder_config_file, 'w') as output: - for (k, v) in decoder_config: - output.write('{}={}\n'.format(k, v)) - decoder_weights = os.path.join(configdir, 'weights.final') - self.decoder = decoder.MIRADecoder(decoder_config_file, decoder_weights) + self.ctx_names = set() + # All context-dependent operations are atomic + self.ctx_sems = collections.defaultdict(threading.Semaphore) + # ctx -> list of (source, target, alignment) + self.ctx_data = {} + + # ctx -> deque of file + self.grammar_files = {} + # ctx -> dict of {sentence: file} + self.grammar_dict = {} + self.decoders = {} + + # TODO: state # Load state if given if state: with open(state) as input: @@ -80,125 +117,197 @@ class RealtimeDecoder: def __enter__(self): return self - def __exit__(self, type, value, traceback): - self.close() + def __exit__(self, ex_type, ex_value, ex_traceback): + self.close(ex_type is KeyboardInterrupt) - def close(self): + def close(self, force=False): + '''Cleanup''' + if force: + logging.info('Forced shutdown: stopping immediately') + for ctx_name in list(self.ctx_names): + self.drop_ctx(ctx_name, force) logging.info('Closing processes') self.aligner.close() - self.decoder.close() - self.ref_fifo.close() if self.norm: self.tokenizer.stdin.close() self.detokenizer.stdin.close() logging.info('Deleting {}'.format(self.tmp)) shutil.rmtree(self.tmp) - def grammar(self, sentence): - grammar_file = self.grammar_dict.get(sentence, None) + def lazy_ctx(self, ctx_name): + '''Initialize a context (inc starting a new decoder) if needed''' + self.ctx_sems[ctx_name].acquire() + if ctx_name in self.ctx_names: + self.ctx_sems[ctx_name].release() + return + logging.info('New context: {}'.format(ctx_name)) + self.ctx_names.add(ctx_name) + self.ctx_data[ctx_name] = [] + self.grammar_files[ctx_name] = collections.deque() + self.grammar_dict[ctx_name] = {} + tmpdir = os.path.join(self.tmp, 'decoder.{}'.format(ctx_name)) + self.decoders[ctx_name] = RealtimeDecoder(self.config, tmpdir) + self.ctx_sems[ctx_name].release() + + def drop_ctx(self, ctx_name, force=False): + '''Delete a context (inc stopping the decoder)''' + if not force: + sem = self.ctx_sems[ctx_name] + sem.acquire() + logging.info('Dropping context: {}'.format(ctx_name)) + self.ctx_names.remove(ctx_name) + self.ctx_data.pop(ctx_name) + self.extractor.drop_ctx(ctx_name) + self.grammar_files.pop(ctx_name) + self.grammar_dict.pop(ctx_name) + self.decoders.pop(ctx_name).close(force) + self.ctx_sems.pop(ctx_name) + if not force: + sem.release() + + def grammar(self, sentence, ctx_name=None): + '''Extract a sentence-level grammar on demand (or return cached)''' + self.lazy_ctx(ctx_name) + sem = self.ctx_sems[ctx_name] + sem.acquire() + grammar_dict = self.grammar_dict[ctx_name] + grammar_file = grammar_dict.get(sentence, None) # Cache hit if grammar_file: - logging.info('Grammar cache hit') + logging.info('Grammar cache hit: {}'.format(grammar_file)) + sem.release() return grammar_file # Extract and cache - (fid, grammar_file) = tempfile.mkstemp(dir=self.tmp, prefix='grammar.') + (fid, grammar_file) = tempfile.mkstemp(dir=self.decoders[ctx_name].tmp, prefix='grammar.') os.close(fid) with open(grammar_file, 'w') as output: - for rule in self.extractor.grammar(sentence): + for rule in self.extractor.grammar(sentence, ctx_name): output.write('{}\n'.format(str(rule))) - if len(self.grammar_files) == self.cache_size: - rm_sent = self.grammar_files.popleft() + grammar_files = self.grammar_files[ctx_name] + if len(grammar_files) == self.cache_size: + rm_sent = grammar_files.popleft() # If not already removed by learn method - if rm_sent in self.grammar_dict: - rm_grammar = self.grammar_dict.pop(rm_sent) + if rm_sent in grammar_dict: + rm_grammar = grammar_dict.pop(rm_sent) os.remove(rm_grammar) - self.grammar_files.append(sentence) - self.grammar_dict[sentence] = grammar_file + grammar_files.append(sentence) + grammar_dict[sentence] = grammar_file + sem.release() return grammar_file - def decode(self, sentence): + def decode(self, sentence, ctx_name=None): + '''Decode a sentence (inc extracting a grammar if needed)''' + self.lazy_ctx(ctx_name) # Empty in, empty out if sentence.strip() == '': return '' if self.norm: sentence = self.tokenize(sentence) logging.info('Normalized input: {}'.format(sentence)) - grammar_file = self.grammar(sentence) + # grammar method is threadsafe + grammar_file = self.grammar(sentence, ctx_name) + decoder = self.decoders[ctx_name] + sem = self.ctx_sems[ctx_name] + sem.acquire() start_time = time.time() - hyp = self.decoder.decode(sentence, grammar_file) + hyp = decoder.decoder.decode(sentence, grammar_file) stop_time = time.time() logging.info('Translation time: {} seconds'.format(stop_time - start_time)) # Empty reference: HPYPLM does not learn prior to next translation - self.ref_fifo.write('\n') - self.ref_fifo.flush() + decoder.ref_fifo.write('\n') + decoder.ref_fifo.flush() + sem.release() if self.norm: logging.info('Normalized translation: {}'.format(hyp)) hyp = self.detokenize(hyp) return hyp def tokenize(self, line): + self.tokenizer_sem.acquire() self.tokenizer.stdin.write('{}\n'.format(line)) - return self.tokenizer.stdout.readline().strip() + tok_line = self.tokenizer.stdout.readline().strip() + self.tokenizer_sem.release() + return tok_line def detokenize(self, line): + self.detokenizer_sem.acquire() self.detokenizer.stdin.write('{}\n'.format(line)) - return self.detokenizer.stdout.readline().strip() + detok_line = self.detokenizer.stdout.readline().strip() + self.detokenizer_sem.release() + return detok_line - def command_line(self, line): + # TODO + def command_line(self, line, ctx_name=None): args = [f.strip() for f in line.split('|||')] try: if len(args) == 2 and not args[1]: - self.commands[args[0]]() + self.commands[args[0]](ctx_name) else: - self.commands[args[0]](*args[1:]) + self.commands[args[0]](*args[1:], ctx_name=ctx_name) except: logging.info('Command error: {}'.format(' ||| '.join(args))) - def learn(self, source, target): + def learn(self, source, target, ctx_name=None): + self.lazy_ctx(ctx_name) if '' in (source.strip(), target.strip()): logging.info('Error empty source or target: {} ||| {}'.format(source, target)) return if self.norm: source = self.tokenize(source) target = self.tokenize(target) + # Align instance (threadsafe) + alignment = self.aligner.align(source, target) + # grammar method is threadsafe + grammar_file = self.grammar(source, ctx_name) + sem = self.ctx_sems[ctx_name] + sem.acquire() # MIRA update before adding data to grammar extractor - grammar_file = self.grammar(source) - mira_log = self.decoder.update(source, grammar_file, target) + decoder = self.decoders[ctx_name] + mira_log = decoder.decoder.update(source, grammar_file, target) logging.info('MIRA: {}'.format(mira_log)) - # Align instance - alignment = self.aligner.align(source, target) + # Add to HPYPLM by writing to fifo (read on next translation) + logging.info('Adding to HPYPLM: {}'.format(target)) + decoder.ref_fifo.write('{}\n'.format(target)) + decoder.ref_fifo.flush() # Store incremental data for save/load - self.inc_data.append((source, target, alignment)) + self.ctx_data[ctx_name].append((source, target, alignment)) # Add aligned sentence pair to grammar extractor logging.info('Adding to bitext: {} ||| {} ||| {}'.format(source, target, alignment)) - self.extractor.add_instance(source, target, alignment) + self.extractor.add_instance(source, target, alignment, ctx_name) # Clear (old) cached grammar - rm_grammar = self.grammar_dict.pop(source) + rm_grammar = self.grammar_dict[ctx_name].pop(source) os.remove(rm_grammar) - # Add to HPYPLM by writing to fifo (read on next translation) - logging.info('Adding to HPYPLM: {}'.format(target)) - self.ref_fifo.write('{}\n'.format(target)) - self.ref_fifo.flush() + sem.release() - def save_state(self, filename=None): + def save_state(self, filename=None, ctx_name=None): + self.lazy_ctx(ctx_name) out = open(filename, 'w') if filename else sys.stdout - logging.info('Saving state with {} sentences'.format(len(self.inc_data))) - out.write('{}\n'.format(self.decoder.get_weights())) - for (source, target, alignment) in self.inc_data: + sem = self.ctx_sems[ctx_name] + sem.acquire() + ctx_data = self.ctx_data[ctx_name] + logging.info('Saving state with {} sentences'.format(len(self.ctx_data))) + out.write('{}\n'.format(self.decoders[ctx_name].decoder.get_weights())) + for (source, target, alignment) in ctx_data: out.write('{} ||| {} ||| {}\n'.format(source, target, alignment)) + sem.release() out.write('EOF\n') if filename: out.close() - def load_state(self, input=sys.stdin): - # Non-initial load error - if self.inc_data: + def load_state(self, input=sys.stdin, ctx_name=None): + self.lazy_ctx(ctx_name) + sem = self.ctx_sems[ctx_name] + sem.acquire() + ctx_data = self.ctx_data[ctx_name] + decoder = self.decoders[ctx_name] + # Non-initial load error + if ctx_data: logging.info('Error: Incremental data has already been added to decoder.') logging.info(' State can only be loaded by a freshly started decoder.') return # MIRA weights line = input.readline().strip() - self.decoder.set_weights(line) + decoder.decoder.set_weights(line) logging.info('Loading state...') start_time = time.time() # Lines source ||| target ||| alignment @@ -207,12 +316,13 @@ class RealtimeDecoder: if line == 'EOF': break (source, target, alignment) = line.split(' ||| ') - self.inc_data.append((source, target, alignment)) + ctx_data.append((source, target, alignment)) # Extractor - self.extractor.add_instance(source, target, alignment) + self.extractor.add_instance(source, target, alignment, ctx_name) # HPYPLM - hyp = self.decoder.decode(LIKELY_OOV) + hyp = decoder.decoder.decode(LIKELY_OOV) self.ref_fifo.write('{}\n'.format(target)) self.ref_fifo.flush() stop_time = time.time() - logging.info('Loaded state with {} sentences in {} seconds'.format(len(self.inc_data), stop_time - start_time)) + logging.info('Loaded state with {} sentences in {} seconds'.format(len(ctx_data), stop_time - start_time)) + sem.release() -- cgit v1.2.3 From 49ddc45e717ac495c6adf80a20d02a1672a069df Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Wed, 25 Sep 2013 18:45:28 -0700 Subject: Threading tests --- realtime/realtime.py | 79 +++++++++++++++++++++++++++++++++++----------------- realtime/rt/rt.py | 4 +++ 2 files changed, 58 insertions(+), 25 deletions(-) diff --git a/realtime/realtime.py b/realtime/realtime.py index 282d3311..bbec288b 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -2,9 +2,9 @@ import argparse import logging -import signal import sys import threading +import time import rt @@ -15,6 +15,41 @@ class Parser(argparse.ArgumentParser): sys.stderr.write('\n{}\n'.format(message)) sys.exit(2) +def handle_line(translator, line, output, ctx_name): + if '|||' in line: + translator.command_line(line, ctx_name) + else: + hyp = translator.decode(line, ctx_name) + output.write('{}\n'.format(hyp)) + output.flush() + +def test1(translator, input, output, ctx_name): + inp = open(input) + out = open(output, 'w') + for line in inp: + handle_line(translator, line.strip(), out, ctx_name) + out.close() + +def debug(translator, input): + # Test 1: identical output + threads = [] + for i in range(4): + t = threading.Thread(target=test1, args=(translator, input, '{}.out.{}'.format(input, i), str(i))) + threads.append(t) + t.start() + time.sleep(30) + for t in threads: + t.join() + # Test 2: flood (same number of lines) + threads = [] + out = open('{}.out.flood'.format(input), 'w') + for line in open(input): + t = threading.Thread(target=handle_line, args=(translator, line.strip(), out, None)) + threads.append(t) + t.start() + for t in threads: + t.join() + def main(): parser = Parser(description='Real-time adaptive translation with cdec. (See README.md)') @@ -24,7 +59,7 @@ def main(): parser.add_argument('-T', '--temp', help='Temp directory (default /tmp)', default='/tmp') parser.add_argument('-a', '--cache', help='Grammar cache size (default 5)', default='5') parser.add_argument('-v', '--verbose', help='Info to stderr', action='store_true') - parser.add_argument('-D', '--debug-test', help='Test thread safety (debug use only)', action='store_true') + parser.add_argument('-D', '--debug-test', help='Run debug tests on input file') args = parser.parse_args() if args.verbose: @@ -32,29 +67,23 @@ def main(): with rt.RealtimeTranslator(args.config, tmpdir=args.temp, cache_size=int(args.cache), norm=args.normalize) as translator: - # Load state if given - if args.state: - with open(args.state) as input: - rtd.load_state(input) - if not args.debug_test: - run(translator) + # Debugging + if args.debug_test: + debug(translator, args.debug_test) + return + + # Read lines and commands + while True: + line = sys.stdin.readline() + if not line: + break + line = line.strip() + if '|||' in line: + translator.command_line(line) else: - # TODO: write test - run(translator) - -def run(translator, input=sys.stdin, output=sys.stdout, ctx_name=None): - # Read lines and commands - while True: - line = input.readline() - if not line: - break - line = line.strip() - if '|||' in line: - translator.command_line(line, ctx_name) - else: - hyp = translator.decode(line, ctx_name) - output.write('{}\n'.format(hyp)) - output.flush() - + hyp = translator.decode(line) + sys.stdout.write('{}\n'.format(hyp)) + sys.stdout.flush() + if __name__ == '__main__': main() diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 6f1fb70f..f8126283 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -101,6 +101,8 @@ class RealtimeTranslator: # ctx -> list of (source, target, alignment) self.ctx_data = {} + # Grammar extractor is not threadsafe + self.extractor_sem = threading.Semaphore() # ctx -> deque of file self.grammar_files = {} # ctx -> dict of {sentence: file} @@ -181,8 +183,10 @@ class RealtimeTranslator: (fid, grammar_file) = tempfile.mkstemp(dir=self.decoders[ctx_name].tmp, prefix='grammar.') os.close(fid) with open(grammar_file, 'w') as output: + self.extractor_sem.acquire() for rule in self.extractor.grammar(sentence, ctx_name): output.write('{}\n'.format(str(rule))) + self.extractor_sem.release() grammar_files = self.grammar_files[ctx_name] if len(grammar_files) == self.cache_size: rm_sent = grammar_files.popleft() -- cgit v1.2.3 From cb718c763e07b8e1417383ef7ae5c1aca36d2a0a Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Thu, 26 Sep 2013 14:28:42 -0700 Subject: FIFO Locks --- realtime/rt/aligner.py | 6 ++--- realtime/rt/decoder.py | 24 +++++++++--------- realtime/rt/rt.py | 66 +++++++++++++++++++++++++------------------------- realtime/rt/util.py | 19 +++++++++++++++ 4 files changed, 67 insertions(+), 48 deletions(-) diff --git a/realtime/rt/aligner.py b/realtime/rt/aligner.py index a14121db..62ce32b8 100644 --- a/realtime/rt/aligner.py +++ b/realtime/rt/aligner.py @@ -31,7 +31,7 @@ class ForceAligner: self.tools = util.popen_io(tools_cmd) # Used to guarantee thread safety - self.semaphore = threading.Semaphore() + self.lock = util.FIFOLock() def align(self, source, target): '''Threadsafe''' @@ -39,7 +39,7 @@ class ForceAligner: def align_formatted(self, line): '''Threadsafe''' - self.semaphore.acquire() + self.lock.acquire() self.fwd_align.stdin.write('{}\n'.format(line)) self.rev_align.stdin.write('{}\n'.format(line)) # f words ||| e words ||| links ||| score @@ -48,7 +48,7 @@ class ForceAligner: self.tools.stdin.write('{}\n'.format(fwd_line)) self.tools.stdin.write('{}\n'.format(rev_line)) al_line = self.tools.stdout.readline().strip() - self.semaphore.release() + self.lock.release() return al_line def close(self): diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py index 72b5b959..7c36b441 100644 --- a/realtime/rt/decoder.py +++ b/realtime/rt/decoder.py @@ -9,18 +9,18 @@ class Decoder: def close(self, force=False): if not force: - self.semaphore.acquire() + self.lock.acquire() self.decoder.stdin.close() if not force: - self.semaphore.release() + self.lock.release() def decode(self, sentence, grammar=None): '''Threadsafe''' input = '{s}\n'.format(s=sentence, g=grammar) if grammar else '{}\n'.format(sentence) - self.semaphore.acquire() + self.lock.acquire() self.decoder.stdin.write(input) hyp = self.decoder.stdout.readline().strip() - self.semaphore.release() + self.lock.release() return hyp class CdecDecoder(Decoder): @@ -31,7 +31,7 @@ class CdecDecoder(Decoder): decoder_cmd = [decoder, '-c', config, '-w', weights] logging.info('Executing: {}'.format(' '.join(decoder_cmd))) self.decoder = util.popen_io(decoder_cmd) - self.semaphore = threading.Semaphore() + self.lock = util.FIFOLock() class MIRADecoder(Decoder): @@ -42,27 +42,27 @@ class MIRADecoder(Decoder): mira_cmd = [mira, '-c', config, '-w', weights, '-o', '2', '-C', '0.001', '-b', '500', '-k', '500', '-u', '-t'] logging.info('Executing: {}'.format(' '.join(mira_cmd))) self.decoder = util.popen_io(mira_cmd) - self.semaphore = threading.Semaphore() + self.lock = util.FIFOLock() def get_weights(self): '''Threadsafe''' - self.semaphore.acquire() + self.lock.acquire() self.decoder.stdin.write('WEIGHTS ||| WRITE\n') weights = self.decoder.stdout.readline().strip() - self.semaphore.release() + self.lock.release() return weights def set_weights(self, w_line): '''Threadsafe''' - self.semaphore.acquire() + self.lock.acquire() self.decoder.stdin.write('WEIGHTS ||| {}\n'.format(w_line)) - self.semaphore.release() + self.lock.release() def update(self, sentence, grammar, reference): '''Threadsafe''' input = 'LEARN ||| {s} ||| {r}\n'.format(s=sentence, g=grammar, r=reference) - self.semaphore.acquire() + self.lock.acquire() self.decoder.stdin.write(input) log = self.decoder.stdout.readline().strip() - self.semaphore.release() + self.lock.release() return log diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index f8126283..1e78e188 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -74,9 +74,9 @@ class RealtimeTranslator: self.norm = norm if self.norm: self.tokenizer = util.popen_io([os.path.join(cdec_root, 'corpus', 'tokenize-anything.sh'), '-u']) - self.tokenizer_sem = threading.Semaphore() + self.tokenizer_lock = util.FIFOLock() self.detokenizer = util.popen_io([os.path.join(cdec_root, 'corpus', 'untok.pl')]) - self.detokenizer_sem = threading.Semaphore() + self.detokenizer_lock = util.FIFOLock() # Word aligner fwd_params = os.path.join(configdir, 'a.fwd_params') @@ -97,12 +97,12 @@ class RealtimeTranslator: self.ctx_names = set() # All context-dependent operations are atomic - self.ctx_sems = collections.defaultdict(threading.Semaphore) + self.ctx_locks = collections.defaultdict(util.FIFOLock) # ctx -> list of (source, target, alignment) self.ctx_data = {} # Grammar extractor is not threadsafe - self.extractor_sem = threading.Semaphore() + self.extractor_lock = util.FIFOLock() # ctx -> deque of file self.grammar_files = {} # ctx -> dict of {sentence: file} @@ -138,9 +138,9 @@ class RealtimeTranslator: def lazy_ctx(self, ctx_name): '''Initialize a context (inc starting a new decoder) if needed''' - self.ctx_sems[ctx_name].acquire() + self.ctx_locks[ctx_name].acquire() if ctx_name in self.ctx_names: - self.ctx_sems[ctx_name].release() + self.ctx_locks[ctx_name].release() return logging.info('New context: {}'.format(ctx_name)) self.ctx_names.add(ctx_name) @@ -149,13 +149,13 @@ class RealtimeTranslator: self.grammar_dict[ctx_name] = {} tmpdir = os.path.join(self.tmp, 'decoder.{}'.format(ctx_name)) self.decoders[ctx_name] = RealtimeDecoder(self.config, tmpdir) - self.ctx_sems[ctx_name].release() + self.ctx_locks[ctx_name].release() def drop_ctx(self, ctx_name, force=False): '''Delete a context (inc stopping the decoder)''' if not force: - sem = self.ctx_sems[ctx_name] - sem.acquire() + lock = self.ctx_locks[ctx_name] + lock.acquire() logging.info('Dropping context: {}'.format(ctx_name)) self.ctx_names.remove(ctx_name) self.ctx_data.pop(ctx_name) @@ -163,30 +163,30 @@ class RealtimeTranslator: self.grammar_files.pop(ctx_name) self.grammar_dict.pop(ctx_name) self.decoders.pop(ctx_name).close(force) - self.ctx_sems.pop(ctx_name) + self.ctx_locks.pop(ctx_name) if not force: - sem.release() + lock.release() def grammar(self, sentence, ctx_name=None): '''Extract a sentence-level grammar on demand (or return cached)''' self.lazy_ctx(ctx_name) - sem = self.ctx_sems[ctx_name] - sem.acquire() + lock = self.ctx_locks[ctx_name] + lock.acquire() grammar_dict = self.grammar_dict[ctx_name] grammar_file = grammar_dict.get(sentence, None) # Cache hit if grammar_file: logging.info('Grammar cache hit: {}'.format(grammar_file)) - sem.release() + lock.release() return grammar_file # Extract and cache (fid, grammar_file) = tempfile.mkstemp(dir=self.decoders[ctx_name].tmp, prefix='grammar.') os.close(fid) with open(grammar_file, 'w') as output: - self.extractor_sem.acquire() + self.extractor_lock.acquire() for rule in self.extractor.grammar(sentence, ctx_name): output.write('{}\n'.format(str(rule))) - self.extractor_sem.release() + self.extractor_lock.release() grammar_files = self.grammar_files[ctx_name] if len(grammar_files) == self.cache_size: rm_sent = grammar_files.popleft() @@ -196,7 +196,7 @@ class RealtimeTranslator: os.remove(rm_grammar) grammar_files.append(sentence) grammar_dict[sentence] = grammar_file - sem.release() + lock.release() return grammar_file def decode(self, sentence, ctx_name=None): @@ -211,8 +211,8 @@ class RealtimeTranslator: # grammar method is threadsafe grammar_file = self.grammar(sentence, ctx_name) decoder = self.decoders[ctx_name] - sem = self.ctx_sems[ctx_name] - sem.acquire() + lock = self.ctx_locks[ctx_name] + lock.acquire() start_time = time.time() hyp = decoder.decoder.decode(sentence, grammar_file) stop_time = time.time() @@ -220,24 +220,24 @@ class RealtimeTranslator: # Empty reference: HPYPLM does not learn prior to next translation decoder.ref_fifo.write('\n') decoder.ref_fifo.flush() - sem.release() + lock.release() if self.norm: logging.info('Normalized translation: {}'.format(hyp)) hyp = self.detokenize(hyp) return hyp def tokenize(self, line): - self.tokenizer_sem.acquire() + self.tokenizer_lock.acquire() self.tokenizer.stdin.write('{}\n'.format(line)) tok_line = self.tokenizer.stdout.readline().strip() - self.tokenizer_sem.release() + self.tokenizer_lock.release() return tok_line def detokenize(self, line): - self.detokenizer_sem.acquire() + self.detokenizer_lock.acquire() self.detokenizer.stdin.write('{}\n'.format(line)) detok_line = self.detokenizer.stdout.readline().strip() - self.detokenizer_sem.release() + self.detokenizer_lock.release() return detok_line # TODO @@ -263,8 +263,8 @@ class RealtimeTranslator: alignment = self.aligner.align(source, target) # grammar method is threadsafe grammar_file = self.grammar(source, ctx_name) - sem = self.ctx_sems[ctx_name] - sem.acquire() + lock = self.ctx_locks[ctx_name] + lock.acquire() # MIRA update before adding data to grammar extractor decoder = self.decoders[ctx_name] mira_log = decoder.decoder.update(source, grammar_file, target) @@ -281,27 +281,27 @@ class RealtimeTranslator: # Clear (old) cached grammar rm_grammar = self.grammar_dict[ctx_name].pop(source) os.remove(rm_grammar) - sem.release() + lock.release() def save_state(self, filename=None, ctx_name=None): self.lazy_ctx(ctx_name) out = open(filename, 'w') if filename else sys.stdout - sem = self.ctx_sems[ctx_name] - sem.acquire() + lock = self.ctx_locks[ctx_name] + lock.acquire() ctx_data = self.ctx_data[ctx_name] logging.info('Saving state with {} sentences'.format(len(self.ctx_data))) out.write('{}\n'.format(self.decoders[ctx_name].decoder.get_weights())) for (source, target, alignment) in ctx_data: out.write('{} ||| {} ||| {}\n'.format(source, target, alignment)) - sem.release() + lock.release() out.write('EOF\n') if filename: out.close() def load_state(self, input=sys.stdin, ctx_name=None): self.lazy_ctx(ctx_name) - sem = self.ctx_sems[ctx_name] - sem.acquire() + lock = self.ctx_locks[ctx_name] + lock.acquire() ctx_data = self.ctx_data[ctx_name] decoder = self.decoders[ctx_name] # Non-initial load error @@ -329,4 +329,4 @@ class RealtimeTranslator: self.ref_fifo.flush() stop_time = time.time() logging.info('Loaded state with {} sentences in {} seconds'.format(len(ctx_data), stop_time - start_time)) - sem.release() + lock.release() diff --git a/realtime/rt/util.py b/realtime/rt/util.py index 6e07f116..05dcae96 100644 --- a/realtime/rt/util.py +++ b/realtime/rt/util.py @@ -1,4 +1,5 @@ import os +import Queue import subprocess import sys import threading @@ -13,6 +14,24 @@ SA_INI_FILES = set(( 'precompute_file', )) +class FIFOLock: + + def __init__(self): + self.q = Queue.Queue() + self.i = 0 + + def acquire(self): + self.i += 1 + if self.i > 1: + event = threading.Event() + self.q.put(event) + event.wait() + + def release(self): + self.i -= 1 + if self.i > 0: + self.q.get().set() + def cdec_ini_for_config(config): # This is a list of (k, v), not a ConfigObj or dict for i in range(len(config)): -- cgit v1.2.3 From b8116c5c3c7e31a276ff38fc8173eab37f292364 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Fri, 27 Sep 2013 13:39:24 -0700 Subject: Decoding and learning with multiple contexts is threadsafe and FIFO. --- realtime/realtime.py | 17 ++++++++----- realtime/rt/aligner.py | 10 +++++--- realtime/rt/decoder.py | 8 +++---- realtime/rt/rt.py | 65 ++++++++++++++++++++++++++++---------------------- realtime/rt/util.py | 8 +++++++ 5 files changed, 67 insertions(+), 41 deletions(-) diff --git a/realtime/realtime.py b/realtime/realtime.py index bbec288b..38da4413 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -31,22 +31,27 @@ def test1(translator, input, output, ctx_name): out.close() def debug(translator, input): - # Test 1: identical output + # Test 1: multiple contexts threads = [] for i in range(4): t = threading.Thread(target=test1, args=(translator, input, '{}.out.{}'.format(input, i), str(i))) threads.append(t) t.start() time.sleep(30) - for t in threads: - t.join() - # Test 2: flood (same number of lines) - threads = [] + # Test 2: flood out = open('{}.out.flood'.format(input), 'w') - for line in open(input): + inp = open(input) + while True: + line = inp.readline() + if not line: + break + line = line.strip() t = threading.Thread(target=handle_line, args=(translator, line.strip(), out, None)) threads.append(t) t.start() + time.sleep(1) + translator.drop_ctx(None) + # Join test threads for t in threads: t.join() diff --git a/realtime/rt/aligner.py b/realtime/rt/aligner.py index 62ce32b8..def3fcb5 100644 --- a/realtime/rt/aligner.py +++ b/realtime/rt/aligner.py @@ -34,11 +34,11 @@ class ForceAligner: self.lock = util.FIFOLock() def align(self, source, target): - '''Threadsafe''' + '''Threadsafe, FIFO''' return self.align_formatted('{} ||| {}'.format(source, target)) def align_formatted(self, line): - '''Threadsafe''' + '''Threadsafe, FIFO''' self.lock.acquire() self.fwd_align.stdin.write('{}\n'.format(line)) self.rev_align.stdin.write('{}\n'.format(line)) @@ -51,10 +51,14 @@ class ForceAligner: self.lock.release() return al_line - def close(self): + def close(self, force=False): + if not force: + self.lock.acquire() self.fwd_align.stdin.close() self.rev_align.stdin.close() self.tools.stdin.close() + if not force: + self.lock.release() def read_err(self, err): (T, m) = ('', '') diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py index 7c36b441..da646f68 100644 --- a/realtime/rt/decoder.py +++ b/realtime/rt/decoder.py @@ -15,7 +15,7 @@ class Decoder: self.lock.release() def decode(self, sentence, grammar=None): - '''Threadsafe''' + '''Threadsafe, FIFO''' input = '{s}\n'.format(s=sentence, g=grammar) if grammar else '{}\n'.format(sentence) self.lock.acquire() self.decoder.stdin.write(input) @@ -45,7 +45,7 @@ class MIRADecoder(Decoder): self.lock = util.FIFOLock() def get_weights(self): - '''Threadsafe''' + '''Threadsafe, FIFO''' self.lock.acquire() self.decoder.stdin.write('WEIGHTS ||| WRITE\n') weights = self.decoder.stdout.readline().strip() @@ -53,13 +53,13 @@ class MIRADecoder(Decoder): return weights def set_weights(self, w_line): - '''Threadsafe''' + '''Threadsafe, FIFO''' self.lock.acquire() self.decoder.stdin.write('WEIGHTS ||| {}\n'.format(w_line)) self.lock.release() def update(self, sentence, grammar, reference): - '''Threadsafe''' + '''Threadsafe, FIFO''' input = 'LEARN ||| {s} ||| {r}\n'.format(s=sentence, g=grammar, r=reference) self.lock.acquire() self.decoder.stdin.write(input) diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 1e78e188..5ace5d59 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -129,18 +129,23 @@ class RealtimeTranslator: for ctx_name in list(self.ctx_names): self.drop_ctx(ctx_name, force) logging.info('Closing processes') - self.aligner.close() + self.aligner.close(force) if self.norm: + if not force: + self.tokenizer_lock.acquire() + self.detokenizer_lock.acquire() self.tokenizer.stdin.close() self.detokenizer.stdin.close() + if not force: + self.tokenizer_lock.release() + self.detokenizer_lock.release() logging.info('Deleting {}'.format(self.tmp)) shutil.rmtree(self.tmp) def lazy_ctx(self, ctx_name): - '''Initialize a context (inc starting a new decoder) if needed''' - self.ctx_locks[ctx_name].acquire() + '''Initialize a context (inc starting a new decoder) if needed. + NOT threadsafe, acquire ctx_name lock before calling.''' if ctx_name in self.ctx_names: - self.ctx_locks[ctx_name].release() return logging.info('New context: {}'.format(ctx_name)) self.ctx_names.add(ctx_name) @@ -149,12 +154,12 @@ class RealtimeTranslator: self.grammar_dict[ctx_name] = {} tmpdir = os.path.join(self.tmp, 'decoder.{}'.format(ctx_name)) self.decoders[ctx_name] = RealtimeDecoder(self.config, tmpdir) - self.ctx_locks[ctx_name].release() - def drop_ctx(self, ctx_name, force=False): - '''Delete a context (inc stopping the decoder)''' + def drop_ctx(self, ctx_name=None, force=False): + '''Delete a context (inc stopping the decoder) + Threadsafe and FIFO unless forced.''' + lock = self.ctx_locks[ctx_name] if not force: - lock = self.ctx_locks[ctx_name] lock.acquire() logging.info('Dropping context: {}'.format(ctx_name)) self.ctx_names.remove(ctx_name) @@ -168,25 +173,24 @@ class RealtimeTranslator: lock.release() def grammar(self, sentence, ctx_name=None): - '''Extract a sentence-level grammar on demand (or return cached)''' + '''Extract a sentence-level grammar on demand (or return cached) + Threadsafe wrt extractor but NOT decoder. Acquire ctx_name lock + before calling.''' + self.extractor_lock.acquire() self.lazy_ctx(ctx_name) - lock = self.ctx_locks[ctx_name] - lock.acquire() grammar_dict = self.grammar_dict[ctx_name] grammar_file = grammar_dict.get(sentence, None) # Cache hit if grammar_file: logging.info('Grammar cache hit: {}'.format(grammar_file)) - lock.release() + self.extractor_lock.release() return grammar_file # Extract and cache (fid, grammar_file) = tempfile.mkstemp(dir=self.decoders[ctx_name].tmp, prefix='grammar.') os.close(fid) with open(grammar_file, 'w') as output: - self.extractor_lock.acquire() for rule in self.extractor.grammar(sentence, ctx_name): output.write('{}\n'.format(str(rule))) - self.extractor_lock.release() grammar_files = self.grammar_files[ctx_name] if len(grammar_files) == self.cache_size: rm_sent = grammar_files.popleft() @@ -196,23 +200,25 @@ class RealtimeTranslator: os.remove(rm_grammar) grammar_files.append(sentence) grammar_dict[sentence] = grammar_file - lock.release() + self.extractor_lock.release() return grammar_file def decode(self, sentence, ctx_name=None): - '''Decode a sentence (inc extracting a grammar if needed)''' + '''Decode a sentence (inc extracting a grammar if needed) + Threadsafe, FIFO''' + lock = self.ctx_locks[ctx_name] + lock.acquire() self.lazy_ctx(ctx_name) + logging.info('DECODE: {}'.format(sentence)) # Empty in, empty out if sentence.strip() == '': + lock.release() return '' if self.norm: sentence = self.tokenize(sentence) logging.info('Normalized input: {}'.format(sentence)) - # grammar method is threadsafe grammar_file = self.grammar(sentence, ctx_name) decoder = self.decoders[ctx_name] - lock = self.ctx_locks[ctx_name] - lock.acquire() start_time = time.time() hyp = decoder.decoder.decode(sentence, grammar_file) stop_time = time.time() @@ -220,10 +226,10 @@ class RealtimeTranslator: # Empty reference: HPYPLM does not learn prior to next translation decoder.ref_fifo.write('\n') decoder.ref_fifo.flush() - lock.release() if self.norm: logging.info('Normalized translation: {}'.format(hyp)) hyp = self.detokenize(hyp) + lock.release() return hyp def tokenize(self, line): @@ -242,29 +248,32 @@ class RealtimeTranslator: # TODO def command_line(self, line, ctx_name=None): - args = [f.strip() for f in line.split('|||')] - try: + args = [f.strip() for f in line.split('|||')] + #try: if len(args) == 2 and not args[1]: self.commands[args[0]](ctx_name) else: self.commands[args[0]](*args[1:], ctx_name=ctx_name) - except: - logging.info('Command error: {}'.format(' ||| '.join(args))) + #except: + # logging.info('Command error: {}'.format(' ||| '.join(args))) def learn(self, source, target, ctx_name=None): + '''Learn from training instance (inc extracting grammar if needed) + Threadsafe, FIFO''' + lock = self.ctx_locks[ctx_name] + lock.acquire() self.lazy_ctx(ctx_name) + logging.info('LEARN: {}'.format(source)) if '' in (source.strip(), target.strip()): logging.info('Error empty source or target: {} ||| {}'.format(source, target)) + lock.release() return if self.norm: source = self.tokenize(source) target = self.tokenize(target) - # Align instance (threadsafe) + # Align instance alignment = self.aligner.align(source, target) - # grammar method is threadsafe grammar_file = self.grammar(source, ctx_name) - lock = self.ctx_locks[ctx_name] - lock.acquire() # MIRA update before adding data to grammar extractor decoder = self.decoders[ctx_name] mira_log = decoder.decoder.update(source, grammar_file, target) diff --git a/realtime/rt/util.py b/realtime/rt/util.py index 05dcae96..52767dac 100644 --- a/realtime/rt/util.py +++ b/realtime/rt/util.py @@ -15,22 +15,30 @@ SA_INI_FILES = set(( )) class FIFOLock: + '''Lock that preserves FIFO order of blocking threads''' def __init__(self): self.q = Queue.Queue() self.i = 0 + self.lock = threading.Lock() def acquire(self): + self.lock.acquire() self.i += 1 if self.i > 1: event = threading.Event() self.q.put(event) + self.lock.release() event.wait() + return + self.lock.release() def release(self): + self.lock.acquire() self.i -= 1 if self.i > 0: self.q.get().set() + self.lock.release() def cdec_ini_for_config(config): # This is a list of (k, v), not a ConfigObj or dict -- cgit v1.2.3 From e97bb01cc3a0790dc8dc474db2fd204cbd3fe579 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Mon, 30 Sep 2013 07:45:06 -0700 Subject: Command handling --- realtime/mkinput.py | 2 +- realtime/realtime.py | 16 ++++++---------- realtime/rt/rt.py | 37 ++++++++++++++++++++++--------------- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/realtime/mkinput.py b/realtime/mkinput.py index 897b44fd..df434c76 100755 --- a/realtime/mkinput.py +++ b/realtime/mkinput.py @@ -10,7 +10,7 @@ def main(): sys.exit(2) for (src, ref) in itertools.izip(open(sys.argv[1]), open(sys.argv[2])): - sys.stdout.write('{}'.format(src)) + sys.stdout.write('TR ||| {}'.format(src)) sys.stdout.write('LEARN ||| {} ||| {}'.format(src.strip(), ref)) if __name__ == '__main__': diff --git a/realtime/realtime.py b/realtime/realtime.py index 38da4413..af3a3aba 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -16,11 +16,9 @@ class Parser(argparse.ArgumentParser): sys.exit(2) def handle_line(translator, line, output, ctx_name): - if '|||' in line: - translator.command_line(line, ctx_name) - else: - hyp = translator.decode(line, ctx_name) - output.write('{}\n'.format(hyp)) + res = translator.command_line(line, ctx_name) + if res: + output.write('{}\n'.format(res)) output.flush() def test1(translator, input, output, ctx_name): @@ -83,11 +81,9 @@ def main(): if not line: break line = line.strip() - if '|||' in line: - translator.command_line(line) - else: - hyp = translator.decode(line) - sys.stdout.write('{}\n'.format(hyp)) + res = translator.command_line(line) + if res: + sys.stdout.write('{}\n'.format(res)) sys.stdout.flush() if __name__ == '__main__': diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 5ace5d59..4a31070f 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -58,9 +58,14 @@ class RealtimeTranslator: def __init__(self, configdir, tmpdir='/tmp', cache_size=5, norm=False, state=None): - # TODO: save/load - self.commands = {'LEARN': self.learn, 'SAVE': self.save_state, 'LOAD': self.load_state} - + # name -> (method, set of possible nargs) + self.COMMANDS = { + 'TR': (self.translate, set((1,))), + 'LEARN': (self.learn, set((2,))), + 'SAVE': (self.save_state, set((0, 1))), + 'LOAD': (self.load_state, set((0, 1))), + } + cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) ### Single instance for all contexts @@ -203,13 +208,12 @@ class RealtimeTranslator: self.extractor_lock.release() return grammar_file - def decode(self, sentence, ctx_name=None): + def translate(self, sentence, ctx_name=None): '''Decode a sentence (inc extracting a grammar if needed) Threadsafe, FIFO''' lock = self.ctx_locks[ctx_name] lock.acquire() self.lazy_ctx(ctx_name) - logging.info('DECODE: {}'.format(sentence)) # Empty in, empty out if sentence.strip() == '': lock.release() @@ -246,16 +250,20 @@ class RealtimeTranslator: self.detokenizer_lock.release() return detok_line - # TODO def command_line(self, line, ctx_name=None): - args = [f.strip() for f in line.split('|||')] - #try: - if len(args) == 2 and not args[1]: - self.commands[args[0]](ctx_name) - else: - self.commands[args[0]](*args[1:], ctx_name=ctx_name) - #except: - # logging.info('Command error: {}'.format(' ||| '.join(args))) + args = [f.strip() for f in line.split('|||')] + (command, nargs) = self.COMMANDS[args[0]] + # ctx_name provided + if len(args[1:]) + 1 in nargs: + logging.info('Context {}: {} ||| {}'.format(args[1], args[0], ' ||| '.join(args[2:]))) + return command(*args[2:], ctx_name=args[1]) + # No ctx_name, use default or passed + elif len(args[1:]) in nargs: + logging.info('Context {}: {} ||| {}'.format(ctx_name, args[0], ' ||| '.join(args[1:]))) + return command(*args[1:], ctx_name=ctx_name) + # nargs doesn't match + else: + logging.info('Command error: {}'.format(' ||| '.join(args))) def learn(self, source, target, ctx_name=None): '''Learn from training instance (inc extracting grammar if needed) @@ -263,7 +271,6 @@ class RealtimeTranslator: lock = self.ctx_locks[ctx_name] lock.acquire() self.lazy_ctx(ctx_name) - logging.info('LEARN: {}'.format(source)) if '' in (source.strip(), target.strip()): logging.info('Error empty source or target: {} ||| {}'.format(source, target)) lock.release() -- cgit v1.2.3 From bf3b6d31e7402252188ecb814a8fcdfd755c10ac Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Mon, 30 Sep 2013 16:00:12 -0700 Subject: New commands, save/load context --- realtime/mkinput.py | 9 ++-- realtime/rt/decoder.py | 12 ++++- realtime/rt/rt.py | 121 +++++++++++++++++++++++++++++++------------------ 3 files changed, 91 insertions(+), 51 deletions(-) diff --git a/realtime/mkinput.py b/realtime/mkinput.py index df434c76..a1b1256d 100755 --- a/realtime/mkinput.py +++ b/realtime/mkinput.py @@ -5,13 +5,14 @@ import sys def main(): - if len(sys.argv[1:]) != 2: - sys.stderr.write('usage: {} test.src test.ref >test.input\n'.format(sys.argv[0])) + if len(sys.argv[1:]) < 2: + sys.stderr.write('usage: {} test.src test.ref [ctx_name] >test.input\n'.format(sys.argv[0])) sys.exit(2) + ctx_name = ' {}'.format(sys.argv[3]) if len(sys.argv[1:]) > 2 else '' for (src, ref) in itertools.izip(open(sys.argv[1]), open(sys.argv[2])): - sys.stdout.write('TR ||| {}'.format(src)) - sys.stdout.write('LEARN ||| {} ||| {}'.format(src.strip(), ref)) + sys.stdout.write('TR{} ||| {}'.format(ctx_name, src)) + sys.stdout.write('LEARN{} ||| {} ||| {}'.format(ctx_name, src.strip(), ref)) if __name__ == '__main__': main() diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py index da646f68..15f7db3f 100644 --- a/realtime/rt/decoder.py +++ b/realtime/rt/decoder.py @@ -55,8 +55,16 @@ class MIRADecoder(Decoder): def set_weights(self, w_line): '''Threadsafe, FIFO''' self.lock.acquire() - self.decoder.stdin.write('WEIGHTS ||| {}\n'.format(w_line)) - self.lock.release() + try: + # Check validity + for w_str in w_line.split(): + (k, v) = w_str.split('=') + float(v) + self.decoder.stdin.write('WEIGHTS ||| {}\n'.format(w_line)) + self.lock.release() + except: + raise Exception('Invalid weights line: {}'.format(w_line)) + def update(self, sentence, grammar, reference): '''Threadsafe, FIFO''' diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 4a31070f..40305f66 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -64,6 +64,8 @@ class RealtimeTranslator: 'LEARN': (self.learn, set((2,))), 'SAVE': (self.save_state, set((0, 1))), 'LOAD': (self.load_state, set((0, 1))), + 'DROP': (self.drop_ctx, set((0,))), + 'LIST': (self.list_ctx, set((0,))), } cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -115,7 +117,6 @@ class RealtimeTranslator: self.decoders = {} - # TODO: state # Load state if given if state: with open(state) as input: @@ -125,7 +126,8 @@ class RealtimeTranslator: return self def __exit__(self, ex_type, ex_value, ex_traceback): - self.close(ex_type is KeyboardInterrupt) + # Force shutdown on exception + self.close(ex_type is not None) def close(self, force=False): '''Cleanup''' @@ -166,6 +168,11 @@ class RealtimeTranslator: lock = self.ctx_locks[ctx_name] if not force: lock.acquire() + if ctx_name not in self.ctx_names: + logging.info('No context found, no action: {}'.format(ctx_name)) + if not force: + lock.release() + return logging.info('Dropping context: {}'.format(ctx_name)) self.ctx_names.remove(ctx_name) self.ctx_data.pop(ctx_name) @@ -176,7 +183,11 @@ class RealtimeTranslator: self.ctx_locks.pop(ctx_name) if not force: lock.release() - + + def list_ctx(self, ctx_name=None): + '''Return a string of active contexts''' + return 'ctx_name ||| {}'.format(' '.join(sorted(str(ctx_name) for ctx_name in self.ctx_names))) + def grammar(self, sentence, ctx_name=None): '''Extract a sentence-level grammar on demand (or return cached) Threadsafe wrt extractor but NOT decoder. Acquire ctx_name lock @@ -251,19 +262,23 @@ class RealtimeTranslator: return detok_line def command_line(self, line, ctx_name=None): + # COMMAND [ctx_name] ||| arg1 [||| arg2 ...] args = [f.strip() for f in line.split('|||')] - (command, nargs) = self.COMMANDS[args[0]] - # ctx_name provided - if len(args[1:]) + 1 in nargs: - logging.info('Context {}: {} ||| {}'.format(args[1], args[0], ' ||| '.join(args[2:]))) - return command(*args[2:], ctx_name=args[1]) - # No ctx_name, use default or passed - elif len(args[1:]) in nargs: - logging.info('Context {}: {} ||| {}'.format(ctx_name, args[0], ' ||| '.join(args[1:]))) - return command(*args[1:], ctx_name=ctx_name) - # nargs doesn't match - else: - logging.info('Command error: {}'.format(' ||| '.join(args))) + if args[-1] == '': + args = args[:-1] + if len(args) > 0: + cmd_name = args[0].split() + # ctx_name provided + if len(cmd_name) == 2: + (cmd_name, ctx_name) = cmd_name + # ctx_name default/passed + else: + cmd_name = cmd_name[0] + (command, nargs) = self.COMMANDS.get(cmd_name, (None, None)) + if command and len(args[1:]) in nargs: + logging.info('{} ({}) ||| {}'.format(cmd_name, ctx_name, ' ||| '.join(args[1:]))) + return command(*args[1:], ctx_name=ctx_name) + logging.info('ERROR: command: {}'.format(' ||| '.join(args))) def learn(self, source, target, ctx_name=None): '''Learn from training instance (inc extracting grammar if needed) @@ -272,7 +287,7 @@ class RealtimeTranslator: lock.acquire() self.lazy_ctx(ctx_name) if '' in (source.strip(), target.strip()): - logging.info('Error empty source or target: {} ||| {}'.format(source, target)) + logging.info('ERROR: empty source or target: {} ||| {}'.format(source, target)) lock.release() return if self.norm: @@ -300,49 +315,65 @@ class RealtimeTranslator: lock.release() def save_state(self, filename=None, ctx_name=None): - self.lazy_ctx(ctx_name) - out = open(filename, 'w') if filename else sys.stdout lock = self.ctx_locks[ctx_name] lock.acquire() + self.lazy_ctx(ctx_name) ctx_data = self.ctx_data[ctx_name] - logging.info('Saving state with {} sentences'.format(len(self.ctx_data))) + out = open(filename, 'w') if filename else sys.stdout + logging.info('Saving state for context ({}) with {} sentences'.format(ctx_name, len(ctx_data))) out.write('{}\n'.format(self.decoders[ctx_name].decoder.get_weights())) for (source, target, alignment) in ctx_data: out.write('{} ||| {} ||| {}\n'.format(source, target, alignment)) - lock.release() out.write('EOF\n') if filename: out.close() + lock.release() - def load_state(self, input=sys.stdin, ctx_name=None): - self.lazy_ctx(ctx_name) + def load_state(self, filename=None, ctx_name=None): lock = self.ctx_locks[ctx_name] lock.acquire() + self.lazy_ctx(ctx_name) ctx_data = self.ctx_data[ctx_name] decoder = self.decoders[ctx_name] - # Non-initial load error + input = open(filename) if filename else sys.stdin + # Non-initial load error if ctx_data: - logging.info('Error: Incremental data has already been added to decoder.') - logging.info(' State can only be loaded by a freshly started decoder.') + logging.info('ERROR: Incremental data has already been added to context ({})'.format(ctx_name)) + logging.info(' State can only be loaded to a new context.') + lock.release() return - # MIRA weights - line = input.readline().strip() - decoder.decoder.set_weights(line) - logging.info('Loading state...') - start_time = time.time() - # Lines source ||| target ||| alignment - while True: + # Many things can go wrong if bad state data is given + try: + # MIRA weights line = input.readline().strip() - if line == 'EOF': - break - (source, target, alignment) = line.split(' ||| ') - ctx_data.append((source, target, alignment)) - # Extractor - self.extractor.add_instance(source, target, alignment, ctx_name) - # HPYPLM - hyp = decoder.decoder.decode(LIKELY_OOV) - self.ref_fifo.write('{}\n'.format(target)) - self.ref_fifo.flush() - stop_time = time.time() - logging.info('Loaded state with {} sentences in {} seconds'.format(len(ctx_data), stop_time - start_time)) - lock.release() + # Throws exception if bad line + decoder.decoder.set_weights(line) + logging.info('Loading state...') + start_time = time.time() + # Lines source ||| target ||| alignment + while True: + line = input.readline() + if not line: + raise Exception('End of file before EOF line') + line = line.strip() + if line == 'EOF': + break + (source, target, alignment) = line.split(' ||| ') + ctx_data.append((source, target, alignment)) + # Extractor + self.extractor.add_instance(source, target, alignment, ctx_name) + # HPYPLM + hyp = decoder.decoder.decode(LIKELY_OOV) + decoder.ref_fifo.write('{}\n'.format(target)) + decoder.ref_fifo.flush() + stop_time = time.time() + logging.info('Loaded state for context ({}) with {} sentences in {} seconds'.format(ctx_name, len(ctx_data), stop_time - start_time)) + lock.release() + # Recover from bad load attempt by restarting context. + # Guaranteed not to cause data loss since only a new context can load state. + except: + logging.info('ERROR: could not load state, restarting context ({})'.format(ctx_name)) + # ctx_name is already owned and needs to be restarted before other blocking threads use + self.drop_ctx(ctx_name, force=True) + self.lazy_ctx(ctx_name) + lock.release() -- cgit v1.2.3 From 8eb6dc27e27d03eefdf29efad4b6092d56ad3006 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Mon, 30 Sep 2013 23:30:51 -0700 Subject: Release lock on exception --- realtime/rt/decoder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py index 15f7db3f..1cee4610 100644 --- a/realtime/rt/decoder.py +++ b/realtime/rt/decoder.py @@ -63,6 +63,7 @@ class MIRADecoder(Decoder): self.decoder.stdin.write('WEIGHTS ||| {}\n'.format(w_line)) self.lock.release() except: + self.lock.release() raise Exception('Invalid weights line: {}'.format(w_line)) -- cgit v1.2.3 From 4830491825f0c8740d505c192d60b388f64acf1b Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Mon, 30 Sep 2013 23:34:04 -0700 Subject: Loading state moved to command, specific to context --- realtime/realtime.py | 1 - realtime/rt/rt.py | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/realtime/realtime.py b/realtime/realtime.py index af3a3aba..be02d486 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -57,7 +57,6 @@ def main(): parser = Parser(description='Real-time adaptive translation with cdec. (See README.md)') parser.add_argument('-c', '--config', required=True, help='Config directory') - parser.add_argument('-s', '--state', help='Load state file (saved incremental data)') parser.add_argument('-n', '--normalize', help='Normalize text (tokenize, translate, detokenize)', action='store_true') parser.add_argument('-T', '--temp', help='Temp directory (default /tmp)', default='/tmp') parser.add_argument('-a', '--cache', help='Grammar cache size (default 5)', default='5') diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 40305f66..43cc43b4 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -56,7 +56,7 @@ class RealtimeDecoder: class RealtimeTranslator: '''Main entry point into API: serves translations to any number of concurrent users''' - def __init__(self, configdir, tmpdir='/tmp', cache_size=5, norm=False, state=None): + def __init__(self, configdir, tmpdir='/tmp', cache_size=5, norm=False): # name -> (method, set of possible nargs) self.COMMANDS = { @@ -117,11 +117,6 @@ class RealtimeTranslator: self.decoders = {} - # Load state if given - if state: - with open(state) as input: - self.load_state(input) - def __enter__(self): return self -- cgit v1.2.3 From 51a83643d95ab0d7add9dd66b0b38044db10a797 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Tue, 1 Oct 2013 14:08:05 -0700 Subject: Better logging, save/load to default context --- realtime/realtime.py | 5 +++++ realtime/rt/aligner.py | 8 +++++--- realtime/rt/decoder.py | 6 ++++-- realtime/rt/rt.py | 50 ++++++++++++++++++++++++++------------------------ 4 files changed, 40 insertions(+), 29 deletions(-) diff --git a/realtime/realtime.py b/realtime/realtime.py index be02d486..6ee785f8 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -57,6 +57,7 @@ def main(): parser = Parser(description='Real-time adaptive translation with cdec. (See README.md)') parser.add_argument('-c', '--config', required=True, help='Config directory') + parser.add_argument('-s', '--state', help='Load state file to default context (saved incremental data)') parser.add_argument('-n', '--normalize', help='Normalize text (tokenize, translate, detokenize)', action='store_true') parser.add_argument('-T', '--temp', help='Temp directory (default /tmp)', default='/tmp') parser.add_argument('-a', '--cache', help='Grammar cache size (default 5)', default='5') @@ -74,6 +75,10 @@ def main(): debug(translator, args.debug_test) return + # Load state if given + if args.state: + rtd.load_state(state) + # Read lines and commands while True: line = sys.stdin.readline() diff --git a/realtime/rt/aligner.py b/realtime/rt/aligner.py index def3fcb5..bcc1ef87 100644 --- a/realtime/rt/aligner.py +++ b/realtime/rt/aligner.py @@ -6,6 +6,8 @@ import threading import util +logger = logging.getLogger('rt.aligner') + class ForceAligner: def __init__(self, fwd_params, fwd_err, rev_params, rev_err): @@ -21,13 +23,13 @@ class ForceAligner: rev_cmd = [fast_align, '-i', '-', '-d', '-T', rev_T, '-m', rev_m, '-f', rev_params, '-r'] tools_cmd = [atools, '-i', '-', '-j', '-', '-c', 'grow-diag-final-and'] - logging.info('Executing: {}'.format(' '.join(fwd_cmd))) + logger.info('Executing: {}'.format(' '.join(fwd_cmd))) self.fwd_align = util.popen_io(fwd_cmd) - logging.info('Executing: {}'.format(' '.join(rev_cmd))) + logger.info('Executing: {}'.format(' '.join(rev_cmd))) self.rev_align = util.popen_io(rev_cmd) - logging.info('Executing: {}'.format(' '.join(tools_cmd))) + logger.info('Executing: {}'.format(' '.join(tools_cmd))) self.tools = util.popen_io(tools_cmd) # Used to guarantee thread safety diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py index 1cee4610..e6e7489d 100644 --- a/realtime/rt/decoder.py +++ b/realtime/rt/decoder.py @@ -5,6 +5,8 @@ import threading import util +logger = logging.getLogger('rt.decoder') + class Decoder: def close(self, force=False): @@ -29,7 +31,7 @@ class CdecDecoder(Decoder): cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) decoder = os.path.join(cdec_root, 'decoder', 'cdec') decoder_cmd = [decoder, '-c', config, '-w', weights] - logging.info('Executing: {}'.format(' '.join(decoder_cmd))) + logger.info('Executing: {}'.format(' '.join(decoder_cmd))) self.decoder = util.popen_io(decoder_cmd) self.lock = util.FIFOLock() @@ -40,7 +42,7 @@ class MIRADecoder(Decoder): mira = os.path.join(cdec_root, 'training', 'mira', 'kbest_cut_mira') # optimizer=2 step=0.001 best=500, k=500, uniq, stream mira_cmd = [mira, '-c', config, '-w', weights, '-o', '2', '-C', '0.001', '-b', '500', '-k', '500', '-u', '-t'] - logging.info('Executing: {}'.format(' '.join(mira_cmd))) + logger.info('Executing: {}'.format(' '.join(mira_cmd))) self.decoder = util.popen_io(mira_cmd) self.lock = util.FIFOLock() diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 43cc43b4..db831712 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -19,6 +19,8 @@ import util # Dummy input token that is unlikely to appear in normalized data (but no fatal errors if it does) LIKELY_OOV = '(OOV)' +logger = logging.getLogger('rt') + class RealtimeDecoder: '''Do not use directly unless you know what you're doing. Use RealtimeTranslator.''' @@ -48,7 +50,7 @@ class RealtimeDecoder: self.decoder = decoder.MIRADecoder(decoder_config_file, decoder_weights) def close(self, force=False): - logging.info('Closing decoder and removing {}'.format(self.tmp)) + logger.info('Closing decoder and removing {}'.format(self.tmp)) self.decoder.close(force) self.ref_fifo.close() shutil.rmtree(self.tmp) @@ -75,7 +77,7 @@ class RealtimeTranslator: self.config = configdir # Temporary work dir self.tmp = tempfile.mkdtemp(dir=tmpdir, prefix='realtime.') - logging.info('Using temp dir {}'.format(self.tmp)) + logger.info('Using temp dir {}'.format(self.tmp)) # Normalization self.norm = norm @@ -127,10 +129,10 @@ class RealtimeTranslator: def close(self, force=False): '''Cleanup''' if force: - logging.info('Forced shutdown: stopping immediately') + logger.info('Forced shutdown: stopping immediately') for ctx_name in list(self.ctx_names): self.drop_ctx(ctx_name, force) - logging.info('Closing processes') + logger.info('Closing processes') self.aligner.close(force) if self.norm: if not force: @@ -141,7 +143,7 @@ class RealtimeTranslator: if not force: self.tokenizer_lock.release() self.detokenizer_lock.release() - logging.info('Deleting {}'.format(self.tmp)) + logger.info('Deleting {}'.format(self.tmp)) shutil.rmtree(self.tmp) def lazy_ctx(self, ctx_name): @@ -149,7 +151,7 @@ class RealtimeTranslator: NOT threadsafe, acquire ctx_name lock before calling.''' if ctx_name in self.ctx_names: return - logging.info('New context: {}'.format(ctx_name)) + logger.info('New context: {}'.format(ctx_name)) self.ctx_names.add(ctx_name) self.ctx_data[ctx_name] = [] self.grammar_files[ctx_name] = collections.deque() @@ -164,11 +166,11 @@ class RealtimeTranslator: if not force: lock.acquire() if ctx_name not in self.ctx_names: - logging.info('No context found, no action: {}'.format(ctx_name)) + logger.info('No context found, no action: {}'.format(ctx_name)) if not force: lock.release() return - logging.info('Dropping context: {}'.format(ctx_name)) + logger.info('Dropping context: {}'.format(ctx_name)) self.ctx_names.remove(ctx_name) self.ctx_data.pop(ctx_name) self.extractor.drop_ctx(ctx_name) @@ -193,7 +195,7 @@ class RealtimeTranslator: grammar_file = grammar_dict.get(sentence, None) # Cache hit if grammar_file: - logging.info('Grammar cache hit: {}'.format(grammar_file)) + logger.info('Grammar cache hit: {}'.format(grammar_file)) self.extractor_lock.release() return grammar_file # Extract and cache @@ -226,18 +228,18 @@ class RealtimeTranslator: return '' if self.norm: sentence = self.tokenize(sentence) - logging.info('Normalized input: {}'.format(sentence)) + logger.info('Normalized input: {}'.format(sentence)) grammar_file = self.grammar(sentence, ctx_name) decoder = self.decoders[ctx_name] start_time = time.time() hyp = decoder.decoder.decode(sentence, grammar_file) stop_time = time.time() - logging.info('Translation time: {} seconds'.format(stop_time - start_time)) + logger.info('Translation time: {} seconds'.format(stop_time - start_time)) # Empty reference: HPYPLM does not learn prior to next translation decoder.ref_fifo.write('\n') decoder.ref_fifo.flush() if self.norm: - logging.info('Normalized translation: {}'.format(hyp)) + logger.info('Normalized translation: {}'.format(hyp)) hyp = self.detokenize(hyp) lock.release() return hyp @@ -271,9 +273,9 @@ class RealtimeTranslator: cmd_name = cmd_name[0] (command, nargs) = self.COMMANDS.get(cmd_name, (None, None)) if command and len(args[1:]) in nargs: - logging.info('{} ({}) ||| {}'.format(cmd_name, ctx_name, ' ||| '.join(args[1:]))) + logger.info('{} ({}) ||| {}'.format(cmd_name, ctx_name, ' ||| '.join(args[1:]))) return command(*args[1:], ctx_name=ctx_name) - logging.info('ERROR: command: {}'.format(' ||| '.join(args))) + logger.info('ERROR: command: {}'.format(' ||| '.join(args))) def learn(self, source, target, ctx_name=None): '''Learn from training instance (inc extracting grammar if needed) @@ -282,7 +284,7 @@ class RealtimeTranslator: lock.acquire() self.lazy_ctx(ctx_name) if '' in (source.strip(), target.strip()): - logging.info('ERROR: empty source or target: {} ||| {}'.format(source, target)) + logger.info('ERROR: empty source or target: {} ||| {}'.format(source, target)) lock.release() return if self.norm: @@ -294,15 +296,15 @@ class RealtimeTranslator: # MIRA update before adding data to grammar extractor decoder = self.decoders[ctx_name] mira_log = decoder.decoder.update(source, grammar_file, target) - logging.info('MIRA: {}'.format(mira_log)) + logger.info('MIRA: {}'.format(mira_log)) # Add to HPYPLM by writing to fifo (read on next translation) - logging.info('Adding to HPYPLM: {}'.format(target)) + logger.info('Adding to HPYPLM: {}'.format(target)) decoder.ref_fifo.write('{}\n'.format(target)) decoder.ref_fifo.flush() # Store incremental data for save/load self.ctx_data[ctx_name].append((source, target, alignment)) # Add aligned sentence pair to grammar extractor - logging.info('Adding to bitext: {} ||| {} ||| {}'.format(source, target, alignment)) + logger.info('Adding to bitext: {} ||| {} ||| {}'.format(source, target, alignment)) self.extractor.add_instance(source, target, alignment, ctx_name) # Clear (old) cached grammar rm_grammar = self.grammar_dict[ctx_name].pop(source) @@ -315,7 +317,7 @@ class RealtimeTranslator: self.lazy_ctx(ctx_name) ctx_data = self.ctx_data[ctx_name] out = open(filename, 'w') if filename else sys.stdout - logging.info('Saving state for context ({}) with {} sentences'.format(ctx_name, len(ctx_data))) + logger.info('Saving state for context ({}) with {} sentences'.format(ctx_name, len(ctx_data))) out.write('{}\n'.format(self.decoders[ctx_name].decoder.get_weights())) for (source, target, alignment) in ctx_data: out.write('{} ||| {} ||| {}\n'.format(source, target, alignment)) @@ -333,8 +335,8 @@ class RealtimeTranslator: input = open(filename) if filename else sys.stdin # Non-initial load error if ctx_data: - logging.info('ERROR: Incremental data has already been added to context ({})'.format(ctx_name)) - logging.info(' State can only be loaded to a new context.') + logger.info('ERROR: Incremental data has already been added to context ({})'.format(ctx_name)) + logger.info(' State can only be loaded to a new context.') lock.release() return # Many things can go wrong if bad state data is given @@ -343,7 +345,7 @@ class RealtimeTranslator: line = input.readline().strip() # Throws exception if bad line decoder.decoder.set_weights(line) - logging.info('Loading state...') + logger.info('Loading state...') start_time = time.time() # Lines source ||| target ||| alignment while True: @@ -362,12 +364,12 @@ class RealtimeTranslator: decoder.ref_fifo.write('{}\n'.format(target)) decoder.ref_fifo.flush() stop_time = time.time() - logging.info('Loaded state for context ({}) with {} sentences in {} seconds'.format(ctx_name, len(ctx_data), stop_time - start_time)) + logger.info('Loaded state for context ({}) with {} sentences in {} seconds'.format(ctx_name, len(ctx_data), stop_time - start_time)) lock.release() # Recover from bad load attempt by restarting context. # Guaranteed not to cause data loss since only a new context can load state. except: - logging.info('ERROR: could not load state, restarting context ({})'.format(ctx_name)) + logger.info('ERROR: could not load state, restarting context ({})'.format(ctx_name)) # ctx_name is already owned and needs to be restarted before other blocking threads use self.drop_ctx(ctx_name, force=True) self.lazy_ctx(ctx_name) -- cgit v1.2.3 From 13b1eb367cfeab33fa081ca6725a7dcecf16ed88 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Mon, 7 Oct 2013 08:09:51 -0700 Subject: Documentation --- realtime/README.md | 2 +- realtime/realtime.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/realtime/README.md b/realtime/README.md index 584ee516..e5290fc5 100644 --- a/realtime/README.md +++ b/realtime/README.md @@ -1,4 +1,4 @@ -cdec-realtime +cdec Realtime ------------- Code by Michael Denkowski (http://www.cs.cmu.edu/~mdenkows/, mdenkows@cs.cmu.edu) diff --git a/realtime/realtime.py b/realtime/realtime.py index 6ee785f8..ec15b59d 100755 --- a/realtime/realtime.py +++ b/realtime/realtime.py @@ -8,9 +8,26 @@ import time import rt +ABOUT = '''Realtime adaptive translation with cdec (See README.md) + +Code by Michael Denkowski + +Citation: +@misc{denkowski-proposal2013, + author = {Michael Denkowski}, + title = {Machine Translation for Human Translators}, + year = {2013}, + month = {May}, + day = {30}, + howpublished = {{Ph.D.} Thesis Proposal, Carnegie Mellon University} +} + +''' + class Parser(argparse.ArgumentParser): def error(self, message): + sys.stderr.write(ABOUT) self.print_help() sys.stderr.write('\n{}\n'.format(message)) sys.exit(2) @@ -55,7 +72,7 @@ def debug(translator, input): def main(): - parser = Parser(description='Real-time adaptive translation with cdec. (See README.md)') + parser = Parser() parser.add_argument('-c', '--config', required=True, help='Config directory') parser.add_argument('-s', '--state', help='Load state file to default context (saved incremental data)') parser.add_argument('-n', '--normalize', help='Normalize text (tokenize, translate, detokenize)', action='store_true') -- cgit v1.2.3 From 77aa94390b678dc6f2faad52ec52847104a5f9b6 Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Tue, 8 Oct 2013 17:25:00 -0400 Subject: Better logging --- realtime/rt/rt.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index db831712..f66d3a4d 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -151,7 +151,7 @@ class RealtimeTranslator: NOT threadsafe, acquire ctx_name lock before calling.''' if ctx_name in self.ctx_names: return - logger.info('New context: {}'.format(ctx_name)) + logger.info('({}) New context'.format(ctx_name)) self.ctx_names.add(ctx_name) self.ctx_data[ctx_name] = [] self.grammar_files[ctx_name] = collections.deque() @@ -166,11 +166,11 @@ class RealtimeTranslator: if not force: lock.acquire() if ctx_name not in self.ctx_names: - logger.info('No context found, no action: {}'.format(ctx_name)) + logger.info('({}) No context found, no action taken'.format(ctx_name)) if not force: lock.release() return - logger.info('Dropping context: {}'.format(ctx_name)) + logger.info('({}) Dropping context'.format(ctx_name)) self.ctx_names.remove(ctx_name) self.ctx_data.pop(ctx_name) self.extractor.drop_ctx(ctx_name) @@ -195,7 +195,7 @@ class RealtimeTranslator: grammar_file = grammar_dict.get(sentence, None) # Cache hit if grammar_file: - logger.info('Grammar cache hit: {}'.format(grammar_file)) + logger.info('({}) Grammar cache hit: {}'.format(ctx_name, grammar_file)) self.extractor_lock.release() return grammar_file # Extract and cache @@ -228,18 +228,18 @@ class RealtimeTranslator: return '' if self.norm: sentence = self.tokenize(sentence) - logger.info('Normalized input: {}'.format(sentence)) + logger.info('({}) Normalized input: {}'.format(ctx_name, sentence)) grammar_file = self.grammar(sentence, ctx_name) decoder = self.decoders[ctx_name] start_time = time.time() hyp = decoder.decoder.decode(sentence, grammar_file) stop_time = time.time() - logger.info('Translation time: {} seconds'.format(stop_time - start_time)) + logger.info('({}) Translation time: {} seconds'.format(ctx_name, stop_time - start_time)) # Empty reference: HPYPLM does not learn prior to next translation decoder.ref_fifo.write('\n') decoder.ref_fifo.flush() if self.norm: - logger.info('Normalized translation: {}'.format(hyp)) + logger.info('({}) Normalized translation: {}'.format(ctx_name, hyp)) hyp = self.detokenize(hyp) lock.release() return hyp @@ -273,7 +273,7 @@ class RealtimeTranslator: cmd_name = cmd_name[0] (command, nargs) = self.COMMANDS.get(cmd_name, (None, None)) if command and len(args[1:]) in nargs: - logger.info('{} ({}) ||| {}'.format(cmd_name, ctx_name, ' ||| '.join(args[1:]))) + logger.info('({}) {} ||| {}'.format(ctx_name, cmd_name, ' ||| '.join(args[1:]))) return command(*args[1:], ctx_name=ctx_name) logger.info('ERROR: command: {}'.format(' ||| '.join(args))) @@ -284,7 +284,7 @@ class RealtimeTranslator: lock.acquire() self.lazy_ctx(ctx_name) if '' in (source.strip(), target.strip()): - logger.info('ERROR: empty source or target: {} ||| {}'.format(source, target)) + logger.info('({}) ERROR: empty source or target: {} ||| {}'.format(ctx_name, source, target)) lock.release() return if self.norm: @@ -296,15 +296,15 @@ class RealtimeTranslator: # MIRA update before adding data to grammar extractor decoder = self.decoders[ctx_name] mira_log = decoder.decoder.update(source, grammar_file, target) - logger.info('MIRA: {}'.format(mira_log)) + logger.info('({}) MIRA HBF: {}'.format(ctx_name, mira_log)) # Add to HPYPLM by writing to fifo (read on next translation) - logger.info('Adding to HPYPLM: {}'.format(target)) + logger.info('({}) Adding to HPYPLM: {}'.format(ctx_name, target)) decoder.ref_fifo.write('{}\n'.format(target)) decoder.ref_fifo.flush() # Store incremental data for save/load self.ctx_data[ctx_name].append((source, target, alignment)) # Add aligned sentence pair to grammar extractor - logger.info('Adding to bitext: {} ||| {} ||| {}'.format(source, target, alignment)) + logger.info('({}) Adding to bitext: {} ||| {} ||| {}'.format(ctx_name, source, target, alignment)) self.extractor.add_instance(source, target, alignment, ctx_name) # Clear (old) cached grammar rm_grammar = self.grammar_dict[ctx_name].pop(source) @@ -317,7 +317,7 @@ class RealtimeTranslator: self.lazy_ctx(ctx_name) ctx_data = self.ctx_data[ctx_name] out = open(filename, 'w') if filename else sys.stdout - logger.info('Saving state for context ({}) with {} sentences'.format(ctx_name, len(ctx_data))) + logger.info('({}) Saving state with {} sentences'.format(ctx_name, len(ctx_data))) out.write('{}\n'.format(self.decoders[ctx_name].decoder.get_weights())) for (source, target, alignment) in ctx_data: out.write('{} ||| {} ||| {}\n'.format(source, target, alignment)) @@ -335,8 +335,8 @@ class RealtimeTranslator: input = open(filename) if filename else sys.stdin # Non-initial load error if ctx_data: - logger.info('ERROR: Incremental data has already been added to context ({})'.format(ctx_name)) - logger.info(' State can only be loaded to a new context.') + logger.info('({}) ERROR: Incremental data has already been added to context'.format(ctx_name)) + logger.info(' State can only be loaded to a new context.') lock.release() return # Many things can go wrong if bad state data is given @@ -345,7 +345,7 @@ class RealtimeTranslator: line = input.readline().strip() # Throws exception if bad line decoder.decoder.set_weights(line) - logger.info('Loading state...') + logger.info('({}) Loading state...'.format(ctx_name)) start_time = time.time() # Lines source ||| target ||| alignment while True: @@ -364,12 +364,12 @@ class RealtimeTranslator: decoder.ref_fifo.write('{}\n'.format(target)) decoder.ref_fifo.flush() stop_time = time.time() - logger.info('Loaded state for context ({}) with {} sentences in {} seconds'.format(ctx_name, len(ctx_data), stop_time - start_time)) + logger.info('({}) Loaded state with {} sentences in {} seconds'.format(ctx_name, len(ctx_data), stop_time - start_time)) lock.release() # Recover from bad load attempt by restarting context. # Guaranteed not to cause data loss since only a new context can load state. except: - logger.info('ERROR: could not load state, restarting context ({})'.format(ctx_name)) + logger.info('({}) ERROR: could not load state, restarting context'.format(ctx_name)) # ctx_name is already owned and needs to be restarted before other blocking threads use self.drop_ctx(ctx_name, force=True) self.lazy_ctx(ctx_name) -- cgit v1.2.3 From 3564060d2567816e526f5c002aee906e85f51d50 Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Mon, 14 Oct 2013 17:16:24 -0400 Subject: Save/load from StringIO --- realtime/rt/rt.py | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index f66d3a4d..7cc5bc10 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -5,8 +5,9 @@ import collections import logging import os import shutil -import sys +import StringIO import subprocess +import sys import tempfile import threading import time @@ -311,28 +312,46 @@ class RealtimeTranslator: os.remove(rm_grammar) lock.release() - def save_state(self, filename=None, ctx_name=None): + def save_state(self, file_or_stringio=None, ctx_name=None): + '''Write state (several lines terminated by EOF line) to file, buffer, or stdout''' lock = self.ctx_locks[ctx_name] lock.acquire() self.lazy_ctx(ctx_name) ctx_data = self.ctx_data[ctx_name] - out = open(filename, 'w') if filename else sys.stdout + # Filename, StringIO or None (stdout) + if file_or_stringio: + if isinstance(file_or_stringio, StringIO.StringIO): + out = file_or_stringio + else: + out = open(file_or_stringio, 'w') + else: + out = sys.stdout logger.info('({}) Saving state with {} sentences'.format(ctx_name, len(ctx_data))) out.write('{}\n'.format(self.decoders[ctx_name].decoder.get_weights())) for (source, target, alignment) in ctx_data: out.write('{} ||| {} ||| {}\n'.format(source, target, alignment)) out.write('EOF\n') - if filename: + # Close if file + if file_or_stringio and not isinstance(file_or_stringio, StringIO.StringIO): out.close() lock.release() - def load_state(self, filename=None, ctx_name=None): + def load_state(self, file_or_stringio=None, ctx_name=None): + '''Load state (several lines terminated by EOF line) from file, buffer, or stdin. + Restarts context on any error.''' lock = self.ctx_locks[ctx_name] lock.acquire() self.lazy_ctx(ctx_name) ctx_data = self.ctx_data[ctx_name] decoder = self.decoders[ctx_name] - input = open(filename) if filename else sys.stdin + # Filename, StringIO, or None (stdin) + if file_or_stringio: + if isinstance(file_or_stringio, StringIO.StringIO): + input = file_or_stringio.getvalue() + else: + input = open(file_or_stringio) + else: + input = sys.stdin # Non-initial load error if ctx_data: logger.info('({}) ERROR: Incremental data has already been added to context'.format(ctx_name)) -- cgit v1.2.3 From af80da3fecbd56554314b1135872272cc7d3793a Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Fri, 18 Oct 2013 16:18:04 -0400 Subject: wait() to avoid zombies --- realtime/rt/aligner.py | 3 +++ realtime/rt/decoder.py | 5 +++-- realtime/rt/rt.py | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/realtime/rt/aligner.py b/realtime/rt/aligner.py index bcc1ef87..c34805eb 100644 --- a/realtime/rt/aligner.py +++ b/realtime/rt/aligner.py @@ -57,8 +57,11 @@ class ForceAligner: if not force: self.lock.acquire() self.fwd_align.stdin.close() + self.fwd_align.wait() self.rev_align.stdin.close() + self.rev_align.wait() self.tools.stdin.close() + self.tools.wait() if not force: self.lock.release() diff --git a/realtime/rt/decoder.py b/realtime/rt/decoder.py index e6e7489d..ed45c248 100644 --- a/realtime/rt/decoder.py +++ b/realtime/rt/decoder.py @@ -13,13 +13,14 @@ class Decoder: if not force: self.lock.acquire() self.decoder.stdin.close() + self.decoder.wait() if not force: self.lock.release() def decode(self, sentence, grammar=None): '''Threadsafe, FIFO''' - input = '{s}\n'.format(s=sentence, g=grammar) if grammar else '{}\n'.format(sentence) self.lock.acquire() + input = '{s}\n'.format(s=sentence, g=grammar) if grammar else '{}\n'.format(sentence) self.decoder.stdin.write(input) hyp = self.decoder.stdout.readline().strip() self.lock.release() @@ -71,8 +72,8 @@ class MIRADecoder(Decoder): def update(self, sentence, grammar, reference): '''Threadsafe, FIFO''' - input = 'LEARN ||| {s} ||| {r}\n'.format(s=sentence, g=grammar, r=reference) self.lock.acquire() + input = 'LEARN ||| {s} ||| {r}\n'.format(s=sentence, g=grammar, r=reference) self.decoder.stdin.write(input) log = self.decoder.stdout.readline().strip() self.lock.release() diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index 7cc5bc10..d1d01ad8 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -140,7 +140,9 @@ class RealtimeTranslator: self.tokenizer_lock.acquire() self.detokenizer_lock.acquire() self.tokenizer.stdin.close() + self.tokenizer.wait() self.detokenizer.stdin.close() + self.detokenizer.wait() if not force: self.tokenizer_lock.release() self.detokenizer_lock.release() -- cgit v1.2.3 From a1d78e9ba97af7d3b442a2b8759035a0c6f6b35a Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Tue, 22 Oct 2013 04:16:07 -0400 Subject: Don't getvalue() yet --- realtime/rt/rt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/realtime/rt/rt.py b/realtime/rt/rt.py index d1d01ad8..c0aec410 100644 --- a/realtime/rt/rt.py +++ b/realtime/rt/rt.py @@ -349,7 +349,7 @@ class RealtimeTranslator: # Filename, StringIO, or None (stdin) if file_or_stringio: if isinstance(file_or_stringio, StringIO.StringIO): - input = file_or_stringio.getvalue() + input = file_or_stringio else: input = open(file_or_stringio) else: -- cgit v1.2.3 From 074fa88375967adababc632ea763e9dea389831e Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Wed, 30 Oct 2013 23:37:39 -0400 Subject: Specify heuristic for force alignment --- realtime/rt/aligner.py | 4 ++-- word-aligner/force_align.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/realtime/rt/aligner.py b/realtime/rt/aligner.py index c34805eb..e1782496 100644 --- a/realtime/rt/aligner.py +++ b/realtime/rt/aligner.py @@ -10,7 +10,7 @@ logger = logging.getLogger('rt.aligner') class ForceAligner: - def __init__(self, fwd_params, fwd_err, rev_params, rev_err): + def __init__(self, fwd_params, fwd_err, rev_params, rev_err, heuristic='grow-diag-final-and'): cdec_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) fast_align = os.path.join(cdec_root, 'word-aligner', 'fast_align') @@ -21,7 +21,7 @@ class ForceAligner: fwd_cmd = [fast_align, '-i', '-', '-d', '-T', fwd_T, '-m', fwd_m, '-f', fwd_params] rev_cmd = [fast_align, '-i', '-', '-d', '-T', rev_T, '-m', rev_m, '-f', rev_params, '-r'] - tools_cmd = [atools, '-i', '-', '-j', '-', '-c', 'grow-diag-final-and'] + tools_cmd = [atools, '-i', '-', '-j', '-', '-c', heuristic] logger.info('Executing: {}'.format(' '.join(fwd_cmd))) self.fwd_align = util.popen_io(fwd_cmd) diff --git a/word-aligner/force_align.py b/word-aligner/force_align.py index 8b6ca224..b03d446e 100755 --- a/word-aligner/force_align.py +++ b/word-aligner/force_align.py @@ -5,13 +5,15 @@ import sys def main(): - if len(sys.argv[1:]) != 4: + if len(sys.argv[1:]) < 4: sys.stderr.write('run:\n') sys.stderr.write(' fast_align -i corpus.f-e -d -v -o -p fwd_params >fwd_align 2>fwd_err\n') sys.stderr.write(' fast_align -i corpus.f-e -r -d -v -o -p rev_params >rev_align 2>rev_err\n') sys.stderr.write('\n') sys.stderr.write('then run:\n') - sys.stderr.write(' {} fwd_params fwd_err rev_params rev_err out.f-e.gdfa\n'.format(sys.argv[0])) + sys.stderr.write(' {} fwd_params fwd_err rev_params rev_err [heuristic] out.f-e.gdfa\n'.format(sys.argv[0])) + sys.stderr.write('\n') + sys.stderr.write('where heuristic is one of: (intersect union grow-diag grow-diag-final grow-diag-final-and) default=grow-diag-final-and\n') sys.exit(2) # Hook into realtime -- cgit v1.2.3 From 2d3948b98bb9e8c7bad60f1acd99ff0b42b3ae30 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 10 Nov 2013 00:58:44 -0500 Subject: guard against direct includes of tr1 --- configure.ac | 3 +- decoder/Makefile.am | 4 - decoder/apply_models.cc | 11 +- decoder/cdec_ff.cc | 11 - decoder/decoder.cc | 10 +- decoder/dwarf.cc | 3209 ----------------------------------- decoder/dwarf.h | 286 ---- decoder/earley_composer.cc | 11 +- decoder/factored_lexicon_helper.cc | 1 + decoder/factored_lexicon_helper.h | 3 +- decoder/ff_dwarf.cc | 894 ---------- decoder/ff_dwarf.h | 100 -- decoder/ff_lm.cc | 101 -- decoder/ff_lm.h | 22 - decoder/ff_source_syntax.cc | 6 + decoder/ff_source_syntax2.cc | 4 +- decoder/ff_source_syntax2_p.cc | 10 +- decoder/ff_source_syntax_p.cc | 9 +- decoder/ff_wordalign.cc | 9 +- decoder/ff_wordalign.h | 13 +- decoder/ff_wordset.cc | 52 +- decoder/ff_wordset.h | 73 +- decoder/grammar.cc | 11 +- decoder/hg_intersect.cc | 8 +- decoder/kbest.h | 11 +- decoder/maxtrans_blunsom.cc | 11 +- decoder/phrasebased_translator.cc | 11 +- decoder/scfg_translator.cc | 10 +- decoder/sentence_metadata.h | 4 +- extractor/Makefile.am | 27 +- klm/lm/builder/Makefile.am | 6 +- mteval/mbr_kbest.cc | 8 +- mteval/ns_ter.cc | 8 +- mteval/scorer.cc | 23 +- mteval/ter.cc | 8 +- python/cdec/sa/strmap.cc | 11 +- training/crf/mpi_online_optimize.cc | 8 +- training/mira/kbest_cut_mira.cc | 65 +- training/mira/kbest_mira.cc | 18 +- training/mira/mira.py | 98 +- training/pro/mr_pro_map.cc | 1 - training/utils/candidate_set.cc | 11 +- training/utils/online_optimizer.h | 8 +- training/utils/optimize_test.cc | 6 +- utils/hash.h | 12 +- word-aligner/fast_align.cc | 8 +- word-aligner/ttables.cc | 1 - word-aligner/ttables.h | 11 +- 48 files changed, 369 insertions(+), 4877 deletions(-) delete mode 100644 decoder/dwarf.cc delete mode 100644 decoder/dwarf.h delete mode 100644 decoder/ff_dwarf.cc delete mode 100644 decoder/ff_dwarf.h diff --git a/configure.ac b/configure.ac index 37d8cced..c3b749e3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([cdec],[2013-03-08]) +AC_INIT([cdec],[2013-11-10]) AC_CONFIG_SRCDIR([decoder/cdec.cc]) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(config.h) @@ -7,7 +7,6 @@ AC_PROG_LEX case $LEX in :) AC_MSG_ERROR([No lex (Flex, lex, etc.) program found]);; esac -# CPPFLAGS="$CPPFLAGS -std=c++0x" AC_PROG_CC AC_PROG_CXX AX_CXX_COMPILE_STDCXX_11 diff --git a/decoder/Makefile.am b/decoder/Makefile.am index 914faaea..39a13ad8 100644 --- a/decoder/Makefile.am +++ b/decoder/Makefile.am @@ -41,7 +41,6 @@ libcdec_a_SOURCES = \ cfg_options.h \ csplit.h \ decoder.h \ - dwarf.h \ earley_composer.h \ exp_semiring.h \ factored_lexicon_helper.h \ @@ -51,7 +50,6 @@ libcdec_a_SOURCES = \ ff_charset.h \ ff_context.h \ ff_csplit.h \ - ff_dwarf.h \ ff_external.h \ ff_factory.h \ ff_klm.h \ @@ -103,8 +101,6 @@ libcdec_a_SOURCES = \ maxtrans_blunsom.cc \ cdec_ff.cc \ cfg.cc \ - dwarf.cc \ - ff_dwarf.cc \ ff_external.cc \ rule_lexer.cc \ fst_translator.cc \ diff --git a/decoder/apply_models.cc b/decoder/apply_models.cc index 330de9e2..2e093d6a 100644 --- a/decoder/apply_models.cc +++ b/decoder/apply_models.cc @@ -8,8 +8,14 @@ #include #include -#include -#include +#ifdef HAVE_CXX11 +# include +# include +#else +# include +# include +namespace std { using std::tr1::unordered_map; using std::tr1::unordered_set; } +#endif #include @@ -23,7 +29,6 @@ #define FAST_CP_2 3 using namespace std; -using namespace std::tr1; struct Candidate; typedef SmallVectorInt JVector; diff --git a/decoder/cdec_ff.cc b/decoder/cdec_ff.cc index e7b31f50..09597e87 100644 --- a/decoder/cdec_ff.cc +++ b/decoder/cdec_ff.cc @@ -29,12 +29,8 @@ #include "ff_register.h" #include "ff_charset.h" #include "ff_wordset.h" -#include "ff_dwarf.h" #include "ff_external.h" -#ifdef HAVE_GLC -#include -#endif void register_feature_functions() { static bool registered = false; @@ -51,9 +47,6 @@ void register_feature_functions() { RegisterFF(); //TODO: use for all features the new Register which requires static FF::usage(false,false) give name -#ifdef HAVE_RANDLM - ff_registry.Register("RandLM", new FFFactory); -#endif ff_registry.Register("SpanFeatures", new FFFactory()); ff_registry.Register("NgramFeatures", new FFFactory()); ff_registry.Register("RuleContextFeatures", new FFFactory()); @@ -98,10 +91,6 @@ void register_feature_functions() { ff_registry.Register("WordPairFeatures", new FFFactory); ff_registry.Register("SourcePathFeatures", new FFFactory); ff_registry.Register("WordSet", new FFFactory); - ff_registry.Register("Dwarf", new FFFactory); ff_registry.Register("External", new FFFactory); -#ifdef HAVE_GLC - ff_registry.Register("ContextCRF", new FFFactory); -#endif } diff --git a/decoder/decoder.cc b/decoder/decoder.cc index 31e6dc46..2c0e07b7 100644 --- a/decoder/decoder.cc +++ b/decoder/decoder.cc @@ -1,6 +1,11 @@ #include "decoder.h" -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; } +#endif #include #include #include @@ -61,7 +66,6 @@ static const double kMINUS_EPSILON = -1e-6; // don't be too strict using namespace std; -using namespace std::tr1; namespace po = boost::program_options; static bool verbose_feature_functions=true; @@ -90,7 +94,7 @@ struct ELengthWeightFunction { } }; inline void ShowBanner() { - cerr << "cdec v1.0 (c) 2009-2011 by Chris Dyer\n"; + cerr << "cdec (c) 2009--2013 by Chris Dyer\n"; } inline string str(char const* name,po::variables_map const& conf) { diff --git a/decoder/dwarf.cc b/decoder/dwarf.cc deleted file mode 100644 index fb0404a6..00000000 --- a/decoder/dwarf.cc +++ /dev/null @@ -1,3209 +0,0 @@ -#include "dwarf.h" -#include "tdict.h" -#include "wordid.h" -#include "lattice.h" -#include "ff_dwarf.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace std::tr1; -using namespace boost::tuples; -using namespace boost; - -Alignment::Alignment() { - //unordered_map,int> XX; - _I=0; - _J=0; - kSOS = TD::Convert(""); - kEOS = TD::Convert(""); - kUNK = TD::Convert("**UNKNOWN**"); - SourceFWAntsIdxs = new int*[MAX_ARITY]; - SourceFWAntsAbsIdxs = new int*[MAX_ARITY]; - TargetFWAntsIdxs = new int*[MAX_ARITY]; - SourceAntsIdxs = new int*[MAX_ARITY]; - TargetAntsIdxs = new int*[MAX_ARITY]; - AntsAl = new int*[MAX_ARITY]; - for (int idx=0; idx=0); - if (start==-1) start = _tSpan[j][0]; - if (_tSpan[j][0]==MINIMUM_INIT) return -1; - for (int idx=start; idx<=_tSpan[j][1]; idx++) { - if (_matrix[j][idx]) return idx; - } - return -1; -} - -int Alignment::sourceOf(int i, int start) { - assert(i>=0); - if (start==-1) start = _sSpan[i][0]; - if (_sSpan[i][0]==MINIMUM_INIT) return -1; - for (int idx=start; idx<=_sSpan[i][1]; idx++) { - if (_matrix[idx][i]) return idx; - } - return -1; -} - -void Alignment::clearAls(int prevJ, int prevI) { - for (int j=0; j<=prevJ; j++) { - for (int i=0; i neither, 1 -> leftFirst, 2 -> rightFirst, 3 -> dontCare - if (DEBUG) cerr << "DominanceSource(" << fw1 << "," << fw2 << ")" << endl; - //cerr << TD::Convert(_f[fw1]) << "," << TD::Convert(_f[fw2]) << endl; - //cerr << AsString() << endl; - int dom = 0; - curr_al.push_back(fw1); curr_al.push_back(fw2); - if (doms_hash.find(curr_al)==doms_hash.end()) { - int* block = blockSource(fw1,fw2); - //cerr << "block = " << block[0] << "," << block[1] << "," << block[2] << "," << block[3] << endl; - if (block[0]==fw1) { - int tfw10 = _tSpan[fw1][0]; - int tfw11 = _tSpan[fw1][1]; - //cerr << "tfw = " << tfw10 << "," << tfw11 << endl; - if (tfw11<0) { - dom+=1; - } else { - if ((block[2]==tfw10 || block[3]==tfw11)) dom+=1; - } - } - if (block[1]==fw2) { - int tfw20 = _tSpan[fw2][0]; - int tfw21 = _tSpan[fw2][1]; - //cerr << "tfw = " << tfw20 << "," << tfw21 << endl; - if (tfw21<0) { - dom+=2; - } else { - if ((block[2]==tfw20 || block[3]==tfw21)) dom+=2; - } - } - delete block; - doms_hash.insert(pair,int>(curr_al,dom)); - } else { - dom = doms_hash[curr_al]; - } - if (DEBUG) cerr << " dom = " << dom << endl; - curr_al.pop_back(); curr_al.pop_back(); - return dom; -} - -vector Alignment::DominanceSource4Sampler(int fw1, int fw2) { - if (DEBUG) cerr << "DominanceSource4Sampler(" << fw1 << "," << fw2 << ")" << endl; - int dom = 0; - int* block = blockSource(fw1,fw2); - //cerr << "block = " << block[0] << "," << block[1] << "," << block[2] << "," << block[3] << endl; - if (block[0]==fw1) { - int tfw10 = _tSpan[fw1][0]; - int tfw11 = _tSpan[fw1][1]; - //cerr << "tfw = " << tfw10 << "," << tfw11 << endl; - if (tfw11<0) { - dom+=1; - } else { - if ((block[2]==tfw10 || block[3]==tfw11)) dom+=1; - } - } - if (block[1]==fw2) { - int tfw20 = _tSpan[fw2][0]; - int tfw21 = _tSpan[fw2][1]; - //cerr << "tfw = " << tfw20 << "," << tfw21 << endl; - if (tfw21<0) { - dom+=2; - } else { - if ((block[2]==tfw20 || block[3]==tfw21)) dom+=2; - } - } - if (DEBUG) cerr << "doms = " << dom << endl; - vector ret; - ret.push_back(dom); ret.push_back(block[0]); ret.push_back(block[1]); - ret.push_back(block[2]); ret.push_back(block[3]); - delete block; - return ret; -} - -int Alignment::DominanceTarget(int fw1, int fw2) { - int dom = 0; - curr_al.push_back(fw1); curr_al.push_back(fw2); - if (domt_hash.find(curr_al)==domt_hash.end()) { - int* block = blockTarget(fw1,fw2); - if (block[2]==fw1) { - int sfw10 = _sSpan[fw1][0]; - int sfw11 = _sSpan[fw1][1]; - if (sfw11<0) { - dom+=1; - } else { - if (block[0]==sfw10 || block[1]==sfw11) dom+=1; - } - } - if (block[3]==fw2) { - int sfw20 = _sSpan[fw2][0]; - int sfw21 = _sSpan[fw2][0]; - if (sfw21<0) { - dom+=2; - } else { - if (block[0]==sfw20 || block[1]==sfw21) dom+=2; - } - } - delete block; - domt_hash.insert(pair,int>(curr_al,dom)); - } else { - dom = domt_hash[curr_al]; - } - curr_al.pop_back(); curr_al.pop_back(); - return dom; -} - -vector Alignment::DominanceTarget4Sampler(int fw1, int fw2) { - int dom = 0; - int* block = blockTarget(fw1,fw2); - if (block[2]==fw1) { - int sfw10 = _sSpan[fw1][0]; - int sfw11 = _sSpan[fw1][1]; - if (sfw11<0) { - dom+=1; - } else { - if (block[0]==sfw10 || block[1]==sfw11) dom+=1; - } - } - if (block[3]==fw2) { - int sfw20 = _sSpan[fw2][0]; - int sfw21 = _sSpan[fw2][0]; - if (sfw21<0) { - dom+=2; - } else { - if (block[0]==sfw20 || block[1]==sfw21) dom+=2; - } - } - vector ret; - ret.push_back(dom); ret.push_back(block[0]); ret.push_back(block[1]); - ret.push_back(block[2]); ret.push_back(block[3]); - delete block; - return ret; -} - -void Alignment::OrientationSource(int fw, int* oril, int* orir, bool Lcompute, bool Rcompute) { - OrientationSource(fw,fw,oril,orir,Lcompute,Rcompute); -} - -vector Alignment::OrientationSourceLeft4Sampler(int fw) { - return OrientationSourceLeft4Sampler(fw,fw); -} - -vector Alignment::OrientationSourceLeft4Sampler(int fw0, int fw1) { - if (DEBUG) cerr << "OrientationSourceLeft4Sampler(" << fw0 << "," << fw1 << ")" << endl; - int oril = 0; - int N0=fw0-1; - while (N0>=0) { - if (minTSpan(N0)!=MINIMUM_INIT) break; - N0--; - } - int N1=fw1+1; - while (N1<_J) { - if (minTSpan(N1)!=MINIMUM_INIT) break; - N1++; - } - if (minTSpan(fw0)==MINIMUM_INIT && minTSpan(fw1)==MINIMUM_INIT) { - fw0 = N1; fw1 = N0; - } - if (DEBUG) cerr << "fw0=" << fw0 << ", fw1=" << fw1 << ", N0=" << N0 << ", N1=" << N1 << endl; - if (maxTSpan(N0)=0) { - if (minTSpan(N0)!=MINIMUM_INIT) break; - N0--; - } - int N1=fw1+1; - while (N1<_J) { - if (minTSpan(N1)!=MINIMUM_INIT) break; - N1++; - } - if (minTSpan(fw0)==MINIMUM_INIT && minTSpan(fw1)==MINIMUM_INIT) { - fw0 = N1; fw1 = N0; - } - if (DEBUG) cerr << "fw0=" << fw0 << ", fw1=" << fw1 << ", N0=" << N0 << ", N1=" << N1 << endl; - if (maxTSpan(N1)=0) { - if (minTSpan(N0)!=MINIMUM_INIT) break; - N0--; - } - int N1=fw1+1; - while (N1<_J) { - if (minTSpan(N1)!=MINIMUM_INIT) break; - N1++; - } - if (minTSpan(fw0)==MINIMUM_INIT && minTSpan(fw1)==MINIMUM_INIT) { - fw0 = N1; fw1 = N0; - //cerr << "minTSpan(fw)==MINIMUM_INIT, thus fw0=" << fw0 << ", fw1=" << fw1 << endl; - } - if (DEBUG) cerr << "fw0=" << fw0 << ", fw1=" << fw1 << ", N0=" << N0 << ", N1=" << N1 << endl; - if (maxTSpan(N0) Alignment::OrientationTargetLeft4Sampler(int fw) { - return OrientationTargetLeft4Sampler(fw,fw); -} - -vector Alignment::OrientationTargetLeft4Sampler(int fw0, int fw1) { - if (DEBUG) cerr << "OrientationTargetLeft4Sampler " << fw0 << "," << fw1 << endl; - int oril=0; - int N0=fw0-1; - while (N0>=0) { - if (minSSpan(N0)!=MINIMUM_INIT) break; - N0--; - } - int N1=fw1+1; - while (N1<_I) { - if (minSSpan(N1)!=MINIMUM_INIT) break; - N1++; - } - if (minSSpan(fw0)==MINIMUM_INIT && minSSpan(fw1)==MINIMUM_INIT) { - fw0=N1; fw1=N0; - } - if (maxSSpan(N0)=0) { - if (minSSpan(N0)!=MINIMUM_INIT) break; - N0--; - } - int N1=fw1+1; - while (N1<_I) { - if (minSSpan(N1)!=MINIMUM_INIT) break; - N1++; - } - if (minSSpan(fw0)==MINIMUM_INIT && minSSpan(fw1)==MINIMUM_INIT) { - fw0=N1; fw1=N0; - } - if (maxSSpan(N1)=0) { - if (minSSpan(N0)!=MINIMUM_INIT) break; - N0--; - } - int N1=fw1+1; - while (N1<_I) { - if (minSSpan(N1)!=MINIMUM_INIT) break; - N1++; - } - if (minSSpan(fw0)==MINIMUM_INIT && minSSpan(fw1)==MINIMUM_INIT) { - fw0=N1; fw1=N0; - } - if (DEBUG) { - cerr << "fw0:" << fw0 << ", fw1:" << fw1 << ", N0:" << N0 << ", N1:" << N1 << endl ; - cerr << "minSSpan(N0)=" << minSSpan(N0) << " maxSSpan(N0)=" << maxSSpan(N0); - cerr << " minSSpan(fw0)="<< minSSpan(fw0) << " maxSSpan(fw0)=" << maxSSpan(fw0) << endl; - cerr << "minSSpan(fw1)=" << minSSpan(fw1) << " maxSSpan(fw1)=" << maxSSpan(fw1); - cerr << " minSSpan(N1)="<< minSSpan(N1) << " maxSSpan(N1)=" << maxSSpan(N1) << endl; - } - if (maxSSpan(N0)=0; j--) - if (_tSpan[j][0]!=MINIMUM_INIT) return j; - return -1; -} - -int Alignment::firstTargetAligned(int start) { - for (int i=start; i<_I; i++) - if (_sSpan[i][0]!=MINIMUM_INIT) return i; - return -1; -} - -int Alignment::lastTargetAligned(int end) { - for (int i=end; i>=0; i--) - if (_sSpan[i][0]!=MINIMUM_INIT) return i; - return -1; -} - -void Alignment::BorderingSFWsOnly() { -// removes the record of all function word alignments, except those at the borders -// the number of alignments kept may be more than two -// i.e. where the leftmost / the rightmost alignments are unaligned. -// In such cases, this function continues keeping function word alignments until the -// first (or last) alignment words. - if (SourceFWIdxs[0]>2) { - int firstCut = 1; - for (int j=2; j<=SourceFWIdxs[0]; j++) { - if (SourceFWIdxs[3*j-2]>fas) break; - firstCut=j; - } - int lastCut = SourceFWIdxs[0]; - for (int j=SourceFWIdxs[0]-1; j>=0; j--) { - if (SourceFWIdxs[3*j-2]=lastCut) return; - int delta = 0; - for (int j=lastCut; j<=SourceFWIdxs[0]; j++) { - delta++; - SourceFWIdxs[3*(firstCut+delta)-2]=SourceFWIdxs[3*j-2]; - SourceFWIdxs[3*(firstCut+delta)-1]=SourceFWIdxs[3*j-1]; - SourceFWIdxs[3*(firstCut+delta)] =SourceFWIdxs[3*j]; - } - SourceFWIdxs[0]=firstCut+delta; - } -} - -void Alignment::BorderingTFWsOnly() { -// similar to BorderingSFWsOnly() except this looks at the source side. - if (TargetFWIdxs[0]>2) { - int firstCut = 1; - for (int j=2; j<=TargetFWIdxs[0]; j++) { - if (TargetFWIdxs[3*j-2]>fat) break; - firstCut=j; - } - int lastCut = TargetFWIdxs[0]; - for (int j=TargetFWIdxs[0]-1; j>=0; j--) { - if (TargetFWIdxs[3*j-2]=lastCut) return; - int delta = 0; - for (int j=lastCut; j<=TargetFWIdxs[0]; j++) { - delta++; - TargetFWIdxs[3*(firstCut+delta)-2]=TargetFWIdxs[3*j-2]; - TargetFWIdxs[3*(firstCut+delta)-1]=TargetFWIdxs[3*j-1]; - TargetFWIdxs[3*(firstCut+delta)] =TargetFWIdxs[3*j]; - } - TargetFWIdxs[0]=firstCut+delta; - } -} - -void Alignment::FillFWIdxsState(int* state, int fas, int las, int fat, int lat) { - if (DEBUG) cerr << "FillFWIdxsState ("<< fas <<","<< las<<"," << fat <<"," << lat << ")" << endl; - if (fas==las) las+=1; - if (fat==lat) lat+=1; - for (int idx=0; idx<12; idx++) state[idx]=-1; - if (SourceFWIdxs[0]<=2) { - if (SourceFWIdxs[0]>=1) {state[0]=SourceFWIdxs[1]; state[1]=SourceFWIdxs[2]; state[2]=SourceFWIdxs[3];} - if (SourceFWIdxs[0]==2) {state[3]=SourceFWIdxs[4]; state[4]=SourceFWIdxs[5]; state[5]=SourceFWIdxs[6];} - } else { - if (SourceFWIdxs[1]>fas) { - state[0]=SourceFWIdxs[1]; state[1]=SourceFWIdxs[2]; state[2]=SourceFWIdxs[3]; - } else { - ostringstream issf; ostringstream isse; - for (int idx=1; idx<=SourceFWIdxs[0]; idx++) { - if (SourceFWIdxs[3*idx-2]>las) break; - if (idx>1) { issf << " "; isse << " ";}; - issf << TD::Convert(SourceFWIdxs[3*idx-1]); - isse << TD::Convert(SourceFWIdxs[3*idx]); - state[0]=SourceFWIdxs[3*idx-2]; - if (state[0]>=fas) break; - } - if (state[0]>=0) { - state[1]=TD::Convert(issf.str())*-1; state[2]=TD::Convert(isse.str()); //multiplying source with -1 as marker - } - } - if (SourceFWIdxs[SourceFWIdxs[0]*3-2]==las) { - state[3]=SourceFWIdxs[SourceFWIdxs[0]*3-2]; - state[4]=SourceFWIdxs[SourceFWIdxs[0]*3-1]; - state[5]=SourceFWIdxs[SourceFWIdxs[0]*3]; - } else { - int lastCut = SourceFWIdxs[0]; - for (int j=lastCut-1; j>=state[0]+1; j--) { - if (SourceFWIdxs[3*j-2]==state[0]) break; - if (SourceFWIdxs[3*j-2]lastCut) { issf << " "; isse << " ";}; - issf << TD::Convert(SourceFWIdxs[3*idx-1]); - isse << TD::Convert(SourceFWIdxs[3*idx]); - } - if (state[3]>=0) { - //multiplying source with -1 as compound marker - state[4]=TD::Convert(issf.str())*-1; state[5]=TD::Convert(isse.str()); - } - } - } - if (TargetFWIdxs[0]<=2) { - if (TargetFWIdxs[0]>=1) {state[6]=TargetFWIdxs[1]; state[7]=TargetFWIdxs[2]; state[8]=TargetFWIdxs[3];} - if (TargetFWIdxs[0]==2) {state[9]=TargetFWIdxs[4]; state[10]=TargetFWIdxs[5]; state[11]=TargetFWIdxs[6];} - } else { - if (TargetFWIdxs[1]>fat) { //shouldn't come here if SetTargetBorderingFW is invoked - state[6]=TargetFWIdxs[1]; state[7]=TargetFWIdxs[2]; state[8]=TargetFWIdxs[3]; - } else { - ostringstream issf; ostringstream isse; - for (int idx=1; idx<=TargetFWIdxs[0]; idx++) { - if (TargetFWIdxs[3*idx-2]>fat) break; - if (idx>1) { issf << " "; isse << " ";}; - issf << TD::Convert(TargetFWIdxs[3*idx-1]); - isse << TD::Convert(TargetFWIdxs[3*idx]); - state[6]=TargetFWIdxs[3*idx-2]; - } - state[7]=TD::Convert(issf.str()); state[8]=TD::Convert(isse.str())*-1; - //multiplying target with -1 as compound marker - } - if (TargetFWIdxs[TargetFWIdxs[0]*3-2]==lat) { - state[9]=TargetFWIdxs[TargetFWIdxs[0]*3-2]; - state[10]=TargetFWIdxs[TargetFWIdxs[0]*3-1]; - state[11]=TargetFWIdxs[TargetFWIdxs[0]*3]; - } else { - int lastCut = TargetFWIdxs[0]; - for (int j=lastCut-1; j>=1; j--) { - if (TargetFWIdxs[3*j-2]<=state[9]) break; - if (TargetFWIdxs[3*j-2]lastCut) issf << " "; isse << " ";; - issf << TD::Convert(TargetFWIdxs[3*idx-1]); - isse << TD::Convert(TargetFWIdxs[3*idx]); - } - state[10]=TD::Convert(issf.str()); state[11]=TD::Convert(isse.str())*-1; - } - } -} - -void Alignment::simplifyBackward(vector*blocks, int* block, const vector& danglings) { -// given a *block*, see whether its target span contains any index inside *danglings*. -// if yes, break it; otherwise, keep it. put the result(s) to *blocks* - if (DEBUG) cerr << "simplifyBackward[" << block[0] << "," << block[1] << "," << block[2] << "," << block[3] << "]" << endl; - if (DEBUG) for (int i=0; idanglings[i_dangling]) { - if (i_dangling+1 >= danglings.size()) break; - i_dangling++; - } - while (danglings[i_dangling]==currIdx) { - i_dangling++; - currIdx++; - } - /*if (i_dangling>=danglings.size() && currIdx) { - blocks->push_back(block); - if (DEBUG) cerr << "pushing(1) " << block[0] << "," << block[1] << "," << block[2] << "," << block[3] << endl; - return; - } - if (block[3]push_back(block); - if (DEBUG) cerr << "pushing(2) " << block[0] << "," << block[1] << "," << block[2] << "," << block[3] << endl; - return; - }*/ - if (DEBUG) cerr << "i_dangling = " << i_dangling << endl; - int anchorIdx = danglings[i_dangling]; - if (i_dangling+1>=danglings.size() || anchorIdx>block[3]+1) anchorIdx=block[3]+1; - if (DEBUG) cerr << "anchorIdx = " << anchorIdx << ", currIdx = " << currIdx << endl; - do { - while(currIdx treat this as one alignment each - // record all function word alignments first, important because it may be unaligned - // return true if it's truly simple (no function word alignment involves); false, otherwise - if (DEBUG) cerr << "begin simplify" << endl; - reset(0,0); reset(_J-1,_I-1); // remove the phrase boundary alignments, NEED TO CHECK AGAIN !!! - if (SourceFWIdxs[0]+TargetFWIdxs[0]==0) { // return singleton - if (DEBUG) cerr << "no function words" << endl; - for (int idx=0; idx<12; idx++) ret[idx]=-1; - ret[12]=1; ret[13]=0; ret[14]=0; // 0-0 - FillFWIdxsState(ret,0,0,0,0); - return; - } - curr_al.insert(curr_al.begin(),curr_al.size()); - curr_al.push_back(SourceFWIdxs[0]); - for (int i=1; i<=SourceFWIdxs[0]; i++) curr_al.push_back(SourceFWIdxs[3*i-2]); - curr_al.push_back(TargetFWIdxs[0]); - for (int i=1; i<=TargetFWIdxs[0]; i++) curr_al.push_back(TargetFWIdxs[3*i-2]); - vector el; - if (simplify_hash.find(curr_al)==simplify_hash.end()) { - if (DEBUG) { - cerr << "SourceFWIdxs:" << SourceFWIdxs[0] << endl; - for (int i=1; i<=SourceFWIdxs[0]; i++) - cerr << SourceFWIdxs[3*i-2] << "," << SourceFWIdxs[3*i-1] << "," << SourceFWIdxs[3*i] << endl; - cerr << "TargetFWIdxs:" << TargetFWIdxs[0] << endl; - for (int i=1; i<=TargetFWIdxs[0]; i++) { - cerr << TargetFWIdxs[3*i-2] << "," << TargetFWIdxs[3*i-1] << "," << TargetFWIdxs[3*i] << endl; - } - } - - vector< int* > blocks; // each element contains s1,s2,t1,t2 - int currIdx = 1; // start from 1 to avoid considering phrase start - std::set FWIdxs; - std::vector DanglingTargetFWIdxs; - for (int i=1; i<= SourceFWIdxs[0]; i++) FWIdxs.insert(SourceFWIdxs[3*i-2]); - for (int i=1; i<= TargetFWIdxs[0]; i++) { - int source = sourceOf(TargetFWIdxs[3*i-2]); - if (source>=0) { - do { - FWIdxs.insert(source); - source = sourceOf(TargetFWIdxs[3*i-2],source+1); - } while(source >=0); - } else { - int *block = new int[4]; - block[0]=-1; block[1]=-1; block[2]=TargetFWIdxs[3*i-2]; block[3]=TargetFWIdxs[3*i-2]; - blocks.push_back(block); - if (DEBUG) cerr << "pushing[1] " << block[0] << "," << block[1] << "," << block[2] << "," << block[3] << endl; - DanglingTargetFWIdxs.push_back(TargetFWIdxs[3*i-2]); - } - } - if (DEBUG) - for (std::set::const_iterator iter=FWIdxs.begin(); iter!=FWIdxs.end(); iter++) { - cerr << "FWIdxs=" << *iter << endl; - } - std::set::const_iterator currFWIdx = FWIdxs.begin(); - if (currFWIdx == FWIdxs.end()) { - int* block = new int[4]; - block[0]=1; block[1]=_J-2; block[2]=1; block[3]=_I-2; // no need to consider phrase boundaries - simplifyBackward(&blocks,block,DanglingTargetFWIdxs); - } else { - int anchorIdx = *currFWIdx; // also used to denote _J+1 - do { - // add alignments whose source from currIdx to currFWIdx-1 - while (currIdx=0) target = targetOf(anchorIdx,target+1); - } while (target>=0); - // advance indexes - currIdx = anchorIdx+1; - anchorIdx = getJ()-1; // was minus 2 - if (++currFWIdx!=FWIdxs.end()) anchorIdx = *currFWIdx; - } while (currIdx<=getJ()-2); - } - - - vector source_block_mapper(getJ(),-1); - vector target_block_mapper(getI(),-1); - for (int i = 0; i=0) source_block_mapper[blocks[i][0]]=1; - if (blocks[i][2]>=0) target_block_mapper[blocks[i][2]]=1; - } - int curr = 1; - int prev = -1; - for (int idx=0; idx0) { - source_block_mapper[idx]=curr++; - prev = curr; - } else { - source_block_mapper[idx]=prev; - } - } - curr = 1; - for (int idx=0; idx0) { - target_block_mapper[idx]=curr++; - prev = curr; - } else { - target_block_mapper[idx]=prev; - } - } - - //assert(blocks.size()<=50); - if (DEBUG) cerr << "resulting alignment:" << endl; - for (int i = 0; i, vector > (curr_al,el)); - if (DEBUG) cerr << "inserted" << endl; - } else { - el = simplify_hash[curr_al]; - } - if (DEBUG) { - cerr << "pull key:el = "; - for (int ii=0; ii1) quickSort(num,1,num[0]); -} - -void Alignment::quickSort(int arr[], int left, int right) { - int i = left, j = right; - int tmp1,tmp2,tmp3; - int mid = (left + right) / 2; - int pivot = arr[3*mid-2]; - - /* partition */ - while (i <= j) { - while (arr[3*i-2] < pivot) i++; - while (arr[3*j-2] > pivot) j--; - if (i <= j) { - tmp1 = arr[3*i-2]; tmp2 = arr[3*i-1]; tmp3 = arr[3*i]; - arr[3*i-2] = arr[3*j-2]; arr[3*i-1] = arr[3*j-1]; arr[3*i] = arr[3*j]; - arr[3*j-2] = tmp1; arr[3*j-1] = tmp2; arr[3*j] = tmp3; - i++; - j--; - } - }; - - /* recursion */ - if (left < j) quickSort(arr, left, j); - if (i < right) quickSort(arr, i, right); -} - -double Alignment::ScoreOrientation(const CountTable& table, int offset, int ori, WordID cond1, WordID cond2) { - string source = TD::Convert(cond1); - string sourceidx; - if (table.mode == 1) { - sourceidx = source; - int slashidx = sourceidx.find_last_of("/"); - source = sourceidx.substr(0,slashidx); - string idx = sourceidx.substr(slashidx+1); - if (DEBUG) cerr << " sourceidx = " << sourceidx << ", idx = " << idx << endl; - if (idx == "X") { - if (DEBUG) cerr << " idx == X, returning 0" << endl; - return 0; - } - } - string target = TD::Convert(cond2); - if (DEBUG) cerr << "sourceidx='" << sourceidx << "', source='" << source << "', target='" << target << "'" << endl; - double count = table.ultimate[offset+ori-1]; - double total = table.ultimate[offset+5]; - double alpha = 0.1; - double prob = count/total; - if (DEBUG) cerr << "level0 " << count << "/" << total << "=" << prob << endl; - - WordID key_id = (table.mode!=1) ? cond1 : TD::Convert(source); - map::const_iterator it = table.model.find(key_id); - bool stop = (it==table.model.end()); - if (!stop) { - stop=true; - if (it->second[offset+5]>=0) { - count = it->second[offset+ori-1] + alpha * prob; - total = it->second[offset+5] + alpha; - prob = count/total; - stop = false; - if (DEBUG) cerr << "level1 " << count << "/" << total << "=" << prob << endl; - } - } - if (stop) return prob; - - string key = source + " " + target; - it = table.model.find(TD::Convert(key)); - stop = (it==table.model.end()); - if (!stop) { - stop = true; - if (it->second[offset+5]>=0) { - count = it->second[offset+ori-1] + alpha * prob; - total = it->second[offset+5] + alpha; - prob = count/total; - stop = false; - if (DEBUG) cerr << "level2 " << count << "/" << total << "=" << prob << endl; - } - } - - if (stop || table.mode!=1) return prob; - - key = sourceidx + " " + target; - it = table.model.find(TD::Convert(key)); - if (it!=table.model.end()) { - if (it->second[offset+5]>=0) { - count = it->second[offset+ori-1] + alpha * prob; - total = it->second[offset+5] + alpha; - prob = count/total; - if (DEBUG) cerr << "level3 " << count << "/" << total << "=" << prob << endl; - } - } - - return prob; -} - -void Alignment::ScoreOrientation(const CountTable& table, int offset, int ori, WordID cond1, WordID cond2, - bool isBonus, double *cost, double *bonus, double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus, - double alpha1, double beta1) { - if (DEBUG) cerr << "ScoreOrientation:" << TD::Convert(cond1) << "," << TD::Convert(cond2) << ", alpha1 = " << alpha1 << ", beta1 = " << beta1 << endl; - double ret = ScoreOrientation(table,offset,ori,cond1,cond2); - if (isBonus) { - if (table.mode == 0) *bonus += log(ret); else *bonus += ret; - } else { - if (table.mode == 0) *cost += log(ret); else *cost += ret; - } -} - -double Alignment::ScoreOrientationLeft(const CountTable& table, int ori, WordID cond1, WordID cond2) { - double ret = ScoreOrientation(table,0,ori,cond1,cond2); - if (table.mode == 0) return log(ret); - return ret; -} - -double Alignment::ScoreOrientationLeftBackward(const CountTable& table, int ori, WordID cond1, WordID cond2) { - double ret = ScoreOrientation(table,12,ori,cond1,cond2); - if (table.mode == 0) return log(ret); - return ret; -} - -double Alignment::ScoreOrientationRight(const CountTable& table, int ori, WordID cond1, WordID cond2) { - double ret = ScoreOrientation(table,6,ori,cond1,cond2); - if (table.mode == 0) return log(ret); - return ret; -} - -double Alignment::ScoreOrientationRightBackward(const CountTable& table, int ori, WordID cond1, WordID cond2) { - double ret = ScoreOrientation(table,18,ori,cond1,cond2); - if (table.mode == 0) return log(ret); - return ret; -} - -void Alignment::ScoreOrientationLeft(const CountTable& table, int ori, WordID cond1, WordID cond2, - bool isBonus, double *cost, double *bonus, double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus, double alpha1, double beta1) { - if (DEBUG) cerr << "ScoreOrientationLeft(" << isBonus << ")" << endl; - ScoreOrientation(table,0,ori,cond1,cond2,isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha1,beta1); -} - -void Alignment::ScoreOrientationLeftBackward(const CountTable& table, int ori, WordID cond1, WordID cond2, - bool isBonus, double *cost, double *bonus, double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus, double alpha1, double beta1) { - if (DEBUG) cerr << "ScoreOrientationLeftBackward" << endl; - ScoreOrientation(table,12,ori,cond1,cond2,isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha1,beta1); -} - -void Alignment::ScoreOrientationRight(const CountTable& table, int ori, WordID cond1, WordID cond2, - bool isBonus, double *cost, double *bonus, double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus, double alpha1, double beta1) { - if (DEBUG) cerr << "ScoreOrientationRight(" << isBonus << ")" << endl; - ScoreOrientation(table,6,ori,cond1,cond2,isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha1,beta1); -} - -void Alignment::ScoreOrientationRightBackward(const CountTable& table, int ori, WordID cond1, WordID cond2, - bool isBonus, double *cost, double *bonus, double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus, double alpha1, double beta1) { - if (DEBUG) cerr << "ScoreOrientationRightBackward" << endl; - ScoreOrientation(table,18,ori,cond1,cond2,isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha1,beta1); -} - -void Alignment::computeOrientationSourceBackwardPos(const CountTable& table, double *cost, double *bonus, - double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus, int maxfwidx, int maxdepth1, int maxdepth2) { - if (DEBUG) cerr << "computeOrientationSourceBackward" << endl; - int oril, orir; - for (int idx=1; idx<=SourceFWRuleIdxs[0]; idx++) { - if (DEBUG) cerr << "considering SourceFWRuleIdxs[" << idx << "]: " << SourceFWRuleIdxs[3*idx-2] << endl; - if (!(SourceFWRuleAbsIdxs[idx]<=maxdepth1 || maxfwidx-SourceFWRuleAbsIdxs[idx]+1<=maxdepth2)) continue; - int* fwblock = blockSource(SourceFWRuleIdxs[3*idx-2],SourceFWRuleIdxs[3*idx-2]); - bool aligned = (fwblock[2]!=MINIMUM_INIT); - if (aligned) { - OrientationTarget(fwblock[2],fwblock[3],&oril,&orir); - } else { - OrientationSource(SourceFWRuleIdxs[3*idx-2],&oril,&orir); - } - if (DEBUG) cerr << "oril = " << oril << ", orir = " << orir << endl; - bool isBonus = false; // fas -> first aligned source word, las -> last aligned source word - if ((aligned && fwblock[2]<=fat)|| - (!aligned && SourceFWRuleIdxs[3*idx-2]<=fas)) isBonus=true; - if (SourceFWRuleAbsIdxs[idx]<=maxdepth1) { - ostringstream nusource; - nusource << TD::Convert(SourceFWRuleIdxs[3*idx-1]) << "/" << SourceFWRuleAbsIdxs[idx]; - ScoreOrientationLeftBackward(table,oril,TD::Convert(nusource.str()),SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - if (maxfwidx-SourceFWRuleAbsIdxs[idx]+1<=maxdepth2) { - ostringstream nusource; - nusource << TD::Convert(SourceFWRuleIdxs[3*idx-1]) << "/" << ((maxfwidx-SourceFWRuleAbsIdxs[idx]+1)*-1); - ScoreOrientationLeftBackward(table,oril,TD::Convert(nusource.str()),SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - isBonus = false; - if ((aligned && lat<=fwblock[3])|| - (!aligned && las<=SourceFWRuleIdxs[3*idx-2])) isBonus=true; - if (SourceFWRuleAbsIdxs[idx]<=maxdepth1) { - ostringstream nusource; - nusource << TD::Convert(SourceFWRuleIdxs[3*idx-1]) << "/" << SourceFWRuleAbsIdxs[idx]; - ScoreOrientationRightBackward(table,orir,SourceFWRuleIdxs[3*idx-1],SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - if (maxfwidx-SourceFWRuleAbsIdxs[idx]+1<=maxdepth2) { - ostringstream nusource; - nusource << TD::Convert(SourceFWRuleIdxs[3*idx-1]) << "/" << ((maxfwidx-SourceFWRuleAbsIdxs[idx]+1)*-1); - ScoreOrientationRightBackward(table,orir,SourceFWRuleIdxs[3*idx-1],SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - delete fwblock; - } - for (int i_ant=0; i_ant<_Arity; i_ant++) { - // antfas -> first aligned source word antecedent-wise - // antlas -> last aligned source word antecedent-wise - int antfat = firstTargetAligned(TargetAntsIdxs[i_ant][1]); - int antlat = lastTargetAligned(TargetAntsIdxs[i_ant][TargetAntsIdxs[i_ant][0]]); - int antfas = firstSourceAligned(SourceAntsIdxs[i_ant][1]); - int antlas = lastSourceAligned(SourceAntsIdxs[i_ant][SourceAntsIdxs[i_ant][0]]); - assert(antfat <= antlat); - assert(antfas <= antlas); - for (int idx=1; idx<=SourceFWAntsIdxs[i_ant][0]; idx++) { - if (DEBUG) - cerr << "considering SourceFWAntsIdxs[" << i_ant << "][" << idx << "]: " << SourceFWAntsIdxs[i_ant][3*idx-2] << endl; - if (!(SourceFWAntsAbsIdxs[i_ant][idx]<=maxdepth1 || maxfwidx-SourceFWAntsAbsIdxs[i_ant][idx]+1<=maxdepth2)) continue; - int* fwblock = blockSource(SourceFWAntsIdxs[i_ant][3*idx-2],SourceFWAntsIdxs[i_ant][3*idx-2]); - //bool aligned = (minTSpan(SourceFWAntsIdxs[i_ant][3*idx-2])!=MINIMUM_INIT); - bool aligned = (fwblock[2]!=MINIMUM_INIT); - bool Lcompute = true; bool Rcompute = true; - if (DEBUG) { - cerr << " aligned = " << aligned << endl; - cerr << " fwblock = " << fwblock[0] << "," << fwblock[1] << "," << fwblock[2] << "," << fwblock[3] << endl; - cerr << " antfas=" << antfas << ", antlas=" << antlas << ", antfat=" << antfat << ", antlat=" << antlat << endl; - } - if (aligned) { - if (DEBUG) cerr << "laligned" << endl; - if (antfat first aligned source word, las -> last aligned source word - if (SourceFWRuleIdxs[3*idx-2]<=fas) isBonus=true; - if (!isBonus) // this is unnecessary because fas <= las assertion - if (minTSpan(SourceFWRuleIdxs[3*idx-2])==MINIMUM_INIT && las<=SourceFWRuleIdxs[3*idx-2]) isBonus=true; - if (maxdepth1>0) { - oss << source << "/"; - if (SourceFWRuleAbsIdxs[idx]<=maxdepth1) - oss << SourceFWRuleAbsIdxs[idx]; - else - oss << "X"; - sourceID = TD::Convert(oss.str()); - oss.str(""); - ScoreOrientationLeft(table,oril,sourceID,SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - if (maxdepth2>0) { - oss << source << "/"; - if (maxfwidx-SourceFWRuleAbsIdxs[idx]+1<=maxdepth2) - oss << ((maxfwidx-SourceFWRuleAbsIdxs[idx]+1)*-1); - else - oss << "X"; - sourceID = TD::Convert(oss.str()); - oss.str(""); - ScoreOrientationLeft(table,oril,sourceID,SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - isBonus = false; - if (las<=SourceFWRuleIdxs[3*idx-2]) isBonus=true; - if (!isBonus) // this is unnecessary becuase fas <= las assertion - if (minTSpan(SourceFWRuleIdxs[3*idx-2])==MINIMUM_INIT && SourceFWRuleIdxs[3*idx-2]<=fas) isBonus=true; - if (maxdepth1>0) { - oss << source << "/"; - if (SourceFWRuleAbsIdxs[idx]<=maxdepth1) - oss << SourceFWRuleAbsIdxs[idx]; - else - oss << "X"; - sourceID = TD::Convert(oss.str()); - oss.str(""); - ScoreOrientationRight(table,orir,sourceID,SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - if (maxdepth2>0) { - oss << source << "/"; - if (maxfwidx-SourceFWRuleAbsIdxs[idx]+1<=maxdepth2) - oss << ((maxfwidx-SourceFWRuleAbsIdxs[idx]+1)*-1); - else - oss << "X"; - sourceID = TD::Convert(oss.str()); - oss.str(""); - ScoreOrientationRight(table,orir,sourceID,SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - - } - for (int i_ant=0; i_ant<_Arity; i_ant++) { - for (int idx=1; idx<=SourceFWAntsIdxs[i_ant][0]; idx++) { - if (DEBUG) - cerr << "considering SourceFWAntsIdxs[" << i_ant << "][" << idx << "]: " << SourceFWAntsIdxs[i_ant][3*idx-2] << endl; - //if (!((SourceFWAntsAbsIdxs[i_ant][idx]<=maxdepth1)||(maxfwidx-SourceFWAntsAbsIdxs[i_ant][idx]+1<=maxdepth2))) continue; - // antfas -> first aligned source word antecedent-wise - // antlas -> last aligned source word antecedent-wise - int antfas = firstSourceAligned(SourceAntsIdxs[i_ant][1]); - int antlas = lastSourceAligned(SourceAntsIdxs[i_ant][SourceAntsIdxs[i_ant][0]]); - if (DEBUG) cerr << " SourceFWAntsAbsIdxs[i_ant][3*idx-1]=" << SourceFWAntsAbsIdxs[i_ant][3*idx-1] << endl; - string source = TD::Convert(SourceFWAntsIdxs[i_ant][3*idx-1]); - assert(antfas <= antlas); - bool aligned = (minTSpan(SourceFWAntsIdxs[i_ant][3*idx-2])!=MINIMUM_INIT); - bool Lcompute = true;bool Rcompute = true; - if ((aligned && antfas0) { - oss << source << "/"; - if (SourceFWAntsAbsIdxs[i_ant][idx]<=maxdepth1) - oss << SourceFWAntsAbsIdxs[i_ant][idx]; - else - oss << "X"; - sourceID = TD::Convert(oss.str()); - oss.str(""); - ScoreOrientationLeft(table,oril,sourceID,SourceFWAntsIdxs[i_ant][3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - if (maxdepth2>0) { - oss << source << "/"; - if (maxfwidx-SourceFWAntsAbsIdxs[i_ant][idx]+1<=maxdepth2) - oss << ((maxfwidx-SourceFWAntsAbsIdxs[i_ant][idx]+1)*-1); - else - oss << "X"; - sourceID = TD::Convert(oss.str()); - oss.str(""); - ScoreOrientationLeft(table,oril,sourceID,SourceFWAntsIdxs[i_ant][3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - } - isBonus = false; - if (Rcompute) { - if (las<=SourceFWAntsIdxs[i_ant][3*idx-2]) isBonus = true; - //if (!isBonus) // this is unnecessary - // if (!aligned && SourceFWAntsIdxs[i_ant][3*idx-2]<=fas) isBonus=true; - if (maxdepth1>0) { - oss << source << "/"; - if (SourceFWAntsAbsIdxs[i_ant][idx]<=maxdepth1) - oss << SourceFWAntsAbsIdxs[i_ant][idx]; - else - oss << "X"; - sourceID = TD::Convert(oss.str()); - oss.str(""); - ScoreOrientationRight(table,orir,sourceID,SourceFWAntsIdxs[i_ant][3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - if (maxdepth2>0) { - oss << source << "/"; - if (maxfwidx-SourceFWAntsAbsIdxs[i_ant][idx]+1<=maxdepth2) - oss << ((maxfwidx-SourceFWAntsAbsIdxs[i_ant][idx]+1)*-1); - else - oss << "X"; - sourceID = TD::Convert(oss.str()); - oss.str(""); - ScoreOrientationRight(table,orir,sourceID,SourceFWAntsIdxs[i_ant][3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - } - } - } -} - -void Alignment::computeOrientationSource(const CountTable& table, double *cost, double *bonus, - double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus) { -// a bit complex due to imperfect state (TO DO!!!) -// 1. there are cases where function word alignments come from antecedents, which orientation -// (either its left or its right) has been computed earlier. -// 2. some orientation will go as bonus - if (DEBUG) cerr << "computeOrientationSource" << endl; - int oril, orir; - for (int idx=1; idx<=SourceFWRuleIdxs[0]; idx++) { - if (DEBUG) cerr << "considering SourceFWRuleIdxs[" << idx << "]: " << SourceFWRuleIdxs[3*idx-2] << endl; - OrientationSource(SourceFWRuleIdxs[3*idx-2],&oril,&orir); - bool isBonus = false; // fas -> first aligned source word, las -> last aligned source word - if (SourceFWRuleIdxs[3*idx-2]<=fas) isBonus=true; - if (!isBonus) // this is unnecessary because fas <= las assertion - if (minTSpan(SourceFWRuleIdxs[3*idx-2])==MINIMUM_INIT && las<=SourceFWRuleIdxs[3*idx-2]) isBonus=true; - ScoreOrientationLeft(table,oril,SourceFWRuleIdxs[3*idx-1],SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - isBonus = false; - if (las<=SourceFWRuleIdxs[3*idx-2]) isBonus=true; - if (!isBonus) // this is unnecessary becuase fas <= las assertion - if (minTSpan(SourceFWRuleIdxs[3*idx-2])==MINIMUM_INIT && SourceFWRuleIdxs[3*idx-2]<=fas) isBonus=true; - ScoreOrientationRight(table,orir,SourceFWRuleIdxs[3*idx-1],SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - for (int i_ant=0; i_ant<_Arity; i_ant++) { - for (int idx=1; idx<=SourceFWAntsIdxs[i_ant][0]; idx++) { - if (DEBUG) - cerr << "considering SourceFWAntsIdxs[" << i_ant << "][" << idx << "]: " << SourceFWAntsIdxs[i_ant][3*idx-2] << endl; - // antfas -> first aligned source word antecedent-wise - // antlas -> last aligned source word antecedent-wise - int antfas = firstSourceAligned(SourceAntsIdxs[i_ant][1]); - int antlas = lastSourceAligned(SourceAntsIdxs[i_ant][SourceAntsIdxs[i_ant][0]]); - assert(antfas <= antlas); - bool aligned = (minTSpan(SourceFWAntsIdxs[i_ant][3*idx-2])!=MINIMUM_INIT); - bool Lcompute = true;bool Rcompute = true; - if ((aligned && antfas& tags) { - if (DEBUG) cerr << "computeOrientationSourceGen" << endl; - int oril, orir; - for (int idx=1; idx<=SourceFWRuleIdxs[0]; idx++) { - if (DEBUG) cerr << "considering SourceFWRuleIdxs[" << idx << "]: " << SourceFWRuleIdxs[3*idx-2] << endl; - OrientationSource(SourceFWRuleIdxs[3*idx-2],&oril,&orir); - bool isBonus = false; // fas -> first aligned source word, las -> last aligned source word - if (SourceFWRuleIdxs[3*idx-2]<=fas) isBonus=true; - if (!isBonus) // this is unnecessary because fas <= las assertion - if (minTSpan(SourceFWRuleIdxs[3*idx-2])==MINIMUM_INIT && las<=SourceFWRuleIdxs[3*idx-2]) isBonus=true; - ScoreOrientationLeft(table,oril,generalize(SourceFWRuleIdxs[3*idx-1],tags),SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - isBonus = false; - if (las<=SourceFWRuleIdxs[3*idx-2]) isBonus=true; - if (!isBonus) // this is unnecessary becuase fas <= las assertion - if (minTSpan(SourceFWRuleIdxs[3*idx-2])==MINIMUM_INIT && SourceFWRuleIdxs[3*idx-2]<=fas) isBonus=true; - ScoreOrientationRight(table,orir,generalize(SourceFWRuleIdxs[3*idx-1],tags),SourceFWRuleIdxs[3*idx], - isBonus,cost,bonus,bo1,bo1_bonus,bo2,bo2_bonus,alpha_oris,beta_oris); - } - for (int i_ant=0; i_ant<_Arity; i_ant++) { - for (int idx=1; idx<=SourceFWAntsIdxs[i_ant][0]; idx++) { - if (DEBUG) - cerr << "considering SourceFWAntsIdxs[" << i_ant << "][" << idx << "]: " << SourceFWAntsIdxs[i_ant][3*idx-2] << endl; - // antfas -> first aligned source word antecedent-wise - // antlas -> last aligned source word antecedent-wise - int antfas = firstSourceAligned(SourceAntsIdxs[i_ant][1]); - int antlas = lastSourceAligned(SourceAntsIdxs[i_ant][SourceAntsIdxs[i_ant][0]]); - assert(antfas <= antlas); - bool aligned = (minTSpan(SourceFWAntsIdxs[i_ant][3*idx-2])!=MINIMUM_INIT); - bool Lcompute = true;bool Rcompute = true; - if ((aligned && antfas0) { - if (lfw>=0) { - int dom = DominanceSource(0,SourceFWIdxs[1]); - if (DEBUG) cerr << " --> lfw = " << lfw << "-" << TD::Convert(lfw) << endl; - if (DEBUG) cerr << " --> rfw = " << rfw << "-" << TD::Convert(rfw) << endl; - ScoreDominance(table,dom,lfw,SourceFWIdxs[2],lfw,SourceFWIdxs[3],bonus,bo1_bonus,bo2_bonus,true,alpha_doms,beta_doms); - } - if (rfw>=0) { - int dom = DominanceSource(SourceFWIdxs[3*SourceFWIdxs[0]-2],_J-1); - ScoreDominance(table,dom,SourceFWIdxs[3*SourceFWIdxs[0]-1],rfw,SourceFWIdxs[3*SourceFWIdxs[0]], - rfw,bonus,bo1_bonus,bo2_bonus,true,alpha_doms,beta_doms); - } - } -} - -void Alignment::computeDominanceSourcePos(const CountTable& table, WordID lfw, WordID rfw, - double *cost, double *bonus, double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus, int maxfwidx, int maxdepth1, int maxdepth2) { - if (DEBUG) cerr << "computeDominanceSourcePos" << endl; - if (DEBUG) cerr << " initial cost=" << *cost << ", initial bonus=" << *bonus << endl; - ostringstream oss; - for (int idx=2; idx<=SourceFWIdxs[0]; idx++) { - if (DEBUG) { - cerr << "PrevSourceFWIdxs :" << SourceFWIdxs[3*(idx-1)-2] << "," << SourceFWIdxs[3*(idx-1)-1] - << "," << SourceFWIdxs[3*(idx-1)] << endl; - cerr << "CurrSourceFWIdxs :" << SourceFWIdxs[3*(idx)-2] << "," << SourceFWIdxs[3*(idx)-1] - << "," << SourceFWIdxs[3*(idx)] << endl; - } - //if (!((SourceFWAbsIdxs[3*(idx-1)-2]<=maxdepth1 && SourceFWAbsIdxs[3*idx-2]<=maxdepth1) || - // (maxfwidx-SourceFWAbsIdxs[3*(idx-1)-2]+1<=maxdepth2 && maxfwidx-SourceFWAbsIdxs[3*idx-2]+1<=maxdepth2))) continue; - bool compute = true; - for (int i_ant=0; i_ant<_Arity && compute; i_ant++) { - if (MemberOf(SourceFWAntsIdxs[i_ant],SourceFWIdxs[3*(idx-1)-2],SourceFWIdxs[3*(idx)-2])) { - //cerr << "Skipping, they have been calculated in the " << (i_ant+1) << "-th branch" << endl; - compute=false; - } - } - if (compute) { - int dom = DominanceSource(SourceFWIdxs[3*(idx-1)-2],SourceFWIdxs[3*idx-2]); - if (DEBUG) cerr << "dom = " << dom << endl; - if (maxdepth1+maxdepth2>0) { - string source1 = TD::Convert(SourceFWIdxs[3*(idx-1)-1]); - string source2 = TD::Convert(SourceFWIdxs[3*(idx)-1]); - if (maxdepth1>0) { - oss << source1 << "/"; - if (SourceFWAbsIdxs[3*(idx-1)-2]<=maxdepth1) - oss << SourceFWAbsIdxs[3*(idx-1)-2]; - else - oss << "X"; - WordID source1id = TD::Convert(oss.str()); - oss.str(""); - oss << source2 << "/"; - if (SourceFWAbsIdxs[3*idx-2]<=maxdepth1) - oss << SourceFWAbsIdxs[3*idx-2]; - else - oss << "X"; - WordID source2id = TD::Convert(oss.str()); - oss.str(""); - ScoreDominance(table,dom,source1id,source2id,SourceFWIdxs[3*(idx-1)],SourceFWIdxs[3*idx], - cost,bo1,bo2,false,alpha_doms,beta_doms); - } - if (maxdepth2>0) { - oss << source1 << "/"; - if (maxfwidx-SourceFWAbsIdxs[3*(idx-1)-2]+1<=maxdepth2) - oss << ((maxfwidx-SourceFWAbsIdxs[3*(idx-1)-2]+1)*-1); - else - oss << "X"; - WordID source1id = TD::Convert(oss.str()); - oss.str(""); - oss << source2 << "/"; - if (maxfwidx-SourceFWAbsIdxs[3*idx-2]+1<=maxdepth2) - oss << ((maxfwidx-SourceFWAbsIdxs[3*(idx-1)-2]+1)*-1); - else - oss << "X"; - WordID source2id = TD::Convert(oss.str()); - oss.str(""); - ScoreDominance(table,dom,source1id,source2id,SourceFWIdxs[3*(idx-1)],SourceFWIdxs[3*idx], - cost,bo1,bo2,false,alpha_doms,beta_doms); - } - } - } - } - if (SourceFWIdxs[0]>0) { - if (lfw>=0) { - int dom = DominanceSource(0,SourceFWIdxs[1]); - string source1 = TD::Convert(lfw); - string source2 = TD::Convert(SourceFWIdxs[2]); - if (maxdepth1>0) { - oss << source1 << "/"; - if (SourceFWAbsIdxs[1]-1<=maxdepth1) - oss << (SourceFWAbsIdxs[1]-1); - else - oss << "X"; - WordID source1id = TD::Convert(oss.str()); - oss.str(""); - oss << source2 << "/"; - if (SourceFWAbsIdxs[1]<=maxdepth1) - oss << SourceFWAbsIdxs[1]; - else - oss << "X"; - WordID source2id = TD::Convert(oss.str()); - oss.str(""); - ScoreDominance(table,dom,source1id,source2id,lfw,SourceFWIdxs[3],bonus,bo1_bonus,bo2_bonus,true,alpha_doms,beta_doms); - } - if (maxdepth2>0) { - oss << source1 << "/"; - if (maxfwidx-(SourceFWAbsIdxs[1]-1)+1<=maxdepth2) - oss << ((maxfwidx-(SourceFWAbsIdxs[1]-1)+1)*-1); - else - oss << "X"; - WordID source1id = TD::Convert(oss.str()); - oss.str(""); - oss << source2 << "/"; - if (maxfwidx-SourceFWAbsIdxs[1]+1<=maxdepth2) - oss << ((maxfwidx-SourceFWAbsIdxs[1]+1)*-1); - else - oss << "X"; - WordID source2id = TD::Convert(oss.str()); - oss.str(""); - ScoreDominance(table,dom,source1id,source2id,lfw,SourceFWIdxs[3],bonus,bo1_bonus,bo2_bonus,true,alpha_doms,beta_doms); - } - } - if (rfw>=0) { - int dom = DominanceSource(SourceFWIdxs[3*SourceFWIdxs[0]-2],_J-1); - string source1 = TD::Convert(SourceFWIdxs[3*SourceFWIdxs[0]-1]); - string source2 = TD::Convert(rfw); - if (maxdepth1>0) { - oss << source1 << "/"; - if (SourceFWAbsIdxs[3*SourceFWAbsIdxs[0]-2]<=maxdepth1) - oss << SourceFWAbsIdxs[3*SourceFWIdxs[0]-2]; - else - oss << "X"; - WordID source1id = TD::Convert(oss.str()); - oss.str(""); - oss << source2 << "/"; - if (SourceFWAbsIdxs[3*SourceFWAbsIdxs[0]-2]+1<=maxdepth1) - oss << (SourceFWAbsIdxs[3*SourceFWAbsIdxs[0]-2]+1); - else - oss << "X"; - WordID source2id = TD::Convert(oss.str()); - ScoreDominance(table,dom,source1id,source2id,SourceFWIdxs[3*SourceFWIdxs[0]], - rfw,bonus,bo1_bonus,bo2_bonus,true,alpha_doms,beta_doms); - } - if (maxdepth2>0) { - oss << source1 << "/"; - if (maxfwidx-SourceFWAbsIdxs[3*SourceFWAbsIdxs[0]-2]+1<=maxdepth2) - oss << ((maxfwidx-SourceFWAbsIdxs[3*SourceFWAbsIdxs[0]-2]+1)*-1); - else - oss << "X"; - WordID source1id = TD::Convert(oss.str()); - oss.str(""); - oss << source2 << "/"; - if (maxfwidx-(SourceFWAbsIdxs[3*SourceFWAbsIdxs[0]-2]+1)+1<=maxdepth2) - oss << ((maxfwidx-(SourceFWAbsIdxs[3*SourceFWAbsIdxs[0]-2]+1)+1)*-1); - else - oss << "X"; - WordID source2id = TD::Convert(oss.str()); - oss.str(""); - ScoreDominance(table,dom,source1id,source2id,SourceFWIdxs[3*SourceFWIdxs[0]], - rfw,bonus,bo1_bonus,bo2_bonus,true,alpha_doms,beta_doms); - } - } - } -} - - -void Alignment::computeDominanceTarget(const CountTable& table, WordID lfw, WordID rfw, - double *cost, double *bonus, double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus) { - if (DEBUG) cerr << "computeDominanceTarget" << endl; - for (int idx=2; idx<=TargetFWIdxs[0]; idx++) { - if (DEBUG) cerr << "PrevTargetFWIdxs :" << TargetFWIdxs[3*(idx-1)-2] << "," << TargetFWIdxs[3*(idx-1)-1] << "," <=0) { - int dom = DominanceTarget(0,TargetFWIdxs[1]); - if (DEBUG) cerr << "dom target (with left) = " << dom << endl; - ScoreDominance(table,dom,lfw,lfw,TargetFWIdxs[2],TargetFWIdxs[3],bonus,bo1_bonus,bo2_bonus,true,alpha_domt,beta_domt); - } - if (rfw>=0) { - int dom = DominanceTarget(TargetFWIdxs[3*TargetFWIdxs[0]-2],_I-1); - if (DEBUG) cerr << "dom target (with right) = " << dom << endl; - ScoreDominance(table,dom,TargetFWIdxs[3*TargetFWIdxs[0]-1],TargetFWIdxs[3*TargetFWIdxs[0]], - rfw,rfw,bonus,bo1_bonus,bo2_bonus,true,alpha_domt,beta_domt); - } - } - - //cerr << "END of computeDominanceTarget" << endl; -} - -double Alignment::ScoreDominance(const CountTable& table, int dom, WordID source1, WordID source2, WordID target1, WordID target2) { - if (DEBUG) { - cerr << "ScoreDominance(source1=" << TD::Convert(source1) << ",source2=" << TD::Convert(source2) - << ",target1=" << TD::Convert(target1) << ",target2=" << TD::Convert(target2) << ", dom=" << dom << endl; - } - string _source1 = TD::Convert(source1); - string _source2 = TD::Convert(source2); - string _source1idx; string _source2idx; - if (table.mode==1) { - _source1idx = _source1; _source2idx = _source2; - _source1 = _source1idx.substr(0,_source1idx.find_last_of("/")); - _source2 = _source2idx.substr(0,_source2idx.find_last_of("/")); - } - string _target1 = TD::Convert(target1); - string _target2 = TD::Convert(target2); - - double count = table.ultimate[dom]; - double total = table.ultimate[4]; - double prob = count/total; - if (DEBUG) cerr << "level0 " << count << "/" << total << "=" << prob << endl; - double alpha = 0.1; - - string key = _source1 + " " + _source2; - WordID key_id = TD::Convert(key); - map::const_iterator it = table.model.find(key_id); - bool stop = (it==table.model.end()); - if (!stop) { - stop = true; - if (it->second[4]>=0) { - count = it->second[dom] + alpha*prob; - total = it->second[4] + alpha; - prob = count/total; - if (DEBUG) cerr << "level1 " << count << "/" << total << "=" << prob << endl; - stop = false; - } - } - if (stop) return prob; - - key = _source1 + " " + _source2 + " " + _target1 + " " + _target2; - key_id = TD::Convert(key); - it = table.model.find(key_id); - stop = (it==table.model.end()); - if (!stop) { - stop = true; - if (it->second[4]>=0) { - count = it->second[dom] + alpha*prob; - total = it->second[4] + alpha; - prob = count/total; - if (DEBUG) cerr << "level2 " << count << "/" << total << "=" << prob << endl; - stop = false; - } - } - - if (table.mode!=1 || stop) return prob; - key = _source1 + " " + _source2 + " " + _target1 + " " + _target2; - key_id = TD::Convert(key); - it = table.model.find(key_id); - if (it!=table.model.end()) { - if (it->second[4]>=0) { - count = it->second[dom] + alpha*prob; - total = it->second[4] + alpha; - if (DEBUG) cerr << "level3 " << count << "/" << total << "=" << prob << endl; - prob = count/total; - } - } - - return prob; -} - -void Alignment::ScoreDominance(const CountTable& table, int dom, WordID source1, WordID source2, WordID target1, WordID target2, double *cost, double *bo1, double *bo2, bool isBonus, double alpha2, double beta2) { - if (DEBUG) - cerr << "ScoreDominance(source1=" << TD::Convert(source1) << ",source2=" << TD::Convert(source2) - << ",target1=" << TD::Convert(target1) << ",target2=" << TD::Convert(target2) << ",isBonus=" << isBonus << ", alpha2 = " << alpha2 << ", beta2 = " << beta2 << endl; - if (DEBUG) cerr << " BEFORE=" << *cost << endl; - *cost += ScoreDominance(table,dom,source1,source2,target1,target2); - if (DEBUG) cerr << " AFTER=" << *cost << endl; -} - -WordID Alignment::F2EProjectionFromExternal(int idx, const vector& als, const string& delimiter) { - if (DEBUG) { - cerr << "F2EProjectionFromExternal=" << idx << endl; - for (int i=0; i< als.size(); i++) cerr << "als[" << i << "]=" << als[i] << " "; - cerr << endl; - } - vector alignedTo; - for (int i=0; i0) projection << delimiter; - projection << TD::Convert(_e[alignedTo[i]]); - } - if (DEBUG) { - cerr << "projection = " << projection.str() << endl; - cerr << "returns = " << TD::Convert(projection.str()) << endl; - } - return TD::Convert(projection.str()); - } -} - -WordID Alignment::E2FProjectionFromExternal(int idx, const vector& als, const string& delimiter) { - vector alignedTo; - for (int i=0; i0) projection << delimiter; - projection << TD::Convert(_f[alignedTo[i]]); - } - return TD::Convert(projection.str()); - } -} - - -WordID Alignment::F2EProjection(int idx, const string& delimiter) { - if (DEBUG) cerr << "F2EProjection(" << idx << ")" << endl; - int e = targetOf(idx); - if (e<0) { - if (DEBUG) cerr << "projection = NULL" << endl; - return TD::Convert("NULL"); - } else { - if (targetOf(idx,e+1)<0) { - if (DEBUG) cerr << "e-1=" << (e-1) << ", size=" << _e.size() << endl; - return getE(e-1); // if not aligned to many, why bother continuing - } - ostringstream projection; - bool firstTime = true; - do { - if (!firstTime) projection << delimiter; - projection << TD::Convert(_e[e-1]); // transform space - firstTime = false; - e = targetOf(idx,e+1); - //if (DEBUG) cerr << "projection = " << projection.str() << endl; - } while(e>=0); - return TD::Convert(projection.str()); - } -} - -WordID Alignment::E2FProjection(int idx, const string& delimiter) { - //cerr << "E2FProjection(" << idx << ")" << endl; - //cerr << "i" << endl; - int f = sourceOf(idx); - //cerr << "j, f=" << f << endl; - if (f<0) { - //cerr << "projection = NULL" << endl; - return TD::Convert("NULL"); - } else { - if (sourceOf(idx,f+1)<0) return getF(f-1); - bool firstTime = true; - ostringstream projection(ostringstream::out); - do { - if (!firstTime) projection << delimiter; - projection << TD::Convert(_f[f-1]); //transform space - firstTime = false; - f = sourceOf(idx,f+1); - //cerr << "projection = " << projection.str() << endl; - } while(f>=0); - return TD::Convert(projection.str()); - } -} -void Alignment::computeBorderDominanceSource(const CountTable& table, double *cost, double *bonus, double *state_mono, - double *state_nonmono, TRule &rule, const std::vector& ant_contexts, const map& sfw) { - // HACK: GOAL is assumed to always be "S" - if (DEBUG) cerr << "computeBorderDominanceSource" << endl; - std::vector f = rule.f(); - std::vector e = rule.e(); - int nt_index[f.size()]; - int nt_count=0; - for (int i=0; i als; - for (std::vector::const_iterator i = rule.als().begin(); i != rule.als().end(); ++i) { - int s = i->s_; int t = i->t_; - als.push_back(link(t,s)); - } - if (DEBUG) cerr << "rule.Arity=" << rule.Arity() << endl; - if (rule.Arity()>0) { - int ntc=0; - for (int s=0; s neither, 1 -> leftFirst, 2 -> rightFirst, 3 -> dontCare - // ScoreDominance(const CountTable& table, int dom, WordID source1, WordID source2, WordID target1, WordID target2) - int prevs = 0; - for (int i=0; i(ant_contexts[nt_index[s]-1]); - *cost += Dwarf::IntegerToDouble(ants[51]); // 50->mono, 51->non-mono - if (DEBUG) cerr << " adding "<< Dwarf::IntegerToDouble(ants[51]) << " into cost, resulting = " << *cost << endl; - } - flag[s] = true; - } - } - prevs = currs; - } - if (DEBUG) cerr << "bonus and state matter" << endl; - for (int s=0; s(ant_contexts[nt_index[s]-1]); - double indbonus = Dwarf::IntegerToDouble(ants[50]); - *bonus += indbonus; - *state_mono += indbonus; - *state_nonmono += Dwarf::IntegerToDouble(ants[51]); - if (DEBUG) cerr << " propagating state=" << *state_mono <<","<< *state_nonmono<< endl; - } - } - } - if (DEBUG) cerr << "LHS:" << rule.GetLHS() << ":" << TD::Convert(rule.GetLHS()*-1) <(ant_contexts[i]); - *cost += Dwarf::IntegerToDouble(ants[50]); - } - *bonus = 0; - } - if (DEBUG) cerr << "-->>>> cost="<<*cost<<", bonus="<<*bonus<<", state_mono="<<*state_mono<<", state_nonmono="<<*state_nonmono<& ant_contexts, const map& sfw, const map& tfw,const Lattice& sourcelattice, int spanstart, int spanend) { - if (DEBUG) cerr << "===Rule===" << rule.AsString() << endl; - _f = rule.f(); - _e = rule.e(); - _Arity = rule.Arity(); - if (DEBUG) { - cerr << "F: "; - for (int idx=0; idx<_f.size(); idx++) cerr << _f[idx] << " "; - cerr << endl; - cerr << "F': "; - for (int idx=0; idx<_f.size(); idx++) - if (_f[idx]>=0) { - cerr << TD::Convert(_f[idx]) << " "; - } else { - cerr << TD::Convert(_f[idx]*-1); - } - cerr << endl; - cerr << "E: "; - for (int idx=0; idx<_e.size(); idx++) - cerr << _e[idx] << " "; - cerr << endl; - cerr << "E': "; - for (int idx=0; idx<_e.size(); idx++) - if (_e[idx]>0) { - cerr << TD::Convert(_e[idx]) << " "; - } else { - cerr << "[NT]" << " "; - } - cerr << endl; - } - - SourceFWRuleIdxs[0]=0; - SourceFWRuleAbsIdxs[0]=0; - for (int idx=1; idx<=_f.size(); idx++) { // in transformed space - if (sfw.find(_f[idx-1])!=sfw.end()) { - SourceFWRuleIdxs[0]++; - SourceFWRuleAbsIdxs[++SourceFWRuleAbsIdxs[0]]=GetFWGlobalIdx(idx,sourcelattice,_f,spanstart,spanend,ant_contexts,sfw); - SourceFWRuleIdxs[3*SourceFWRuleIdxs[0]-2]=idx; - SourceFWRuleIdxs[3*SourceFWRuleIdxs[0]-1]=_f[idx-1]; - SourceFWRuleIdxs[3*SourceFWRuleIdxs[0]] =F2EProjectionFromExternal(idx-1,rule.a_,"_SEP_"); - } - } - TargetFWRuleIdxs[0]=0; - for (int idx=1; idx<=_e.size(); idx++) { // in transformed space - if (tfw.find(_e[idx-1])!=tfw.end()) { - TargetFWRuleIdxs[0]++; - TargetFWRuleIdxs[3*TargetFWRuleIdxs[0]-2]=idx; - TargetFWRuleIdxs[3*TargetFWRuleIdxs[0]-1]=E2FProjectionFromExternal(idx-1,rule.a_,"_SEP_"); - TargetFWRuleIdxs[3*TargetFWRuleIdxs[0]] =_e[idx-1]; - } - } - - if (DEBUG) { - cerr << "SourceFWRuleIdxs[" << SourceFWRuleIdxs[0] << "]:"; - for (int idx=1; idx<=SourceFWRuleIdxs[0]; idx++) { - cerr << " idx:" << SourceFWRuleIdxs[3*idx-2]; - cerr << " absidx:" << SourceFWRuleAbsIdxs[idx]; - cerr << " F:" << SourceFWRuleIdxs[3*idx-1]; - cerr << " E:" << SourceFWRuleIdxs[3*idx]; - cerr << "; "; - } - cerr << endl; - cerr << "TargetFWRuleIdxs[" << TargetFWRuleIdxs[0] << "]:"; - for (int idx=1; idx<=TargetFWRuleIdxs[0]; idx++) { - cerr << " idx:" << TargetFWRuleIdxs[3*idx-2]; - cerr << " F:" << TargetFWRuleIdxs[3*idx-1]; - cerr << " E:" << TargetFWRuleIdxs[3*idx]; - } - cerr << endl; - } - if (SourceFWRuleIdxs[0]+TargetFWRuleIdxs[0]==0) { - bool nofw = true; - for (int i_ant=0; i_ant<_Arity && nofw; i_ant++) { - const int* ants = reinterpret_cast(ant_contexts[i_ant]); - if (ants[0]>=0||ants[3]>=0||ants[6]>=0||ants[9]>=0) nofw=false; - } - if (nofw) return true; - } - //cerr << "clearing als first" << endl; - clearAls(_J,_I); - - if (DEBUG) cerr << "A["<< rule.a_.size() << "]: " ; - RuleAl[0]=0; - // add phrase start boundary - RuleAl[0]++; RuleAl[RuleAl[0]*2-1]=0; RuleAl[RuleAl[0]*2]=0; - if (DEBUG) cerr << RuleAl[RuleAl[0]*2-1] << "-" << RuleAl[RuleAl[0]*2] << " "; - for (int idx=0; idx(ant_contexts[i_ant]); - int span = ants[Dwarf::STATE_SIZE-1]; - if (DEBUG) { - cerr << "antcontexts[" << i_ant << "] "; - for (int idx=0; idx=0) { - // Given a span, give the index of the first function word - int firstfwidx = GetFirstFWIdx(source(span),target(span),sourcelattice,sfw); - if (DEBUG) cerr << " firstfwidx = " << firstfwidx << endl; - int fwcount = 0; - if (ants[1]>=0) { // one function word - SourceFWAntsIdxs[i_ant][0]++; SourceFWAntsIdxs[i_ant][1]=ants[0]; - SourceFWAntsIdxs[i_ant][2]=ants[1]; SourceFWAntsIdxs[i_ant][3]=ants[2]; - fwcount++; - } else { // if ants[1] < 0 then compound fws - //cerr << "ants[1]<0" << endl; - istringstream ossf(TD::Convert(ants[1]*-1)); string ffw; - istringstream osse(TD::Convert(ants[2])); string efw; //projection would be mostly NULL - int delta=ants[0]; - while (osse >> efw && ossf >> ffw) { - SourceFWAntsIdxs[i_ant][0]++; - SourceFWAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][0]*3-2]=ants[0]-(delta--); - SourceFWAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][0]*3-1]=TD::Convert(ffw); - SourceFWAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][0]*3] =TD::Convert(efw); - fwcount++; - } - } - if (DEBUG) cerr << " fwcount=" << fwcount << endl; - SourceFWAntsAbsIdxs[i_ant][0]=fwcount; - for (int i=1; i<=fwcount; i++) SourceFWAntsAbsIdxs[i_ant][i]=firstfwidx++; - } - if (ants[3]>=0) { - int lastfwidx = GetLastFWIdx(source(span),target(span),sourcelattice,sfw); - if (DEBUG) cerr << " lastfwidx = " << lastfwidx << endl; - int fwcount=0; - if (ants[4]>=0) { - fwcount++; - SourceFWAntsIdxs[i_ant][0]++; - SourceFWAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][0]*3-2]=ants[3]; - SourceFWAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][0]*3-1]=ants[4]; - SourceFWAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][0]*3] =ants[5]; - } else { // if ants[4] < 0 then compound fws - //cerr << "ants[4]<0" << endl; - istringstream ossf(TD::Convert(ants[4]*-1)); string ffw; - istringstream osse(TD::Convert(ants[5])); string efw; - int delta=0; - while (osse >> efw && ossf >> ffw) { - fwcount++; - SourceFWAntsIdxs[i_ant][0]++; - SourceFWAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][0]*3-2]=ants[3]+(delta++); - SourceFWAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][0]*3-1]=TD::Convert(ffw); - SourceFWAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][0]*3] =TD::Convert(efw); - } - } - if (DEBUG) cerr << " fwcount=" << fwcount << endl; - for (int i=1; i<=fwcount; i++) SourceFWAntsAbsIdxs[i_ant][SourceFWAntsAbsIdxs[i_ant][0]+i]=lastfwidx-fwcount+i; - SourceFWAntsAbsIdxs[i_ant][0]+=fwcount; - } - TargetFWAntsIdxs[i_ant][0]=0; - if (ants[6]>=0) { - if (ants[8]>=0) { // check the e part - TargetFWAntsIdxs[i_ant][0]++; - TargetFWAntsIdxs[i_ant][1]=ants[6]; - TargetFWAntsIdxs[i_ant][2]=ants[7]; - TargetFWAntsIdxs[i_ant][3]=ants[8]; - } else { // if ants[8] < 0 then compound fws - //cerr << "ants[8]<0" << endl; - //cerr << "ants[7]=" << TD::Convert(ants[7]) << endl; - //cerr << "ants[8]=" << TD::Convert(ants[8]*-1) << endl; - istringstream ossf(TD::Convert(ants[7])); string ffw; - istringstream osse(TD::Convert(ants[8]*-1)); string efw; - int delta=ants[6]; - while (osse >> efw && ossf >> ffw) { - //cerr << "efw="<< efw << ",ffw=" << ffw << endl; - TargetFWAntsIdxs[i_ant][0]++; - TargetFWAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][0]*3-2]=ants[6]-(delta--); - TargetFWAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][0]*3-1]=TD::Convert(ffw); - TargetFWAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][0]*3] =TD::Convert(efw); - } - } - } - if (ants[9]>=0) { - if (ants[11]>=0) { - TargetFWAntsIdxs[i_ant][0]++; - TargetFWAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][0]*3-2]=ants[9]; - TargetFWAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][0]*3-1]=ants[10]; - TargetFWAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][0]*3] =ants[11]; - } else { - //cerr << "ants[11]<0" << endl; - //cerr << "ants[10]=" << TD::Convert(ants[10]) << endl; - //cerr << "ants[11]=" << TD::Convert(ants[11]*-1) << endl; - istringstream ossf(TD::Convert(ants[10])); string ffw; - istringstream osse(TD::Convert(ants[11]*-1)); string efw; - int delta = 0; - while (osse >> efw && ossf >> ffw) { - //cerr << "efw="<< efw << ",ffw=" << ffw << endl; - TargetFWAntsIdxs[i_ant][0]++; - TargetFWAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][0]*3-2]=ants[9]+(delta++); - TargetFWAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][0]*3-1]=TD::Convert(ffw); - TargetFWAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][0]*3] =TD::Convert(efw); - } - } - } - AntsAl[i_ant][0]=ants[12];//number of alignments - for (int idx=1; idx<=AntsAl[i_ant][0]; idx++) { - AntsAl[i_ant][idx*2-1] = source(ants[12+idx]); - AntsAl[i_ant][idx*2] = target(ants[12+idx]); - } - } - - for (int i_ant=0; i_ant<_Arity; i_ant++) { - int length = AntsAl[i_ant][0]; - int maxs = -1000; - int maxt = -1000; - for (int idx=0; idx=0) { - TargetRuleIdxs[idx]=curr++; - } else { - int i_ant = TargetRuleIdxs[idx]*-1-1; - if (DEBUG) cerr << "TargetRuleIdxs[" << i_ant << "]" << endl; - for (int idx2=1; idx2<=TargetAntsIdxs[i_ant][0]; idx2++) { - TargetAntsIdxs[i_ant][idx2]=curr++; - if (DEBUG) cerr << TargetAntsIdxs[i_ant][idx2] << " "; - } - if (DEBUG) cerr << endl; - } - } - if (DEBUG) { - cerr << "TargetRuleIdxs" << endl; - for (int idx=1; idx<=TargetRuleIdxs[0]; idx++) cerr << TargetRuleIdxs[idx] << " "; - cerr << endl; - } - for (int idx=1; idx<=RuleAl[0]; idx++) { - if (DEBUG) { - cerr << RuleAl[idx*2-1] << " - " << RuleAl[idx*2] << " to "; - cerr << SourceRuleIdxs[RuleAl[idx*2-1]+1] << " - " << TargetRuleIdxs[RuleAl[idx*2]+1] << endl; - } - set(SourceRuleIdxs[RuleAl[idx*2-1]+1],TargetRuleIdxs[RuleAl[idx*2]+1]); - } - for (int i_ant=0; i_ant<_Arity; i_ant++) { - for (int idx=1; idx<=AntsAl[i_ant][0]; idx++) { - if (DEBUG) { - cerr << AntsAl[i_ant][2*idx-1] << " - " << AntsAl[i_ant][2*idx] << " to "; - cerr << SourceAntsIdxs[i_ant][AntsAl[i_ant][2*idx-1]+1] << " - "; - cerr << TargetAntsIdxs[i_ant][AntsAl[i_ant][2*idx]+1] << endl; - } - set(SourceAntsIdxs[i_ant][AntsAl[i_ant][2*idx-1]+1],TargetAntsIdxs[i_ant][AntsAl[i_ant][2*idx]+1]); - } - } - SourceFWIdxs[0]=0; - SourceFWAbsIdxs[0]=0; - if (DEBUG) cerr << "SourceFWRuleIdxs:" << endl; - for (int idx=1; idx<=SourceFWRuleIdxs[0]; idx++) { - if (DEBUG) cerr << SourceFWRuleIdxs[3*idx-2] << " to " << SourceRuleIdxs[SourceFWRuleIdxs[3*idx-2]+1] << endl; - SourceFWRuleIdxs[3*idx-2] = SourceRuleIdxs[SourceFWRuleIdxs[3*idx-2]+1]; - SourceFWAbsIdxs[0]++; - SourceFWAbsIdxs[3*SourceFWAbsIdxs[0]-2]=SourceFWRuleAbsIdxs[idx]; - SourceFWIdxs[0]++; - SourceFWIdxs[3*SourceFWIdxs[0]-2]=SourceFWRuleIdxs[3*idx-2]; - SourceFWIdxs[3*SourceFWIdxs[0]-1]=SourceFWRuleIdxs[3*idx-1]; - SourceFWIdxs[3*SourceFWIdxs[0]] =SourceFWRuleIdxs[3*idx]; - } - for (int i_ant=0; i_ant<_Arity; i_ant++) { - if (DEBUG) cerr << "SourceFWAntsIdxs[" << i_ant << "]" << endl; - for (int idx=1; idx<=SourceFWAntsIdxs[i_ant][0]; idx++) { - if (DEBUG) - cerr << SourceFWAntsIdxs[i_ant][3*idx-2] << " to " << SourceAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][3*idx-2]+1] << endl; - SourceFWAntsIdxs[i_ant][3*idx-2] = SourceAntsIdxs[i_ant][SourceFWAntsIdxs[i_ant][3*idx-2]+1]; - SourceFWAbsIdxs[0]++; - SourceFWAbsIdxs[3*SourceFWAbsIdxs[0]-2]=SourceFWAntsAbsIdxs[i_ant][idx]; - SourceFWIdxs[0]++; - SourceFWIdxs[3*SourceFWIdxs[0]-2]=SourceFWAntsIdxs[i_ant][3*idx-2]; - SourceFWIdxs[3*SourceFWIdxs[0]-1]=SourceFWAntsIdxs[i_ant][3*idx-1]; - SourceFWIdxs[3*SourceFWIdxs[0]] =SourceFWAntsIdxs[i_ant][3*idx]; - } - } - sort(SourceFWIdxs); - sort(SourceFWAbsIdxs); - if (DEBUG) { - cerr << "SourceFWIdxs : "; - for (int idx=1; idx<=SourceFWIdxs[0]; idx++) { - cerr << "idx:" << SourceFWIdxs[3*idx-2] << ","; - cerr << "F:" << SourceFWIdxs[3*idx-1] << ","; - cerr << "E:" << SourceFWIdxs[3*idx] << " "; - } - cerr << endl; - } - TargetFWIdxs[0]=0; - if (DEBUG) cerr << "TargetFWRuleIdxs:" << endl; - for (int idx=1; idx<=TargetFWRuleIdxs[0]; idx++) { - if (DEBUG) cerr << TargetFWRuleIdxs[3*idx-2] << " to " << TargetRuleIdxs[TargetFWRuleIdxs[3*idx-2]+1] << endl; - TargetFWRuleIdxs[3*idx-2] = TargetRuleIdxs[TargetFWRuleIdxs[3*idx-2]+1]; - TargetFWIdxs[0]++; - TargetFWIdxs[3*TargetFWIdxs[0]-2]=TargetFWRuleIdxs[3*idx-2]; - TargetFWIdxs[3*TargetFWIdxs[0]-1]=TargetFWRuleIdxs[3*idx-1]; - TargetFWIdxs[3*TargetFWIdxs[0]] =TargetFWRuleIdxs[3*idx]; - } - for (int i_ant=0; i_ant<_Arity; i_ant++) { - if (DEBUG) cerr << "TargetFWAntsIdxs[" << i_ant << "]" << endl; - for (int idx=1; idx<=TargetFWAntsIdxs[i_ant][0]; idx++) { - if (DEBUG) cerr << TargetFWAntsIdxs[i_ant][3*idx-2] << " to " << TargetAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][3*idx-2]+1] << endl; - TargetFWAntsIdxs[i_ant][3*idx-2] = TargetAntsIdxs[i_ant][TargetFWAntsIdxs[i_ant][3*idx-2]+1]; - TargetFWIdxs[0]++; - TargetFWIdxs[3*TargetFWIdxs[0]-2]=TargetFWAntsIdxs[i_ant][3*idx-2]; - TargetFWIdxs[3*TargetFWIdxs[0]-1]=TargetFWAntsIdxs[i_ant][3*idx-1]; - TargetFWIdxs[3*TargetFWIdxs[0]] =TargetFWAntsIdxs[i_ant][3*idx]; - } - } - sort(TargetFWIdxs); - if (DEBUG) { - cerr << "TargetFWIdxs : "; - for (int idx=1; idx<=TargetFWIdxs[0]; idx++) { - cerr << "idx:" << TargetFWIdxs[3*idx-2]<< ","; - cerr << "E:" << TargetFWIdxs[3*idx-1]<< ","; - cerr << "F:" << TargetFWIdxs[3*idx]<< " "; - } - cerr << endl; - cerr << AsString() << endl; - } - fas = firstSourceAligned(1); las = lastSourceAligned(_J-2); - fat = firstTargetAligned(1); lat = lastTargetAligned(_I-2); - if (DEBUG) cerr << "fas=" << fas << ", las=" << las << ", fat=" << fat << ", lat=" << lat << endl; - assert(fas<=las); - assert(fat<=lat); - SetCurrAlVector(); - if (DEBUG) cerr << "end prepare" << endl; - return false; -} - -string Alignment::AsStringSimple() { - ostringstream stream; - for (int j=0; j=0) { - stream << " " << j << "-" << t; - t = targetOf(j,t+1); - } - } - return stream.str(); -}; - - -string Alignment::AsString() { - ostringstream stream; - stream << "J:" << getJ() << " I:" << getI(); - for (int j=0; j=0) { - stream << " " << j << "-" << t; - t = targetOf(j,t+1); - } - } - stream << " TargetSpan:"; - for (int j=0; j=0) { - curr_al.push_back(link(j,i)); - i = targetOf(j,i+1); - } - } -} - -void CountTable::print() const { - cerr << "+++ Model +++" << endl; - for (map::const_iterator iter=model.begin(); iter!=model.end(); iter++) { - cerr << TD::Convert(iter->first) << " "; - for (int i=0; isecond[i] << " "; - cerr << endl; - } - cerr << "+++ Ultimate +++" << endl; - for (int i=0; i* ret) { - ret->clear(); - for (int i=0; i<_J; i++) { - int t = targetOf(i); - while (t>=0) { - ret->push_back(link(i,t)); - t = targetOf(i,t+1); - } - } -} - -int Alignment::GetFWGlobalIdx(int idx, const Lattice& sourcelattice, vector& sources, int spanstart, int spanend, const std::vector& ant_contexts, const map& sfw) { - // get the index of the function word in the lattice - if (DEBUG) cerr << " GetFWGlobalIdx(" << idx << "," << spanstart << "," << spanend << ")" << endl; - int curr = spanstart; int i_ant = 0; - for (int i=1; i and - if (sources[i]<0) { - const int* ants = reinterpret_cast(ant_contexts[i_ant++]); - int antstate = ants[Dwarf::STATE_SIZE-1]; - if (DEBUG) cerr << " found NT[" << target(antstate) << "," << source(antstate) << "]" << endl; - curr += target(antstate)-source(antstate); - } else { - curr++; - } - } - if (DEBUG) cerr << " curr = " << curr << endl; - //compute the fw index - int ret = 1; - for (int i=0; i=spanstart) return curr; - } - } -// assert(0); - return curr; -} - -int Alignment::GetLastFWIdx(int spanstart,int spanend, const Lattice& sourcelattice, const map& sfw) { - if (DEBUG) cerr << " GetLastFWIdx(" << spanstart << "," << spanend << ")" << endl; - int curr=0; - for (int i=0; i& tags, bool pos) { - if (!pos) { - map::const_iterator it = tags.find(original); - if (it!=tags.end()) { - return it->second; - } - } else { - string key,idx; - Dwarf::stripIndex(TD::Convert(original),&key,&idx); - map::const_iterator it = tags.find(TD::Convert(key)); - if (it!=tags.end()) { - ostringstream oss; - oss << TD::Convert(it->second) << "/" << idx; - return TD::Convert(oss.str()); - } - } - return original; -} - -int* Alignment::SOS() { - int* neighbor = new int[4]; - neighbor[0]=0; neighbor[1]=0; - neighbor[2]=0; neighbor[3]=0; - return neighbor; -} - -int* Alignment::EOS() { - int* neighbor = new int[4]; - neighbor[0]=getJ()-1; neighbor[1]=neighbor[0]; - neighbor[2]=getI()-1; neighbor[3]=neighbor[2]; - return neighbor; -} - -int* Alignment::neighborLeft(int startidx, int endidx, bool* getit) { - if (DEBUG) cerr << " neighborLeft("< -#include -#include -#include -#include -#include "wordid.h" -#include "lattice.h" -#include "trule.h" -#include "tdict.h" -#include -#include -#include - -using namespace std; -using namespace std::tr1; -using namespace boost::tuples; -using namespace boost; - -const static bool DEBUG = false; - -class CountTable { -public: - int* ultimate; - map model; - int mode; - int numColumn; - void print() const; - void setup(int _numcolumn, int _mode) { - mode = _mode; numColumn = _numcolumn; - } -}; - -class Alignment { -/* Alignment represents an alignment object in a 2D format to support function word-based models calculation - - A note about model's parameter estimation: - ========================================== - The model is estimated as a two-level Dirichlet process. - For orientation model, the first tier estimation is: - P(o|f,e) where *o* is the orientation value to estimate, *f* is the source function word aligned to *e* - its second tier is: P(o|f), while its third tier is P(o) - For dominance model, the first tier estimation is: - P(d|f1,f2,e1,e2) where *d* is a dominance value to estimate, *f1,f2* are the neighboring function words on the source - aligned to *e1,e2* on the target side - its second tier is: P(d|f1,f2) while its third tier is P(d) - - Taking orientation model as a case in point, a two level estimation proceeds as follow: - P(o|f,e) = c(o,f,e) + alpha { c(o,f) + beta [ c (o) / c(.) ] } - ------------------------------ - c(f) + beta - ------------------------------------------------- - c(f,e) + alpha - where c() is a count function, alpha and beta are the concentration parameter - of the first and second Dirichlet process respectively - To encourage or penalize the use of second and third tier statistics, bo1 and bo2 binary features are introduced -*/ -public: - const static int MAX_WORDS = 200; - const static int MINIMUM_INIT = 1000; - const static int MAXIMUM_INIT = -1000; - const static int MAX_ARITY = 2; - WordID kSOS; - WordID kEOS; - WordID kUNK; - double alpha_oris; // 1st concentration parameter for orientation model - double beta_oris; // 2nd concentration parameter for orientation model - double alpha_orit; // 1st concentration parameter for orientation model - double beta_orit; // 2nd concentration parameter for orientation model - double alpha_doms; // idem as above but for dominance model - double beta_doms; - double alpha_domt; // idem as above but for dominance model - double beta_domt; - - // ACCESS to alignment - void set(int j,int i); // j is the source index, while i is the target index - void reset(int j,int i); // idem as above - inline bool at(int j, int i) { return _matrix[j][i]; }; - inline int getJ() {return _J;}; // max source of the current alignment - inline int getI() {return _I;}; // max target of the current alignment - inline void setI(int I) { _I = I; }; - inline void setJ(int J) { _J = J; }; - inline void setF(vector f) { _f=f;}; - inline void setE(vector e) { _e=e;}; - inline WordID getF(int id) { if (id<0) return TD::Convert(""); if (id>=_f.size()) return TD::Convert(""); return _f[id];}; - inline WordID getE(int id) { if (id<0) return TD::Convert(""); if (id>=_e.size()) return TD::Convert(""); return _e[id];}; - void clearAls(int prevJ=200, int prevI=200); - int sourceOf(int i, int start = -1); - int targetOf(int j, int start = -1); - inline int minSSpan(int i) { return _sSpan[i][0];} - inline int maxSSpan(int i) { return _sSpan[i][1];} - inline int minTSpan(int j) { return _tSpan[j][0];} - inline int maxTSpan(int j) { return _tSpan[j][1];} - static inline int link(int s, int t) { return (s << 16) | t; } - static inline int source(int st) {return st >> 16; } - static inline int target(int st) {return st & 0xffff; } - inline void setAlphaOris(double val) { alpha_oris=val; } - inline void setAlphaOrit(double val) { alpha_orit=val; } - inline void setAlphaDoms(double val) { alpha_doms=val; } - inline void setAlphaDomt(double val) { alpha_domt=val; } - inline void setBetaOris(double val) { beta_oris=val; } - inline void setBetaOrit(double val) { beta_orit=val; } - inline void setBetaDoms(double val) { beta_doms=val; } - inline void setBetaDomt(double val) { beta_domt=val; } - inline void setFreqCutoff(int val) { cout << _freq_cutoff << " to " << val << endl; _freq_cutoff=val; } - string AsString(); - string AsStringSimple(); - int* SOS(); - int* EOS(); - - // Model related function - Alignment(); - // Given the current *rule* and its antecedents, construct an alignment space and mark the function word alignments - // according *sfw* and *tfw* - bool prepare(TRule& rule, const std::vector& ant_contexts, - const map& sfw, const map& tfw, const Lattice& sourcelattice, int spanstart, int spanend); - - // Compute orientation model score which parameters are stored in *table* and pass the values accordingly - // will call Orientation(Source|Target) and ScoreOrientation(Source|Target) - void computeOrientationSource(const CountTable& table, double *cost, double *bonus, double *bo1, - double *bo1_bonus, double *bo2, double *bo2_bonus); - void computeOrientationSourcePos(const CountTable& table, double *cost, double *bonus, - double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus, int maxfwidx, int maxdepth1, int maxdepth2); - void computeOrientationSourceGen(const CountTable& table, double *cost, double *bonus, double *bo1, - double *bo1_bonus, double *bo2, double *bo2_bonus, const map& tags); - void computeOrientationSourceBackward(const CountTable& table, double *cost, double *bonus, double *bo1, - double *bo1_bonus, double *bo2, double *bo2_bonus); - void computeOrientationSourceBackwardPos(const CountTable& table, double *cost, double *bonus, double *bo1, - double *bo1_bonus, double *bo2, double *bo2_bonus, int maxfwidx, int maxdepth1, int maxdepth2); - void computeOrientationTarget(const CountTable& table, double *cost, double *bonus, double *bo1, - double *bo1_bonus, double *bo2, double *bo2_bonus); - void computeOrientationTargetBackward(const CountTable& table, double *cost, double *bonus, double *bo1, - double *bo1_bonus, double *bo2, double *bo2_bonus); - // Get the orientation value of a function word at a particular index *fw* - // assign the value to either *oril* or *orir* accoring to *Lcompute* and *Rcompute* - void OrientationSource(int fw, int*oril, int* orir, bool Lcompute=true, bool Rcompute=true); - void OrientationSource(int fw0, int fw1, int*oril, int* orir, bool Lcompute=true, bool Rcompute=true); - int OrientationSource(int* left, int* right); - void OrientationTarget(int fw, int*oril, int* orir, bool Lcompute=true, bool Rcompute=true); - void OrientationTarget(int fw0, int fw1, int*oril, int* orir, bool Lcompute=true, bool Rcompute=true); - - vector OrientationSourceLeft4Sampler(int fw0, int fw1); - vector OrientationSourceLeft4Sampler(int fw); - vector OrientationSourceRight4Sampler(int fw0, int fw1); - vector OrientationSourceRight4Sampler(int fw); - vector OrientationTargetLeft4Sampler(int fw0, int fw1); - vector OrientationTargetLeft4Sampler(int fw); - vector OrientationTargetRight4Sampler(int fw0, int fw1); - vector OrientationTargetRight4Sampler(int fw); - - // Given an orientation value *ori*, estimate the score accoding to *cond1*, *cond2* - // and assign the value accordingly according to *isBonus* and whether the first or the second tier estimation - // is used or not - void ScoreOrientationRight(const CountTable& table, int ori, WordID cond1, WordID cond2, - bool isBonus, double *cost, double *bonus, double *bo1, double *bo1_bonus, - double *bo2, double *bo2_bonus, double alpha1, double beta1); - void ScoreOrientationLeft(const CountTable& table, int ori, WordID cond1, WordID cond, - bool isBonus, double *cost, double *bonus, double *bo1, double *bo1_bonus, - double *bo2, double *bo2_bonus, double alpha1, double beta1); - double ScoreOrientationRight(const CountTable& table, int ori, WordID cond1, WordID cond2); - double ScoreOrientationLeft(const CountTable& table, int ori, WordID cond1, WordID cond); - void ScoreOrientationRightBackward(const CountTable& table, int ori, WordID cond1, WordID cond2, - bool isBonus, double *cost, double *bonus, double *bo1, double *bo1_bonus, - double *bo2, double *bo2_bonus, double alpha1, double beta1); - void ScoreOrientationLeftBackward(const CountTable& table, int ori, WordID cond1, WordID cond, - bool isBonus, double *cost, double *bonus, double *bo1, double *bo1_bonus, - double *bo2, double *bo2_bonus, double alpha1, double beta1); - double ScoreOrientationRightBackward(const CountTable& table, int ori, WordID cond1, WordID cond2); - double ScoreOrientationLeftBackward(const CountTable& table, int ori, WordID cond1, WordID cond); - void ScoreOrientation(const CountTable& table, int offset, int ori, WordID cond1, WordID cond2, - bool isBonus, double *cost, double *bonus, double *bo1, double *bo1_bonus, - double *bo2, double *bo2_bonus, double alpha1, double beta1); - double ScoreOrientation(const CountTable& table, int offset, int ori, WordID cond1, WordID cond2); - - // idem as above except these are for dominance model - void computeDominanceSource(const CountTable& table, WordID lfw, WordID rfw, double *cost, double *bonus, - double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus); - void computeDominanceSourcePos(const CountTable& table, WordID lfw, WordID rfw, double *cost, double *bonus, - double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus, int maxfwidx, int maxdepth1, int maxdepth2); - void computeDominanceTarget(const CountTable& table, WordID lfw, WordID rfw, double *cost, double *bonus, - double *bo1, double *bo1_bonus, double *bo2, double *bo2_bonus); - void computeBorderDominanceSource(const CountTable& table, double *cost, double *bonus, - double *state_mono, double *state_nonmono, - TRule &rule, const std::vector& ant_contexts, const map& sfw); - int DominanceSource(int fw1, int fw2); - int DominanceTarget(int fw1, int fw2); - vector DominanceSource4Sampler(int fw1, int fw2); - vector DominanceTarget4Sampler(int fw1, int fw2); - void ScoreDominance(const CountTable& table, int dom, WordID s1, WordID s2, WordID t1, WordID t2, - double *cost, double *bo1, double *bo2, bool isBonus, double alpha2, double beta2); - double ScoreDominance(const CountTable& table, int dom, WordID s1, WordID s2, WordID t1, WordID t2); - - // Remove all function word alignments except those at the borders - // May result in more than two function word alignments at each side, because this function - // will continue keeping function word alignments until the first aligned word at each side - void BorderingSFWsOnly(); - void BorderingTFWsOnly(); - void simplify(int *ret); // preparing the next state - void simplify_nofw(int *ret); // preparing the next state when no function word appears - // set the first part of the next state, which concerns with function word - // fas, las, fat, lat is the (f)irst or (l)ast function word alignments either on the (s)ource or (t)arget - // these parameters to anticipate cases where there are more than two function word alignments - void FillFWIdxsState(int *state, int fas, int las, int fat, int lat); - - // Helper function to obtain the aligned words on the other side - // WARNING!!! Only to be used if the als are in sync with either source or target sentences - WordID F2EProjectionFromExternal(int idx, const vector& als, const string& delimiter=" "); - WordID E2FProjectionFromExternal(int idx, const vector& als, const string& delimiter=" "); - // WARNING!!! Only to be used in dwarf_main.cc - // These two function words assume that the alignment contains phrase boundary - // but the source and target sentences do not - WordID F2EProjection(int idx, const string& delimiter=" "); - WordID E2FProjection(int idx, const string& delimiter=" "); - void SetCurrAlVector(); - int* blockSource(int fw1, int fw2); - int* blockTarget(int fw1, int fw2); - void ToArrayInt(vector* arr); - int* neighborLeft(int startidx, int endidx, bool* found); - int* neighborRight(int startidx, int endidx, bool* found); -private: - // Hash to avoid redundancy - unordered_map, int, boost::hash > > oris_hash; - unordered_map, int, boost::hash > > orit_hash; - unordered_map, int, boost::hash > > doms_hash; - unordered_map, int, boost::hash > > domt_hash; - unordered_map, vector, boost::hash > > simplify_hash; - unordered_map, vector, boost::hash > > prepare_hash; - - int _J; // effective source length; - int _I; // effective target length; - bool _matrix[MAX_WORDS][MAX_WORDS]; // true if aligned - short _sSpan[MAX_WORDS][2]; //the source span of a target index; 0->min, 1->max - short _tSpan[MAX_WORDS][2]; //the target span of a source index; 0->min, 2->max - int _freq_cutoff; - int SourceFWRuleIdxs[40]; //the indexes of function words in the rule; - // The following applies to all *FW*Idxs - // *FW*Idxs[0] = size - // *FW*Idxs[idx*3-2] = index in the alignment, where idx starts from 1 to size - // *FW*Idxs[idx*3-1] = source WordID - // *FW*Idxs[idx*3] = target WordID - int SourceFWRuleAbsIdxs[40]; - int TargetFWRuleIdxs[40]; //the indexes of function words in the rule; zeroth element is the count - int ** SourceFWAntsIdxs; //the indexes of function words in antecedents - int ** SourceFWAntsAbsIdxs; - int ** TargetFWAntsIdxs; //the indexes of function words in antecedents - int SourceRuleIdxs[40]; //the indexes of SOURCE tokens (zeroth element is the number of source tokens) - //>0 means terminal, -i means the i-th Xs - int TargetRuleIdxs[40]; //the indexes of TARGET tokens (zeroth element is the number of target tokens) - int ** SourceAntsIdxs; //the array of indexes of a particular antecedent's SOURCE tokens - int ** TargetAntsIdxs; //the array of indexes of a particular antecedent's TARGET tokens - int SourceFWIdxs[40]; - int SourceFWAbsIdxs[40]; - int TargetFWIdxs[40]; - // *sort* and *quickSort* are used to sort *FW*Idxs - void sort(int* num); - void quickSort(int arr[], int top, int bottom); - - // *block(Source|Target)* finds the minimum block that containts two indexes (fw1 and fw2) - inline int least(int i1, int i2) { return (i1i2)?i1:i2; } - void simplifyBackward(vector*blocks, int* block, const vector& danglings); - // used in simplify to check whether an atomic block according to source function words is also atomic according - // to target function words as well, otherwise break it - // the resulting blocks are added into *blocks* - int _Arity; - std::vector _f; // the source sentence of the **current** rule (may not consistent with the current alignment) - std::vector _e; // the target sentence of the **current** rule - int RuleAl[40]; - int **AntsAl; - int firstSourceAligned(int start); - int firstTargetAligned(int start); - int lastSourceAligned(int end); - int lastTargetAligned(int end); - int fas, las, fat, lat; // first aligned source, last aligned source, first aligned target, last aligned target - bool MemberOf(int* FWIdxs, int pos1, int pos2); // whether FWIdxs contains pos1 and pos2 consecutively - // Convert the alignment to vector form, will be used for hashing purposes - vector curr_al; - int GetFWGlobalIdx(int idx, const Lattice& sourcelattice, vector& sources, int spanstart, int spanend, const std::vector& ant_contexts, const map& sfw); - int GetFirstFWIdx(int spanstart,int spanend, const Lattice& sourcelattice, const map& sfw); - int GetLastFWIdx(int spanstart,int spanend, const Lattice& sourcelattice, const map& sfw); - WordID generalize(WordID original, const map& tags, bool pos=false); -}; - -#endif diff --git a/decoder/earley_composer.cc b/decoder/earley_composer.cc index efce70a6..32c387d3 100644 --- a/decoder/earley_composer.cc +++ b/decoder/earley_composer.cc @@ -4,8 +4,14 @@ #include #include #include -#include -#include +#ifdef HAVE_CXX11 +# include +# include +#else +# include +# include +namespace std { using std::tr1::unordered_map; using std::tr1::unordered_multiset; using std::tr1::unordered_set; } +#endif #include #include @@ -19,7 +25,6 @@ #include "hg_remove_eps.h" using namespace std; -using namespace std::tr1; // Define the following macro if you want to see lots of debugging output // when you run the chart parser diff --git a/decoder/factored_lexicon_helper.cc b/decoder/factored_lexicon_helper.cc index 7203b325..e7899215 100644 --- a/decoder/factored_lexicon_helper.cc +++ b/decoder/factored_lexicon_helper.cc @@ -2,6 +2,7 @@ #include "filelib.h" #include "stringlib.h" +#include "sentence_metadata.h" using namespace std; diff --git a/decoder/factored_lexicon_helper.h b/decoder/factored_lexicon_helper.h index 81c75275..7fedc517 100644 --- a/decoder/factored_lexicon_helper.h +++ b/decoder/factored_lexicon_helper.h @@ -6,7 +6,8 @@ #include #include #include "tdict.h" -#include "sentence_metadata.h" + +struct SentenceMetadata; // when computing features, it can be advantageous to: // 1) back off to less specific forms (e.g., less highly inflected forms, POS tags, etc) diff --git a/decoder/ff_dwarf.cc b/decoder/ff_dwarf.cc deleted file mode 100644 index fe7a472e..00000000 --- a/decoder/ff_dwarf.cc +++ /dev/null @@ -1,894 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "hg.h" -#include "ff_dwarf.h" -#include "dwarf.h" -#include "wordid.h" -#include "tdict.h" -#include "filelib.h" -#include "sentence_metadata.h" -#include "stringlib.h" - -using namespace std; - -Dwarf::Dwarf(const std::string& param) { -/* Param is a space separated string which contains any or all of the following: - oris|orit|doms|domt=filename - e.g. oris=/fs/clip-galep3eval/hendra/z2e/oris128.gz -*/ - sSOS=""; - sEOS=""; - kSOS=TD::Convert(sSOS); - kEOS=TD::Convert(sEOS); - kGOAL=TD::Convert("S")*-1; - _sent_id = (int *)malloc(sizeof(int)); - *_sent_id = -1; - if (DEBUG) cerr << "here = " << *_sent_id << endl; - _fwcount = (int *)malloc(sizeof(int)); - *_fwcount = -1; - cerr << "initializing dwarf" << endl; - flag_oris=false; flag_orit=false; flag_doms=false; flag_domt=false; flag_tfw_count=false; - flag_bdoms=false; flag_porislr=false, flag_porisrl=false, flag_goris=false; flag_pgorislr=false, flag_pgorisrl=false; - flag_pdomslr=false; flag_pdomsrl=false; flag_pgdomslr=false; flag_pgdomsrl=false; flag_gdoms=false; - flag_oris_backward=false; flag_orit_backward=false; - explicit_soseos=false; - SetStateSize(STATE_SIZE*sizeof(int)); - als = new Alignment(); - als->clearAls(Alignment::MAX_WORDS,Alignment::MAX_WORDS); - istringstream iss(param); string w; - while(iss >> w) { - int equal = w.find_first_of("="); - if (equal!=string::npos) { - string model = w.substr(0,equal); - vector params; - Tokenize(w.substr(equal+1),',',¶ms); - string fn = params[0]; - if (model == "minfreq") { - cerr << "model minfreq " << fn << endl; - als->setFreqCutoff(atoi(fn.c_str())); - } else if (model == "oris") { - flag_oris = readOrientation(&toris,fn,&sfw); - if (flag_oris) { - oris_ = FD::Convert("OrientationSource"); - //oris_bo1_ = FD::Convert("OrientationSource_BO1"); - //oris_bo2_ = FD::Convert("OrientationSource_BO2"); - } - if (params.size()>1) als->setAlphaOris(atof(params[1].c_str())); - if (params.size()>2) als->setBetaOris(atof(params[2].c_str())); - } else if (model == "porislr") { - flag_porislr = readOrientation(&tporislr,fn,&sfw,true); - poris_nlr = 0; - if (flag_porislr) { - porislr_ = FD::Convert("OrientationSourcePositionfulLeftRight"); - } - if (params.size()>1) poris_nlr = atoi(params[1].c_str()); - if (DEBUG) cerr << " maximum poris depth=" << poris_nlr << endl; - } else if (model == "porisrl") { - flag_porisrl = readOrientation(&tporisrl,fn,&sfw,true); - poris_nrl = 0; - if (flag_porisrl) { - porisrl_ = FD::Convert("OrientationSourcePositionfulRightLeft"); - } - if (params.size()>1) poris_nrl = atoi(params[1].c_str()); - if (DEBUG) cerr << " maximum poris depth=" << poris_nrl << endl; - } else if (model=="goris") { - flag_goris = readOrientation(&tgoris,fn,&sfw); - if (flag_goris) { - goris_ = FD::Convert("OrientationSourceGeneralized"); - } - if (params.size()>1) { - readTags(params[1],&tags); - generalizeOrientation(&tgoris,tags); - } - } else if (model=="pgorislr") { - flag_pgorislr = readOrientation(&tpgorislr,fn,&sfw,true); - pgoris_nlr = 0; - if (flag_pgorislr) { - pgorislr_ = FD::Convert("OrientationSourceGeneralizedPositionfulLeftRight"); - } - if (DEBUG) { - cerr << "BEFORE GENERALIZATION" << endl; - tpgorislr.print(); - } - if (params.size()>1) pgoris_nlr = atoi(params[1].c_str()); - if (params.size()>2) { - readTags(params[2],&tags); - generalizeOrientation(&tpgorislr,tags,true); - } - if (DEBUG) { - cerr << "AFTER GENERALIZATION" << endl; - tpgorislr.print(); - } - } else if (model=="pgorisrl") { - flag_pgorisrl = readOrientation(&tpgorisrl,fn,&sfw,true); - pgoris_nrl = 0; - if (flag_pgorisrl) { - pgorisrl_ = FD::Convert("OrientationSourceGeneralizedPositionfulLeftRight"); - } - if (params.size()>1) pgoris_nrl = atoi(params[1].c_str()); - if (params.size()>2) { - readTags(params[2],&tags); - generalizeOrientation(&tpgorisrl,tags,true); - } - } else if (model == "oris_backward") { - flag_oris_backward = true; - if (!flag_oris) readOrientation(&toris,fn,&sfw); - oris_backward_ = FD::Convert("OrientationSourceBackward"); - if (params.size()>1) als->setAlphaOris(atof(params[1].c_str())); - if (params.size()>2) als->setBetaOris(atof(params[2].c_str())); - } else if (model == "orit") { - flag_orit = readOrientation(&torit,fn,&tfw); - if (flag_orit) { - orit_ = FD::Convert("OrientationTarget"); - //orit_bo1_ = FD::Convert("OrientationTarget_BO1"); - //orit_bo2_ = FD::Convert("OrientationTarget_BO2"); - } - if (params.size()>1) als->setAlphaOrit(atof(params[1].c_str())); - if (params.size()>2) als->setBetaOrit(atof(params[2].c_str())); - } else if (model == "orit_backward") { - flag_orit_backward = true; - if (!flag_orit) readOrientation(&torit,fn,&tfw); - orit_backward_ = FD::Convert("OrientationTargetBackward"); - if (params.size()>1) als->setAlphaOrit(atof(params[1].c_str())); - if (params.size()>2) als->setBetaOrit(atof(params[2].c_str())); - } else if (model == "doms") { - flag_doms = readDominance(&tdoms,fn,&sfw); - if (flag_doms) { - doms_ = FD::Convert("DominanceSource"); - //doms_bo1_ = FD::Convert("DominanceSource_BO1"); - //doms_bo2_ = FD::Convert("DominanceSource_BO2"); - } - if (params.size()>1) als->setAlphaDoms(atof(params[1].c_str())); - if (params.size()>2) als->setBetaDoms(atof(params[2].c_str())); - } else if (model == "pdomsrl") { - flag_pdomsrl = readDominance(&tpdomsrl,fn,&sfw,true); - if (flag_pdomsrl) { - pdomsrl_ = FD::Convert("DominanceSourcePositionfulRightLeft"); - } - if (params.size()>1) pdoms_nrl = atoi(params[1].c_str()); - } else if (model == "pdomslr") { - flag_pdomslr = readDominance(&tpdomslr,fn,&sfw,true); - tpdomslr.print(); - if (flag_pdomslr) { - pdomslr_ = FD::Convert("DominanceSourcePositionfulLeftRight"); - } - if (params.size()>1) pdoms_nlr = atoi(params[1].c_str()); - } else if (model == "pgdomsrl") { - flag_pgdomsrl = readDominance(&tpgdomsrl,fn,&sfw,true); - if (flag_pgdomsrl) { - pgdomsrl_ = FD::Convert("DominanceSourceGeneralizedPositionfulRightLeft"); - } - if (params.size()>1) pgdoms_nrl = atoi(params[1].c_str()); - if (params.size()>2) { - readTags(params[2],&tags); - generalizeDominance(&tpgdomsrl,tags,true); - } - } else if (model == "pgdomslr") { - flag_pgdomslr = readDominance(&tpgdomslr,fn,&sfw,true); - if (flag_pgdomslr) { - pgdomslr_ = FD::Convert("DominanceSourceGeneralizedPositionfulLeftRight"); - } - if (params.size()>1) pgdoms_nlr = atoi(params[1].c_str()); - if (params.size()>2) { - readTags(params[2],&tags); - if (DEBUG) { - for (map::const_iterator it=tags.begin(); it!=tags.end(); it++) { - cerr << "tags = " << TD::Convert(it->first) << ", " << TD::Convert(it->second) << endl; - } - } - generalizeDominance(&tpgdomslr,tags,true); - } - if (DEBUG) tpgdomslr.print(); - } else if (model == "bdoms") { - flag_bdoms = readDominance(&tbdoms,fn,&sfw); - if (flag_bdoms) { - bdoms_ = FD::Convert("BorderDominanceSource"); - } - } else if (model == "domt") { - flag_domt = readDominance(&tdomt,fn,&tfw); - if (flag_domt) { - domt_ = FD::Convert("DominanceTarget"); - //domt_bo1_ = FD::Convert("DominanceTarget_BO1"); - //domt_bo2_ = FD::Convert("DominanceTarget_BO2"); - } - if (params.size()>1) als->setAlphaDomt(atof(params[1].c_str())); - if (params.size()>2) als->setBetaDomt(atof(params[2].c_str())); - } else if (model== "tfw_count") { - flag_tfw_count = readList(fn,&tfw); - tfw_count_ = FD::Convert("TargetFunctionWordsCount"); - } else { - cerr << "DWARF doesn't understand this model: " << model << endl; - } - } else { - if (w=="tfw_count") { - flag_tfw_count = true; - tfw_count_ = FD::Convert("TargetFunctionWordsCount"); - } else if (w=="oris_backward") { - flag_oris_backward = true; - oris_backward_ = FD::Convert("OrientationSourceBackward"); - } else if (w=="orit_backward") { - flag_orit_backward = true; - orit_backward_ = FD::Convert("OrientationTargetBackward"); - } else if (w=="explicit_soseos") { - explicit_soseos=true; - } else { - cerr << "DWARF doesn't need this param: " << param << endl; - } - } - } - for (map::const_iterator it=sfw.begin(); it!=sfw.end() && DEBUG; it++) { - cerr << " FW:" << TD::Convert(it->first) << endl; - } -} - -void Dwarf::TraversalFeaturesImpl(const SentenceMetadata& smeta, - const Hypergraph::Edge& edge, - const std::vector& ant_contexts, - SparseVector* features, - SparseVector* estimated_features, - void* context) const { - if (DEBUG) cerr << "TraversalFeaturesImpl" << endl; - double cost, bonus, bo1, bo2, bo1_bonus, bo2_bonus; - double bdoms_state_mono= 0; double bdoms_state_nonmono = 0; - TRule r = *edge.rule_; - if (DEBUG) cerr << " sent_id=" << *_sent_id << ", " << smeta.GetSentenceID() << endl; - if (DEBUG) cerr << "rule = " << r.AsString() << endl; - if (DEBUG) cerr << "rule[i,j] = " << edge.i_ << "," << edge.j_ << endl; - if (*_sent_id != smeta.GetSentenceID()) { //new sentence - *_sent_id = smeta.GetSentenceID(); - const Lattice l = smeta.GetSourceLattice(); - *_fwcount=0; - for (int i=0; icomputeDominanceSource(tdoms,_lfw,_rfw,&cost,&bonus, - &bo1,&bo1_bonus,&bo2,&bo2_bonus); - if (DEBUG) cerr << " COST=" << cost << ", BONUS=" << bonus << endl; - if (isFinal&&!explicit_soseos) { - cost += bonus; - if (DEBUG) cerr << " final and !explicit_soseos, thus cost = " << cost << endl; - bonus = 0; - } - features->set_value(doms_,cost); - estimated_features->set_value(doms_,bonus); - } - if (flag_pdomslr) { - if (DEBUG) cerr << " flag_pdomslr true, nofw=" << nofw << endl; - if (DEBUG) cerr << " lfw=" << _lfw << ", rfw=" << _rfw << endl; - if (DEBUG) cerr << " kSOS=" << kSOS << ", kEOS=" << kEOS << endl; - cost=0; bonus=0; bo1=0; bo2=0; bo1_bonus=0; bo2_bonus=0; - if (!nofw) als->computeDominanceSourcePos(tpdomslr,_lfw,_rfw,&cost,&bonus, - &bo1,&bo1_bonus,&bo2,&bo2_bonus,*_fwcount,pdoms_nlr,0); - if (isFinal&&!explicit_soseos) { - cost += bonus; - bonus = 0; - } - features->set_value(pdomslr_,cost); - estimated_features->set_value(pdomslr_,bonus); - } - if (flag_pdomsrl) { - cost=0; bonus=0; bo1=0; bo2=0; bo1_bonus=0; bo2_bonus=0; - if (!nofw) als->computeDominanceSourcePos(tpdomsrl,_lfw,_rfw,&cost,&bonus, - &bo1,&bo1_bonus,&bo2,&bo2_bonus,*_fwcount,0,pdoms_nrl); - if (isFinal&&!explicit_soseos) { - cost += bonus; - bonus = 0; - } - features->set_value(pdomsrl_,cost); - estimated_features->set_value(pdomsrl_,bonus); - } - if (flag_pgdomslr) { - cost=0; bonus=0; bo1=0; bo2=0; bo1_bonus=0; bo2_bonus=0; - if (!nofw) als->computeDominanceSourcePos(tpgdomslr,_lfw,_rfw,&cost,&bonus, - &bo1,&bo1_bonus,&bo2,&bo2_bonus,*_fwcount,pgdoms_nlr,0); - if (isFinal&&!explicit_soseos) { - cost += bonus; - bonus = 0; - } - features->set_value(pgdomslr_,cost); - estimated_features->set_value(pgdomslr_,bonus); - } - if (flag_pgdomsrl) { cost=0; bonus=0; bo1=0; bo2=0; bo1_bonus=0; bo2_bonus=0; - if (!nofw) als->computeDominanceSourcePos(tpgdomsrl,_lfw,_rfw,&cost,&bonus, - &bo1,&bo1_bonus,&bo2,&bo2_bonus,*_fwcount,0,pgdoms_nrl); - if (isFinal&&!explicit_soseos) { - cost += bonus; - bonus = 0; - } - features->set_value(pgdomsrl_,cost); - estimated_features->set_value(pgdomsrl_,bonus); - } - - - if (flag_bdoms) { - cost=0; bonus=0; bdoms_state_mono=0; bdoms_state_nonmono=0; - if (!nofw) - als->computeBorderDominanceSource(tbdoms,&cost,&bonus, - &bdoms_state_mono, &bdoms_state_nonmono,*edge.rule_, ant_contexts, sfw); - features->set_value(bdoms_,cost); - estimated_features->set_value(bdoms_,bonus); - } - if (flag_orit) { - cost=0; bonus=0; bo1=0; bo2=0; bo1_bonus=0; bo2_bonus=0; - if (!nofw) als->computeOrientationTarget(torit,&cost,&bonus,&bo1,&bo1_bonus,&bo2,&bo2_bonus); - if (DEBUG) cerr << "cost=" << cost << ", bonus=" << bonus << ", bo1=" << bo1 << ", bo1_bonus=" << bo1_bonus << ", bo2=" << bo2 << ", bo2_bonus=" << bo2_bonus << endl; - features->set_value(orit_,cost); - //features->set_value(orit_bo1_,bo1); - //features->set_value(orit_bo2_,bo2); - estimated_features->set_value(orit_,bonus); - //estimated_features->set_value(orit_bo1_,bo1_bonus); - //estimated_features->set_value(orit_bo2_,bo2_bonus); - } - if (flag_orit_backward) { - cost=0; bonus=0; - if (!nofw) als->computeOrientationTargetBackward(torit,&cost,&bonus,&bo1,&bo1_bonus,&bo2,&bo2_bonus); - features->set_value(orit_backward_,cost); - estimated_features->set_value(orit_backward_,bonus); - } - if (flag_domt) { - cost=0; bonus=0; bo1=0; bo2=0; bo1_bonus=0; bo2_bonus=0; - WordID _lfw=-1; int start = edge.i_; - WordID _rfw=-1; int end = edge.j_; - if (smeta.HasReference()) { - const Lattice l = smeta.GetReference(); - for (int idx=start-1; idx>=0; idx--) { - if (l.size()>0) - if (tfw.find(l[idx][0].label) !=tfw.end()) { - _lfw=l[idx][0].label; break; - } - } - for (int idx=end; idx0) - if (tfw.find(l[idx][0].label)!=tfw.end()) { - _rfw=l[idx][0].label; break; - } - } - } - //neighboringFWs(smeta.GetReference(),edge.i_,edge.j_,tfw,&_lfw,&_rfw); - if (!nofw) als->computeDominanceTarget(tdomt,_lfw,_rfw,&cost,&bonus, - &bo1,&bo1_bonus,&bo2,&bo2_bonus); - features->set_value(domt_,cost); - //features->set_value(domt_bo1_,bo1); - //features->set_value(domt_bo2_,bo2); - estimated_features->set_value(domt_,bonus); - //estimated_features->set_value(domt_bo1_,bo1_bonus); - //estimated_features->set_value(domt_bo2_,bo2_bonus); - } - int* vcontext = reinterpret_cast(context); - if (!nofw) { - als->BorderingSFWsOnly(); - als->BorderingTFWsOnly(); - als->simplify(vcontext); - } else { - als->simplify_nofw(vcontext); - } - vcontext[50] = DoubleToInteger(bdoms_state_mono); - vcontext[51] = DoubleToInteger(bdoms_state_nonmono); - vcontext[STATE_SIZE-1] = Alignment::link(edge.i_,edge.j_); - if (DEBUG) { - cerr << "state@traverse = "; - for (int idx=0; idxsetup(24,pos); - table->ultimate = new int[24]; - for (int i=0; i<24; i++) table->ultimate[i]=0; - ostringstream oss; - while (in) { - string line; - getline(in,line); - if (line=="") break; - istringstream tokenizer(line); - string sourceidx, source, target, word; - tokenizer >> source >> target; - if (pos) { - sourceidx = source; - source = sourceidx.substr(0,sourceidx.find_last_of("/")); - } - if (fw->find(TD::Convert(source))==fw->end()) fw->insert(pair(TD::Convert(source),1)); - - - int* element = new int[24]; - element[5] = 0; - for (int i=0; i<5; i++) { - element[i] = 0; - if (tokenizer >> word) element[i] = atoi(word.c_str()); - element[5] += element[i]; - } - element[11] = 0; - for (int i=6; i<11; i++) { - element[i] = 0; - if (tokenizer >> word) element[i] = atoi(word.c_str()); - element[11] += element[i]; - } - element[17] = 0; - for (int i=12; i<17; i++) { - element[i] = 0; - if (tokenizer >> word) element[i] = atoi(word.c_str()); - element[17] += element[i]; - } - element[23] = 0; - for (int i=18; i<23; i++) { - element[i] = 0; - if (tokenizer >> word) element[i] = atoi(word.c_str()); - element[23] += element[i]; - } - for (int i=0; i<24; i++) table->ultimate[i] += element[i]; - oss << source << " " << target; - WordID key_id = TD::Convert(oss.str()); - oss.str(""); - if (table->model.find(key_id)!=table->model.end()) { - for (int i=0; i<24; i++) table->model[key_id][i]+=element[i]; - } else { - int* el2 = new int[24]; - for (int i=0; i<24; i++) el2[i] = element[i]; - table->model.insert(pair(key_id,el2)); - } - - oss << source; - key_id = TD::Convert(oss.str()); - oss.str(""); - if (table->model.find(key_id)!=table->model.end()) { - for (int i=0; i<24; i++) table->model[key_id][i]+=element[i]; - } else { - int* el2 = new int[24]; - for (int i=0; i<24; i++) el2[i] = element[i]; - table->model.insert(pair(key_id,el2)); - } - - if (pos) { - oss << sourceidx << " " << target; - key_id = TD::Convert(oss.str()); - oss.str(""); - if (table->model.find(key_id)!=table->model.end()) { - for (int i=0; i<24; i++) table->model[key_id][i]+=element[i]; - } else { - int* el2 = new int[24]; - for (int i=0; i<24; i++) el2[i] = element[i]; - table->model.insert(pair(key_id,el2)); - } - } - delete[] element; - } - return true; -} - -bool Dwarf::readList(const std::string& filename, std::map* fw) { - ReadFile rf(filename); - istream& in = *rf.stream(); - while (in) { - string word; - getline(in,word); - if (fw->find(TD::Convert(word))==fw->end()) fw->insert(pair(TD::Convert(word),1)); - } - return true; -} - -bool Dwarf::readDominance(CountTable* table, const std::string& filename, std::map* fw, bool pos) { - // the input format is - // source1 source2 target1 target2 0 1 2 3 - // 0 -> dontcase 1->leftfirst 2->rightfirst 3->neither - if (DEBUG) cerr << "readDominance(" << filename << ",pos="<< pos << ")" << endl; - ReadFile rf(filename); - istream& in = *rf.stream(); - table->ultimate = new int[5]; - table->setup(5,pos); - for (int i=0; i<5; i++) table->ultimate[i]=0; - while (in) { - string line, word; - getline(in,line); - if (line=="") break; - string source1idx, source2idx, target1, target2, source1, source2; - ostringstream oss; - WordID key_id; - istringstream tokenizer(line); - tokenizer >> source1 >> source2 >> target1 >> target2; - if (pos) { - source1idx = source1; - source2idx = source2; - source1 = source1idx.substr(0,source1idx.find_last_of("/")); - source2 = source2idx.substr(0,source2idx.find_last_of("/")); - } - if (fw->find(TD::Convert(source1))==fw->end()) fw->insert(pair(TD::Convert(source1),1)); - if (fw->find(TD::Convert(source2))==fw->end()) fw->insert(pair(TD::Convert(source2),1)); - - int* element = new int[5]; - element[4]=0; - for (int i=0; i<4; i++) { - element[i] = 0; - if (tokenizer >> word) element[i] = atoi(word.c_str()); - element[4]+=element[i]; - } - for (int i=0; i<5; i++) table->ultimate[i] += element[i]; - - oss << source1 << " " << source2 << " " << target1 << " " << target2; - key_id = TD::Convert(oss.str()); - oss.str(""); - if (table->model.find(key_id)!=table->model.end()) { - for (int i=0; i<5; i++) table->model[key_id][i]+=element[i]; - } else { - int* el2 = new int[5]; - for (int i=0; i<5; i++) el2[i]=element[i]; - table->model.insert(pair(key_id,el2)); - } - - oss << source1 << " " << source2; - key_id = TD::Convert(oss.str()); - oss.str(""); - if (table->model.find(key_id)!=table->model.end()) { - for (int i=0; i<5; i++) table->model[key_id][i]+=element[i]; - } else { - int* el2 = new int[5]; - for (int i=0; i<5; i++) el2[i]=element[i]; - table->model.insert(pair(key_id,el2)); - } - - if (pos) { - oss << source1idx << " " << source2idx << " " << target1 << " " << target2; - key_id = TD::Convert(oss.str()); - oss.str(""); - if (table->model.find(key_id)!=table->model.end()) { - for (int i=0; i<5; i++) table->model[key_id][i]+=element[i]; - } else { - int* el2 = new int[5]; - for (int i=0; i<5; i++) el2[i]=element[i]; - table->model.insert(pair(key_id,el2)); - } - } - delete element; - } - - return true; -} - -bool Dwarf::readTags(const std::string& filename, std::map* tags) { - ReadFile rf(filename); - istream& in = *rf.stream(); - while(in) { - string line, word, tag; - getline(in,line); - if (line=="") break; - istringstream tokenizer(line); - tokenizer >> tag >> word; - tags->insert(pair(TD::Convert(word),TD::Convert(tag))); - } - return true; -} - -bool Dwarf::generalizeOrientation(CountTable* table, const std::map& tags, bool pos) { - map generalized; - for (map::iterator it=table->model.begin(); it!=table->model.end(); it++) { - string source, target; - istringstream tokenizer(TD::Convert(it->first)); - tokenizer >> source >> target; - string idx = ""; - if (pos) { - int found = source.find_last_of("/"); - if (found!=string::npos && found>0) { - idx = source.substr(found+1); - source = source.substr(0,found); - } - } - map::const_iterator tags_iter = tags.find(TD::Convert(source)); - if (tags_iter!=tags.end()) { - ostringstream genkey; - genkey << TD::Convert(tags_iter->second); - if (idx!="") genkey << "/" << idx; - if (target!="") genkey << " " << target; - int* model; - if (generalized.find(genkey.str())!=generalized.end()) { - model = generalized[genkey.str()]; - for (int i=0; i<24; i++) model[i] += it->second[i]; - } else { - int* el = new int[24]; - for (int i=0; i<24; i++) el[i] = it->second[i]; - generalized.insert(pair(genkey.str(),el)); - } - } - } - for (map::iterator it=table->model.begin(); it!=table->model.end(); it++) { - string source, target; - istringstream tokenizer(TD::Convert(it->first)); - tokenizer >> source >> target; - string idx = ""; - if (pos) { - int found = source.find_last_of("/"); - if (found!=string::npos && found>0) { - idx = source.substr(found+1); - source = source.substr(0,found); - } - } - map::const_iterator tags_iter = tags.find(TD::Convert(source)); - if (tags_iter!=tags.end()) { - ostringstream genkey; - genkey << TD::Convert(tags_iter->second); - if (idx!="") genkey << "/" << idx; - if (target!="") genkey << " " << target; - if (generalized.find(genkey.str())!=generalized.end()) { - delete it->second; - it->second = generalized[genkey.str()]; - } - } - } - return false; // no idea if this is right -} - - - -bool Dwarf::generalizeDominance(CountTable* table, const std::map& tags, bool pos) { - map generalized; - ostringstream oss; - for (map::iterator it=table->model.begin(); it!=table->model.end(); it++) { - string source1, source2, target1, target2; - string idx1 = ""; string idx2 = ""; - istringstream tokenizer(TD::Convert(it->first)); - tokenizer >> source1 >> source2 >> target1 >> target2; - if (DEBUG) cerr << "source1=|" << source1 << "|, source2=|" << source2 << "|, target1=|" << target1 << "|, target2=|" << target2 << "|" << endl; - if (pos) { - int found1 = source1.find_last_of("/"); - int found2 = source2.find_last_of("/"); - if (found1!=string::npos && found2!=string::npos && found1>0 && found2>0) { - idx1 = source1.substr(found1+1); - source1 = source1.substr(0,found1); - idx2 = source2.substr(found2+1); - source2 = source2.substr(0,found2); - } - } - if (DEBUG) - cerr << "[U]source1='" << source1 << "', idx1='"<< idx1 << "', source2='" << source2 << "', idx2='"<< idx2 << "', target1='" << target1 << "', target2='" << target2 << "'" << endl; - map::const_iterator tags_iter1 = tags.find(TD::Convert(source1)); - map::const_iterator tags_iter2 = tags.find(TD::Convert(source2)); - if (tags_iter1!=tags.end()) - source1 = TD::Convert(tags_iter1->second); - oss << source1; - if (idx1!="") oss << "/" << idx1; - if (tags_iter2!=tags.end()) - source2 = TD::Convert(tags_iter2->second); - oss << " " << source2; - if (idx2!="") oss << "/" << idx2; - if (target1!="" && target2!="") oss << " " << target1 << " " << target2; - - if (DEBUG) cerr << "generalized key = '" << oss.str() << "'" << endl; - if (generalized.find(oss.str())!=generalized.end()) { - int* model = generalized[oss.str()]; - for (int i=0; i<5; i++) model[i] += it->second[i]; - } else { - int* model = new int[5]; - for (int i=0; i<5; i++) model[i] = it->second[i]; - generalized.insert(pair(oss.str(),model)); - } - oss.str(""); - } - - if (DEBUG) { - for (map::const_iterator it=generalized.begin(); it!=generalized.end(); it++) { - cerr << "GENERALIZED = " << it->first << ", "; - for (int i=0; i<5; i++) cerr << it->second[i] << " "; - cerr << endl; - } - } - - for (map::iterator it=table->model.begin(); it!=table->model.end(); it++) { - string source1, source2, target1, target2; - string idx1 = ""; string idx2 = ""; - istringstream tokenizer(TD::Convert(it->first)); - tokenizer >> source1 >> source2 >> target1 >> target2; - if (pos) { - int found1 = source1.find_last_of("/"); - int found2 = source2.find_last_of("/"); - if (found1!=string::npos && found2!=string::npos && found1>0 && found2>0) { - idx1 = source1.substr(found1+1); - source1 = source1.substr(0,found1); - idx2 = source2.substr(found2+1); - source2 = source2.substr(0,found2); - } - } - map::const_iterator tags_iter1 = tags.find(TD::Convert(source1)); - map::const_iterator tags_iter2 = tags.find(TD::Convert(source2)); - if (tags_iter1!=tags.end()) - source1 = TD::Convert(tags_iter1->second); - oss << source1; - if (idx1!="") oss << "/" << idx1; - if (tags_iter2!=tags.end()) - source2 = TD::Convert(tags_iter2->second); - oss << " " << source2; - if (idx2!="") oss << "/" << idx2; - if (target1!="" && target2!="") oss << " " << target1 << " " << target2; - - if (generalized.find(oss.str())!=generalized.end()) { - if (DEBUG) cerr << " generalizing "<< TD::Convert(it->first) << " into " << oss.str() << endl; - if (DEBUG) { - cerr << " model from "; - for (int i=0; i<5; i++) cerr << it->second[i] << " "; - cerr << endl; - } - delete it->second; - it->second = generalized[oss.str()]; - if (DEBUG) { - cerr << " into "; - for (int i=0; i<5; i++) cerr << it->second[i] << " "; - cerr << endl; - } - } - oss.str(""); - } - -} diff --git a/decoder/ff_dwarf.h b/decoder/ff_dwarf.h deleted file mode 100644 index 3d6a7da6..00000000 --- a/decoder/ff_dwarf.h +++ /dev/null @@ -1,100 +0,0 @@ -#include -#include -#include -#include "ff.h" -#include "dwarf.h" -#include "lattice.h" - -using namespace std; - -class Dwarf : public FeatureFunction { - public: - Dwarf(const std::string& param); - /* State-related param - STATE_SIZE: the number of ints - MAXIMUM_ALIGNMENTS: the maximum number of alignments in the states, - each alignment point is encoded in one int - (the first two bytes for source, and the remaining one for target) - */ - static const int STATE_SIZE=53; - static const int IMPOSSIBLY_LARGE_POS = 9999999; - static const int MAXIMUM_ALIGNMENTS=37; - /* Read from file the Orientation(Source|Target model parameter. */ - static bool readOrientation(CountTable* table, const std::string& filename, std::map *fw, bool pos=false); - /* Read from file the Dominance(Source|Target) model parameter. */ - static bool readDominance(CountTable* table, const std::string& filename, std::map *fw, bool pos=false); - static bool readList(const std::string& filename, std::map* fw); - static double IntegerToDouble(int val); - static int DoubleToInteger(double val); - bool readTags(const std::string& filename, std::map* tags); - bool generalizeOrientation(CountTable* table, const std::map& tags, bool pos=false); - bool generalizeDominance(CountTable* table, const std::map& tags, bool pos=false); - static void stripIndex(const string& source, string* pkey, string* pidx) { - if (DEBUG) cerr << " stripIndex(" << source << ")" << endl; - int found = source.find_last_of("/"); - string idx = source.substr(found+1); - string key = source.substr(0,found); - if (DEBUG) cerr << " found=" << found << "," << key << "," << idx << endl; - pkey = &key; - pidx = &idx; - } - - - protected: - /* The high-level workflow is as follow: - 1. call *als->prepare*, which constructs the full alignment of the edge while taking into account the antecedents - also in this call, function words are identified. Most of the work in this call is to make sure the indexes - of the alignments (including the function words) are consistent with the newly created alignment - 2. call *als->computeOrientationSource*, *als->computeOrientationTarget*, - *als->computeDominanceSource*, or *als->computeDominanceTarget* - and pass the resulting score to either *features* or to *estimated_features* - 3. call *als->BorderingSFWsOnly()* and *als->BorderingTFWsOnly()*, which removes records of all function word - alignments except those at the borders. Note that fw alignments kept may be more than two on each side - for examples if there are a number of unaligned fw alignments before the leftmost alignment or the rightmost one - 4. call *als->simplify()*, which assigns the state of this edge (*context*). It simplifies the alignment space to - its most compact representation, enough to compute the unscored models. This is done by observing the surviving - function word alignments set by 3. - */ - void TraversalFeaturesImpl(const SentenceMetadata& smeta, - const HG::Edge& edge, - const std::vector& ant_contexts, - SparseVector* features, - SparseVector* estimated_features, - void* context) const; - private: - Alignment* als; - /* Feature IDs set by calling FD::Convert(model's string) */ - int oris_, oris_bo1_, oris_bo2_, orit_, orit_bo1_, orit_bo2_; - int oris_backward_, orit_backward_, porislr_, porisrl_, goris_, pgorislr_, pgorisrl_; - int pdomslr_, pdomsrl_, pgdomslr_, pgdomsrl_; - int doms_, doms_bo1_, doms_bo2_, domt_, domt_bo1_, domt_bo2_; - int tfw_count_; - int bdoms_; - int poris_count; - int pgoris_count; - int poris_nlr, poris_nrl; // maximum depth (1->from the beginning of the sentence, 2-> from the end of the sentence) - int pgoris_nlr, pgoris_nrl; - int pdoms_nlr, pdoms_nrl; - int pgdoms_nlr, pgdoms_nrl; - int* _sent_id; - int* _fwcount; - WordID kSOS; - WordID kEOS; - string sSOS; - string sEOS; - WordID kGOAL; - /* model's flag, if set true will invoke the model scoring */ - bool flag_oris, flag_orit, flag_doms, flag_domt, flag_tfw_count, flag_oris_backward, flag_orit_backward, flag_bdoms; - bool flag_porislr, flag_porisrl, flag_goris, flag_pgorislr, flag_pgorisrl; - bool explicit_soseos; - bool flag_pdomslr, flag_pdomsrl, flag_pgdomslr, flag_pgdomsrl, flag_gdoms; - /* a collection of Source function words (sfw) and Target function words (tfw) */ - std::map sfw; - std::map tfw; - std::map tags; - /* a collection of model's parameter */ - CountTable toris, torit, tdoms, tbdoms, tdomt, tporislr, tporisrl, tgoris, tpgorislr, tpgorisrl; - CountTable tpdomslr, tpdomsrl, tpgdomslr, tpgdomsrl; - void neighboringFWs(const Lattice& l, const int& i, const int& j, const map& fw_hash, int* lfw, int* rfw); -}; - diff --git a/decoder/ff_lm.cc b/decoder/ff_lm.cc index 6ec7b4f3..bc51076f 100644 --- a/decoder/ff_lm.cc +++ b/decoder/ff_lm.cc @@ -61,11 +61,6 @@ char const* usage_verbose="-n determines the name of the feature (and its weight #include "hg.h" #include "stringlib.h" -#ifdef HAVE_RANDLM -// http://randlm.sourceforge.net/ -#include "RandLM.h" -#endif - using namespace std; string LanguageModel::usage(bool param,bool verbose) { @@ -542,99 +537,3 @@ void LanguageModel::FinalTraversalFeatures(const void* ant_state, features->set_value(fid_, imp().FinalTraversalCost(ant_state)); } -#ifdef HAVE_RANDLM -struct RandLMImpl : public LanguageModelImpl { - RandLMImpl(int order, randlm::RandLM* rlm) : - LanguageModelImpl(order), - rlm_(rlm), - oov_(rlm->getWordID(rlm->getOOV())), - rb_(1000, oov_) { - map map_cdec2randlm; - int max_wordid = 0; - for(map::const_iterator it = rlm->vocabStart(); - it != rlm->vocabEnd(); ++it) { - const int cur = TD::Convert(it->first); - map_cdec2randlm[TD::Convert(it->first)] = it->second; - if (cur > max_wordid) max_wordid = cur; - } - cdec2randlm_.resize(max_wordid + 1, oov_); - for (map::iterator it = map_cdec2randlm.begin(); - it != map_cdec2randlm.end(); ++it) - cdec2randlm_[it->first] = it->second; - map_cdec2randlm.clear(); - } - - inline randlm::WordID Convert2RandLM(int w) { - return (w < cdec2randlm_.size() ? cdec2randlm_[w] : oov_); - } - - virtual double WordProb(int word, int* context) { - int i = order_; - int c = 1; - rb_[i] = Convert2RandLM(word); - while (i > 1 && *context > 0) { - --i; - rb_[i] = Convert2RandLM(*context); - ++context; - ++c; - } - const void* finalState = 0; - int found; - //cerr << "I = " << i << endl; - return rlm_->getProb(&rb_[i], c, &found, &finalState); - } - private: - boost::shared_ptr rlm_; - randlm::WordID oov_; - vector cdec2randlm_; - vector rb_; -}; - -LanguageModelRandLM::LanguageModelRandLM(const string& param) : - fid_(FD::Convert("RandLM")) { - vector argv; - int argc = SplitOnWhitespace(param, &argv); - int order = 3; - // TODO add support for -n FeatureName - string filename; - if (argc < 1) { cerr << "RandLM requires a filename, minimally!\n"; abort(); } - else if (argc == 1) { filename = argv[0]; } - else if (argc == 2 || argc > 3) { cerr << "Don't understand 'RandLM " << param << "'\n"; } - else if (argc == 3) { - if (argv[0] == "-o") { - order = atoi(argv[1].c_str()); - filename = argv[2]; - } else if (argv[1] == "-o") { - order = atoi(argv[2].c_str()); - filename = argv[0]; - } - } -// set_order(order); - int cache_MB = 200; // increase cache size - randlm::RandLM* rlm = randlm::RandLM::initRandLM(filename, order, cache_MB); - assert(rlm != NULL); - pimpl_ = new RandLMImpl(order, rlm); -} - -LanguageModelRandLM::~LanguageModelRandLM() { - delete pimpl_; -} - -void LanguageModelRandLM::TraversalFeaturesImpl(const SentenceMetadata& smeta, - const Hypergraph::Edge& edge, - const vector& ant_states, - SparseVector* features, - SparseVector* estimated_features, - void* state) const { - (void) smeta; - features->set_value(fid_, imp().LookupWords(*edge.rule_, ant_states, state)); - estimated_features->set_value(fid_, imp().EstimateProb(state)); -} - -void LanguageModelRandLM::FinalTraversalFeatures(const void* ant_state, - SparseVector* features) const { - features->set_value(fid_, imp().FinalTraversalCost(ant_state)); -} - -#endif - diff --git a/decoder/ff_lm.h b/decoder/ff_lm.h index 94e18f00..85e79704 100644 --- a/decoder/ff_lm.h +++ b/decoder/ff_lm.h @@ -69,26 +69,4 @@ class LanguageModel : public FeatureFunction { /* mutable */ LanguageModelInterface* pimpl_; }; -#ifdef HAVE_RANDLM -class LanguageModelRandLM : public FeatureFunction { - public: - // param = "filename.lm [-o n]" - LanguageModelRandLM(const std::string& param); - ~LanguageModelRandLM(); - virtual void FinalTraversalFeatures(const void* context, - SparseVector* features) const; - std::string DebugStateToString(const void* state) const; - protected: - virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta, - const HG::Edge& edge, - const std::vector& ant_contexts, - SparseVector* features, - SparseVector* estimated_features, - void* out_context) const; - private: - const int fid_; - mutable LanguageModelImpl* pimpl_; -}; -#endif - #endif diff --git a/decoder/ff_source_syntax.cc b/decoder/ff_source_syntax.cc index a1997695..95709076 100644 --- a/decoder/ff_source_syntax.cc +++ b/decoder/ff_source_syntax.cc @@ -2,6 +2,12 @@ #include #include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_set; } +#endif #include "hg.h" #include "sentence_metadata.h" diff --git a/decoder/ff_source_syntax2.cc b/decoder/ff_source_syntax2.cc index 08ece917..622c6908 100644 --- a/decoder/ff_source_syntax2.cc +++ b/decoder/ff_source_syntax2.cc @@ -3,7 +3,6 @@ #include #include #include -#include #include "sentence_metadata.h" #include "array2d.h" @@ -126,8 +125,7 @@ struct SourceSyntaxFeatures2Impl { Array2D src_tree; // src_tree(i,j) NT = type mutable Array2D > fids_ef; // fires for fully lexicalized - tr1::unordered_set feature_filter; - + unordered_set feature_filter; }; SourceSyntaxFeatures2::SourceSyntaxFeatures2(const string& param) : diff --git a/decoder/ff_source_syntax2_p.cc b/decoder/ff_source_syntax2_p.cc index dfa791ea..130144fa 100644 --- a/decoder/ff_source_syntax2_p.cc +++ b/decoder/ff_source_syntax2_p.cc @@ -3,7 +3,12 @@ #include #include #include -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_set; } +#endif #include "sentence_metadata.h" #include "array2d.h" @@ -133,8 +138,7 @@ struct PSourceSyntaxFeatures2Impl { Array2D src_tree; // src_tree(i,j) NT = type mutable Array2D > fids_ef; // fires for fully lexicalized - tr1::unordered_set feature_filter; - + unordered_set feature_filter; }; PSourceSyntaxFeatures2::PSourceSyntaxFeatures2(const string& param) : diff --git a/decoder/ff_source_syntax_p.cc b/decoder/ff_source_syntax_p.cc index cd081544..1d3dc497 100644 --- a/decoder/ff_source_syntax_p.cc +++ b/decoder/ff_source_syntax_p.cc @@ -2,7 +2,12 @@ #include #include -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; using std::tr1::unordered_set; } +#endif #include "sentence_metadata.h" #include "array2d.h" @@ -139,7 +144,7 @@ struct PSourceSyntaxFeaturesImpl { Array2D src_tree; // src_tree(i,j) NT = type // mutable Array2D fids_cat; // this tends to overfit baddly mutable Array2D > fids_ef; // fires for fully lexicalized - tr1::unordered_set feature_filter; + unordered_set feature_filter; }; PSourceSyntaxFeatures::PSourceSyntaxFeatures(const string& param) : diff --git a/decoder/ff_wordalign.cc b/decoder/ff_wordalign.cc index 1491819d..8ed053c2 100644 --- a/decoder/ff_wordalign.cc +++ b/decoder/ff_wordalign.cc @@ -7,7 +7,12 @@ #include #include #include -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; } +#endif #include #include "boost/tuple/tuple_comparison.hpp" @@ -249,7 +254,7 @@ void NewJump::FireFeature(const SentenceMetadata& smeta, if (fp1_) get<6>(key) = GetSourceWord(id, cur_src_index + 1); if (fprev_) get<7>(key) = GetSourceWord(id, prev_src_index); - static std::tr1::unordered_map fids; + static std::unordered_map fids; int& fid = fids[key]; if (!fid) { ostringstream os; diff --git a/decoder/ff_wordalign.h b/decoder/ff_wordalign.h index ba3d0b9b..50f0dafa 100644 --- a/decoder/ff_wordalign.h +++ b/decoder/ff_wordalign.h @@ -5,8 +5,16 @@ #include "array2d.h" #include "factored_lexicon_helper.h" +#include +#include #include #include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; } +#endif class RelativeSentencePosition : public FeatureFunction { public: @@ -124,9 +132,6 @@ class LexicalTranslationTrigger : public FeatureFunction { std::vector > triggers_; }; -#include -#include -#include class BlunsomSynchronousParseHack : public FeatureFunction { public: BlunsomSynchronousParseHack(const std::string& param); @@ -196,7 +201,7 @@ class BlunsomSynchronousParseHack : public FeatureFunction { const int fid_; mutable int cur_sent_; - typedef std::tr1::unordered_map, int, boost::hash > > Vec2Int; + typedef std::unordered_map, int, boost::hash > > Vec2Int; mutable Vec2Int cur_map_; const std::vector mutable * cur_ref_; mutable std::vector > refs_; diff --git a/decoder/ff_wordset.cc b/decoder/ff_wordset.cc index 70cea7de..9be6f2e0 100644 --- a/decoder/ff_wordset.cc +++ b/decoder/ff_wordset.cc @@ -2,21 +2,67 @@ #include "hg.h" #include "fdict.h" +#include "filelib.h" +#include #include #include using namespace std; +void WordSet::parseArgs(const string& args, string* featName, string* vocabFile, bool* oovMode) { + vector toks(10); + boost::split(toks, args, boost::is_any_of(" ")); + + *oovMode = false; + + // skip initial feature name + for(vector::const_iterator it = toks.begin(); it != toks.end(); ++it) { + if(*it == "-v") { + *vocabFile = *++it; // copy + + } else if(*it == "-N") { + *featName = *++it; + } else if(*it == "--oov") { + *oovMode = true; + } else { + cerr << "Unrecognized argument: " << *it << endl; + exit(1); + } + } + + if(*featName == "") { + cerr << "featName (-N) not specified for WordSet" << endl; + exit(1); + } + if(*vocabFile == "") { + cerr << "vocabFile (-v) not specified for WordSet" << endl; + exit(1); + } +} + +void WordSet::loadVocab(const string& vocabFile, unordered_set* vocab) { + ReadFile rf(vocabFile); + if (!rf) { + cerr << "Unable to open file: " << vocabFile; + abort(); + } + string line; + while (getline(*rf.stream(), line)) { + boost::trim(line); + if(line.empty()) continue; + WordID vocabId = TD::Convert(line); + vocab->insert(vocabId); + } +} + void WordSet::TraversalFeaturesImpl(const SentenceMetadata& /*smeta*/ , const Hypergraph::Edge& edge, const vector& /* ant_contexts */, SparseVector* features, SparseVector* /* estimated_features */, void* /* context */) const { - double addScore = 0.0; - for(std::vector::const_iterator it = edge.rule_->e_.begin(); it != edge.rule_->e_.end(); ++it) { - + for(vector::const_iterator it = edge.rule_->e_.begin(); it != edge.rule_->e_.end(); ++it) { bool inVocab = (vocab_.find(*it) != vocab_.end()); if(oovMode_ && !inVocab) { addScore += 1.0; diff --git a/decoder/ff_wordset.h b/decoder/ff_wordset.h index 639e1514..affee2f4 100644 --- a/decoder/ff_wordset.h +++ b/decoder/ff_wordset.h @@ -4,14 +4,18 @@ #include "ff.h" #include "tdict.h" -#include -#include - #include #include #include #include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_set; } +#endif + class WordSet : public FeatureFunction { public: // we depend on the order of the initializer list @@ -42,69 +46,12 @@ class WordSet : public FeatureFunction { void* context) const; private: - static void loadVocab(const std::string& vocabFile, std::tr1::unordered_set* vocab) { - - std::ifstream file; - std::string line; - - file.open(vocabFile.c_str(), std::fstream::in); - if (file.is_open()) { - unsigned lineNum = 0; - while (!file.eof()) { - ++lineNum; - getline(file, line); - boost::trim(line); - if(line.empty()) { - continue; - } - - WordID vocabId = TD::Convert(line); - vocab->insert(vocabId); - } - file.close(); - } else { - std::cerr << "Unable to open file: " << vocabFile; - exit(1); - } - } - - static void parseArgs(const std::string& args, std::string* featName, std::string* vocabFile, bool* oovMode) { - - std::vector toks(10); - boost::split(toks, args, boost::is_any_of(" ")); - - *oovMode = false; - - // skip initial feature name - for(std::vector::const_iterator it = toks.begin(); it != toks.end(); ++it) { - if(*it == "-v") { - *vocabFile = *++it; // copy - - } else if(*it == "-N") { - *featName = *++it; - - } else if(*it == "--oov") { - *oovMode = true; - - } else { - std::cerr << "Unrecognized argument: " << *it << std::endl; - exit(1); - } - } - - if(*featName == "") { - std::cerr << "featName (-N) not specified for WordSet" << std::endl; - exit(1); - } - if(*vocabFile == "") { - std::cerr << "vocabFile (-v) not specified for WordSet" << std::endl; - exit(1); - } - } + static void parseArgs(const std::string& args, std::string* featName, std::string* vocabFile, bool* oovMode); + static void loadVocab(const std::string& vocabFile, std::unordered_set* vocab); int fid_; bool oovMode_; - std::tr1::unordered_set vocab_; + std::unordered_set vocab_; }; #endif diff --git a/decoder/grammar.cc b/decoder/grammar.cc index ee43f537..f2530d35 100644 --- a/decoder/grammar.cc +++ b/decoder/grammar.cc @@ -3,15 +3,20 @@ #include #include #include -#include -#include +#ifdef HAVE_CXX11 +# include +# include +#else +# include +# include +namespace std { using std::tr1::unordered_map; using std::tr1::unordered_set; } +#endif #include "rule_lexer.h" #include "filelib.h" #include "tdict.h" using namespace std; -using namespace std::tr1; const vector Grammar::NO_RULES; diff --git a/decoder/hg_intersect.cc b/decoder/hg_intersect.cc index ad5b701a..c5f1cc91 100644 --- a/decoder/hg_intersect.cc +++ b/decoder/hg_intersect.cc @@ -1,7 +1,12 @@ #include "hg_intersect.h" #include -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; } +#endif #include "fast_lexical_cast.hpp" #include @@ -13,7 +18,6 @@ #include "bottom_up_parser.h" using boost::lexical_cast; -using namespace std::tr1; using namespace std; struct RuleFilter { diff --git a/decoder/kbest.h b/decoder/kbest.h index 44c23151..cd386aef 100644 --- a/decoder/kbest.h +++ b/decoder/kbest.h @@ -3,7 +3,12 @@ #include #include -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_set; } +#endif #include #include @@ -22,7 +27,7 @@ namespace KBest { // optional, filter unique yield strings struct FilterUnique { - std::tr1::unordered_set, boost::hash > > unique; + std::unordered_set, boost::hash > > unique; bool operator()(const std::vector& yield) { return !unique.insert(yield).second; @@ -111,7 +116,7 @@ namespace KBest { }; typedef std::vector CandidateHeap; typedef std::vector DerivationList; - typedef std::tr1::unordered_set< + typedef std::unordered_set< const Derivation*, DerivationUniquenessHash, DerivationUniquenessEquals> UniqueDerivationSet; struct NodeDerivationState { diff --git a/decoder/maxtrans_blunsom.cc b/decoder/maxtrans_blunsom.cc index 774e4170..8d1d471c 100644 --- a/decoder/maxtrans_blunsom.cc +++ b/decoder/maxtrans_blunsom.cc @@ -2,8 +2,14 @@ #include #include -#include -#include +#ifdef HAVE_CXX11 +# include +# include +#else +# include +# include +namespace std { using std::tr1::unordered_map; using std::tr1::unordered_set; } +#endif #include #include @@ -14,7 +20,6 @@ using boost::tuple; using namespace std; -using namespace std::tr1; namespace Hack { diff --git a/decoder/phrasebased_translator.cc b/decoder/phrasebased_translator.cc index d65e44d1..321fb286 100644 --- a/decoder/phrasebased_translator.cc +++ b/decoder/phrasebased_translator.cc @@ -2,8 +2,14 @@ #include #include -#include -#include +#ifdef HAVE_CXX11 +# include +# include +#else +# include +# include +namespace std { using std::tr1::unordered_map; using std::tr1::unordered_set; } +#endif #include #include @@ -17,7 +23,6 @@ #include "array2d.h" using namespace std; -using namespace std::tr1; using namespace boost::tuples; struct Coverage : public vector { diff --git a/decoder/scfg_translator.cc b/decoder/scfg_translator.cc index 6f0b003b..a506c591 100644 --- a/decoder/scfg_translator.cc +++ b/decoder/scfg_translator.cc @@ -1,13 +1,9 @@ -//TODO: bottom-up pruning, with actual final models' (appropriately weighted) heuristics and local scores. - -//TODO: grammar heuristic (min cost of reachable rule set) for binarizations (active edges) if we wish to prune those also - -#include "hash.h" -#include "translator.h" #include #include #include #include +#include "hash.h" +#include "translator.h" #include "hg.h" #include "grammar.h" #include "bottom_up_parser.h" @@ -16,13 +12,11 @@ #include "tdict.h" #include "viterbi.h" #include "verbose.h" -#include #define foreach BOOST_FOREACH #define reverse_foreach BOOST_REVERSE_FOREACH using namespace std; -using namespace std::tr1; static bool printGrammarsUsed = false; struct GlueGrammar : public TextGrammar { diff --git a/decoder/sentence_metadata.h b/decoder/sentence_metadata.h index eab9f15d..52586331 100644 --- a/decoder/sentence_metadata.h +++ b/decoder/sentence_metadata.h @@ -5,7 +5,9 @@ #include #include #include "lattice.h" -#include "scorer.h" + +struct DocScorer; // deprecated, will be removed +struct Score; // deprecated, will be removed struct SentenceMetadata { friend class DecoderImpl; diff --git a/extractor/Makefile.am b/extractor/Makefile.am index e94a9b91..65a3d436 100644 --- a/extractor/Makefile.am +++ b/extractor/Makefile.am @@ -1,7 +1,8 @@ -if HAVE_CXX11 bin_PROGRAMS = compile run_extractor +if HAVE_CXX11 + EXTRA_PROGRAMS = alignment_test \ data_array_test \ fast_intersector_test \ @@ -113,7 +114,29 @@ libcompile_a_SOURCES = \ precomputation.cc \ suffix_array.cc \ time_util.cc \ - translation_table.cc + translation_table.cc \ + alignment.h \ + data_array.h \ + fast_intersector.h \ + grammar.h \ + grammar_extractor.h \ + matchings_finder.h \ + matchings_trie.h \ + phrase.h \ + phrase_builder.h \ + phrase_location.h \ + precomputation.h \ + rule.h \ + rule_extractor.h \ + rule_extractor_helper.h \ + rule_factory.h \ + sampler.h \ + scorer.h \ + suffix_array.h \ + target_phrase_extractor.h \ + time_util.h \ + translation_table.h \ + vocabulary.h libextractor_a_SOURCES = \ alignment.cc \ diff --git a/klm/lm/builder/Makefile.am b/klm/lm/builder/Makefile.am index 317e03ce..38259c51 100644 --- a/klm/lm/builder/Makefile.am +++ b/klm/lm/builder/Makefile.am @@ -1,6 +1,6 @@ -bin_PROGRAMS = builder +bin_PROGRAMS = lmplz -builder_SOURCES = \ +lmplz_SOURCES = \ lmplz_main.cc \ adjust_counts.cc \ adjust_counts.hh \ @@ -22,7 +22,7 @@ builder_SOURCES = \ print.hh \ sort.hh -builder_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/mteval/mbr_kbest.cc b/mteval/mbr_kbest.cc index 2519bc01..787c03bd 100644 --- a/mteval/mbr_kbest.cc +++ b/mteval/mbr_kbest.cc @@ -1,9 +1,14 @@ #include #include -#include #include #include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; } +#endif #include "prob.h" #include "tdict.h" @@ -12,7 +17,6 @@ #include "stringlib.h" using namespace std; -using namespace std::tr1; namespace po = boost::program_options; diff --git a/mteval/ns_ter.cc b/mteval/ns_ter.cc index 0e1008db..f0d84098 100644 --- a/mteval/ns_ter.cc +++ b/mteval/ns_ter.cc @@ -4,7 +4,12 @@ #include #include #include -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; } +#endif #include #include #include "tdict.h" @@ -20,7 +25,6 @@ static const unsigned kREF_WORDCOUNT = 4; static const unsigned kDUMMY_LAST_ENTRY = 5; using namespace std; -using namespace std::tr1; bool TERMetric::IsErrorMetric() const { return true; diff --git a/mteval/scorer.cc b/mteval/scorer.cc index de84e076..9eb9a76e 100644 --- a/mteval/scorer.cc +++ b/mteval/scorer.cc @@ -594,26 +594,29 @@ void DocScorer::Init( const ScoreType type, const vector& ref_files, const string& src_file, bool verbose) { + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" + "!!! This code is using the deprecated DocScorer interface, please fix !!!\n" + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; scorers_.clear(); - // TODO stop using valarray, start using ReadFile + static const WordID kDIV = TD::Convert("|||"); cerr << "Loading references (" << ref_files.size() << " files)\n"; ReadFile srcrf; if (type == AER && src_file.size() > 0) { cerr << " (source=" << src_file << ")\n"; srcrf.Init(src_file); } + std::vector tmp; std::vector ifs(ref_files.begin(),ref_files.end()); for (int i=0; i < ref_files.size(); ++i) ifs[i].Init(ref_files[i]); char buf[64000]; bool expect_eof = false; int line=0; while (ifs[0].get()) { - vector > refs(ref_files.size()); + vector > refs; for (int i=0; i < ref_files.size(); ++i) { istream &in=ifs[i].get(); if (in.eof()) break; in.getline(buf, 64000); - refs[i].clear(); if (strlen(buf) == 0) { if (in.eof()) { if (!expect_eof) { @@ -622,9 +625,17 @@ void DocScorer::Init( } break; } - } else { - TD::ConvertSentence(buf, &refs[i]); - assert(!refs[i].empty()); + } else { // process reference + tmp.clear(); + TD::ConvertSentence(buf, &tmp); + unsigned last = 0; + for (unsigned j = 0; j < tmp.size(); ++j) { + if (tmp[j] == kDIV) { + refs.push_back(vector(tmp.begin() + last, tmp.begin() + j)); + last = j + 1; + } + } + refs.push_back(vector(tmp.begin() + last, tmp.end())); } assert(!expect_eof); } diff --git a/mteval/ter.cc b/mteval/ter.cc index cacc5b00..9da54306 100644 --- a/mteval/ter.cc +++ b/mteval/ter.cc @@ -5,7 +5,12 @@ #include #include #include -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; } +#endif #include #include #include @@ -16,7 +21,6 @@ const bool ter_use_average_ref_len = true; const int ter_short_circuit_long_sentences = -1; using namespace std; -using namespace std::tr1; struct COSTS { static const float substitution; diff --git a/python/cdec/sa/strmap.cc b/python/cdec/sa/strmap.cc index 5040477e..d7c4f2a3 100644 --- a/python/cdec/sa/strmap.cc +++ b/python/cdec/sa/strmap.cc @@ -2,11 +2,16 @@ #include #include -#include -#include +#include + +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; } +#endif using namespace std; -using namespace std::tr1; #undef HAVE_64_BITS diff --git a/training/crf/mpi_online_optimize.cc b/training/crf/mpi_online_optimize.cc index 9e1ae34c..6b5b7d64 100644 --- a/training/crf/mpi_online_optimize.cc +++ b/training/crf/mpi_online_optimize.cc @@ -4,11 +4,11 @@ #include #include #include -#include #include #include #include +#include #include "stringlib.h" #include "verbose.h" @@ -219,7 +219,7 @@ int main(int argc, char** argv) { #endif if (size > 1) SetSilent(true); // turn off verbose decoder output register_feature_functions(); - std::tr1::shared_ptr rng; + boost::shared_ptr rng; po::variables_map conf; if (!InitCommandLine(argc, argv, &conf)) @@ -264,8 +264,8 @@ int main(int argc, char** argv) { ReadTrainingCorpus(conf["training_data"].as(), rank, size, &corpus, &ids); assert(corpus.size() > 0); - std::tr1::shared_ptr o; - std::tr1::shared_ptr lr; + boost::shared_ptr o; + boost::shared_ptr lr; const unsigned size_per_proc = conf["minibatch_size_per_proc"].as(); if (size_per_proc > corpus.size()) { diff --git a/training/mira/kbest_cut_mira.cc b/training/mira/kbest_cut_mira.cc index 59fa860a..3b1108e0 100644 --- a/training/mira/kbest_cut_mira.cc +++ b/training/mira/kbest_cut_mira.cc @@ -30,7 +30,6 @@ #include "sparse_vector.h" using namespace std; -using boost::shared_ptr; namespace po = boost::program_options; bool invert_score; @@ -149,7 +148,7 @@ struct HypothesisInfo { double alpha; double oracle_loss; SparseVector oracle_feat_diff; - shared_ptr oracleN; + boost::shared_ptr oracleN; }; bool ApproxEqual(double a, double b) { @@ -157,7 +156,7 @@ bool ApproxEqual(double a, double b) { return (fabs(a-b)/fabs(b)) < EPSILON; } -typedef shared_ptr HI; +typedef boost::shared_ptr HI; bool HypothesisCompareB(const HI& h1, const HI& h2 ) { return h1->mt_metric > h2->mt_metric; @@ -185,11 +184,11 @@ bool HypothesisCompareG(const HI& h1, const HI& h2 ) }; -void CuttingPlane(vector >* cur_c, bool* again, vector >& all_hyp, vector dense_weights) +void CuttingPlane(vector >* cur_c, bool* again, vector >& all_hyp, vector dense_weights) { bool DEBUG_CUT = false; - shared_ptr max_fear, max_fear_in_set; - vector >& cur_constraint = *cur_c; + boost::shared_ptr max_fear, max_fear_in_set; + vector >& cur_constraint = *cur_c; if(no_reweight) { @@ -235,9 +234,9 @@ void CuttingPlane(vector >* cur_c, bool* again, vecto } -double ComputeDelta(vector >* cur_p, double max_step_size,vector dense_weights ) +double ComputeDelta(vector >* cur_p, double max_step_size,vector dense_weights ) { - vector >& cur_pair = *cur_p; + vector >& cur_pair = *cur_p; double loss = cur_pair[0]->oracle_loss - cur_pair[1]->oracle_loss; double margin = -(cur_pair[0]->oracleN->features.dot(dense_weights)- cur_pair[0]->features.dot(dense_weights)) + (cur_pair[1]->oracleN->features.dot(dense_weights) - cur_pair[1]->features.dot(dense_weights)); @@ -261,12 +260,12 @@ double ComputeDelta(vector >* cur_p, double max_step_ } -vector > SelectPair(vector >* cur_c) +vector > SelectPair(vector >* cur_c) { bool DEBUG_SELECT= false; - vector >& cur_constraint = *cur_c; + vector >& cur_constraint = *cur_c; - vector > pair; + vector > pair; if (no_select || optimizer == 2){ //skip heuristic search and return oracle and fear for pa-mira @@ -278,7 +277,7 @@ vector > SelectPair(vector for(int u=0;u != cur_constraint.size();u++) { - shared_ptr max_fear; + boost::shared_ptr max_fear; if(DEBUG_SELECT) cerr<< "cur alpha " << u << " " << cur_constraint[u]->alpha; for(int i=0; i < cur_constraint.size();i++) //select maximal violator @@ -323,8 +322,8 @@ vector > SelectPair(vector } struct GoodBadOracle { - vector > good; - vector > bad; + vector > good; + vector > bad; }; struct BasicObserver: public DecoderObserver { @@ -367,8 +366,8 @@ struct TrainingObserver : public DecoderObserver { const DocScorer& ds; vector& corpus_bleu_sent_stats; vector& oracles; - vector > cur_best; - shared_ptr cur_oracle; + vector > cur_best; + boost::shared_ptr cur_oracle; const int kbest_size; Hypergraph forest; int cur_sent; @@ -386,7 +385,7 @@ struct TrainingObserver : public DecoderObserver { return *cur_best[0]; } - const vector > GetCurrentBest() const { + const vector > GetCurrentBest() const { return cur_best; } @@ -411,8 +410,8 @@ struct TrainingObserver : public DecoderObserver { } - shared_ptr MakeHypothesisInfo(const SparseVector& feats, const double score, const vector& hyp) { - shared_ptr h(new HypothesisInfo); + boost::shared_ptr MakeHypothesisInfo(const SparseVector& feats, const double score, const vector& hyp) { + boost::shared_ptr h(new HypothesisInfo); h->features = feats; h->mt_metric = score; h->hyp = hyp; @@ -424,14 +423,14 @@ struct TrainingObserver : public DecoderObserver { if (stream) sent_id = 0; bool PRINT_LIST= false; - vector >& cur_good = oracles[sent_id].good; - vector >& cur_bad = oracles[sent_id].bad; + vector >& cur_good = oracles[sent_id].good; + vector >& cur_bad = oracles[sent_id].bad; //TODO: look at keeping previous iterations hypothesis lists around cur_best.clear(); cur_good.clear(); cur_bad.clear(); - vector > all_hyp; + vector > all_hyp; typedef KBest::KBestDerivations, ESentenceTraversal,Filter> K; K kbest(forest,kbest_size); @@ -527,7 +526,7 @@ struct TrainingObserver : public DecoderObserver { if(PRINT_LIST) { cerr << "GOOD" << endl; for(int u=0;u!=cur_good.size();u++) cerr << cur_good[u]->mt_metric << " " << cur_good[u]->hope << endl;} //use hope for fear selection - shared_ptr& oracleN = cur_good[0]; + boost::shared_ptr& oracleN = cur_good[0]; if(fear_select == 1){ //compute fear hyps with model - bleu if (PRINT_LIST) cerr << "FEAR " << endl; @@ -663,13 +662,13 @@ int main(int argc, char** argv) { invert_score = false; } - shared_ptr ds; + boost::shared_ptr ds; //normal: load references, stream: start stream scorer if (stream) { - ds = shared_ptr(new DocStreamScorer(type, vector(0), "")); + ds = boost::shared_ptr(new DocStreamScorer(type, vector(0), "")); cerr << "Scoring doc stream with " << metric_name << endl; } else { - ds = shared_ptr(new DocScorer(type, conf["reference"].as >(), "")); + ds = boost::shared_ptr(new DocScorer(type, conf["reference"].as >(), "")); cerr << "Loaded " << ds->size() << " references for scoring with " << metric_name << endl; } vector corpus_bleu_sent_stats; @@ -774,9 +773,9 @@ int main(int argc, char** argv) { const HypothesisInfo& cur_good = *oracles[cur_sent].good[0]; const HypothesisInfo& cur_bad = *oracles[cur_sent].bad[0]; - vector >& cur_good_v = oracles[cur_sent].good; - vector >& cur_bad_v = oracles[cur_sent].bad; - vector > cur_best_v = observer.GetCurrentBest(); + vector >& cur_good_v = oracles[cur_sent].good; + vector >& cur_bad_v = oracles[cur_sent].bad; + vector > cur_best_v = observer.GetCurrentBest(); tot_loss += cur_hyp.mt_metric; @@ -824,13 +823,13 @@ int main(int argc, char** argv) { } else if(optimizer == 5) //full mira with n-best list of constraints from hope, fear, model best { - vector > cur_constraint; + vector > cur_constraint; cur_constraint.insert(cur_constraint.begin(), cur_bad_v.begin(), cur_bad_v.end()); cur_constraint.insert(cur_constraint.begin(), cur_best_v.begin(), cur_best_v.end()); cur_constraint.insert(cur_constraint.begin(), cur_good_v.begin(), cur_good_v.end()); bool optimize_again; - vector > cur_pair; + vector > cur_pair; //SMO for(int u=0;u!=cur_constraint.size();u++) cur_constraint[u]->alpha =0; @@ -879,7 +878,7 @@ int main(int argc, char** argv) { else if(optimizer == 2 || optimizer == 3) //PA and Cutting Plane MIRA update { bool DEBUG_SMO= true; - vector > cur_constraint; + vector > cur_constraint; cur_constraint.push_back(cur_good_v[0]); //add oracle to constraint set bool optimize_again = true; int cut_plane_calls = 0; @@ -919,7 +918,7 @@ int main(int argc, char** argv) { while (iter < smo_iter) { //select pair to optimize from constraint set - vector > cur_pair = SelectPair(&cur_constraint); + vector > cur_pair = SelectPair(&cur_constraint); if(cur_pair.empty()){ iter=MAX_SMO; diff --git a/training/mira/kbest_mira.cc b/training/mira/kbest_mira.cc index d59b4224..2868de0c 100644 --- a/training/mira/kbest_mira.cc +++ b/training/mira/kbest_mira.cc @@ -3,10 +3,10 @@ #include #include #include -#include #include #include +#include #include "stringlib.h" #include "hg_sampler.h" @@ -30,7 +30,7 @@ using namespace std; namespace po = boost::program_options; bool invert_score; -std::tr1::shared_ptr rng; +boost::shared_ptr rng; void RandomPermutation(int len, vector* p_ids) { vector& ids = *p_ids; @@ -88,8 +88,8 @@ struct HypothesisInfo { }; struct GoodBadOracle { - std::tr1::shared_ptr good; - std::tr1::shared_ptr bad; + boost::shared_ptr good; + boost::shared_ptr bad; }; struct TrainingObserver : public DecoderObserver { @@ -97,7 +97,7 @@ struct TrainingObserver : public DecoderObserver { const DocumentScorer& ds; const EvaluationMetric& metric; vector& oracles; - std::tr1::shared_ptr cur_best; + boost::shared_ptr cur_best; const int kbest_size; const bool sample_forest; @@ -109,16 +109,16 @@ struct TrainingObserver : public DecoderObserver { UpdateOracles(smeta.GetSentenceID(), *hg); } - std::tr1::shared_ptr MakeHypothesisInfo(const SparseVector& feats, const double score) { - std::tr1::shared_ptr h(new HypothesisInfo); + boost::shared_ptr MakeHypothesisInfo(const SparseVector& feats, const double score) { + boost::shared_ptr h(new HypothesisInfo); h->features = feats; h->mt_metric = score; return h; } void UpdateOracles(int sent_id, const Hypergraph& forest) { - std::tr1::shared_ptr& cur_good = oracles[sent_id].good; - std::tr1::shared_ptr& cur_bad = oracles[sent_id].bad; + boost::shared_ptr& cur_good = oracles[sent_id].good; + boost::shared_ptr& cur_bad = oracles[sent_id].bad; cur_bad.reset(); // TODO get rid of?? if (sample_forest) { diff --git a/training/mira/mira.py b/training/mira/mira.py index 29c51e1d..7b2d06a3 100755 --- a/training/mira/mira.py +++ b/training/mira/mira.py @@ -4,8 +4,17 @@ import subprocess, shlex, glob import argparse import logging import random, time -import cdec.score import gzip, itertools +try: + import cdec.score +except ImportError: + sys.stderr.write('Could not import pycdec, see cdec/python/README.md for details\n') + sys.exit(1) +have_mpl = True +try: + import matplotlib.pyplot as plt +except ImportError: + have_mpl = False #mira run script #requires pycdec to be built, since it is used for scoring hypothesis @@ -16,17 +25,17 @@ import gzip, itertools #scoring function using pycdec scoring def fast_score(hyps, refs, metric): scorer = cdec.score.Scorer(metric) - logging.info('loaded {0} references for scoring with {1}\n'.format( + logging.info('loaded {0} references for scoring with {1}'.format( len(refs), metric)) if metric=='BLEU': logging.warning('BLEU is ambiguous, assuming IBM_BLEU\n') metric = 'IBM_BLEU' elif metric=='COMBI': logging.warning('COMBI metric is no longer supported, switching to ' - 'COMB:TER=-0.5;BLEU=0.5\n') + 'COMB:TER=-0.5;BLEU=0.5') metric = 'COMB:TER=-0.5;BLEU=0.5' stats = sum(scorer(r).evaluate(h) for h,r in itertools.izip(hyps,refs)) - logging.info(stats.detail+'\n') + logging.info('Score={} ({})'.format(stats.score, stats.detail)) return stats.score #create new parallel input file in output directory in sgml format @@ -71,6 +80,8 @@ def main(): #set logging to write all info messages to stderr logging.basicConfig(level=logging.INFO) script_dir = os.path.dirname(os.path.abspath(sys.argv[0])) + if not have_mpl: + logging.warning('Failed to import matplotlib, graphs will not be generated.') parser= argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter) @@ -181,10 +192,11 @@ def main(): dev_size = enseg(args.devset, newdev, args.grammar_prefix) args.devset = newdev - write_config(args) + log_config(args) args.weights, hope_best_fear = optimize(args, script_dir, dev_size) - graph_file = graph(args.output_dir, hope_best_fear, args.metric) + graph_file = '' + if have_mpl: graph_file = graph(args.output_dir, hope_best_fear, args.metric) dev_results, dev_bleu = evaluate(args.devset, args.weights, args.config, script_dir, args.output_dir) @@ -205,17 +217,12 @@ def main(): if graph_file: logging.info('A graph of the best/hope/fear scores over the iterations ' - 'has been saved to {}\n'.format(graph_file)) + 'has been saved to {}'.format(graph_file)) print 'final weights:\n{}\n'.format(args.weights) #graph of hope/best/fear metric values across all iterations def graph(output_dir, hope_best_fear, metric): - try: - import matplotlib.pyplot as plt - except ImportError: - logging.error('Error importing matplotlib. Graphing disabled.\n') - return '' max_y = float(max(hope_best_fear['best']))*1.5 plt.plot(hope_best_fear['best'], label='best') plt.plot(hope_best_fear['hope'], label='hope') @@ -308,6 +315,7 @@ def optimize(args, script_dir, dev_size): decoder = script_dir+'/kbest_cut_mira' (source, refs) = split_devset(args.devset, args.output_dir) port = random.randint(15000,50000) + logging.info('using port {}'.format(port)) num_features = 0 last_p_score = 0 best_score_iter = -1 @@ -316,8 +324,8 @@ def optimize(args, script_dir, dev_size): hope_best_fear = {'hope':[],'best':[],'fear':[]} #main optimization loop while i best_score: best_score_iter = i @@ -436,12 +441,13 @@ def optimize(args, script_dir, dev_size): new_weights_file = '{}/weights.{}'.format(args.output_dir, i+1) last_weights_file = '{}/weights.{}'.format(args.output_dir, i) i += 1 - weight_files = weightdir+'/weights.mira-pass*.*[0-9].gz' + weight_files = args.output_dir+'/weights.pass*/weights.mira-pass*[0-9].gz' average_weights(new_weights_file, weight_files) - logging.info('\nBEST ITER: {} :: {}\n\n'.format( + logging.info('BEST ITERATION: {} (SCORE={})'.format( best_score_iter, best_score)) weights_final = args.output_dir+'/weights.final' + logging.info('WEIGHTS FILE: {}'.format(weights_final)) shutil.copy(last_weights_file, weights_final) average_final_weights(args.output_dir) @@ -481,15 +487,15 @@ def gzip_file(filename): #average the weights for a given pass def average_weights(new_weights, weight_files): - logging.info('AVERAGE {} {}\n'.format(new_weights, weight_files)) + logging.info('AVERAGE {} {}'.format(new_weights, weight_files)) feature_weights = {} total_mult = 0.0 for path in glob.glob(weight_files): score = gzip.open(path) mult = 0 - logging.info('FILE {}\n'.format(path)) + logging.info(' FILE {}'.format(path)) msg, ran, mult = score.readline().strip().split(' ||| ') - logging.info('Processing {} {}'.format(ran, mult)) + logging.info(' Processing {} {}'.format(ran, mult)) for line in score: f,w = line.split(' ',1) if f in feature_weights: @@ -500,34 +506,30 @@ def average_weights(new_weights, weight_files): score.close() #write new weights to outfile + logging.info('Writing averaged weights to {}'.format(new_weights)) out = open(new_weights, 'w') for f in iter(feature_weights): avg = feature_weights[f]/total_mult - logging.info('{} {} {} ||| Printing {} {}\n'.format(f,feature_weights[f], - total_mult, f, avg)) out.write('{} {}\n'.format(f,avg)) -def write_config(args): - config = ('\n' - 'DECODER: ' - '/usr0/home/eschling/cdec/training/mira/kbest_cut_mira\n' - 'INI FILE: '+args.config+'\n' - 'WORKING DIRECTORY: '+args.output_dir+'\n' - 'DEVSET: '+args.devset+'\n' - 'EVAL METRIC: '+args.metric+'\n' - 'MAX ITERATIONS: '+str(args.max_iterations)+'\n' - 'DECODE NODES: '+str(args.jobs)+'\n' - 'INITIAL WEIGHTS: '+args.weights+'\n') +def log_config(args): + logging.info('WORKING DIRECTORY={}'.format(args.output_dir)) + logging.info('INI FILE={}'.format(args.config)) + logging.info('DEVSET={}'.format(args.devset)) + logging.info('EVAL METRIC={}'.format(args.metric)) + logging.info('MAX ITERATIONS={}'.format(args.max_iterations)) + logging.info('PARALLEL JOBS={}'.format(args.jobs)) + logging.info('INITIAL WEIGHTS={}'.format(args.weights)) if args.grammar_prefix: - config += 'GRAMMAR PREFIX: '+str(args.grammar_prefix)+'\n' + logging.info('GRAMMAR PREFIX={}'.format(args.grammar_prefix)) if args.test: - config += 'TEST SET: '+args.test+'\n' + logging.info('TEST SET={}'.format(args.test)) + else: + logging.info('TEST SET=none specified') if args.test_config: - config += 'TEST CONFIG: '+args.test_config+'\n' + logging.info('TEST CONFIG={}'.format(args.test_config)) if args.email: - config += 'EMAIL: '+args.email+'\n' - - logging.info(config) + logging.info('EMAIL={}'.format(args.email)) if __name__=='__main__': main() diff --git a/training/pro/mr_pro_map.cc b/training/pro/mr_pro_map.cc index eef40b8a..a5e6e48f 100644 --- a/training/pro/mr_pro_map.cc +++ b/training/pro/mr_pro_map.cc @@ -2,7 +2,6 @@ #include #include #include -#include #include #include diff --git a/training/utils/candidate_set.cc b/training/utils/candidate_set.cc index 087efec3..1dec9609 100644 --- a/training/utils/candidate_set.cc +++ b/training/utils/candidate_set.cc @@ -1,6 +1,11 @@ #include "candidate_set.h" -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_set; } +#endif #include @@ -139,12 +144,12 @@ void CandidateSet::ReadFromFile(const string& file) { void CandidateSet::Dedup() { if(!SILENT) cerr << "Dedup in=" << cs.size(); - tr1::unordered_set u; + unordered_set u; while(cs.size() > 0) { u.insert(cs.back()); cs.pop_back(); } - tr1::unordered_set::iterator it = u.begin(); + unordered_set::iterator it = u.begin(); while (it != u.end()) { cs.push_back(*it); it = u.erase(it); diff --git a/training/utils/online_optimizer.h b/training/utils/online_optimizer.h index 28d89344..19223e9d 100644 --- a/training/utils/online_optimizer.h +++ b/training/utils/online_optimizer.h @@ -1,10 +1,10 @@ #ifndef _ONL_OPTIMIZE_H_ #define _ONL_OPTIMIZE_H_ -#include #include #include #include +#include #include "sparse_vector.h" struct LearningRateSchedule { @@ -56,7 +56,7 @@ struct ExponentialDecayLearningRate : public LearningRateSchedule { class OnlineOptimizer { public: virtual ~OnlineOptimizer(); - OnlineOptimizer(const std::tr1::shared_ptr& s, + OnlineOptimizer(const boost::shared_ptr& s, size_t batch_size, const std::vector& frozen_feats = std::vector()) : N_(batch_size),schedule_(s),k_() { @@ -77,13 +77,13 @@ class OnlineOptimizer { std::set frozen_; // frozen (non-optimizing) features private: - std::tr1::shared_ptr schedule_; + boost::shared_ptr schedule_; int k_; // iteration count }; class CumulativeL1OnlineOptimizer : public OnlineOptimizer { public: - CumulativeL1OnlineOptimizer(const std::tr1::shared_ptr& s, + CumulativeL1OnlineOptimizer(const boost::shared_ptr& s, size_t training_instances, double C, const std::vector& frozen) : OnlineOptimizer(s, training_instances, frozen), C_(C), u_() {} diff --git a/training/utils/optimize_test.cc b/training/utils/optimize_test.cc index bff2ca03..72fcef6d 100644 --- a/training/utils/optimize_test.cc +++ b/training/utils/optimize_test.cc @@ -2,6 +2,7 @@ #include #include #include +#include #include "optimize.h" #include "online_optimizer.h" #include "sparse_vector.h" @@ -96,14 +97,11 @@ void TestOptimizerVariants(int num_vars) { cerr << oa.Name() << " SUCCESS\n"; } -using namespace std::tr1; - void TestOnline() { size_t N = 20; double C = 1.0; double eta0 = 0.2; - std::tr1::shared_ptr r(new ExponentialDecayLearningRate(N, eta0, 0.85)); - //shared_ptr r(new StandardLearningRate(N, eta0)); + boost::shared_ptr r(new ExponentialDecayLearningRate(N, eta0, 0.85)); CumulativeL1OnlineOptimizer opt(r, N, C, std::vector()); assert(r->eta(10) < r->eta(1)); } diff --git a/utils/hash.h b/utils/hash.h index 189ed1ae..e56fca06 100644 --- a/utils/hash.h +++ b/utils/hash.h @@ -20,11 +20,17 @@ # define HASH_MAP_RESERVED(h,empty,deleted) do { (h).set_empty_key(empty); (h).set_deleted_key(deleted); } while(0) # define HASH_MAP_EMPTY(h,empty) do { (h).set_empty_key(empty); } while(0) #else +#ifdef HAVE_CXX11 +# include +# include +#else # include # include -# define SPARSE_HASH_MAP std::tr1::unordered_map -# define HASH_MAP std::tr1::unordered_map -# define HASH_SET std::tr1::unordered_set +namespace std { using std::tr1::unordered_map; using std::tr1::unordered_set; } +#endif +# define SPARSE_HASH_MAP std::unordered_map +# define HASH_MAP std::unordered_map +# define HASH_SET std::unordered_set # define HASH_MAP_DELETED(h,deleted) # define HASH_MAP_RESERVED(h,empty,deleted) # define HASH_MAP_EMPTY(h,empty) diff --git a/word-aligner/fast_align.cc b/word-aligner/fast_align.cc index fddcba9c..589ca62d 100644 --- a/word-aligner/fast_align.cc +++ b/word-aligner/fast_align.cc @@ -1,7 +1,12 @@ #include #include #include -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; } +#endif #include #include @@ -17,7 +22,6 @@ namespace po = boost::program_options; using namespace std; -using namespace std::tr1; bool InitCommandLine(int argc, char** argv, po::variables_map* conf) { po::options_description opts("Configuration options"); diff --git a/word-aligner/ttables.cc b/word-aligner/ttables.cc index c177aa30..a56bbcef 100644 --- a/word-aligner/ttables.cc +++ b/word-aligner/ttables.cc @@ -5,7 +5,6 @@ #include "dict.h" using namespace std; -using namespace std::tr1; void TTable::DeserializeProbsFromText(std::istream* in) { int c = 0; diff --git a/word-aligner/ttables.h b/word-aligner/ttables.h index 507f591a..1785e064 100644 --- a/word-aligner/ttables.h +++ b/word-aligner/ttables.h @@ -2,7 +2,12 @@ #define _TTABLES_H_ #include -#include +#ifdef HAVE_CXX11 +# include +#else +# include +namespace std { using std::tr1::unordered_map; } +#endif #include "sparse_vector.h" #include "m.h" @@ -12,8 +17,8 @@ class TTable { public: TTable() {} - typedef std::tr1::unordered_map Word2Double; - typedef std::tr1::unordered_map Word2Word2Double; + typedef std::unordered_map Word2Double; + typedef std::unordered_map Word2Word2Double; inline double prob(const int& e, const int& f) const { const Word2Word2Double::const_iterator cit = ttable.find(e); if (cit != ttable.end()) { -- cgit v1.2.3 From 4bdb3451dc6c005a5356844435c098bb14dae6a8 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 10 Nov 2013 01:22:11 -0500 Subject: fixes --- configure.ac | 7 ++++++- mteval/mbr_kbest.cc | 2 +- mteval/ns_ter.cc | 2 +- mteval/ter.cc | 2 +- utils/hash.h | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index c3b749e3..e4183c15 100644 --- a/configure.ac +++ b/configure.ac @@ -185,7 +185,12 @@ AC_CHECK_HEADER(google/dense_hash_map, AC_PROG_INSTALL -CPPFLAGS="-DPIC -fPIC $CPPFLAGS -DHAVE_CONFIG_H -DKENLM_MAX_ORDER=6" +CPPFLAGS="-DPIC -fPIC $CXX11_SWITCH $CPPFLAGS -DHAVE_CONFIG_H -DKENLM_MAX_ORDER=6" + +if test "x$HAVE_CXX11" = "x0"; then + CPPFLAGS="$CPPFLAGS -DHAVE_OLD_CPP" +fi + # core cdec stuff AC_CONFIG_FILES([Makefile]) diff --git a/mteval/mbr_kbest.cc b/mteval/mbr_kbest.cc index 787c03bd..76d2c7fc 100644 --- a/mteval/mbr_kbest.cc +++ b/mteval/mbr_kbest.cc @@ -3,7 +3,7 @@ #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/mteval/ns_ter.cc b/mteval/ns_ter.cc index f0d84098..680fb7b4 100644 --- a/mteval/ns_ter.cc +++ b/mteval/ns_ter.cc @@ -4,7 +4,7 @@ #include #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/mteval/ter.cc b/mteval/ter.cc index 9da54306..19b90bbc 100644 --- a/mteval/ter.cc +++ b/mteval/ter.cc @@ -5,7 +5,7 @@ #include #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/utils/hash.h b/utils/hash.h index e56fca06..e1426ffb 100644 --- a/utils/hash.h +++ b/utils/hash.h @@ -20,7 +20,7 @@ # define HASH_MAP_RESERVED(h,empty,deleted) do { (h).set_empty_key(empty); (h).set_deleted_key(deleted); } while(0) # define HASH_MAP_EMPTY(h,empty) do { (h).set_empty_key(empty); } while(0) #else -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include # include #else -- cgit v1.2.3 From e974e1dd835bd7995dca720bba1ce0ab09f6fe54 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 10 Nov 2013 01:23:56 -0500 Subject: small fixes --- decoder/ff_external.cc | 2 +- python/cdec/sa/compile.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/decoder/ff_external.cc b/decoder/ff_external.cc index dea0e20f..6ee4b2cf 100644 --- a/decoder/ff_external.cc +++ b/decoder/ff_external.cc @@ -19,7 +19,7 @@ ExternalFeature::ExternalFeature(const string& param) { cerr << "External requires a path to a dynamic library!\n"; abort(); } - lib_handle = dlopen(file.c_str(), RTLD_LAZY); + lib_handle = dlopen(file.c_str(), RTLD_LAZY | RTLD_GLOBAL); if (!lib_handle) { cerr << "dlopen reports: " << dlerror() << endl; cerr << "Did you provide a full path to the dynamic library?\n"; diff --git a/python/cdec/sa/compile.py b/python/cdec/sa/compile.py index d4cd8387..caa93f8b 100644 --- a/python/cdec/sa/compile.py +++ b/python/cdec/sa/compile.py @@ -75,6 +75,13 @@ def main(): a_bin = os.path.join(args.output, 'a.bin') lex_bin = os.path.join(args.output, 'lex.bin') + config = cdec.configobj.ConfigObj(args.config, unrepr=True) + config['f_sa_file'] = os.path.abspath(f_sa_bin) + config['e_file'] = os.path.abspath(e_bin) + config['a_file'] = os.path.abspath(a_bin) + config['lex_file'] = os.path.abspath(lex_bin) + config['precompute_file'] = os.path.abspath(precomp_bin) + start_time = monitor_cpu() logger.info('Compiling source suffix array') if args.bitext: @@ -116,12 +123,6 @@ def main(): logger.info('Compiling bilexical dictionary took %f seconds', stop_time - start_time) # Write configuration - config = cdec.configobj.ConfigObj(args.config, unrepr=True) - config['f_sa_file'] = os.path.abspath(f_sa_bin) - config['e_file'] = os.path.abspath(e_bin) - config['a_file'] = os.path.abspath(a_bin) - config['lex_file'] = os.path.abspath(lex_bin) - config['precompute_file'] = os.path.abspath(precomp_bin) for name, value in zip(param_names, params): config[name] = value config.write() -- cgit v1.2.3 From f204210aee0748f5183c6f0c853be89266f4a651 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 10 Nov 2013 01:46:28 -0500 Subject: fix for c++11 --- .gitignore | 2 +- decoder/apply_models.cc | 2 +- decoder/decoder.cc | 2 +- decoder/earley_composer.cc | 2 +- decoder/ff_source_syntax.cc | 2 +- decoder/ff_source_syntax2_p.cc | 2 +- decoder/ff_source_syntax_p.cc | 2 +- decoder/ff_wordalign.cc | 2 +- decoder/ff_wordalign.h | 2 +- decoder/ff_wordset.h | 2 +- decoder/grammar.cc | 2 +- decoder/hg_intersect.cc | 2 +- decoder/kbest.h | 2 +- decoder/maxtrans_blunsom.cc | 2 +- decoder/phrasebased_translator.cc | 2 +- python/cdec/sa/strmap.cc | 2 +- python/setup.py.in | 3 ++- training/latent_svm/latent_svm.cc | 13 ++++++------- training/mira/kbest_cut_mira.cc | 7 ------- training/utils/candidate_set.cc | 2 +- word-aligner/fast_align.cc | 2 +- word-aligner/ttables.h | 2 +- 22 files changed, 27 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 697a1a9d..5f573137 100644 --- a/.gitignore +++ b/.gitignore @@ -103,7 +103,7 @@ jam-files/bjam jam-files/engine/bin.* jam-files/engine/bootstrap/ klm/lm/bin/ -klm/lm/builder/builder +klm/lm/builder/lmplz klm/lm/build_binary klm/lm/ngram_query klm/lm/query diff --git a/decoder/apply_models.cc b/decoder/apply_models.cc index 2e093d6a..4cd8b36f 100644 --- a/decoder/apply_models.cc +++ b/decoder/apply_models.cc @@ -8,7 +8,7 @@ #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include # include #else diff --git a/decoder/decoder.cc b/decoder/decoder.cc index 2c0e07b7..da65713a 100644 --- a/decoder/decoder.cc +++ b/decoder/decoder.cc @@ -1,6 +1,6 @@ #include "decoder.h" -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/decoder/earley_composer.cc b/decoder/earley_composer.cc index 32c387d3..d47a6969 100644 --- a/decoder/earley_composer.cc +++ b/decoder/earley_composer.cc @@ -4,7 +4,7 @@ #include #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include # include #else diff --git a/decoder/ff_source_syntax.cc b/decoder/ff_source_syntax.cc index 95709076..88f6714c 100644 --- a/decoder/ff_source_syntax.cc +++ b/decoder/ff_source_syntax.cc @@ -2,7 +2,7 @@ #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/decoder/ff_source_syntax2_p.cc b/decoder/ff_source_syntax2_p.cc index 130144fa..6a2ae742 100644 --- a/decoder/ff_source_syntax2_p.cc +++ b/decoder/ff_source_syntax2_p.cc @@ -3,7 +3,7 @@ #include #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/decoder/ff_source_syntax_p.cc b/decoder/ff_source_syntax_p.cc index 1d3dc497..c094de59 100644 --- a/decoder/ff_source_syntax_p.cc +++ b/decoder/ff_source_syntax_p.cc @@ -2,7 +2,7 @@ #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/decoder/ff_wordalign.cc b/decoder/ff_wordalign.cc index 8ed053c2..dcb80110 100644 --- a/decoder/ff_wordalign.cc +++ b/decoder/ff_wordalign.cc @@ -7,7 +7,7 @@ #include #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/decoder/ff_wordalign.h b/decoder/ff_wordalign.h index 50f0dafa..0161f603 100644 --- a/decoder/ff_wordalign.h +++ b/decoder/ff_wordalign.h @@ -9,7 +9,7 @@ #include #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/decoder/ff_wordset.h b/decoder/ff_wordset.h index affee2f4..e78cd2fb 100644 --- a/decoder/ff_wordset.h +++ b/decoder/ff_wordset.h @@ -9,7 +9,7 @@ #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/decoder/grammar.cc b/decoder/grammar.cc index f2530d35..160d00e6 100644 --- a/decoder/grammar.cc +++ b/decoder/grammar.cc @@ -3,7 +3,7 @@ #include #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include # include #else diff --git a/decoder/hg_intersect.cc b/decoder/hg_intersect.cc index c5f1cc91..31a9a1ce 100644 --- a/decoder/hg_intersect.cc +++ b/decoder/hg_intersect.cc @@ -1,7 +1,7 @@ #include "hg_intersect.h" #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/decoder/kbest.h b/decoder/kbest.h index cd386aef..c7194c7e 100644 --- a/decoder/kbest.h +++ b/decoder/kbest.h @@ -3,7 +3,7 @@ #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/decoder/maxtrans_blunsom.cc b/decoder/maxtrans_blunsom.cc index 8d1d471c..a9f65fab 100644 --- a/decoder/maxtrans_blunsom.cc +++ b/decoder/maxtrans_blunsom.cc @@ -2,7 +2,7 @@ #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include # include #else diff --git a/decoder/phrasebased_translator.cc b/decoder/phrasebased_translator.cc index 321fb286..04b3e5d2 100644 --- a/decoder/phrasebased_translator.cc +++ b/decoder/phrasebased_translator.cc @@ -2,7 +2,7 @@ #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include # include #else diff --git a/python/cdec/sa/strmap.cc b/python/cdec/sa/strmap.cc index d7c4f2a3..b6debfb0 100644 --- a/python/cdec/sa/strmap.cc +++ b/python/cdec/sa/strmap.cc @@ -4,7 +4,7 @@ #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/python/setup.py.in b/python/setup.py.in index ce1eb2ed..8ed0b100 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -21,7 +21,8 @@ ext_modules = [ extra_compile_args=CPPFLAGS, extra_link_args=LDFLAGS), Extension(name='cdec.sa._sa', - sources=['cdec/sa/_sa.c', 'cdec/sa/strmap.cc']) + sources=['cdec/sa/_sa.c', 'cdec/sa/strmap.cc'], + extra_compile_args=CPPFLAGS) ] setup( diff --git a/training/latent_svm/latent_svm.cc b/training/latent_svm/latent_svm.cc index ab9c1d5d..60e52550 100644 --- a/training/latent_svm/latent_svm.cc +++ b/training/latent_svm/latent_svm.cc @@ -32,7 +32,6 @@ total_loss and prev_loss actually refer not to loss, but the metric (usually BLE #include "sampler.h" using namespace std; -using boost::shared_ptr; namespace po = boost::program_options; bool invert_score; @@ -128,7 +127,7 @@ struct HypothesisInfo { }; struct GoodOracle { - shared_ptr good; + boost::shared_ptr good; }; struct TrainingObserver : public DecoderObserver { @@ -143,9 +142,9 @@ struct TrainingObserver : public DecoderObserver { const DocScorer& ds; const vector& feature_weights; vector& oracles; - shared_ptr cur_best; - shared_ptr cur_costaug_best; - shared_ptr cur_ref; + boost::shared_ptr cur_best; + boost::shared_ptr cur_costaug_best; + boost::shared_ptr cur_ref; const int kbest_size; const double mt_metric_scale; const double mu; @@ -168,8 +167,8 @@ struct TrainingObserver : public DecoderObserver { UpdateOracles(smeta.GetSentenceID(), *hg); } - shared_ptr MakeHypothesisInfo(const SparseVector& feats, const double metric) { - shared_ptr h(new HypothesisInfo); + boost::shared_ptr MakeHypothesisInfo(const SparseVector& feats, const double metric) { + boost::shared_ptr h(new HypothesisInfo); h->features = feats; h->mt_metric_score = metric; return h; diff --git a/training/mira/kbest_cut_mira.cc b/training/mira/kbest_cut_mira.cc index 3b1108e0..990609d7 100644 --- a/training/mira/kbest_cut_mira.cc +++ b/training/mira/kbest_cut_mira.cc @@ -49,13 +49,6 @@ bool sent_approx; bool checkloss; bool stream; -void SanityCheck(const vector& w) { - for (int i = 0; i < w.size(); ++i) { - assert(!isnan(w[i])); - assert(!isinf(w[i])); - } -} - struct FComp { const vector& w_; FComp(const vector& w) : w_(w) {} diff --git a/training/utils/candidate_set.cc b/training/utils/candidate_set.cc index 1dec9609..33dae9a3 100644 --- a/training/utils/candidate_set.cc +++ b/training/utils/candidate_set.cc @@ -1,6 +1,6 @@ #include "candidate_set.h" -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/word-aligner/fast_align.cc b/word-aligner/fast_align.cc index 589ca62d..f54233eb 100644 --- a/word-aligner/fast_align.cc +++ b/word-aligner/fast_align.cc @@ -1,7 +1,7 @@ #include #include #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include diff --git a/word-aligner/ttables.h b/word-aligner/ttables.h index 1785e064..d82aff72 100644 --- a/word-aligner/ttables.h +++ b/word-aligner/ttables.h @@ -2,7 +2,7 @@ #define _TTABLES_H_ #include -#ifdef HAVE_CXX11 +#ifndef HAVE_OLD_CPP # include #else # include -- cgit v1.2.3 From 5ca9348b98a519015c4080186ea1a6fe42ef4a2b Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 10 Nov 2013 03:56:11 -0500 Subject: fixes --- decoder/Makefile.am | 90 +++++++------- decoder/tromble_loss.cc | 309 ------------------------------------------------ decoder/tromble_loss.h | 40 ------- 3 files changed, 48 insertions(+), 391 deletions(-) delete mode 100644 decoder/tromble_loss.cc delete mode 100644 decoder/tromble_loss.h diff --git a/decoder/Makefile.am b/decoder/Makefile.am index 39a13ad8..f02299e6 100644 --- a/decoder/Makefile.am +++ b/decoder/Makefile.am @@ -55,12 +55,18 @@ libcdec_a_SOURCES = \ ff_klm.h \ ff_lm.h \ ff_ngrams.h \ + ff_parse_match.h \ ff_register.h \ ff_rules.h \ ff_ruleshape.h \ ff_sample_fsa.h \ + ff_soft_syntax.h \ + ff_soft_syntax2.h \ ff_source_path.h \ ff_source_syntax.h \ + ff_source_syntax2.h \ + ff_source_syntax2_p.h \ + ff_source_syntax_p.h \ ff_spans.h \ ff_tagger.h \ ff_wordalign.h \ @@ -94,66 +100,66 @@ libcdec_a_SOURCES = \ sentences.h \ tagger.h \ translator.h \ - tromble_loss.h \ trule.h \ viterbi.h \ - forest_writer.cc \ - maxtrans_blunsom.cc \ + aligner.cc \ + apply_models.cc \ + bottom_up_parser.cc \ + cdec.cc \ cdec_ff.cc \ cfg.cc \ - ff_external.cc \ - rule_lexer.cc \ - fst_translator.cc \ csplit.cc \ - translator.cc \ - rescore_translator.cc \ - scfg_translator.cc \ - hg.cc \ - hg_io.cc \ - hg_remove_eps.cc \ decoder.cc \ - hg_intersect.cc \ - hg_union.cc \ - hg_sampler.cc \ - factored_lexicon_helper.cc \ - viterbi.cc \ - lattice.cc \ - aligner.cc \ - apply_models.cc \ earley_composer.cc \ - phrasetable_fst.cc \ - trule.cc \ + factored_lexicon_helper.cc \ ff.cc \ - ffset.cc \ ff_basic.cc \ - ff_rules.cc \ - ff_wordset.cc \ - ff_context.cc \ + ff_bleu.cc \ ff_charset.cc \ - ff_lm.cc \ + ff_context.cc \ + ff_csplit.cc \ + ff_external.cc \ + ff_factory.cc \ ff_klm.cc \ + ff_lm.cc \ ff_ngrams.cc \ - ff_spans.cc \ + ff_parse_match.cc \ + ff_rules.cc \ ff_ruleshape.cc \ - ff_wordalign.cc \ - ff_csplit.cc \ - ff_tagger.cc \ + ff_soft_syntax.cc \ + ff_soft_syntax2.cc \ ff_source_path.cc \ - ff_parse_match.cc \ - ff_soft_syntax.cc \ - ff_soft_syntax2.cc \ ff_source_syntax.cc \ - ff_source_syntax_p.cc \ ff_source_syntax2.cc \ ff_source_syntax2_p.cc \ - ff_bleu.cc \ - ff_factory.cc \ + ff_source_syntax_p.cc \ + ff_spans.cc \ + ff_tagger.cc \ + ff_wordalign.cc \ + ff_wordset.cc \ + ffset.cc \ + forest_writer.cc \ + fst_translator.cc \ + grammar.cc \ + hg.cc \ + hg_intersect.cc \ + hg_io.cc \ + hg_remove_eps.cc \ + hg_sampler.cc \ + hg_union.cc \ incremental.cc \ + json_parse.cc \ + lattice.cc \ lexalign.cc \ lextrans.cc \ - tagger.cc \ - bottom_up_parser.cc \ + maxtrans_blunsom.cc \ phrasebased_translator.cc \ - JSON_parser.c \ - json_parse.cc \ - grammar.cc + phrasetable_fst.cc \ + rescore_translator.cc \ + rule_lexer.cc \ + scfg_translator.cc \ + tagger.cc \ + translator.cc \ + trule.cc \ + viterbi.cc \ + JSON_parser.c diff --git a/decoder/tromble_loss.cc b/decoder/tromble_loss.cc deleted file mode 100644 index 24cfef5f..00000000 --- a/decoder/tromble_loss.cc +++ /dev/null @@ -1,309 +0,0 @@ -#include "tromble_loss.h" -#include "fast_lexical_cast.hpp" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "sentence_metadata.h" -#include "trule.h" -#include "tdict.h" - -using namespace std; - -namespace { - -typedef unsigned char GramCount; - -struct RefCounts { - GramCount max; - std::vector refs; - size_t length; -}; - -typedef boost::unordered_map, size_t, boost::hash > > NGramMap; - -// Take all the n-grams in the references and stuff them into ngrams. -void MakeNGramMapFromReferences(const vector > &references, - int n, - vector *counts, - NGramMap *ngrams) { - ngrams->clear(); - std::pair, size_t> insert_me; - vector &ngram = insert_me.first; - ngram.reserve(n); - size_t &id = insert_me.second; - id = 0; - for (int refi = 0; refi < references.size(); ++refi) { - const vector& ref = references[refi]; - const int s = ref.size(); - for (int j=0; j ret(ngrams->insert(insert_me)); - if (ret.second) { - counts->resize(id + 1); - RefCounts &ref_counts = counts->back(); - ref_counts.max = 1; - ref_counts.refs.resize(references.size()); - ref_counts.refs[refi] = 1; - ref_counts.length = ngram.size(); - ++id; - } else { - RefCounts &ref_counts = (*counts)[ret.first->second]; - ref_counts.max = std::max(ref_counts.max, ++ref_counts.refs[refi]); - } - } - } - } -} - -struct MutableState { - MutableState(void *from, size_t n) : length(reinterpret_cast(from)), left(reinterpret_cast(length + 1)), right(left + n - 1), counts(reinterpret_cast(right + n - 1)) {} - size_t *length; - WordID *left, *right; - GramCount *counts; - static size_t Size(size_t n, size_t bound_ngram_id) { return sizeof(size_t) + (n - 1) * 2 * sizeof(WordID) + bound_ngram_id * sizeof(GramCount); } -}; - -struct ConstState { - ConstState(const void *from, size_t n) : length(reinterpret_cast(from)), left(reinterpret_cast(length + 1)), right(left + n - 1), counts(reinterpret_cast(right + n - 1)) {} - const size_t *length; - const WordID *left, *right; - const GramCount *counts; - static size_t Size(size_t n, size_t bound_ngram_id) { return sizeof(size_t) + (n - 1) * 2 * sizeof(WordID) + bound_ngram_id * sizeof(GramCount); } -}; - -template struct CompatibleHashRange : public std::unary_function &, size_t> { - size_t operator()(const boost::iterator_range &range) const { - return boost::hash_range(range.begin(), range.end()); - } -}; - -template struct CompatibleEqualsRange : public std::binary_function &, const std::vector &, size_t> { - size_t operator()(const boost::iterator_range &range, const std::vector &vec) const { - return boost::algorithm::equals(range, vec); - } - size_t operator()(const std::vector &vec, const boost::iterator_range &range) const { - return boost::algorithm::equals(range, vec); - } -}; - -void AddWord(const boost::circular_buffer &segment, size_t min_length, const NGramMap &ref_grams, GramCount *counters) { - typedef boost::circular_buffer::const_iterator BufferIt; - typedef boost::iterator_range SegmentRange; - if (segment.size() < min_length) return; -#if 0 - CompatibleHashRange hasher; - CompatibleEqualsRange equals; - for (BufferIt seg_start(segment.end() - min_length); ; --seg_start) { - NGramMap::const_iterator found = ref_grams.find(SegmentRange(seg_start, segment.end())); - if (found == ref_grams.end()) break; - ++counters[found->second]; - if (seg_start == segment.begin()) break; - } -#endif -} - -} // namespace - -class TrombleLossComputerImpl { - public: - explicit TrombleLossComputerImpl(const std::string ¶ms) : star_(TD::Convert("<{STAR}>")) { - typedef boost::tokenizer > Tokenizer; - // Argument parsing - std::string ref_file_name; - Tokenizer tok(params, boost::char_separator(" ")); - Tokenizer::iterator i = tok.begin(); - if (i == tok.end()) { - std::cerr << "TrombleLossComputer needs a reference file name." << std::endl; - exit(1); - } - ref_file_name = *i++; - if (i == tok.end()) { - std::cerr << "TrombleLossComputer needs to know how many references." << std::endl; - exit(1); - } - num_refs_ = boost::lexical_cast(*i++); - for (; i != tok.end(); ++i) { - thetas_.push_back(boost::lexical_cast(*i)); - } - if (thetas_.empty()) { - std::cerr << "TrombleLossComputer is pointless with no weight on n-grams." << std::endl; - exit(1); - } - - // Read references file. - std::ifstream ref_file(ref_file_name.c_str()); - if (!ref_file) { - std::cerr << "Could not open TrombleLossComputer file " << ref_file_name << std::endl; - exit(1); - } - std::string ref; - vector > references(num_refs_); - bound_ngram_id_ = 0; - for (unsigned int sentence = 0; ref_file; ++sentence) { - for (unsigned int refidx = 0; refidx < num_refs_; ++refidx) { - if (!getline(ref_file, ref)) { - if (refidx == 0) break; - std::cerr << "Short read of " << refidx << " references for sentence " << sentence << std::endl; - exit(1); - } - TD::ConvertSentence(ref, &references[refidx]); - } - ref_ids_.resize(sentence + 1); - ref_counts_.resize(sentence + 1); - MakeNGramMapFromReferences(references, thetas_.size(), &ref_counts_.back(), &ref_ids_.back()); - bound_ngram_id_ = std::max(bound_ngram_id_, ref_ids_.back().size()); - } - } - - size_t StateSize() const { - // n-1 boundary words plus counts for n-grams currently rendered as bytes even though most would fit in bits. - // Also, this is cached by higher up classes so no need to cache here. - return MutableState::Size(thetas_.size(), bound_ngram_id_); - } - - double Traversal( - const SentenceMetadata &smeta, - const TRule &rule, - const vector &ant_contexts, - void *out_context) const { - // TODO: get refs from sentence metadata. - // This will require resizable features. - if (smeta.GetSentenceID() >= ref_ids_.size()) { - std::cerr << "Sentence ID " << smeta.GetSentenceID() << " doesn't have references; there are only " << ref_ids_.size() << " references." << std::endl; - exit(1); - } - const NGramMap &ngrams = ref_ids_[smeta.GetSentenceID()]; - MutableState out_state(out_context, thetas_.size()); - memset(out_state.counts, 0, bound_ngram_id_ * sizeof(GramCount)); - boost::circular_buffer history(thetas_.size()); - std::vector::const_iterator ant_context = ant_contexts.begin(); - *out_state.length = 0; - size_t pushed = 0; - const size_t keep = thetas_.size() - 1; - for (vector::const_iterator rhs = rule.e().begin(); rhs != rule.e().end(); ++rhs) { - if (*rhs < 1) { - assert(ant_context != ant_contexts.end()); - // Constituent - ConstState rhs_state(*ant_context, thetas_.size()); - *out_state.length += *rhs_state.length; - { - GramCount *accum = out_state.counts; - for (const GramCount *c = rhs_state.counts; c != rhs_state.counts + ngrams.size(); ++c, ++accum) { - *accum += *c; - } - } - const WordID *w = rhs_state.left; - bool long_constit = true; - for (size_t i = 1; i <= keep; ++i, ++w) { - if (*w == star_) { - long_constit = false; - break; - } - history.push_back(*w); - if (++pushed == keep) { - std::copy(history.begin(), history.end(), out_state.left); - } - // Now i is the length of the history coming from this constituent. So it needs at least i+1 words to have a cross-child add. - AddWord(history, i + 1, ngrams, out_state.counts); - } - // If the consituent is shorter than thetas_.size(), then the - // constituent's left is the entire constituent, so history is already - // correct. Otherwise, the entire right hand side is the entire - // history. - if (long_constit) { - history.assign(thetas_.size(), rhs_state.right, rhs_state.right + keep); - } - ++ant_context; - } else { - // Word - ++*out_state.length; - history.push_back(*rhs); - if (++pushed == keep) { - std::copy(history.begin(), history.end(), out_state.left); - } - AddWord(history, 1, ngrams, out_state.counts); - } - } - // Fill in left and right constituents. - if (pushed < keep) { - std::copy(history.begin(), history.end(), out_state.left); - for (WordID *i = out_state.left + pushed; i != out_state.left + keep; ++i) { - *i = star_; - } - std::copy(out_state.left, out_state.left + keep, out_state.right); - } else if(pushed == keep) { - std::copy(history.begin(), history.end(), out_state.right); - } else if ((pushed > keep) && !history.empty()) { - std::copy(history.begin() + 1, history.end(), out_state.right); - } - std::vector::const_iterator ref_info = ref_counts_[smeta.GetSentenceID()].begin(); - // Clip the counts and count matches. - // Indexed by reference then by length. - std::vector > matches(num_refs_, std::vector(thetas_.size())); - for (GramCount *c = out_state.counts; c != out_state.counts + ngrams.size(); ++c, ++ref_info) { - *c = std::min(*c, ref_info->max); - if (*c) { - for (unsigned int refidx = 0; refidx < num_refs_; ++refidx) { - assert(ref_info->length >= 1); - assert(ref_info->length - 1 < thetas_.size()); - matches[refidx][ref_info->length - 1] += std::min(*c, ref_info->refs[refidx]); - } - } - } - double best_score = 0.0; - for (unsigned int refidx = 0; refidx < num_refs_; ++refidx) { - double score = 0.0; - for (unsigned int j = 0; j < std::min(*out_state.length, thetas_.size()); ++j) { - score += thetas_[j] * static_cast(matches[refidx][j]) / static_cast(*out_state.length - j); - } - best_score = std::max(best_score, score); - } - return best_score; - } - - private: - unsigned int num_refs_; - // Indexed by sentence id. - std::vector ref_ids_; - // Then by id from ref_ids_. - std::vector > ref_counts_; - - // thetas_[0] is the weight for 1-grams - std::vector thetas_; - - // All ngram ids in ref_ids_ are < this value. - size_t bound_ngram_id_; - - const WordID star_; -}; - -TrombleLossComputer::TrombleLossComputer(const std::string ¶ms) : - boost::base_from_member(new TrombleLossComputerImpl(params)), - FeatureFunction(boost::base_from_member::member->StateSize()), - fid_(FD::Convert("TrombleLossComputer")) {} - -TrombleLossComputer::~TrombleLossComputer() {} - -void TrombleLossComputer::TraversalFeaturesImpl(const SentenceMetadata& smeta, - const Hypergraph::Edge& edge, - const vector& ant_contexts, - SparseVector* features, - SparseVector* estimated_features, - void* out_context) const { - (void) estimated_features; - const double loss = boost::base_from_member::member->Traversal(smeta, *edge.rule_, ant_contexts, out_context); - features->set_value(fid_, loss); -} diff --git a/decoder/tromble_loss.h b/decoder/tromble_loss.h deleted file mode 100644 index fde33100..00000000 --- a/decoder/tromble_loss.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _TROMBLE_LOSS_H_ -#define _TROMBLE_LOSS_H_ - -#include -#include -#include - -#include "ff.h" -#include "wordid.h" - -// this may not be the most elegant way to implement this computation, but since we -// may need cube pruning and state splitting, we reuse the feature detector framework. -// the loss is then stored in a feature #0 (which is guaranteed to have weight 0 and -// never be a "real" feature). -class TrombleLossComputerImpl; -class TrombleLossComputer : private boost::base_from_member >, public FeatureFunction { - private: - typedef boost::scoped_ptr PImpl; - typedef FeatureFunction Base; - - public: - // String parameters are ref.txt num_ref weight1 weight2 ... weightn - // where ref.txt contains references on per line, with num_ref references per sentence - // The weights are the weight on each length n-gram. - explicit TrombleLossComputer(const std::string ¶ms); - - ~TrombleLossComputer(); - - protected: - virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta, - const HG::Edge& edge, - const std::vector& ant_contexts, - SparseVector* features, - SparseVector* estimated_features, - void* out_context) const; - private: - const int fid_; -}; - -#endif -- cgit v1.2.3 From 73a5e89074c7a531caee6faa72cfd9c22dafa43e Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 10 Nov 2013 13:22:23 -0500 Subject: fix for mavericks --- Makefile.am | 7 ++++--- configure.ac | 6 +++--- decoder/ff_context.cc | 2 +- decoder/phrasebased_translator.cc | 9 ++++++--- mteval/ns.cc | 2 +- mteval/scorer.cc | 2 +- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1c30a6ff..3438c0a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,12 +14,13 @@ SUBDIRS = \ training \ training/liblbfgs \ word-aligner \ - example_extff \ - extractor + example_extff + +# extractor #gi/pyp-topics/src gi/clda/src gi/posterior-regularisation/prjava -EXTRA_DIST = corpus tests python/pkg python/src python/tests python/examples compound-split environment +EXTRA_DIST = corpus tests python/tests python/examples compound-split environment AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = -D_GLIBCXX_PARALLEL -march=native -mtune=native -O2 -pipe -fomit-frame-pointer -Wall diff --git a/configure.ac b/configure.ac index e4183c15..9c3e692b 100644 --- a/configure.ac +++ b/configure.ac @@ -185,13 +185,13 @@ AC_CHECK_HEADER(google/dense_hash_map, AC_PROG_INSTALL -CPPFLAGS="-DPIC -fPIC $CXX11_SWITCH $CPPFLAGS -DHAVE_CONFIG_H -DKENLM_MAX_ORDER=6" +CPPFLAGS="-DPIC -fPIC $CPPFLAGS -DHAVE_CONFIG_H -DKENLM_MAX_ORDER=6" +CXXFLAGS="$CXX11_SWITCH $CXXFLAGS" if test "x$HAVE_CXX11" = "x0"; then CPPFLAGS="$CPPFLAGS -DHAVE_OLD_CPP" fi - # core cdec stuff AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([utils/Makefile]) @@ -199,7 +199,7 @@ AC_CONFIG_FILES([mteval/Makefile]) AC_CONFIG_FILES([mteval/meteor_jar.cc]) AC_CONFIG_FILES([decoder/Makefile]) AC_CONFIG_FILES([python/setup.py]) -AC_CONFIG_FILES([extractor/Makefile]) +# AC_CONFIG_FILES([extractor/Makefile]) AC_CONFIG_FILES([word-aligner/Makefile]) # KenLM stuff diff --git a/decoder/ff_context.cc b/decoder/ff_context.cc index f2b0e67c..e56f6f1f 100644 --- a/decoder/ff_context.cc +++ b/decoder/ff_context.cc @@ -46,7 +46,7 @@ void RuleContextFeatures::ReplaceMacroWithString( macro << relative_location << "]"; int macro_index = feature_instance.find(macro.str()); if (macro_index == string::npos) { - cerr << "Can't find macro " << macro << " in feature template " + cerr << "Can't find macro " << macro.str() << " in feature template " << feature_instance; abort(); } diff --git a/decoder/phrasebased_translator.cc b/decoder/phrasebased_translator.cc index 04b3e5d2..8048248e 100644 --- a/decoder/phrasebased_translator.cc +++ b/decoder/phrasebased_translator.cc @@ -54,10 +54,13 @@ struct Coverage : public vector { }; struct CoverageHash { size_t operator()(const Coverage& cov) const { - return hasher_(static_cast&>(cov)); + int seed = 131; + size_t res = 0; + for (vector::const_iterator it = cov.begin(); it != cov.end(); ++it) { + res = (res * seed) + (*it + 1); + } + return res; } - private: - boost::hash > hasher_; }; ostream& operator<<(ostream& os, const Coverage& cov) { os << '['; diff --git a/mteval/ns.cc b/mteval/ns.cc index b64d4798..c1ea238b 100644 --- a/mteval/ns.cc +++ b/mteval/ns.cc @@ -106,7 +106,7 @@ struct BleuSegmentEvaluator : public SegmentEvaluator { } struct NGramCompare { - int operator() (const vector& a, const vector& b) { + int operator() (const vector& a, const vector& b) const { const size_t as = a.size(); const size_t bs = b.size(); const size_t s = (as < bs ? as : bs); diff --git a/mteval/scorer.cc b/mteval/scorer.cc index 9eb9a76e..fedbca91 100644 --- a/mteval/scorer.cc +++ b/mteval/scorer.cc @@ -198,7 +198,7 @@ class BLEUScorerBase : public SentenceScorer { virtual float ComputeRefLength(const vector& hyp) const = 0; private: struct NGramCompare { - int operator() (const vector& a, const vector& b) { + int operator() (const vector& a, const vector& b) const { size_t as = a.size(); size_t bs = b.size(); const size_t s = (as < bs ? as : bs); -- cgit v1.2.3 From bb00ca99c527239ca163b209a599873fc9013072 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 10 Nov 2013 13:52:41 -0500 Subject: mav fixes --- Makefile.am | 4 +--- configure.ac | 2 +- python/setup.py.in | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3438c0a4..008dc704 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,9 +18,7 @@ SUBDIRS = \ # extractor -#gi/pyp-topics/src gi/clda/src gi/posterior-regularisation/prjava - -EXTRA_DIST = corpus tests python/tests python/examples compound-split environment +EXTRA_DIST = corpus tests python/cdec python/tests python/examples compound-split environment AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 AM_CPPFLAGS = -D_GLIBCXX_PARALLEL -march=native -mtune=native -O2 -pipe -fomit-frame-pointer -Wall diff --git a/configure.ac b/configure.ac index 9c3e692b..03bae25c 100644 --- a/configure.ac +++ b/configure.ac @@ -199,7 +199,7 @@ AC_CONFIG_FILES([mteval/Makefile]) AC_CONFIG_FILES([mteval/meteor_jar.cc]) AC_CONFIG_FILES([decoder/Makefile]) AC_CONFIG_FILES([python/setup.py]) -# AC_CONFIG_FILES([extractor/Makefile]) +#AC_CONFIG_FILES([extractor/Makefile]) AC_CONFIG_FILES([word-aligner/Makefile]) # KenLM stuff diff --git a/python/setup.py.in b/python/setup.py.in index 8ed0b100..cdde696e 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -7,7 +7,7 @@ LIB = ['../decoder', '../utils', '../mteval', '../training/utils', '../klm/lm', # Set automatically by configure LIBS = re.findall('-l([^\s]+)', '@LIBS@') -CPPFLAGS = re.findall('-[^\s]+', '@CPPFLAGS@') +CPPFLAGS = re.findall('-[^\s]+', '@CPPFLAGS@ @CXXFLAGS@') LDFLAGS = re.findall('-[^\s]+', '@LDFLAGS@') # Make sure linker flags go only to the linker LDFLAGS = [opt.replace('-R', '-Wl,-rpath,') for opt in LDFLAGS] -- cgit v1.2.3 From adbe2a9683b9012e280318f5569a072ce45eba25 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 10 Nov 2013 17:36:52 -0500 Subject: hack to fix compilation problems on mav --- python/cdec/sa/_sa.c | 80647 ----------------------------------------------- python/cdec/sa/_sa.cpp | 80647 +++++++++++++++++++++++++++++++++++++++++++++++ python/setup.py.in | 2 +- 3 files changed, 80648 insertions(+), 80648 deletions(-) delete mode 100644 python/cdec/sa/_sa.c create mode 100644 python/cdec/sa/_sa.cpp diff --git a/python/cdec/sa/_sa.c b/python/cdec/sa/_sa.c deleted file mode 100644 index a9f7855e..00000000 --- a/python/cdec/sa/_sa.c +++ /dev/null @@ -1,80647 +0,0 @@ -/* Generated by Cython 0.19.1 on Tue Sep 24 13:39:51 2013 */ - -#define PY_SSIZE_T_CLEAN -#ifndef CYTHON_USE_PYLONG_INTERNALS -#ifdef PYLONG_BITS_IN_DIGIT -#define CYTHON_USE_PYLONG_INTERNALS 0 -#else -#include "pyconfig.h" -#ifdef PYLONG_BITS_IN_DIGIT -#define CYTHON_USE_PYLONG_INTERNALS 1 -#else -#define CYTHON_USE_PYLONG_INTERNALS 0 -#endif -#endif -#endif -#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+. -#else -#include /* For offsetof */ -#ifndef offsetof -#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION -#define CYTHON_COMPILING_IN_PYPY 1 -#define CYTHON_COMPILING_IN_CPYTHON 0 -#else -#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 *); -#endif -#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) -#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") -#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) - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#if PY_VERSION_HEX < 0x02060000 - #define Py_TPFLAGS_HAVE_VERSION_TAG 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) -#else - #define CYTHON_PEP393_ENABLED 0 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #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) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_VERSION_HEX < 0x03020000 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #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__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and - a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is - a quiet NaN. */ - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) -#define _USE_MATH_DEFINES -#endif -#include -#define __PYX_HAVE__cdec__sa___sa -#define __PYX_HAVE_API__cdec__sa___sa -#include "string.h" -#include "stdio.h" -#include "stdlib.h" -#include "strmap.h" -#include "math.h" -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# 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*/ - -#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 -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#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) -#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; -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -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 -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#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; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - sys = PyImport_ImportModule("sys"); - if (sys == NULL) 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) { - __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++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (ascii_chars_u == NULL) 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) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - } - Py_XDECREF(sys); - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return 0; -bad: - Py_XDECREF(sys); - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#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; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (sys == NULL) 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); - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - 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; -} -#endif -#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__ */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -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", -}; - -/*--- Type declarations ---*/ -struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector; -struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule; -struct __pyx_obj_4cdec_2sa_3_sa_LCP; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats; -struct __pyx_obj_4cdec_2sa_3_sa_IntList; -struct __pyx_obj_4cdec_2sa_3_sa_Phrase; -struct __pyx_obj_4cdec_2sa_3_sa_TrieNode; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases; -struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode; -struct __pyx_obj_4cdec_2sa_3_sa_Alignment; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa_Rule; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa_Precomputation; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance; -struct __pyx_obj_4cdec_2sa_3_sa_TrieMap; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments; -struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa_FloatList; -struct __pyx_obj_4cdec_2sa_3_sa_StringMap; -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_TrieTable; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa_VEB; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice; -struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation; -struct __pyx_obj_4cdec_2sa_3_sa_Scorer; -struct __pyx_obj_4cdec_2sa_3_sa_Sampler; -struct __pyx_obj_4cdec_2sa_3_sa_Alphabet; -struct __pyx_obj_4cdec_2sa_3_sa_BiLex; -struct __pyx_obj_4cdec_2sa_3_sa_DataArray; -struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator; -struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr; -struct __pyx_obj_4cdec_2sa_3_sa_BitSet; -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence; -struct __pyx_t_4cdec_2sa_3_sa__node; -struct __pyx_t_4cdec_2sa_3_sa__BitSet; -struct __pyx_t_4cdec_2sa_3_sa__VEB; -struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge; -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; - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":9 - * from libc.string cimport memset, strcpy - * - * cdef struct _node: # <<<<<<<<<<<<<< - * _node* smaller - * _node* bigger - */ -struct __pyx_t_4cdec_2sa_3_sa__node { - struct __pyx_t_4cdec_2sa_3_sa__node *smaller; - struct __pyx_t_4cdec_2sa_3_sa__node *bigger; - int key; - int val; -}; - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":30 - * _init_lower_mask() - * - * cdef struct _BitSet: # <<<<<<<<<<<<<< - * long bitset - * int min_val - */ -struct __pyx_t_4cdec_2sa_3_sa__BitSet { - long bitset; - int min_val; - int max_val; - int size; -}; - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":168 - * return result - * - * cdef struct _VEB: # <<<<<<<<<<<<<< - * int top_universe_size - * int num_bottom_bits - */ -struct __pyx_t_4cdec_2sa_3_sa__VEB { - int top_universe_size; - int num_bottom_bits; - int max_val; - int min_val; - int size; - void *top; - void **bottom; -}; - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":10 - * cdef struct _Trie_Node # forward decl - * - * cdef struct _Trie_Edge: # <<<<<<<<<<<<<< - * int val - * _Trie_Node* node - */ -struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge { - int val; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *node; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *bigger; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *smaller; -}; - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":8 - * from libc.string cimport memset, memcpy - * - * cdef struct _Trie_Node # forward decl # <<<<<<<<<<<<<< - * - * cdef struct _Trie_Edge: - */ -struct __pyx_t_4cdec_2sa_3_sa__Trie_Node { - struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *root; - int *arr; - int arr_len; -}; - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":101 - * - * # linked list structure for storing matches in BaselineRuleFactory - * cdef struct match_node: # <<<<<<<<<<<<<< - * int* match - * match_node* next - */ -struct __pyx_t_4cdec_2sa_3_sa_match_node { - int *match; - struct __pyx_t_4cdec_2sa_3_sa_match_node *next; -}; - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":197 - * - * # struct used to encapsulate a single matching - * cdef struct Matching: # <<<<<<<<<<<<<< - * int* arr - * int start - */ -struct __pyx_t_4cdec_2sa_3_sa_Matching { - int *arr; - int start; - int end; - int sent_id; - int size; -}; - -/* "cdec/sa/_sa.pxd":25 - * cdef void read_handle(self, FILE* f) - * - * cdef class FeatureVector: # <<<<<<<<<<<<<< - * cdef IntList names - * cdef FloatList values - */ -struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa_IntList *names; - struct __pyx_obj_4cdec_2sa_3_sa_FloatList *values; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":6 - * from libc.stdio cimport FILE, fclose, fopen - * - * cdef class SuffixArray: # <<<<<<<<<<<<<< - * cdef DataArray darray - * cdef IntList sa - */ -struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray { - PyObject_HEAD - struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *__pyx_vtab; - struct __pyx_obj_4cdec_2sa_3_sa_DataArray *darray; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *sa; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *ha; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110 - * return sym_isvar(sym) - * - * def make_lattice(words): # <<<<<<<<<<<<<< - * word_ids = (sym_fromstring(word, True) for word in words) - * return tuple(((word, None, 1), ) for word in word_ids) - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice { - PyObject_HEAD - PyObject *__pyx_v_word_ids; - PyObject *__pyx_v_words; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2128 - * - * # 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 { - PyObject_HEAD - PyObject *__pyx_v_a; - struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":5 - * as k most frequent n-grams""" - * - * cdef class LCP: # <<<<<<<<<<<<<< - * cdef SuffixArray sa - * cdef IntList lcp - */ -struct __pyx_obj_4cdec_2sa_3_sa_LCP { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *sa; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *lcp; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186 - * 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 { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *__pyx_outer_scope; - PyObject *__pyx_v_a; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":39 - * ]) - * - * cdef class OnlineStats: # <<<<<<<<<<<<<< - * cdef public samples_f - * cdef public phrases_f - */ -struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats { - PyObject_HEAD - PyObject *samples_f; - PyObject *phrases_f; - PyObject *phrases_e; - PyObject *phrases_fe; - PyObject *phrases_al; - PyObject *bilex_f; - PyObject *bilex_e; - PyObject *bilex_fe; -}; - - -/* "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; -}; - - -/* "cdec/sa/_sa.pxd":29 - * cdef FloatList values - * - * cdef class Phrase: # <<<<<<<<<<<<<< - * cdef int *syms - * cdef int n, *varpos, n_vars - */ -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; - int n_vars; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":71 - * cdef int EPSILON = sym_fromstring('*EPS*', True) - * - * cdef class TrieNode: # <<<<<<<<<<<<<< - * cdef public children - * - */ -struct __pyx_obj_4cdec_2sa_3_sa_TrieNode { - PyObject_HEAD - PyObject *children; -}; - - -/* "/home/mdenkows/cdec/python/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) - * - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *__pyx_outer_scope; - PyObject *__pyx_v_line; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":72 - * self.read_text_data(fp) - * - * def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<< - * with gzip_or_text(filename) as fp: - * data = (line.split(' ||| ')[side] for line in fp) - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext { - PyObject_HEAD - PyObject *__pyx_v_fp; - int __pyx_v_side; -}; - - -/* "/home/mdenkows/cdec/python/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 { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *__pyx_outer_scope; - PyObject *__pyx_v_feat; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2147 - * # (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 { - PyObject_HEAD - PyObject *__pyx_v_extract; - PyObject *__pyx_v_f_len; - PyObject *__pyx_v_f_words; - PyObject *__pyx_v_phrases; - struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":77 - * self.children = {} - * - * cdef class ExtendedTrieNode(TrieNode): # <<<<<<<<<<<<<< - * cdef public phrase - * cdef public phrase_location - */ -struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode { - struct __pyx_obj_4cdec_2sa_3_sa_TrieNode __pyx_base; - PyObject *phrase; - PyObject *phrase_location; - PyObject *suffix_link; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":10 - * cdef int ALIGNMENT_CODE = 1 << 16 - * - * cdef class Alignment: # <<<<<<<<<<<<<< - * cdef IntList links - * cdef IntList sent_index - */ -struct __pyx_obj_4cdec_2sa_3_sa_Alignment { - PyObject_HEAD - struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *__pyx_vtab; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *links; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *sent_index; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":978 - * 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 { - PyObject_HEAD - PyObject *__pyx_v_alignment; - PyObject *__pyx_v_als; - PyObject *__pyx_v_alslist; - int __pyx_v_alt; - int __pyx_v_alt_id; - int __pyx_v_arity; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_chunklen; - PyObject *__pyx_v_count; - PyObject *__pyx_v_ctx_name; - PyObject *__pyx_v_e; - PyObject *__pyx_v_elist; - PyObject *__pyx_v_extract; - PyObject *__pyx_v_extract_start; - PyObject *__pyx_v_extract_stop; - PyObject *__pyx_v_extracts; - PyObject *__pyx_v_f; - PyObject *__pyx_v_f_syms; - PyObject *__pyx_v_fcount; - int __pyx_v_flen; - PyObject *__pyx_v_fphrases; - PyObject *__pyx_v_frontier; - PyObject *__pyx_v_frontier_nodes; - PyObject *__pyx_v_fwords; - PyObject *__pyx_v_genexpr; - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_hiero_phrase; - long __pyx_v_hit; - int __pyx_v_i; - PyObject *__pyx_v_input_match; - PyObject *__pyx_v_intersect_start_time; - PyObject *__pyx_v_intersect_stop_time; - PyObject *__pyx_v_is_shadow_path; - int __pyx_v_j; - int __pyx_v_k; - PyObject *__pyx_v_key; - PyObject *__pyx_v_lex_i; - PyObject *__pyx_v_lex_j; - PyObject *__pyx_v_loc; - PyObject *__pyx_v_locs; - int __pyx_v_lookup_required; - struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_matching; - PyObject *__pyx_v_max_locs; - PyObject *__pyx_v_meta; - PyObject *__pyx_v_new_frontier; - PyObject *__pyx_v_new_node; - PyObject *__pyx_v_next_states; - PyObject *__pyx_v_node; - PyObject *__pyx_v_nodes_isteps_away_buffer; - int __pyx_v_nualt; - int __pyx_v_num_samples; - int __pyx_v_num_subpatterns; - PyObject *__pyx_v_pathlen; - PyObject *__pyx_v_phrase; - struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_phrase_location; - PyObject *__pyx_v_prefix; - PyObject *__pyx_v_reachable_buffer; - PyObject *__pyx_v_sa_range; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_sample; - struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_scores; - PyObject *__pyx_v_seen_phrases; - struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; - PyObject *__pyx_v_spanlen; - float __pyx_v_start_time; - PyObject *__pyx_v_stats; - PyObject *__pyx_v_stop_time; - PyObject *__pyx_v_suffix_link; - int __pyx_v_suffix_link_xcat; - PyObject *__pyx_v_suffix_link_xcat_index; - PyObject *__pyx_v_word_id; - int __pyx_v_x1; - int __pyx_v_xcat; - PyObject *__pyx_v_xcat_index; - PyObject *__pyx_v_xnode; - PyObject *__pyx_v_xroot; - Py_ssize_t __pyx_t_0; - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3; - PyObject *__pyx_t_4; - PyObject *__pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - PyObject *(*__pyx_t_11)(PyObject *); -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124 - * return tuple(sym_fromstring(word, True) for word in words) - * - * def decode_words(syms): # <<<<<<<<<<<<<< - * return tuple(sym_tostring(sym) for sym in syms) - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words { - PyObject_HEAD - PyObject *__pyx_v_syms; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2124 - * 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 { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *__pyx_outer_scope; - PyObject *__pyx_v_i; - PyObject *__pyx_v_j; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; -}; - - -/* "cdec/sa/_sa.pxd":35 - * 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; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1193 - * 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 { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *__pyx_outer_scope; - PyObject *__pyx_v_word; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":188 - * - * - * cdef class Precomputation: # <<<<<<<<<<<<<< - * cdef int precompute_rank - * cdef int precompute_secondary_rank - */ -struct __pyx_obj_4cdec_2sa_3_sa_Precomputation { - PyObject_HEAD - struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *__pyx_vtab; - int precompute_rank; - int precompute_secondary_rank; - int max_length; - int max_nonterminals; - int train_max_initial_size; - int train_min_gap_size; - PyObject *precomputed_index; - PyObject *precomputed_collocations; -}; - - -/* "/home/mdenkows/cdec/python/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__ { - PyObject_HEAD - unsigned int __pyx_v_i; - struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self; - int __pyx_t_0; - unsigned int __pyx_t_1; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1891 - * # 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 { - PyObject_HEAD - PyObject *__pyx_v_al; - PyObject *__pyx_v_cover; - PyObject *__pyx_v_e_nt_cover; - PyObject *__pyx_v_e_words; - PyObject *__pyx_v_ef_span; - PyObject *__pyx_v_extract; - PyObject *__pyx_v_f_len; - PyObject *__pyx_v_f_words; - PyObject *__pyx_v_fe_span; - PyObject *__pyx_v_rules; - struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":109 - * trie_node_to_map(edge.node, result, prefix, include_zeros) - * - * cdef class TrieMap: # <<<<<<<<<<<<<< - * - * cdef _Trie_Node** root - */ -struct __pyx_obj_4cdec_2sa_3_sa_TrieMap { - PyObject_HEAD - struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *__pyx_vtab; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node **root; - int V; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":189 - * 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 { - PyObject_HEAD - PyObject *__pyx_v_point; - struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":340 - * - * - * cdef class VEBIterator: # <<<<<<<<<<<<<< - * cdef _VEB* v - * cdef int next_val - */ -struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator { - PyObject_HEAD - struct __pyx_t_4cdec_2sa_3_sa__VEB *v; - int next_val; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111 - * - * def make_lattice(words): - * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< - * return tuple(((word, None, 1), ) for word in word_ids) - * - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *__pyx_outer_scope; - PyObject *__pyx_v_word; - 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 - * - * cdef class FloatList: # <<<<<<<<<<<<<< - * cdef int size - * cdef int increment - */ -struct __pyx_obj_4cdec_2sa_3_sa_FloatList { - PyObject_HEAD - struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtab; - int size; - int increment; - int len; - float *arr; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":8 - * char* stringmap_word(StrMap *vocab, int i) - * - * cdef class StringMap: # <<<<<<<<<<<<<< - * cdef StrMap *vocab - * cdef char *word(self, int i) - */ -struct __pyx_obj_4cdec_2sa_3_sa_StringMap { - PyObject_HEAD - struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *__pyx_vtab; - StrMap *vocab; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":140 - * return self.syms[i] - * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef int i - * for i from 0 <= i < self.n: - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ { - PyObject_HEAD - int __pyx_v_i; - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self; - int __pyx_t_0; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":182 - * 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__ { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":88 - * - * - * cdef class TrieTable: # <<<<<<<<<<<<<< - * cdef public int extended - * cdef public int count - */ -struct __pyx_obj_4cdec_2sa_3_sa_TrieTable { - PyObject_HEAD - int extended; - int count; - PyObject *root; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121 - * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) - * - * def encode_words(words): # <<<<<<<<<<<<<< - * return tuple(sym_fromstring(word, True) for word in words) - * - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words { - PyObject_HEAD - PyObject *__pyx_v_words; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2129 - * # 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 { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *__pyx_outer_scope; - PyObject *__pyx_v_packed; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122 - * - * def encode_words(words): - * return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< - * - * def decode_words(syms): - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *__pyx_outer_scope; - PyObject *__pyx_v_word; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * def decode_lattice(lattice): - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *__pyx_outer_scope; - PyObject *__pyx_v_word; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2063 - * - * # 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 { - PyObject_HEAD - PyObject *__pyx_v_links; - struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119 - * - * def decode_sentence(lattice): - * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< - * - * def encode_words(words): - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr { - PyObject_HEAD - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_outer_scope; - PyObject *__pyx_v__; - PyObject *__pyx_v_sym; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; - PyObject *(*__pyx_t_2)(PyObject *); -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":354 - * - * - * cdef class VEB: # <<<<<<<<<<<<<< - * cdef _VEB* veb - * cdef int _findsucc(self, int i) - */ -struct __pyx_obj_4cdec_2sa_3_sa_VEB { - PyObject_HEAD - struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *__pyx_vtab; - struct __pyx_t_4cdec_2sa_3_sa__VEB *veb; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114 - * return tuple(((word, None, 1), ) for word in word_ids) - * - * 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) - */ -struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice { - PyObject_HEAD - PyObject *__pyx_v_lattice; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":109 - * # in the suffix array; if discontiguous, it is the set of - * # actual locations (packed into an array) - * cdef class PhraseLocation: # <<<<<<<<<<<<<< - * cdef int sa_low - * cdef int sa_high - */ -struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation { - PyObject_HEAD - struct __pyx_vtabstruct_4cdec_2sa_3_sa_PhraseLocation *__pyx_vtab; - int sa_low; - int sa_high; - int arr_low; - int arr_high; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *arr; - int num_subpatterns; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":23 - * return ' '.join('%s=%s' % feat for feat in self) - * - * cdef class Scorer: # <<<<<<<<<<<<<< - * cdef models - * def __init__(self, *models): - */ -struct __pyx_obj_4cdec_2sa_3_sa_Scorer { - PyObject_HEAD - struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer *__pyx_vtab; - PyObject *models; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":131 - * - * - * cdef class Sampler: # <<<<<<<<<<<<<< - * '''A Sampler implements a logic for choosing - * samples from a population range''' - */ -struct __pyx_obj_4cdec_2sa_3_sa_Sampler { - PyObject_HEAD - int sample_size; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *sa; -}; - - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":7 - * cdef int INDEX_MASK = (1<SetupContext((name), __LINE__, __FILE__); \ - PyGILState_Release(__pyx_gilstate_save); \ - } else { \ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil) \ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext() \ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif /* CYTHON_REFNANNY */ -#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) - -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ - -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ - -static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize_t start, - Py_ssize_t end, int direction) -{ - const char* self_ptr = PyBytes_AS_STRING(self); - Py_ssize_t self_len = PyBytes_GET_SIZE(self); - 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); - } -#if PY_MAJOR_VERSION < 3 - else if ( PyUnicode_Check(arg) ) { - return PyUnicode_Tailmatch(self, arg, start, end, direction); - } -#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; - else if (end < 0) - end += self_len; - if (end < 0) - end = 0; - if (start < 0) - start += self_len; - if (start < 0) - start = 0; - if (direction > 0) { - if (end-sub_len > start) - start = end - sub_len; - } - if (start + sub_len <= end) - retval = !memcmp(self_ptr+start, sub_ptr, 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, - Py_ssize_t end, int direction) -{ - if (unlikely(PyTuple_Check(substr))) { - Py_ssize_t i, count = PyTuple_GET_SIZE(substr); - for (i = 0; i < count; i++) { - int result; -#if CYTHON_COMPILING_IN_CPYTHON - result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substr, i), - start, end, direction); -#else - PyObject* sub = PySequence_GetItem(substr, i); - if (unlikely(!sub)) return -1; - result = __Pyx_PyBytes_SingleTailmatch(self, sub, start, end, direction); - Py_DECREF(sub); -#endif - if (result) { - return result; - } - } - return 0; - } - return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction); -} - -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ - const char* function_name); /*proto*/ - -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*/ - -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 void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ - -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename); /*proto*/ - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ - -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ - -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - -#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 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))) -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); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); - -static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) { - int result = PySequence_Contains(seq, item); - 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 = 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*/ - -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); - -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); - -static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */ - -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - -#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) - -static CYTHON_INLINE int __Pyx_mod_int(int, int); /* proto */ - -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 int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ - -#define __Pyx_SetItemInt(o, i, v, size, to_py_func, is_list, wraparound, boundscheck) \ - (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_SetItemInt_Fast(o, i, v, is_list, wraparound, boundscheck) : \ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) -static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); -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 */ -#if CYTHON_COMPILING_IN_PYPY -#define __Pyx_PyObject_AsDouble(obj) \ -(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \ - likely(PyInt_CheckExact(obj)) ? \ - PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj)) -#else -#define __Pyx_PyObject_AsDouble(obj) \ -((likely(PyFloat_CheckExact(obj))) ? \ - PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) -#endif - -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - -static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ - -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len)) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) -#endif - -static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) { - int result = PyDict_Contains(dict, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -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 */ - -#if PY_MAJOR_VERSION >= 3 -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) - PyErr_SetObject(PyExc_KeyError, args); - Py_XDECREF(args); - } - return NULL; - } - Py_INCREF(value); - return value; -} -#else - #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#endif - -#define __Pyx_CyFunction_USED 1 -#include -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CyFunction_GetClosure(f) \ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f) \ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#define __Pyx_CyFunction_Defaults(type, f) \ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { - PyCFunctionObject func; - int flags; - PyObject *func_dict; - PyObject *func_weakreflist; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_code; - PyObject *func_closure; - PyObject *func_classobj; /* No-args super() class cell */ - void *defaults; - int defaults_pyobjects; - PyObject *defaults_tuple; /* Const defaults tuple */ - PyObject *defaults_kwdict; /* Const kwonly defaults dict */ - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; /* function annotations dict */ -} __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) -static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *self, PyObject *module, - PyObject* code); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __Pyx_CyFunction_init(void); - -static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L); /*proto*/ - -#include - -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/ - -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*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 short __Pyx_PyInt_AsShort(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -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*/ - -#define __Pyx_Generator_USED -#include -#include -typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); -typedef struct { - PyObject_HEAD - __pyx_generator_body_t body; - PyObject *closure; - PyObject *exc_type; - PyObject *exc_value; - PyObject *exc_traceback; - PyObject *gi_weakreflist; - PyObject *classobj; - PyObject *yieldfrom; - int resume_label; - char is_running; // using T_BOOL for property below requires char value -} __pyx_GeneratorObject; -static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, - PyObject *closure); -static int __pyx_Generator_init(void); -static int __Pyx_Generator_clear(PyObject* self); -#if 1 || PY_VERSION_HEX < 0x030300B0 -static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); -#else -#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) -#endif - -static int __Pyx_check_binary_version(void); - -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*/ - - -/* Module declarations from 'libc.string' */ - -/* Module declarations from 'libc.stdio' */ - -/* Module declarations from 'libc.stdlib' */ - -/* Module declarations from 'libc.math' */ - -/* Module declarations from 'cdec.sa._sa' */ -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_FeatureVector = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_SuffixArray = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_LCP = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_OnlineStats = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_IntList = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Phrase = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_TrieNode = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext = 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_26_get_f_phrases = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Alignment = 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_13_decode_words = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Rule = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Precomputation = 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_21_add_instance = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_TrieMap = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_VEBIterator = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_FloatList = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_StringMap = 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_TrieTable = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words = 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_12_genexpr = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = 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_10_genexpr = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_VEB = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Scorer = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Sampler = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Alphabet = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_BiLex = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_DataArray = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_BitSetIterator = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_HieroCachingRuleFactory = 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_3_compute_stats = 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____iter__ = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_BitSet = 0; -static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence = 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; -static int __pyx_v_4cdec_2sa_3_sa_LOWER_MASK[32]; -static int __pyx_v_4cdec_2sa_3_sa_INDEX_SHIFT; -static int __pyx_v_4cdec_2sa_3_sa_INDEX_MASK; -static struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_4cdec_2sa_3_sa_ALPHABET = 0; -static int __pyx_v_4cdec_2sa_3_sa_PRECOMPUTE; -static int __pyx_v_4cdec_2sa_3_sa_MERGE; -static int __pyx_v_4cdec_2sa_3_sa_BAEZA_YATES; -static int __pyx_v_4cdec_2sa_3_sa_EPSILON; -static struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_4cdec_2sa_3_sa_FD = 0; -static char *__pyx_f_4cdec_2sa_3_sa_sym_tostring(int); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_sym_isvar(int); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_sym_getindex(int); /*proto*/ -static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int); /*proto*/ -static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__node *); /*proto*/ -static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *, int); /*proto*/ -static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void); /*proto*/ -static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(void); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa__BitSet *, int); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__BitSet *, int); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa__BitSet *, int); /*proto*/ -static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long); /*proto*/ -static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB *, int); /*proto*/ -static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__VEB *); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VEB *, int); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VEB *, int); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_sym_setindex(int, int); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_sym_fromstring(char *, int); /*proto*/ -static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie_node(void); /*proto*/ -static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie_edge(int); /*proto*/ -static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_node(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *); /*proto*/ -static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *); /*proto*/ -static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_find(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *, int); /*proto*/ -static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *, int); /*proto*/ -static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_insert(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *, int); /*proto*/ -static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *, PyObject *, PyObject *, int); /*proto*/ -static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *, PyObject *, PyObject *, int); /*proto*/ -static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa_Matching *, int *, int, int, int *); /*proto*/ -static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int, int, int *); /*proto*/ -static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *, int *, int *, int); /*proto*/ -static int __pyx_f_4cdec_2sa_3_sa_median(int, int, int); /*proto*/ -static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int, int, int *, int, int, int *, int *); /*proto*/ -#define __Pyx_MODULE_NAME "cdec.sa._sa" -int __pyx_module_is_main_cdec__sa___sa = 0; - -/* Implementation of 'cdec.sa._sa' */ -static PyObject *__pyx_builtin_open; -static PyObject *__pyx_builtin_IndexError; -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_TypeError; -static PyObject *__pyx_builtin_enumerate; -static PyObject *__pyx_builtin_map; -static PyObject *__pyx_builtin_Exception; -static PyObject *__pyx_builtin_zip; -static PyObject *__pyx_builtin_StopIteration; -static PyObject *__pyx_builtin_cmp; -static PyObject *__pyx_builtin_sorted; -static PyObject *__pyx_builtin_max; -static PyObject *__pyx_pf_4cdec_2sa_3_sa_monitor_cpu(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_2gzip_or_text(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len); /* proto */ -static void __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /* proto */ -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, float __pyx_v_val); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ -static void __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_16__iter__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /* proto */ -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_27append(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_31write(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_33read(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9StringMap___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self); /* proto */ -static void __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side, int __pyx_v_use_sent_id); /* proto */ -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_11read_bitext_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename, int __pyx_v_side); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4data___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_from_text, PyObject *__pyx_v_from_data, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_earray, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_alignment); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_6BitSet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ -static void __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, int __pyx_v_size); /* proto */ -static void __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_LCP *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sa); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_3LCP_2compute_stats(struct __pyx_obj_4cdec_2sa_3_sa_LCP *__pyx_v_self, int __pyx_v_max_n); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self); /* proto */ -static void __pyx_pf_4cdec_2sa_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sym); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_3genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_lattice_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_15decode_sentence_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_12decode_words_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_syms); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words); /* proto */ -static void __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_10arity(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci); /* proto */ -#if PY_MAJOR_VERSION < 3 -static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ -#endif -static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -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 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 -static int __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); /* proto */ -#endif -static PyObject *__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); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_7__str___genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_12alignments(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1f___get__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1e___get__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size); /* proto */ -static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_from_stats, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_precompute_rank, PyObject *__pyx_v_precompute_secondary_rank, PyObject *__pyx_v_max_length, PyObject *__pyx_v_max_nonterminals, PyObject *__pyx_v_train_max_initial_size, PyObject *__pyx_v_train_min_gap_size); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_stats, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sarray); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_side); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_v_h, struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa, PyObject *__pyx_v_pad); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(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_10read_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_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 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 */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_phrase, PyObject *__pyx_v_phrase_location, PyObject *__pyx_v_suffix_link); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_self, int __pyx_v_sa_low, int __pyx_v_sa_high, int __pyx_v_arr_low, int __pyx_v_arr_high, PyObject *__pyx_v_arr, int __pyx_v_num_subpatterns); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_self, int __pyx_v_sample_size, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_phrase_location); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_alignment, float __pyx_v_by_slack_factor, char *__pyx_v_category, PyObject *__pyx_v_max_chunks, unsigned int __pyx_v_max_initial_size, unsigned int __pyx_v_max_length, unsigned int __pyx_v_max_nonterminals, PyObject *__pyx_v_max_target_chunks, PyObject *__pyx_v_max_target_length, unsigned int __pyx_v_min_gap_size, PyObject *__pyx_v_precompute_file, unsigned int __pyx_v_precompute_secondary_rank, unsigned int __pyx_v_precompute_rank, int __pyx_v_require_aligned_terminal, int __pyx_v_require_aligned_chunks, unsigned int __pyx_v_train_max_initial_size, unsigned int __pyx_v_train_min_gap_size, int __pyx_v_tight_phrases, int __pyx_v_use_baeza_yates, int __pyx_v_use_collocations, int __pyx_v_use_index); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray, struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_edarray, struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_sampler, struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_scorer); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_frontier, PyObject *__pyx_v_res, PyObject *__pyx_v_fwords); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_skip, PyObject *__pyx_v_i, PyObject *__pyx_v_spanlen, PyObject *__pyx_v_pathlen, PyObject *__pyx_v_fwords, PyObject *__pyx_v_next_states, PyObject *__pyx_v_reachable_buffer); /* proto */ -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_lambda5(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_lambda_funcdef_lambda6(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_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_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 */ -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); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_lookup(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_ctx_name); /* proto */ -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); /* proto */ -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); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_ctx_name); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_13FeatureVector___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self, unsigned int __pyx_v_name, float __pyx_v_value); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str___genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self); /* proto */ -static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_self, PyObject *__pyx_v_models); /* proto */ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_FeatureVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_SuffixArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(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_LCP(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_OnlineStats(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_IntList(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Phrase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieNode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(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_26_get_f_phrases(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_ExtendedTrieNode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Alignment(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_13_decode_words(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_Rule(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_Precomputation(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_21_add_instance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieMap(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_VEBIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_FloatList(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_StringMap(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_TrieTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(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_12_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(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_10_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_VEB(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_PhraseLocation(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Scorer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Sampler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Alphabet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BiLex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_DataArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BitSetIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_HieroCachingRuleFactory(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_3_compute_stats(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____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BitSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static char __pyx_k_1[] = ".gz"; -static char __pyx_k_2[] = "Requested index %d of %d-length FloatList"; -static char __pyx_k_3[] = "IntList["; -static char __pyx_k_4[] = ","; -static char __pyx_k_5[] = "]"; -static char __pyx_k_6[] = "len="; -static char __pyx_k_7[] = "%s not in IntList"; -static char __pyx_k_8[] = "Requested index %d of %d-length IntList"; -static char __pyx_k_9[] = "Requested index %d:%d of %d-length IntList"; -static char __pyx_k_10[] = "Illegal key type %s for IntList"; -static char __pyx_k_14[] = "%s "; -static char __pyx_k_15[] = "\n"; -static char __pyx_k_19[] = " ||| "; -static char __pyx_k_23[] = "%d "; -static char __pyx_k_27[] = "%s %d "; -static char __pyx_k_29[] = "write_enhanced_handle"; -static char __pyx_k_33[] = "-"; -static char __pyx_k_37[] = "%d-%d "; -static char __pyx_k_44[] = "%d-%d out of bounds (I=%d,J=%d) in line %d\n"; -static char __pyx_k_47[] = ""; -static char __pyx_k_48[] = "Sort error in CLex"; -static char __pyx_k_50[] = " "; -static char __pyx_k_52[] = "%d %f %f "; -static char __pyx_k_54[] = "%d %s "; -static char __pyx_k_58[] = "%s %s %.6f %.6f\n"; -static char __pyx_k_60[] = " ("; -static char __pyx_k_61[] = ")"; -static char __pyx_k_62[] = "Constructing LCP array"; -static char __pyx_k_64[] = "LCP array completed"; -static char __pyx_k_66[] = "[%s,%d]"; -static char __pyx_k_67[] = "[%s]"; -static char __pyx_k_68[] = "\\"; -static char __pyx_k_69[] = " "; -static char __pyx_k_70[] = "Invalid LHS symbol: %d"; -static char __pyx_k_71[] = "%d-%d"; -static char __pyx_k_72[] = "precompute_secondary_rank"; -static char __pyx_k_73[] = "train_max_initial_size"; -static char __pyx_k_74[] = "Precomputing frequent intersections"; -static char __pyx_k_76[] = " Computing inverted indexes..."; -static char __pyx_k_78[] = " Computing collocations..."; -static char __pyx_k_80[] = " %d sentences"; -static char __pyx_k_85[] = "X "; -static char __pyx_k_86[] = "ERROR: unexpected pattern %s in set of precomputed collocations"; -static char __pyx_k_87[] = "RANK %d\tCOUNT, COST: %d %d\tCUMUL: %d, %d"; -static char __pyx_k_88[] = "Precomputed collocations for %d patterns out of %d possible (upper bound %d)"; -static char __pyx_k_89[] = "Precomputed inverted index for %d patterns "; -static char __pyx_k_90[] = "Precomputation took %f seconds"; -static char __pyx_k_91[] = " Bucket sort took %f seconds"; -static char __pyx_k_92[] = " Refining, sort depth = %d"; -static char __pyx_k_93[] = " Refinement took %f seconds"; -static char __pyx_k_94[] = " Finalizing sort..."; -static char __pyx_k_96[] = "Suffix array construction took %f seconds"; -static char __pyx_k_97[] = "Unexpected condition found in q3sort: sort from %d to %d"; -static char __pyx_k__0[] = "0"; -static char __pyx_k__1[] = "1"; -static char __pyx_k__a[] = "a"; -static char __pyx_k__e[] = "e"; -static char __pyx_k__f[] = "f"; -static char __pyx_k__h[] = "h"; -static char __pyx_k__i[] = "i"; -static char __pyx_k__j[] = "j"; -static char __pyx_k__k[] = "k"; -static char __pyx_k__r[] = "r"; -static char __pyx_k__w[] = "w"; -static char __pyx_k__x[] = "x"; -static char __pyx_k__y[] = "y"; -static char __pyx_k_101[] = "OnlineStats.__cinit__.."; -static char __pyx_k_102[] = "cdec.sa._sa"; -static char __pyx_k_104[] = "Sampling strategy: uniform, max sample size = %d"; -static char __pyx_k_105[] = "Sampling strategy: no sampling"; -static char __pyx_k_107[] = "require_aligned_terminal"; -static char __pyx_k_108[] = "require_aligned_chunks"; -static char __pyx_k_109[] = "[X]"; -static char __pyx_k_110[] = "Must specify an alignment object"; -static char __pyx_k_112[] = "Reading precomputed data from file %s... "; -static char __pyx_k_113[] = "Precomputation done with max nonterminals %d, decoder uses %d"; -static char __pyx_k_114[] = "Precomputation done with max terminals %d, decoder uses %d"; -static char __pyx_k_115[] = "Precomputation done with max initial size %d, decoder uses %d"; -static char __pyx_k_116[] = "Precomputation done with min gap size %d, decoder uses %d"; -static char __pyx_k_117[] = "Converting %d hash keys on precomputed inverted index... "; -static char __pyx_k_118[] = "Converting %d hash keys on precomputed collocations... "; -static char __pyx_k_119[] = "Processing precomputations took %f seconds"; -static char __pyx_k_120[] = "{"; - static char __pyx_k_121[] = "("; -static char __pyx_k_122[] = "}"; -static char __pyx_k_123[] = "get_precomputed_collocation"; -static char __pyx_k_124[] = "double binary"; -static char __pyx_k_125[] = "HieroCachingRuleFactory.input..lambda4.."; -static char __pyx_k_126[] = "Keyword trie error"; -static char __pyx_k_128[] = "HieroCachingRuleFactory.input.."; -static char __pyx_k_129[] = "get_all_nodes_isteps_away"; -static char __pyx_k_130[] = "Total time for rule lookup, extraction, and scoring = %f seconds"; -static char __pyx_k_131[] = " Extract time = %f seconds"; -static char __pyx_k_132[] = " Intersect time = %f seconds"; -static char __pyx_k_133[] = "No aligned terminals"; -static char __pyx_k_134[] = "Unaligned chunk"; -static char __pyx_k_135[] = "Gaps are not tight phrases"; -static char __pyx_k_136[] = "Inside edges of preceding subphrase are not tight"; -static char __pyx_k_137[] = "Inside edges of following subphrase are not tight"; -static char __pyx_k_138[] = "Subphrase [%d, %d] failed integrity check"; -static char __pyx_k_139[] = "Didn't extract anything from [%d, %d] -> [%d, %d]"; -static char __pyx_k_140[] = "Unable to extract basic phrase"; -static char __pyx_k_144[] = "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi"; -static char __pyx_k_145[] = "HieroCachingRuleFactory.add_instance..extract"; -static char __pyx_k_147[] = "HieroCachingRuleFactory.form_rule.."; -static char __pyx_k_150[] = "{0}-{1}"; -static char __pyx_k_151[] = "[X] ||| {0} ||| {1} ||| {2}"; -static char __pyx_k_152[] = "OnlineFeatureContext"; -static char __pyx_k_155[] = "HieroCachingRuleFactory.get_f_phrases..extract"; -static char __pyx_k_156[] = "%s=%s"; -static char __pyx_k_158[] = "/home/mdenkows/cdec/python/cdec/sa/_sa.pyx"; -static char __pyx_k_161[] = "cdec.sa"; -static char __pyx_k_165[] = "/home/mdenkows/cdec/python/cdec/sa/sym.pxi"; -static char __pyx_k_176[] = "*EPS*"; -static char __pyx_k__al[] = "al"; -static char __pyx_k__gc[] = "gc"; -static char __pyx_k__nt[] = "nt"; -static char __pyx_k__sa[] = "sa"; -static char __pyx_k__wc[] = "wc"; -static char __pyx_k__arr[] = "arr"; -static char __pyx_k__cmp[] = "cmp"; -static char __pyx_k__col[] = "col"; -static char __pyx_k__e_i[] = "e_i"; -static char __pyx_k__e_j[] = "e_j"; -static char __pyx_k__end[] = "end"; -static char __pyx_k__f_i[] = "f_i"; -static char __pyx_k__f_j[] = "f_j"; -static char __pyx_k__get[] = "get"; -static char __pyx_k__isa[] = "isa"; -static char __pyx_k__ito[] = "ito"; -static char __pyx_k__key[] = "key"; -static char __pyx_k__lhs[] = "lhs"; -static char __pyx_k__low[] = "low"; -static char __pyx_k__map[] = "map"; -static char __pyx_k__max[] = "max"; -static char __pyx_k__ntc[] = "ntc"; -static char __pyx_k__pad[] = "pad"; -static char __pyx_k__pop[] = "pop"; -static char __pyx_k__res[] = "res"; -static char __pyx_k__set[] = "set"; -static char __pyx_k__sym[] = "sym"; -static char __pyx_k__vec[] = "vec"; -static char __pyx_k__zip[] = "zip"; -static char __pyx_k__NULL[] = "NULL"; -static char __pyx_k__args[] = "args"; -static char __pyx_k__dist[] = "dist"; -static char __pyx_k__gzip[] = "gzip"; -static char __pyx_k__high[] = "high"; -static char __pyx_k__info[] = "info"; -static char __pyx_k__join[] = "join"; -static char __pyx_k__link[] = "link"; -static char __pyx_k__meta[] = "meta"; -static char __pyx_k__name[] = "name"; -static char __pyx_k__open[] = "open"; -static char __pyx_k__seek[] = "seek"; -static char __pyx_k__send[] = "send"; -static char __pyx_k__side[] = "side"; -static char __pyx_k__size[] = "size"; -static char __pyx_k__skip[] = "skip"; -static char __pyx_k__stop[] = "stop"; -static char __pyx_k__syms[] = "syms"; -static char __pyx_k__warn[] = "warn"; -static char __pyx_k__word[] = "word"; -static char __pyx_k___SEP_[] = "_SEP_"; -static char __pyx_k__arity[] = "arity"; -static char __pyx_k__chain[] = "chain"; -static char __pyx_k__close[] = "close"; -static char __pyx_k__debug[] = "debug"; -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__isvar[] = "isvar"; -static char __pyx_k__lex_i[] = "lex_i"; -static char __pyx_k__lex_j[] = "lex_j"; -static char __pyx_k__links[] = "links"; -static char __pyx_k__merge[] = "merge"; -static char __pyx_k__range[] = "range"; -static char __pyx_k__reset[] = "reset"; -static char __pyx_k__split[] = "split"; -static char __pyx_k__start[] = "start"; -static char __pyx_k__stats[] = "stats"; -static char __pyx_k__throw[] = "throw"; -static char __pyx_k__toMap[] = "toMap"; -static char __pyx_k__value[] = "value"; -static char __pyx_k__words[] = "words"; -static char __pyx_k__write[] = "write"; -static char __pyx_k__append[] = "append"; -static char __pyx_k__e_span[] = "e_span"; -static char __pyx_k__e_text[] = "e_text"; -static char __pyx_k__earray[] = "earray"; -static char __pyx_k__extend[] = "extend"; -static char __pyx_k__f_span[] = "f_span"; -static char __pyx_k__f_text[] = "f_text"; -static char __pyx_k__fcount[] = "fcount"; -static char __pyx_k__format[] = "format"; -static char __pyx_k__fwords[] = "fwords"; -static char __pyx_k__get_id[] = "get_id"; -static char __pyx_k__insert[] = "insert"; -static char __pyx_k__link_i[] = "link_i"; -static char __pyx_k__link_j[] = "link_j"; -static char __pyx_k__logger[] = "logger"; -static char __pyx_k__lookup[] = "lookup"; -static char __pyx_k__offset[] = "offset"; -static char __pyx_k__online[] = "online"; -static char __pyx_k__phrase[] = "phrase"; -static char __pyx_k__q3sort[] = "q3sort"; -static char __pyx_k__sa_low[] = "sa_low"; -static char __pyx_k__sample[] = "sample"; -static char __pyx_k__sarray[] = "sarray"; -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__unlink[] = "unlink"; -static char __pyx_k__Counter[] = "Counter"; -static char __pyx_k__advance[] = "advance"; -static char __pyx_k__arr_low[] = "arr_low"; -static char __pyx_k__bilex_e[] = "bilex_e"; -static char __pyx_k__bilex_f[] = "bilex_f"; -static char __pyx_k__collect[] = "collect"; -static char __pyx_k__e_words[] = "e_words"; -static char __pyx_k__edarray[] = "edarray"; -static char __pyx_k__ephrase[] = "ephrase"; -static char __pyx_k__extract[] = "extract"; -static char __pyx_k__f_words[] = "f_words"; -static char __pyx_k__fphrase[] = "fphrase"; -static char __pyx_k__fsarray[] = "fsarray"; -static char __pyx_k__genexpr[] = "genexpr"; -static char __pyx_k__lattice[] = "lattice"; -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_open[] = "nt_open"; -static char __pyx_k__pathlen[] = "pathlen"; -static char __pyx_k__sa_high[] = "sa_high"; -static char __pyx_k__sampler[] = "sampler"; -static char __pyx_k__spanlen[] = "spanlen"; -static char __pyx_k__GzipFile[] = "GzipFile"; -static char __pyx_k____exit__[] = "__exit__"; -static char __pyx_k____main__[] = "__main__"; -static char __pyx_k____name__[] = "__name__"; -static char __pyx_k____test__[] = "__test__"; -static char __pyx_k___columns[] = "_columns"; -static char __pyx_k__arr_high[] = "arr_high"; -static char __pyx_k__bilex_fe[] = "bilex_fe"; -static char __pyx_k__category[] = "category"; -static char __pyx_k__children[] = "children"; -static char __pyx_k__ctx_name[] = "ctx_name"; -static char __pyx_k__curr_idx[] = "curr_idx"; -static char __pyx_k__extended[] = "extended"; -static char __pyx_k__filename[] = "filename"; -static char __pyx_k__frontier[] = "frontier"; -static char __pyx_k__get_e_id[] = "get_e_id"; -static char __pyx_k__get_f_id[] = "get_f_id"; -static char __pyx_k__get_word[] = "get_word"; -static char __pyx_k__getchunk[] = "getchunk"; -static char __pyx_k__min_dist[] = "min_dist"; -static char __pyx_k__resource[] = "resource"; -static char __pyx_k__ru_stime[] = "ru_stime"; -static char __pyx_k__ru_utime[] = "ru_utime"; -static char __pyx_k__shortest[] = "shortest"; -static char __pyx_k__span_dec[] = "span_dec"; -static char __pyx_k__span_inc[] = "span_inc"; -static char __pyx_k__word_ids[] = "word_ids"; -static char __pyx_k__Exception[] = "Exception"; -static char __pyx_k__INCREMENT[] = "INCREMENT"; -static char __pyx_k__TypeError[] = "TypeError"; -static char __pyx_k____enter__[] = "__enter__"; -static char __pyx_k__alignment[] = "alignment"; -static char __pyx_k__enumerate[] = "enumerate"; -static char __pyx_k__form_rule[] = "form_rule"; -static char __pyx_k__from_data[] = "from_data"; -static char __pyx_k__from_text[] = "from_text"; -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__itertools[] = "itertools"; -static char __pyx_k__min_bound[] = "min_bound"; -static char __pyx_k__new_lex_i[] = "new_lex_i"; -static char __pyx_k__new_lex_j[] = "new_lex_j"; -static char __pyx_k__paircount[] = "paircount"; -static char __pyx_k__partition[] = "partition"; -static char __pyx_k__phrases_e[] = "phrases_e"; -static char __pyx_k__phrases_f[] = "phrases_f"; -static char __pyx_k__reachable[] = "reachable"; -static char __pyx_k__read_text[] = "read_text"; -static char __pyx_k__samples_f[] = "samples_f"; -static char __pyx_k__use_index[] = "use_index"; -static char __pyx_k__IndexError[] = "IndexError"; -static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k____import__[] = "__import__"; -static char __pyx_k__alignments[] = "alignments"; -static char __pyx_k__from_stats[] = "from_stats"; -static char __pyx_k__input_span[] = "input_span"; -static char __pyx_k__itervalues[] = "itervalues"; -static char __pyx_k__max_chunks[] = "max_chunks"; -static char __pyx_k__max_length[] = "max_length"; -static char __pyx_k__namedtuple[] = "namedtuple"; -static char __pyx_k__phrases_al[] = "phrases_al"; -static char __pyx_k__phrases_fe[] = "phrases_fe"; -static char __pyx_k__plus_links[] = "plus_links"; -static char __pyx_k__precompute[] = "precompute"; -static char __pyx_k__span_check[] = "span_check"; -static char __pyx_k__write_text[] = "write_text"; -static char __pyx_k__END_OF_FILE[] = "END_OF_FILE"; -static char __pyx_k__END_OF_LINE[] = "END_OF_LINE"; -static char __pyx_k__RUSAGE_SELF[] = "RUSAGE_SELF"; -static char __pyx_k__collections[] = "collections"; -static char __pyx_k__defaultdict[] = "defaultdict"; -static char __pyx_k__from_binary[] = "from_binary"; -static char __pyx_k__initial_len[] = "initial_len"; -static char __pyx_k__input_match[] = "input_match"; -static char __pyx_k__monitor_cpu[] = "monitor_cpu"; -static char __pyx_k__next_states[] = "next_states"; -static char __pyx_k__old_last_nt[] = "old_last_nt"; -static char __pyx_k__precomputed[] = "precomputed"; -static char __pyx_k__read_binary[] = "read_binary"; -static char __pyx_k__read_bitext[] = "read_bitext"; -static char __pyx_k__sample_size[] = "sample_size"; -static char __pyx_k__suffix_link[] = "suffix_link"; -static char __pyx_k__use_sent_id[] = "use_sent_id"; -static char __pyx_k___doquicksort[] = "_doquicksort"; -static char __pyx_k__decode_words[] = "decode_words"; -static char __pyx_k__encode_words[] = "encode_words"; -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__StopIteration[] = "StopIteration"; -static char __pyx_k__alphabet_size[] = "alphabet_size"; -static char __pyx_k__from_iterable[] = "from_iterable"; -static char __pyx_k__fsample_count[] = "fsample_count"; -static char __pyx_k__get_f_phrases[] = "get_f_phrases"; -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____pyx_vtable__[] = "__pyx_vtable__"; -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__by_slack_factor[] = "by_slack_factor"; -static char __pyx_k__decode_sentence[] = "decode_sentence"; -static char __pyx_k__get_next_states[] = "get_next_states"; -static char __pyx_k__num_subpatterns[] = "num_subpatterns"; -static char __pyx_k__phrase_location[] = "phrase_location"; -static char __pyx_k__precompute_file[] = "precompute_file"; -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__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__use_collocations[] = "use_collocations"; -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"; -static char __pyx_k__train_min_gap_size[] = "train_min_gap_size"; -static char __pyx_k__pattern2phrase_plus[] = "pattern2phrase_plus"; -static PyObject *__pyx_kp_s_1; -static PyObject *__pyx_kp_s_10; -static PyObject *__pyx_n_s_101; -static PyObject *__pyx_n_s_102; -static PyObject *__pyx_kp_s_104; -static PyObject *__pyx_kp_s_105; -static PyObject *__pyx_n_s_107; -static PyObject *__pyx_n_s_108; -static PyObject *__pyx_kp_s_110; -static PyObject *__pyx_kp_s_112; -static PyObject *__pyx_kp_s_113; -static PyObject *__pyx_kp_s_114; -static PyObject *__pyx_kp_s_115; -static PyObject *__pyx_kp_s_116; -static PyObject *__pyx_kp_s_117; -static PyObject *__pyx_kp_s_118; -static PyObject *__pyx_kp_s_119; -static PyObject *__pyx_kp_s_120; -static PyObject *__pyx_kp_s_121; -static PyObject *__pyx_kp_s_122; -static PyObject *__pyx_n_s_123; -static PyObject *__pyx_kp_s_124; -static PyObject *__pyx_n_s_125; -static PyObject *__pyx_kp_s_126; -static PyObject *__pyx_n_s_128; -static PyObject *__pyx_n_s_129; -static PyObject *__pyx_kp_s_130; -static PyObject *__pyx_kp_s_131; -static PyObject *__pyx_kp_s_132; -static PyObject *__pyx_kp_s_133; -static PyObject *__pyx_kp_s_134; -static PyObject *__pyx_kp_s_135; -static PyObject *__pyx_kp_s_136; -static PyObject *__pyx_kp_s_137; -static PyObject *__pyx_kp_s_138; -static PyObject *__pyx_kp_s_139; -static PyObject *__pyx_kp_s_14; -static PyObject *__pyx_kp_s_140; -static PyObject *__pyx_kp_s_144; -static PyObject *__pyx_n_s_145; -static PyObject *__pyx_n_s_147; -static PyObject *__pyx_kp_s_15; -static PyObject *__pyx_kp_s_150; -static PyObject *__pyx_kp_s_151; -static PyObject *__pyx_n_s_152; -static PyObject *__pyx_n_s_155; -static PyObject *__pyx_kp_s_156; -static PyObject *__pyx_kp_s_158; -static PyObject *__pyx_kp_s_161; -static PyObject *__pyx_kp_s_165; -static PyObject *__pyx_kp_s_19; -static PyObject *__pyx_kp_s_2; -static PyObject *__pyx_kp_s_23; -static PyObject *__pyx_kp_s_27; -static PyObject *__pyx_n_s_29; -static PyObject *__pyx_kp_s_3; -static PyObject *__pyx_kp_s_33; -static PyObject *__pyx_kp_s_37; -static PyObject *__pyx_kp_s_4; -static PyObject *__pyx_kp_s_44; -static PyObject *__pyx_kp_s_47; -static PyObject *__pyx_kp_s_48; -static PyObject *__pyx_kp_s_5; -static PyObject *__pyx_kp_s_50; -static PyObject *__pyx_kp_s_52; -static PyObject *__pyx_kp_s_54; -static PyObject *__pyx_kp_s_58; -static PyObject *__pyx_kp_s_6; -static PyObject *__pyx_kp_s_60; -static PyObject *__pyx_kp_s_61; -static PyObject *__pyx_kp_s_62; -static PyObject *__pyx_kp_s_64; -static PyObject *__pyx_kp_s_66; -static PyObject *__pyx_kp_s_67; -static PyObject *__pyx_kp_s_68; -static PyObject *__pyx_kp_s_69; -static PyObject *__pyx_kp_s_7; -static PyObject *__pyx_kp_s_70; -static PyObject *__pyx_kp_s_71; -static PyObject *__pyx_n_s_72; -static PyObject *__pyx_n_s_73; -static PyObject *__pyx_kp_s_74; -static PyObject *__pyx_kp_s_76; -static PyObject *__pyx_kp_s_78; -static PyObject *__pyx_kp_s_8; -static PyObject *__pyx_kp_s_80; -static PyObject *__pyx_kp_s_85; -static PyObject *__pyx_kp_s_86; -static PyObject *__pyx_kp_s_87; -static PyObject *__pyx_kp_s_88; -static PyObject *__pyx_kp_s_89; -static PyObject *__pyx_kp_s_9; -static PyObject *__pyx_kp_s_90; -static PyObject *__pyx_kp_s_91; -static PyObject *__pyx_kp_s_92; -static PyObject *__pyx_kp_s_93; -static PyObject *__pyx_kp_s_94; -static PyObject *__pyx_kp_s_96; -static PyObject *__pyx_kp_s_97; -static PyObject *__pyx_kp_s__0; -static PyObject *__pyx_kp_s__1; -static PyObject *__pyx_n_s__Counter; -static PyObject *__pyx_n_s__END_OF_FILE; -static PyObject *__pyx_n_s__END_OF_LINE; -static PyObject *__pyx_n_s__Exception; -static PyObject *__pyx_n_s__FeatureContext; -static PyObject *__pyx_n_s__GzipFile; -static PyObject *__pyx_n_s__INCREMENT; -static PyObject *__pyx_n_s__INITIAL_CAPACITY; -static PyObject *__pyx_n_s__IndexError; -static PyObject *__pyx_n_s__NULL; -static PyObject *__pyx_n_s__RUSAGE_SELF; -static PyObject *__pyx_n_s__StopIteration; -static PyObject *__pyx_n_s__TypeError; -static PyObject *__pyx_n_s__ValueError; -static PyObject *__pyx_n_s____enter__; -static PyObject *__pyx_n_s____exit__; -static PyObject *__pyx_n_s____import__; -static PyObject *__pyx_n_s____main__; -static PyObject *__pyx_n_s____name__; -static PyObject *__pyx_n_s____pyx_vtable__; -static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s___columns; -static PyObject *__pyx_n_s___doquicksort; -static PyObject *__pyx_n_s__a; -static PyObject *__pyx_n_s__advance; -static PyObject *__pyx_n_s__al; -static PyObject *__pyx_n_s__alignment; -static PyObject *__pyx_n_s__alignments; -static PyObject *__pyx_n_s__alphabet_size; -static PyObject *__pyx_n_s__append; -static PyObject *__pyx_n_s__args; -static PyObject *__pyx_n_s__arity; -static PyObject *__pyx_n_s__arr; -static PyObject *__pyx_n_s__arr_high; -static PyObject *__pyx_n_s__arr_low; -static PyObject *__pyx_n_s__bilex_e; -static PyObject *__pyx_n_s__bilex_f; -static PyObject *__pyx_n_s__bilex_fe; -static PyObject *__pyx_n_s__by_slack_factor; -static PyObject *__pyx_n_s__category; -static PyObject *__pyx_n_s__chain; -static PyObject *__pyx_n_s__children; -static PyObject *__pyx_n_s__close; -static PyObject *__pyx_n_s__cmp; -static PyObject *__pyx_n_s__col; -static PyObject *__pyx_n_s__collect; -static PyObject *__pyx_n_s__collections; -static PyObject *__pyx_n_s__ctx_name; -static PyObject *__pyx_n_s__curr_idx; -static PyObject *__pyx_n_s__debug; -static PyObject *__pyx_n_s__decode_lattice; -static PyObject *__pyx_n_s__decode_sentence; -static PyObject *__pyx_n_s__decode_words; -static PyObject *__pyx_n_s__defaultdict; -static PyObject *__pyx_n_s__dist; -static PyObject *__pyx_n_s__e; -static PyObject *__pyx_n_s__e_i; -static PyObject *__pyx_n_s__e_j; -static PyObject *__pyx_n_s__e_span; -static PyObject *__pyx_n_s__e_text; -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__end; -static PyObject *__pyx_n_s__enumerate; -static PyObject *__pyx_n_s__ephrase; -static PyObject *__pyx_n_s__eword; -static PyObject *__pyx_n_s__extend; -static PyObject *__pyx_n_s__extended; -static PyObject *__pyx_n_s__extract; -static PyObject *__pyx_n_s__f; -static PyObject *__pyx_n_s__f_i; -static PyObject *__pyx_n_s__f_j; -static PyObject *__pyx_n_s__f_span; -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__form_rule; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_s__fphrase; -static PyObject *__pyx_n_s__from_binary; -static PyObject *__pyx_n_s__from_data; -static PyObject *__pyx_n_s__from_iterable; -static PyObject *__pyx_n_s__from_stats; -static PyObject *__pyx_n_s__from_text; -static PyObject *__pyx_n_s__frontier; -static PyObject *__pyx_n_s__fsample_count; -static PyObject *__pyx_n_s__fsarray; -static PyObject *__pyx_n_s__fword; -static PyObject *__pyx_n_s__fwords; -static PyObject *__pyx_n_s__gc; -static PyObject *__pyx_n_s__genexpr; -static PyObject *__pyx_n_s__get; -static PyObject *__pyx_n_s__getLogger; -static PyObject *__pyx_n_s__get_e_id; -static PyObject *__pyx_n_s__get_f_id; -static PyObject *__pyx_n_s__get_f_phrases; -static PyObject *__pyx_n_s__get_id; -static PyObject *__pyx_n_s__get_next_states; -static PyObject *__pyx_n_s__get_word; -static PyObject *__pyx_n_s__getchunk; -static PyObject *__pyx_n_s__getrusage; -static PyObject *__pyx_n_s__gzip; -static PyObject *__pyx_n_s__gzip_or_text; -static PyObject *__pyx_n_s__h; -static PyObject *__pyx_n_s__high; -static PyObject *__pyx_n_s__i; -static PyObject *__pyx_n_s__ifrom; -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_match; -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__iteritems; -static PyObject *__pyx_n_s__itertools; -static PyObject *__pyx_n_s__itervalues; -static PyObject *__pyx_n_s__ito; -static PyObject *__pyx_n_s__j; -static PyObject *__pyx_n_s__join; -static PyObject *__pyx_n_s__k; -static PyObject *__pyx_n_s__key; -static PyObject *__pyx_n_s__lattice; -static PyObject *__pyx_n_s__lex_i; -static PyObject *__pyx_n_s__lex_j; -static PyObject *__pyx_n_s__lhs; -static PyObject *__pyx_n_s__link; -static PyObject *__pyx_n_s__link_i; -static PyObject *__pyx_n_s__link_j; -static PyObject *__pyx_n_s__links; -static PyObject *__pyx_n_s__logger; -static PyObject *__pyx_n_s__logging; -static PyObject *__pyx_n_s__lookup; -static PyObject *__pyx_n_s__low; -static PyObject *__pyx_n_s__make_lattice; -static PyObject *__pyx_n_s__map; -static PyObject *__pyx_n_s__matches; -static PyObject *__pyx_n_s__max; -static PyObject *__pyx_n_s__max_chunks; -static PyObject *__pyx_n_s__max_initial_size; -static PyObject *__pyx_n_s__max_length; -static PyObject *__pyx_n_s__max_nonterminals; -static PyObject *__pyx_n_s__max_target_chunks; -static PyObject *__pyx_n_s__max_target_length; -static PyObject *__pyx_n_s__merge; -static PyObject *__pyx_n_s__meta; -static PyObject *__pyx_n_s__min_bound; -static PyObject *__pyx_n_s__min_dist; -static PyObject *__pyx_n_s__min_gap_size; -static PyObject *__pyx_n_s__monitor_cpu; -static PyObject *__pyx_n_s__name; -static PyObject *__pyx_n_s__namedtuple; -static PyObject *__pyx_n_s__new_e_i; -static PyObject *__pyx_n_s__new_e_j; -static PyObject *__pyx_n_s__new_lex_i; -static PyObject *__pyx_n_s__new_lex_j; -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_open; -static PyObject *__pyx_n_s__ntc; -static PyObject *__pyx_n_s__num_subpatterns; -static PyObject *__pyx_n_s__offset; -static PyObject *__pyx_n_s__old_last_nt; -static PyObject *__pyx_n_s__online; -static PyObject *__pyx_n_s__online_ctx_lookup; -static PyObject *__pyx_n_s__open; -static PyObject *__pyx_n_s__pad; -static PyObject *__pyx_n_s__paircount; -static PyObject *__pyx_n_s__partition; -static PyObject *__pyx_n_s__pathlen; -static PyObject *__pyx_n_s__pattern2phrase; -static PyObject *__pyx_n_s__pattern2phrase_plus; -static PyObject *__pyx_n_s__phrase; -static PyObject *__pyx_n_s__phrase_location; -static PyObject *__pyx_n_s__phrases_al; -static PyObject *__pyx_n_s__phrases_e; -static PyObject *__pyx_n_s__phrases_f; -static PyObject *__pyx_n_s__phrases_fe; -static PyObject *__pyx_n_s__plus_links; -static PyObject *__pyx_n_s__pop; -static PyObject *__pyx_n_s__precompute; -static PyObject *__pyx_n_s__precompute_file; -static PyObject *__pyx_n_s__precompute_rank; -static PyObject *__pyx_n_s__precomputed; -static PyObject *__pyx_n_s__q3sort; -static PyObject *__pyx_n_s__range; -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_text; -static PyObject *__pyx_n_s__read_text_data; -static PyObject *__pyx_n_s__res; -static PyObject *__pyx_n_s__reset; -static PyObject *__pyx_n_s__resource; -static PyObject *__pyx_n_s__ru_stime; -static PyObject *__pyx_n_s__ru_utime; -static PyObject *__pyx_n_s__sa; -static PyObject *__pyx_n_s__sa_high; -static PyObject *__pyx_n_s__sa_low; -static PyObject *__pyx_n_s__sample; -static PyObject *__pyx_n_s__sample_size; -static PyObject *__pyx_n_s__sampler; -static PyObject *__pyx_n_s__samples_f; -static PyObject *__pyx_n_s__sarray; -static PyObject *__pyx_n_s__scorer; -static PyObject *__pyx_n_s__scores; -static PyObject *__pyx_n_s__seek; -static PyObject *__pyx_n_s__send; -static PyObject *__pyx_n_s__set; -static PyObject *__pyx_n_s__shortest; -static PyObject *__pyx_n_s__side; -static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__skip; -static PyObject *__pyx_n_s__sorted; -static PyObject *__pyx_n_s__source; -static PyObject *__pyx_n_s__span_check; -static PyObject *__pyx_n_s__span_dec; -static PyObject *__pyx_n_s__span_inc; -static PyObject *__pyx_n_s__spanlen; -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__suffix_link; -static PyObject *__pyx_n_s__sym; -static PyObject *__pyx_n_s__syms; -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__train_min_gap_size; -static PyObject *__pyx_n_s__unlink; -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_n_s__value; -static PyObject *__pyx_n_s__vec; -static PyObject *__pyx_n_s__w; -static PyObject *__pyx_n_s__warn; -static PyObject *__pyx_n_s__wc; -static PyObject *__pyx_n_s__word; -static PyObject *__pyx_n_s__word_alignments; -static PyObject *__pyx_n_s__word_ids; -static PyObject *__pyx_n_s__words; -static PyObject *__pyx_n_s__write; -static PyObject *__pyx_n_s__write_text; -static PyObject *__pyx_n_s__x; -static PyObject *__pyx_n_s__y; -static PyObject *__pyx_n_s__zip; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_5; -static PyObject *__pyx_int_7; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_int_10; -static PyObject *__pyx_int_20; -static PyObject *__pyx_int_1000; -static PyObject *__pyx_k_43; -static PyObject *__pyx_k_103; -static PyObject *__pyx_k_slice_22; -static PyObject *__pyx_k_tuple_11; -static PyObject *__pyx_k_tuple_12; -static PyObject *__pyx_k_tuple_13; -static PyObject *__pyx_k_tuple_16; -static PyObject *__pyx_k_tuple_17; -static PyObject *__pyx_k_tuple_18; -static PyObject *__pyx_k_tuple_20; -static PyObject *__pyx_k_tuple_21; -static PyObject *__pyx_k_tuple_24; -static PyObject *__pyx_k_tuple_25; -static PyObject *__pyx_k_tuple_26; -static PyObject *__pyx_k_tuple_28; -static PyObject *__pyx_k_tuple_30; -static PyObject *__pyx_k_tuple_31; -static PyObject *__pyx_k_tuple_32; -static PyObject *__pyx_k_tuple_34; -static PyObject *__pyx_k_tuple_35; -static PyObject *__pyx_k_tuple_36; -static PyObject *__pyx_k_tuple_38; -static PyObject *__pyx_k_tuple_39; -static PyObject *__pyx_k_tuple_40; -static PyObject *__pyx_k_tuple_41; -static PyObject *__pyx_k_tuple_42; -static PyObject *__pyx_k_tuple_45; -static PyObject *__pyx_k_tuple_46; -static PyObject *__pyx_k_tuple_49; -static PyObject *__pyx_k_tuple_51; -static PyObject *__pyx_k_tuple_53; -static PyObject *__pyx_k_tuple_55; -static PyObject *__pyx_k_tuple_56; -static PyObject *__pyx_k_tuple_57; -static PyObject *__pyx_k_tuple_59; -static PyObject *__pyx_k_tuple_63; -static PyObject *__pyx_k_tuple_65; -static PyObject *__pyx_k_tuple_75; -static PyObject *__pyx_k_tuple_77; -static PyObject *__pyx_k_tuple_79; -static PyObject *__pyx_k_tuple_81; -static PyObject *__pyx_k_tuple_82; -static PyObject *__pyx_k_tuple_83; -static PyObject *__pyx_k_tuple_84; -static PyObject *__pyx_k_tuple_95; -static PyObject *__pyx_k_tuple_98; -static PyObject *__pyx_k_tuple_99; -static PyObject *__pyx_k_slice_141; -static PyObject *__pyx_k_slice_146; -static PyObject *__pyx_k_slice_148; -static PyObject *__pyx_k_slice_149; -static PyObject *__pyx_k_tuple_100; -static PyObject *__pyx_k_tuple_106; -static PyObject *__pyx_k_tuple_111; -static PyObject *__pyx_k_tuple_127; -static PyObject *__pyx_k_tuple_142; -static PyObject *__pyx_k_tuple_153; -static PyObject *__pyx_k_tuple_159; -static PyObject *__pyx_k_tuple_162; -static PyObject *__pyx_k_tuple_163; -static PyObject *__pyx_k_tuple_166; -static PyObject *__pyx_k_tuple_168; -static PyObject *__pyx_k_tuple_170; -static PyObject *__pyx_k_tuple_172; -static PyObject *__pyx_k_tuple_174; -static PyObject *__pyx_k_tuple_177; -static PyObject *__pyx_k_tuple_179; -static PyObject *__pyx_k_tuple_181; -static PyObject *__pyx_k_codeobj_143; -static PyObject *__pyx_k_codeobj_154; -static PyObject *__pyx_k_codeobj_157; -static PyObject *__pyx_k_codeobj_160; -static PyObject *__pyx_k_codeobj_164; -static PyObject *__pyx_k_codeobj_167; -static PyObject *__pyx_k_codeobj_169; -static PyObject *__pyx_k_codeobj_171; -static PyObject *__pyx_k_codeobj_173; -static PyObject *__pyx_k_codeobj_175; -static PyObject *__pyx_k_codeobj_178; -static PyObject *__pyx_k_codeobj_180; -static PyObject *__pyx_k_codeobj_182; - -/* 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 PyObject *__pyx_pw_4cdec_2sa_3_sa_1monitor_cpu(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("monitor_cpu (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_monitor_cpu(__pyx_self); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cdec/sa/_sa.pyx":5 - * import gzip - * - * def monitor_cpu(): # <<<<<<<<<<<<<< - * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ - * resource.getrusage(resource.RUSAGE_SELF).ru_stime) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_monitor_cpu(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("monitor_cpu", 0); - - /* "cdec/sa/_sa.pyx":6 - * - * def monitor_cpu(): - * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ # <<<<<<<<<<<<<< - * resource.getrusage(resource.RUSAGE_SELF).ru_stime) - * - */ - __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_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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "cdec/sa/_sa.pyx":7 - * def monitor_cpu(): - * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ - * resource.getrusage(resource.RUSAGE_SELF).ru_stime) # <<<<<<<<<<<<<< - * - * 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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__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_4); __pyx_t_4 = 0; - __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.monitor_cpu", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_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 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; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("gzip_or_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[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_2gzip_or_text(__pyx_self, ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cdec/sa/_sa.pyx":9 - * resource.getrusage(resource.RUSAGE_SELF).ru_stime) - * - * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< - * if filename.endswith('.gz'): - * return gzip.GzipFile(filename) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_2gzip_or_text(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - 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("gzip_or_text", 0); - - /* "cdec/sa/_sa.pyx":10 - * - * def gzip_or_text(char* filename): - * if filename.endswith('.gz'): # <<<<<<<<<<<<<< - * return gzip.GzipFile(filename) - * else: - */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __Pyx_PyBytes_Tailmatch(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_s_1), 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if ((__pyx_t_2 != 0)) { - - /* "cdec/sa/_sa.pyx":11 - * def gzip_or_text(char* filename): - * if filename.endswith('.gz'): - * return gzip.GzipFile(filename) # <<<<<<<<<<<<<< - * else: - * 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_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(((PyObject *)__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_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__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[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_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "cdec/sa/_sa.pyx":13 - * return gzip.GzipFile(filename) - * else: - * return open(filename) # <<<<<<<<<<<<<< - * - * logger = logging.getLogger('cdec.sa') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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[0]; __pyx_lineno = 13; __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)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_size; - int __pyx_v_increment; - int __pyx_v_initial_len; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__increment,&__pyx_n_s__initial_len,0}; - PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__size); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__increment); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__initial_len); - if (value) { values[2] = 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[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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; - } - } - if (values[0]) { - __pyx_v_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_size = ((int)0); - } - if (values[1]) { - __pyx_v_increment = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_increment == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_increment = ((int)1); - } - if (values[2]) { - __pyx_v_initial_len = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_initial_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_initial_len = ((int)0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.FloatList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":11 - * cdef class FloatList: - * - * def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<< - * if initial_len > size: - * size = initial_len - */ - -static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":12 - * - * def __cinit__(self, int size=0, int increment=1, int initial_len=0): - * if initial_len > size: # <<<<<<<<<<<<<< - * size = initial_len - * self.size = size - */ - __pyx_t_1 = ((__pyx_v_initial_len > __pyx_v_size) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * self.size = size - * self.increment = increment - */ - __pyx_v_size = __pyx_v_initial_len; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":14 - * if initial_len > size: - * size = initial_len - * self.size = size # <<<<<<<<<<<<<< - * self.increment = increment - * self.len = initial_len - */ - __pyx_v_self->size = __pyx_v_size; - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":15 - * size = initial_len - * self.size = size - * self.increment = increment # <<<<<<<<<<<<<< - * self.len = initial_len - * self.arr = malloc(size*sizeof(float)) - */ - __pyx_v_self->increment = __pyx_v_increment; - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":16 - * self.size = size - * self.increment = increment - * self.len = initial_len # <<<<<<<<<<<<<< - * self.arr = malloc(size*sizeof(float)) - * memset(self.arr, 0, initial_len*sizeof(float)) - */ - __pyx_v_self->len = __pyx_v_initial_len; - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":17 - * self.increment = increment - * self.len = initial_len - * self.arr = malloc(size*sizeof(float)) # <<<<<<<<<<<<<< - * memset(self.arr, 0, initial_len*sizeof(float)) - * - */ - __pyx_v_self->arr = ((float *)malloc((__pyx_v_size * (sizeof(float))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":18 - * self.len = initial_len - * self.arr = malloc(size*sizeof(float)) - * memset(self.arr, 0, initial_len*sizeof(float)) # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - memset(__pyx_v_self->arr, 0, (__pyx_v_initial_len * (sizeof(float)))); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static void __pyx_pw_4cdec_2sa_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_4cdec_2sa_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":20 - * memset(self.arr, 0, initial_len*sizeof(float)) - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * free(self.arr) - * - */ - -static void __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":21 - * - * def __dealloc__(self): - * free(self.arr) # <<<<<<<<<<<<<< - * - * def __getitem__(self, i): - */ - free(__pyx_v_self->arr); - - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":23 - * free(self.arr) - * - * def __getitem__(self, i): # <<<<<<<<<<<<<< - * j = i - * if i<0: - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_v_j = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":24 - * - * def __getitem__(self, i): - * j = i # <<<<<<<<<<<<<< - * if i<0: - * j = self.len + i - */ - __Pyx_INCREF(__pyx_v_i); - __pyx_v_j = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":25 - * def __getitem__(self, i): - * j = i - * if i<0: # <<<<<<<<<<<<<< - * j = self.len + i - * if j<0 or j>=self.len: - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __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[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":26 - * j = i - * 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)) - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":27 - * 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)) - * 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_2) { - __pyx_t_3 = PyInt_FromLong(__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; - } else { - __pyx_t_5 = __pyx_t_2; - } - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< - * return self.arr[j] - * - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __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[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __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[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * - * 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_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.FloatList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_j); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":31 - * return self.arr[j] - * - * cdef void set(self, int i, float v): # <<<<<<<<<<<<<< - * j = i - * if i<0: - */ - -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) { - int __pyx_v_j; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":32 - * - * cdef void set(self, int i, float v): - * j = i # <<<<<<<<<<<<<< - * if i<0: - * j = self.len + i - */ - __pyx_v_j = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":33 - * cdef void set(self, int i, float v): - * j = i - * if i<0: # <<<<<<<<<<<<<< - * j = self.len + i - * if j<0 or j>=self.len: - */ - __pyx_t_1 = ((__pyx_v_i < 0) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":34 - * j = i - * 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)) - */ - __pyx_v_j = (__pyx_v_self->len + __pyx_v_i); - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__pyx_v_i); 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 = PyInt_FromLong(__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_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); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__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(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(((PyObject *)__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, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__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_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * - * def __setitem__(self, i, val): - */ - (__pyx_v_self->arr[__pyx_v_j]) = __pyx_v_v; - - goto __pyx_L0; - __pyx_L1_error:; - __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); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":39 - * self.arr[j] = v - * - * def __setitem__(self, i, val): # <<<<<<<<<<<<<< - * self.set(i, val) - * - */ - -static int __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - float __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":40 - * - * def __setitem__(self, i, val): - * self.set(i, val) # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.FloatList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":42 - * self.set(i, val) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.len - * - */ - -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":43 - * - * def __len__(self): - * return self.len # <<<<<<<<<<<<<< - * - * def append(self, float val): - */ - __pyx_r = __pyx_v_self->len; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { - float __pyx_v_val; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("append (wrapper)", 0); - assert(__pyx_arg_val); { - __pyx_v_val = __pyx_PyFloat_AsFloat(__pyx_arg_val); if (unlikely((__pyx_v_val == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.FloatList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((float)__pyx_v_val)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":45 - * return self.len - * - * def append(self, float val): # <<<<<<<<<<<<<< - * if self.len == self.size: - * self.size = self.size + self.increment - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, float __pyx_v_val) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("append", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":46 - * - * def append(self, float val): - * if self.len == self.size: # <<<<<<<<<<<<<< - * self.size = self.size + self.increment - * self.arr = realloc(self.arr, self.size*sizeof(float)) - */ - __pyx_t_1 = ((__pyx_v_self->len == __pyx_v_self->size) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":47 - * def append(self, float val): - * if self.len == self.size: - * self.size = self.size + self.increment # <<<<<<<<<<<<<< - * self.arr = realloc(self.arr, self.size*sizeof(float)) - * self.arr[self.len] = val - */ - __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->increment); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":48 - * if self.len == self.size: - * self.size = self.size + self.increment - * self.arr = realloc(self.arr, self.size*sizeof(float)) # <<<<<<<<<<<<<< - * self.arr[self.len] = val - * self.len = self.len + 1 - */ - __pyx_v_self->arr = ((float *)realloc(__pyx_v_self->arr, (__pyx_v_self->size * (sizeof(float))))); - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":49 - * self.size = self.size + self.increment - * self.arr = realloc(self.arr, self.size*sizeof(float)) - * self.arr[self.len] = val # <<<<<<<<<<<<<< - * self.len = self.len + 1 - * - */ - (__pyx_v_self->arr[__pyx_v_self->len]) = __pyx_v_val; - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":50 - * self.arr = realloc(self.arr, self.size*sizeof(float)) - * self.arr[self.len] = val - * self.len = self.len + 1 # <<<<<<<<<<<<<< - * - * cdef void write_handle(self, FILE* f): - */ - __pyx_v_self->len = (__pyx_v_self->len + 1); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":52 - * self.len = self.len + 1 - * - * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< - * fwrite(&(self.len), sizeof(float), 1, f) - * fwrite(self.arr, sizeof(float), self.len, f) - */ - -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) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_handle", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":53 - * - * cdef void write_handle(self, FILE* f): - * fwrite(&(self.len), sizeof(float), 1, f) # <<<<<<<<<<<<<< - * fwrite(self.arr, sizeof(float), self.len, f) - * - */ - fwrite((&__pyx_v_self->len), (sizeof(float)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * def write(self, char* filename): - */ - fwrite(__pyx_v_self->arr, (sizeof(float)), __pyx_v_self->len, __pyx_v_f); - - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write (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[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.FloatList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":56 - * fwrite(self.arr, sizeof(float), self.len, f) - * - * def write(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":58 - * def write(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "w") # <<<<<<<<<<<<<< - * self.write_handle(f) - * fclose(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":59 - * cdef FILE* f - * f = fopen(filename, "w") - * self.write_handle(f) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":60 - * f = fopen(filename, "w") - * self.write_handle(f) - * fclose(f) # <<<<<<<<<<<<<< - * - * cdef void read_handle(self, FILE* f): - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":62 - * fclose(f) - * - * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< - * free(self.arr) - * fread(&(self.len), sizeof(float), 1, f) - */ - -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) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("read_handle", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":63 - * - * cdef void read_handle(self, FILE* f): - * free(self.arr) # <<<<<<<<<<<<<< - * fread(&(self.len), sizeof(float), 1, f) - * self.arr = malloc(self.len * sizeof(float)) - */ - free(__pyx_v_self->arr); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":64 - * cdef void read_handle(self, FILE* f): - * free(self.arr) - * fread(&(self.len), sizeof(float), 1, f) # <<<<<<<<<<<<<< - * self.arr = malloc(self.len * sizeof(float)) - * self.size = self.len - */ - fread((&__pyx_v_self->len), (sizeof(float)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":65 - * free(self.arr) - * fread(&(self.len), sizeof(float), 1, f) - * self.arr = malloc(self.len * sizeof(float)) # <<<<<<<<<<<<<< - * self.size = self.len - * fread(self.arr, sizeof(float), self.len, f) - */ - __pyx_v_self->arr = ((float *)malloc((__pyx_v_self->len * (sizeof(float))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":66 - * fread(&(self.len), sizeof(float), 1, f) - * self.arr = malloc(self.len * sizeof(float)) - * self.size = self.len # <<<<<<<<<<<<<< - * fread(self.arr, sizeof(float), self.len, f) - * - */ - __pyx_t_1 = __pyx_v_self->len; - __pyx_v_self->size = __pyx_t_1; - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":67 - * self.arr = malloc(self.len * sizeof(float)) - * self.size = self.len - * fread(self.arr, sizeof(float), self.len, f) # <<<<<<<<<<<<<< - * - * def read(self, char* filename): - */ - fread(__pyx_v_self->arr, (sizeof(float)), __pyx_v_self->len, __pyx_v_f); - - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read (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[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.FloatList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":69 - * fread(self.arr, sizeof(float), self.len, f) - * - * def read(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":71 - * def read(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "r") # <<<<<<<<<<<<<< - * self.read_handle(f) - * fclose(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":72 - * cdef FILE* f - * f = fopen(filename, "r") - * self.read_handle(f) # <<<<<<<<<<<<<< - * fclose(f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":73 - * f = fopen(filename, "r") - * self.read_handle(f) - * fclose(f) # <<<<<<<<<<<<<< - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_size; - int __pyx_v_increment; - int __pyx_v_initial_len; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__increment,&__pyx_n_s__initial_len,0}; - PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__size); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__increment); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__initial_len); - if (value) { values[2] = 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[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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; - } - } - if (values[0]) { - __pyx_v_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_size = ((int)0); - } - if (values[1]) { - __pyx_v_increment = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_increment == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_increment = ((int)1); - } - if (values[2]) { - __pyx_v_initial_len = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_initial_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_initial_len = ((int)0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.IntList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":11 - * cdef class IntList: - * - * def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<< - * if initial_len > size: - * size = initial_len - */ - -static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":12 - * - * def __cinit__(self, int size=0, int increment=1, int initial_len=0): - * if initial_len > size: # <<<<<<<<<<<<<< - * size = initial_len - * self.size = size - */ - __pyx_t_1 = ((__pyx_v_initial_len > __pyx_v_size) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * self.size = size - * self.increment = increment - */ - __pyx_v_size = __pyx_v_initial_len; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":14 - * if initial_len > size: - * size = initial_len - * self.size = size # <<<<<<<<<<<<<< - * self.increment = increment - * self.len = initial_len - */ - __pyx_v_self->size = __pyx_v_size; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":15 - * size = initial_len - * self.size = size - * self.increment = increment # <<<<<<<<<<<<<< - * self.len = initial_len - * self.arr = malloc(size*sizeof(int)) - */ - __pyx_v_self->increment = __pyx_v_increment; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":16 - * self.size = size - * self.increment = increment - * self.len = initial_len # <<<<<<<<<<<<<< - * self.arr = malloc(size*sizeof(int)) - * memset(self.arr, 0, initial_len*sizeof(int)) - */ - __pyx_v_self->len = __pyx_v_initial_len; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":17 - * self.increment = increment - * self.len = initial_len - * self.arr = malloc(size*sizeof(int)) # <<<<<<<<<<<<<< - * memset(self.arr, 0, initial_len*sizeof(int)) - * - */ - __pyx_v_self->arr = ((int *)malloc((__pyx_v_size * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":18 - * self.len = initial_len - * self.arr = malloc(size*sizeof(int)) - * memset(self.arr, 0, initial_len*sizeof(int)) # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - memset(__pyx_v_self->arr, 0, (__pyx_v_initial_len * (sizeof(int)))); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_3__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_3__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":20 - * memset(self.arr, 0, initial_len*sizeof(int)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * ret = "IntList[" - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { - PyObject *__pyx_v_ret = NULL; - int __pyx_v_idx; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":22 - * def __str__(self): - * cdef unsigned i - * ret = "IntList[" # <<<<<<<<<<<<<< - * for idx in range(self.size): - * if idx>0: - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); - __pyx_v_ret = ((PyObject *)__pyx_kp_s_3); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":23 - * cdef unsigned i - * ret = "IntList[" - * for idx in range(self.size): # <<<<<<<<<<<<<< - * if idx>0: - * ret += "," - */ - __pyx_t_1 = __pyx_v_self->size; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_idx = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":24 - * ret = "IntList[" - * for idx in range(self.size): - * if idx>0: # <<<<<<<<<<<<<< - * ret += "," - * ret += str(self.arr[idx]) - */ - __pyx_t_3 = ((__pyx_v_idx > 0) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":25 - * for idx in range(self.size): - * if idx>0: - * ret += "," # <<<<<<<<<<<<<< - * ret += str(self.arr[idx]) - * ret += "]" - */ - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_ret, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_v_ret); - __pyx_v_ret = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":26 - * if idx>0: - * ret += "," - * ret += str(self.arr[idx]) # <<<<<<<<<<<<<< - * ret += "]" - * ret += "len=" - */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_self->arr[__pyx_v_idx])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __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[2]; __pyx_lineno = 26; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_ret, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_ret); - __pyx_v_ret = __pyx_t_5; - __pyx_t_5 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":27 - * ret += "," - * ret += str(self.arr[idx]) - * ret += "]" # <<<<<<<<<<<<<< - * ret += "len=" - * ret += str(self.len) - */ - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_ret, ((PyObject *)__pyx_kp_s_5)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_v_ret); - __pyx_v_ret = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":28 - * ret += str(self.arr[idx]) - * ret += "]" - * ret += "len=" # <<<<<<<<<<<<<< - * ret += str(self.len) - * return ret - */ - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_ret, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_v_ret); - __pyx_v_ret = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":29 - * ret += "]" - * ret += "len=" - * ret += str(self.len) # <<<<<<<<<<<<<< - * return ret - * - */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __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[2]; __pyx_lineno = 29; __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(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_ret, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_v_ret); - __pyx_v_ret = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":30 - * ret += "len=" - * ret += str(self.len) - * return ret # <<<<<<<<<<<<<< - * - * def index(self, int val): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_ret); - __pyx_r = __pyx_v_ret; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("cdec.sa._sa.IntList.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_ret); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { - int __pyx_v_val; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("index (wrapper)", 0); - assert(__pyx_arg_val); { - __pyx_v_val = __Pyx_PyInt_AsInt(__pyx_arg_val); if (unlikely((__pyx_v_val == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.IntList.index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_4index(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":32 - * return ret - * - * def index(self, int val): # <<<<<<<<<<<<<< - * cdef unsigned i - * for i in range(self.len): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { - unsigned int __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - unsigned int __pyx_t_2; - int __pyx_t_3; - 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("index", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":34 - * def index(self, int val): - * cdef unsigned i - * for i in range(self.len): # <<<<<<<<<<<<<< - * if self.arr[i] == val: - * return i - */ - __pyx_t_1 = __pyx_v_self->len; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":35 - * cdef unsigned i - * for i in range(self.len): - * if self.arr[i] == val: # <<<<<<<<<<<<<< - * return i - * raise ValueError('%s not in IntList' % val) - */ - __pyx_t_3 = (((__pyx_v_self->arr[__pyx_v_i]) == __pyx_v_val) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":36 - * for i in range(self.len): - * if self.arr[i] == val: - * return i # <<<<<<<<<<<<<< - * raise ValueError('%s not in IntList' % val) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":37 - * if self.arr[i] == val: - * return i - * raise ValueError('%s not in IntList' % val) # <<<<<<<<<<<<<< - * - * def partition(self,start,end): - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_val); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __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); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("cdec.sa._sa.IntList.index", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_start = 0; - PyObject *__pyx_v_end = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("partition (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; - PyObject* values[2] = {0,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__start)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("partition", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "partition") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_start = values[0]; - __pyx_v_end = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("partition", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":39 - * raise ValueError('%s not in IntList' % val) - * - * def partition(self,start,end): # <<<<<<<<<<<<<< - * pivot = self.arr[end] - * bottom = start-1 - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { - PyObject *__pyx_v_pivot = NULL; - PyObject *__pyx_v_bottom = NULL; - PyObject *__pyx_v_top = NULL; - long __pyx_v_done; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("partition", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":40 - * - * def partition(self,start,end): - * pivot = self.arr[end] # <<<<<<<<<<<<<< - * bottom = start-1 - * top = end - */ - __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_end); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((__pyx_v_self->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_pivot = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":41 - * def partition(self,start,end): - * pivot = self.arr[end] - * bottom = start-1 # <<<<<<<<<<<<<< - * top = end - * done = 0 - */ - __pyx_t_2 = PyNumber_Subtract(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_bottom = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":42 - * pivot = self.arr[end] - * bottom = start-1 - * top = end # <<<<<<<<<<<<<< - * done = 0 - * while not done: - */ - __Pyx_INCREF(__pyx_v_end); - __pyx_v_top = __pyx_v_end; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":43 - * bottom = start-1 - * top = end - * done = 0 # <<<<<<<<<<<<<< - * while not done: - * while not done: - */ - __pyx_v_done = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":44 - * top = end - * done = 0 - * while not done: # <<<<<<<<<<<<<< - * while not done: - * bottom += 1 - */ - while (1) { - __pyx_t_3 = ((!(__pyx_v_done != 0)) != 0); - if (!__pyx_t_3) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":45 - * done = 0 - * while not done: - * while not done: # <<<<<<<<<<<<<< - * bottom += 1 - * if bottom == top: - */ - while (1) { - __pyx_t_3 = ((!(__pyx_v_done != 0)) != 0); - if (!__pyx_t_3) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":46 - * while not done: - * while not done: - * bottom += 1 # <<<<<<<<<<<<<< - * if bottom == top: - * done = 1 - */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_bottom, __pyx_int_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(__pyx_v_bottom); - __pyx_v_bottom = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":47 - * while not done: - * bottom += 1 - * if bottom == top: # <<<<<<<<<<<<<< - * done = 1 - * break - */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_bottom, __pyx_v_top, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __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[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":48 - * bottom += 1 - * if bottom == top: - * done = 1 # <<<<<<<<<<<<<< - * break - * if self.arr[bottom] > pivot: - */ - __pyx_v_done = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":49 - * if bottom == top: - * done = 1 - * break # <<<<<<<<<<<<<< - * if self.arr[bottom] > pivot: - * self.arr[top] = self.arr[bottom] - */ - goto __pyx_L6_break; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":50 - * done = 1 - * break - * if self.arr[bottom] > pivot: # <<<<<<<<<<<<<< - * self.arr[top] = self.arr[bottom] - * break - */ - __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_bottom); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((__pyx_v_self->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_v_pivot, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __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[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":51 - * break - * if self.arr[bottom] > pivot: - * self.arr[top] = self.arr[bottom] # <<<<<<<<<<<<<< - * break - * while not done: - */ - __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_bottom); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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]); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":52 - * if self.arr[bottom] > pivot: - * self.arr[top] = self.arr[bottom] - * break # <<<<<<<<<<<<<< - * while not done: - * top -= 1 - */ - goto __pyx_L6_break; - goto __pyx_L8; - } - __pyx_L8:; - } - __pyx_L6_break:; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":53 - * self.arr[top] = self.arr[bottom] - * break - * while not done: # <<<<<<<<<<<<<< - * top -= 1 - * if top == bottom: - */ - while (1) { - __pyx_t_3 = ((!(__pyx_v_done != 0)) != 0); - if (!__pyx_t_3) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":54 - * break - * while not done: - * top -= 1 # <<<<<<<<<<<<<< - * if top == bottom: - * done = 1 - */ - __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_v_top, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_v_top); - __pyx_v_top = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":55 - * while not done: - * top -= 1 - * if top == bottom: # <<<<<<<<<<<<<< - * done = 1 - * break - */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_top, __pyx_v_bottom, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":56 - * top -= 1 - * if top == bottom: - * done = 1 # <<<<<<<<<<<<<< - * break - * if self.arr[top] < pivot: - */ - __pyx_v_done = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":57 - * if top == bottom: - * done = 1 - * break # <<<<<<<<<<<<<< - * if self.arr[top] < pivot: - * self.arr[bottom] = self.arr[top] - */ - goto __pyx_L10_break; - goto __pyx_L11; - } - __pyx_L11:; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":58 - * done = 1 - * break - * if self.arr[top] < pivot: # <<<<<<<<<<<<<< - * self.arr[bottom] = self.arr[top] - * break - */ - __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 = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong((__pyx_v_self->arr[__pyx_t_1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_v_pivot, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":59 - * break - * if self.arr[top] < pivot: - * self.arr[bottom] = self.arr[top] # <<<<<<<<<<<<<< - * break - * self.arr[top] = pivot - */ - __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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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]); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":60 - * if self.arr[top] < pivot: - * self.arr[bottom] = self.arr[top] - * break # <<<<<<<<<<<<<< - * self.arr[top] = pivot - * return top - */ - goto __pyx_L10_break; - goto __pyx_L12; - } - __pyx_L12:; - } - __pyx_L10_break:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":61 - * self.arr[bottom] = self.arr[top] - * break - * self.arr[top] = pivot # <<<<<<<<<<<<<< - * return top - * - */ - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_pivot); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":62 - * break - * self.arr[top] = pivot - * return top # <<<<<<<<<<<<<< - * - * def _doquicksort(self,start,end): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_top); - __pyx_r = __pyx_v_top; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_pivot); - __Pyx_XDECREF(__pyx_v_bottom); - __Pyx_XDECREF(__pyx_v_top); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_start = 0; - PyObject *__pyx_v_end = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_doquicksort (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; - PyObject* values[2] = {0,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__start)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_doquicksort", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_doquicksort") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_start = values[0]; - __pyx_v_end = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_doquicksort", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":64 - * return top - * - * def _doquicksort(self,start,end): # <<<<<<<<<<<<<< - * if start < end: - * split = self.partition(start,end) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { - PyObject *__pyx_v_split = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - 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("_doquicksort", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":65 - * - * def _doquicksort(self,start,end): - * if start < end: # <<<<<<<<<<<<<< - * split = self.partition(start,end) - * self._doquicksort(start,split-1) - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __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[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/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_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_start); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_start); - __Pyx_GIVEREF(__pyx_v_start); - __Pyx_INCREF(__pyx_v_end); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_end); - __Pyx_GIVEREF(__pyx_v_end); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_split = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/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_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_INCREF(__pyx_v_start); - PyTuple_SET_ITEM(__pyx_t_1, 0, __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":68 - * split = self.partition(start,end) - * self._doquicksort(start,split-1) - * self._doquicksort(split+1,end) # <<<<<<<<<<<<<< - * else: - * return - */ - __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_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_end); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_end); - __Pyx_GIVEREF(__pyx_v_end); - __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":70 - * self._doquicksort(split+1,end) - * else: - * return # <<<<<<<<<<<<<< - * - * def sort(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_split); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sort (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":72 - * return - * - * def sort(self): # <<<<<<<<<<<<<< - * self._doquicksort(0,self.len-1) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sort", 0); - - /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong((__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_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_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 0, __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.IntList.sort", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":75 - * self._doquicksort(0,self.len-1) - * - * def reset(self): # <<<<<<<<<<<<<< - * self.len = 0 - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":76 - * - * def reset(self): - * self.len = 0 # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_self->len = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static void __pyx_pw_4cdec_2sa_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_4cdec_2sa_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":78 - * self.len = 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * free(self.arr) - * - */ - -static void __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":79 - * - * def __dealloc__(self): - * free(self.arr) # <<<<<<<<<<<<<< - * - * def __iter__(self): - */ - free(__pyx_v_self->arr); - - __Pyx_RefNannyFinishContext(); -} -static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_16__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":81 - * free(self.arr) - * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef int i - * for i in range(self.len): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_16__iter__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____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____iter__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct____iter__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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(); - return __pyx_r; -} - -static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = 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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":83 - * def __iter__(self): - * cdef int i - * for i in range(self.len): # <<<<<<<<<<<<<< - * yield self.arr[i] - * - */ - __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->len; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":84 - * cdef int i - * for i in range(self.len): - * yield self.arr[i] # <<<<<<<<<<<<<< - * - * def __getitem__(self, index): - */ - __pyx_t_3 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_self->arr[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __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_cur_scope->__pyx_t_1 = __pyx_t_2; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_index)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":86 - * yield self.arr[i] - * - * def __getitem__(self, index): # <<<<<<<<<<<<<< - * cdef int i, j, k - * if isinstance(index, int): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - 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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":88 - * def __getitem__(self, index): - * cdef int i, j, k - * if isinstance(index, int): # <<<<<<<<<<<<<< - * j = index - * if j < 0: - */ - __pyx_t_1 = PyInt_Check(__pyx_v_index); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":89 - * cdef int i, j, k - * if isinstance(index, int): - * j = index # <<<<<<<<<<<<<< - * if j < 0: - * j = self.len + j - */ - __pyx_t_3 = __Pyx_PyInt_AsInt(__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":90 - * if isinstance(index, int): - * j = index - * if j < 0: # <<<<<<<<<<<<<< - * j = self.len + j - * if j<0 or j>=self.len: - */ - __pyx_t_2 = ((__pyx_v_j < 0) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":91 - * j = index - * 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)) - */ - __pyx_v_j = (__pyx_v_self->len + __pyx_v_j); - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_4 = __pyx_t_2; - } - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__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_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); - __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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__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(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(((PyObject *)__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, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_6), NULL); 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(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * elif isinstance(index, slice): - * i = index.start - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyInt_FromLong((__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; - goto __pyx_L0; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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_AsInt(__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_v_i = __pyx_t_3; - - /* "/home/mdenkows/cdec/python/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_AsInt(__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_v_j = __pyx_t_3; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":99 - * j = index.stop - * if i < 0: - * i = self.len + i # <<<<<<<<<<<<<< - * if j < 0: - * j = self.len + j - */ - __pyx_v_i = (__pyx_v_self->len + __pyx_v_i); - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":101 - * 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: - * 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; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * raise IndexError("Requested index %d:%d of %d-length IntList" % (index.start, index.stop, self.len)) - * result = () - */ - __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; - } else { - __pyx_t_4 = __pyx_t_2; - } - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/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_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_GOTREF(__pyx_t_6); - __pyx_t_9 = PyInt_FromLong(__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_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 1, __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_5 = 0; - __pyx_t_6 = 0; - __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), ((PyObject *)__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(((PyObject *)__pyx_t_9)); - __Pyx_DECREF(((PyObject *)__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, ((PyObject *)__pyx_t_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); - __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__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(((PyObject *)__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_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/mdenkows/cdec/python/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 = () # <<<<<<<<<<<<<< - * for k from i <= k < j: - * result = result + (self.arr[k],) - */ - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - __pyx_v_result = __pyx_empty_tuple; - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * result = result + (self.arr[k],) - * return result - */ - __pyx_t_3 = __pyx_v_j; - for (__pyx_v_k = __pyx_v_i; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":106 - * result = () - * for k from i <= k < j: - * result = result + (self.arr[k],) # <<<<<<<<<<<<<< - * return result - * else: - */ - __pyx_t_9 = PyInt_FromLong((__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(((PyObject *)__pyx_v_result), ((PyObject *)__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(((PyObject *)__pyx_t_9)); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyObject*)__pyx_t_9); - __pyx_t_9 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":107 - * for k from i <= k < j: - * result = result + (self.arr[k],) - * return result # <<<<<<<<<<<<<< - * else: - * raise TypeError("Illegal key type %s for IntList" % type(index)) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), ((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(((PyObject *)__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, ((PyObject *)__pyx_t_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); - __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__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(((PyObject *)__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_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("cdec.sa._sa.IntList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":111 - * raise TypeError("Illegal key type %s for IntList" % type(index)) - * - * cdef void set(self, int i, int val): # <<<<<<<<<<<<<< - * j = i - * if i<0: - */ - -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) { - int __pyx_v_j; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":112 - * - * cdef void set(self, int i, int val): - * j = i # <<<<<<<<<<<<<< - * if i<0: - * j = self.len + i - */ - __pyx_v_j = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":113 - * cdef void set(self, int i, int val): - * j = i - * if i<0: # <<<<<<<<<<<<<< - * j = self.len + i - * if j<0 or j>=self.len: - */ - __pyx_t_1 = ((__pyx_v_i < 0) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":114 - * j = i - * 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)) - */ - __pyx_v_j = (__pyx_v_self->len + __pyx_v_i); - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__pyx_v_i); 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 = PyInt_FromLong(__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_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); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__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(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(((PyObject *)__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, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__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_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * - * def __setitem__(self, i, val): - */ - (__pyx_v_self->arr[__pyx_v_j]) = __pyx_v_val; - - goto __pyx_L0; - __pyx_L1_error:; - __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); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":119 - * self.arr[j] = val - * - * def __setitem__(self, i, val): # <<<<<<<<<<<<<< - * self.set(i, val) - * - */ - -static int __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setitem__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":120 - * - * def __setitem__(self, i, val): - * self.set(i, val) # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyInt_AsInt(__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); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.IntList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":122 - * self.set(i, val) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.len - * - */ - -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":123 - * - * def __len__(self): - * return self.len # <<<<<<<<<<<<<< - * - * def get_size(self): - */ - __pyx_r = __pyx_v_self->len; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_size (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":125 - * return self.len - * - * def get_size(self): # <<<<<<<<<<<<<< - * return self.size - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_size", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":126 - * - * def get_size(self): - * return self.size # <<<<<<<<<<<<<< - * - * def append(self, int val): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.IntList.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { - int __pyx_v_val; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("append (wrapper)", 0); - assert(__pyx_arg_val); { - __pyx_v_val = __Pyx_PyInt_AsInt(__pyx_arg_val); if (unlikely((__pyx_v_val == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.IntList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_27append(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":128 - * return self.size - * - * def append(self, int val): # <<<<<<<<<<<<<< - * self._append(val) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_27append(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("append", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":129 - * - * def append(self, int val): - * self._append(val) # <<<<<<<<<<<<<< - * - * cdef void _append(self, int val): - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_append(__pyx_v_self, __pyx_v_val); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":131 - * self._append(val) - * - * cdef void _append(self, int val): # <<<<<<<<<<<<<< - * if self.len == self.size: - * self.size = self.size + self.increment - */ - -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) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("_append", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":132 - * - * cdef void _append(self, int val): - * if self.len == self.size: # <<<<<<<<<<<<<< - * self.size = self.size + self.increment - * self.arr = realloc(self.arr, self.size*sizeof(int)) - */ - __pyx_t_1 = ((__pyx_v_self->len == __pyx_v_self->size) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":133 - * cdef void _append(self, int val): - * if self.len == self.size: - * self.size = self.size + self.increment # <<<<<<<<<<<<<< - * self.arr = realloc(self.arr, self.size*sizeof(int)) - * self.arr[self.len] = val - */ - __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->increment); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":134 - * if self.len == self.size: - * self.size = self.size + self.increment - * self.arr = realloc(self.arr, self.size*sizeof(int)) # <<<<<<<<<<<<<< - * self.arr[self.len] = val - * self.len = self.len + 1 - */ - __pyx_v_self->arr = ((int *)realloc(__pyx_v_self->arr, (__pyx_v_self->size * (sizeof(int))))); - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":135 - * self.size = self.size + self.increment - * self.arr = realloc(self.arr, self.size*sizeof(int)) - * self.arr[self.len] = val # <<<<<<<<<<<<<< - * self.len = self.len + 1 - * - */ - (__pyx_v_self->arr[__pyx_v_self->len]) = __pyx_v_val; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":136 - * self.arr = realloc(self.arr, self.size*sizeof(int)) - * self.arr[self.len] = val - * self.len = self.len + 1 # <<<<<<<<<<<<<< - * - * def extend(self, other): - */ - __pyx_v_self->len = (__pyx_v_self->len + 1); - - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("extend (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_other)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":138 - * self.len = self.len + 1 - * - * def extend(self, other): # <<<<<<<<<<<<<< - * self._extend(other) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("extend", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":139 - * - * def extend(self, other): - * self._extend(other) # <<<<<<<<<<<<<< - * - * cdef void _extend(self, IntList other): - */ - 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)); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.IntList.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":141 - * self._extend(other) - * - * cdef void _extend(self, IntList other): # <<<<<<<<<<<<<< - * self._extend_arr(other.arr, other.len) - * - */ - -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) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_extend", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":142 - * - * cdef void _extend(self, IntList other): - * self._extend_arr(other.arr, other.len) # <<<<<<<<<<<<<< - * - * cdef void _extend_arr(self, int* other, int other_len): - */ - ((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); - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":144 - * self._extend_arr(other.arr, other.len) - * - * cdef void _extend_arr(self, int* other, int other_len): # <<<<<<<<<<<<<< - * if self.size < self.len + other_len: - * self.size = self.len + other_len - */ - -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) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("_extend_arr", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":145 - * - * cdef void _extend_arr(self, int* other, int other_len): - * if self.size < self.len + other_len: # <<<<<<<<<<<<<< - * self.size = self.len + other_len - * self.arr = realloc(self.arr, self.size*sizeof(int)) - */ - __pyx_t_1 = ((__pyx_v_self->size < (__pyx_v_self->len + __pyx_v_other_len)) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * self.arr = realloc(self.arr, self.size*sizeof(int)) - * memcpy(self.arr+self.len, other, other_len*sizeof(int)) - */ - __pyx_v_self->size = (__pyx_v_self->len + __pyx_v_other_len); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":147 - * if self.size < self.len + other_len: - * self.size = self.len + other_len - * self.arr = realloc(self.arr, self.size*sizeof(int)) # <<<<<<<<<<<<<< - * memcpy(self.arr+self.len, other, other_len*sizeof(int)) - * self.len = self.len + other_len - */ - __pyx_v_self->arr = ((int *)realloc(__pyx_v_self->arr, (__pyx_v_self->size * (sizeof(int))))); - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":148 - * self.size = self.len + other_len - * self.arr = realloc(self.arr, self.size*sizeof(int)) - * memcpy(self.arr+self.len, other, other_len*sizeof(int)) # <<<<<<<<<<<<<< - * self.len = self.len + other_len - * - */ - memcpy((__pyx_v_self->arr + __pyx_v_self->len), __pyx_v_other, (__pyx_v_other_len * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":149 - * self.arr = realloc(self.arr, self.size*sizeof(int)) - * memcpy(self.arr+self.len, other, other_len*sizeof(int)) - * self.len = self.len + other_len # <<<<<<<<<<<<<< - * - * cdef void _clear(self): - */ - __pyx_v_self->len = (__pyx_v_self->len + __pyx_v_other_len); - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":151 - * self.len = self.len + other_len - * - * cdef void _clear(self): # <<<<<<<<<<<<<< - * free(self.arr) - * self.len = 0 - */ - -static void __pyx_f_4cdec_2sa_3_sa_7IntList__clear(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_clear", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":152 - * - * cdef void _clear(self): - * free(self.arr) # <<<<<<<<<<<<<< - * self.len = 0 - * self.size = 0 - */ - free(__pyx_v_self->arr); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":153 - * cdef void _clear(self): - * free(self.arr) - * self.len = 0 # <<<<<<<<<<<<<< - * self.size = 0 - * self.arr = malloc(0) - */ - __pyx_v_self->len = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":154 - * free(self.arr) - * self.len = 0 - * self.size = 0 # <<<<<<<<<<<<<< - * self.arr = malloc(0) - * - */ - __pyx_v_self->size = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":155 - * self.len = 0 - * self.size = 0 - * self.arr = malloc(0) # <<<<<<<<<<<<<< - * - * cdef void write_handle(self, FILE* f): - */ - __pyx_v_self->arr = ((int *)malloc(0)); - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":157 - * self.arr = malloc(0) - * - * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< - * fwrite(&(self.len), sizeof(int), 1, f) - * fwrite(self.arr, sizeof(int), self.len, f) - */ - -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) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_handle", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":158 - * - * cdef void write_handle(self, FILE* f): - * fwrite(&(self.len), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * fwrite(self.arr, sizeof(int), self.len, f) - * - */ - fwrite((&__pyx_v_self->len), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * def write(self, char* filename): - */ - fwrite(__pyx_v_self->arr, (sizeof(int)), __pyx_v_self->len, __pyx_v_f); - - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write (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[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.IntList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_31write(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":161 - * fwrite(self.arr, sizeof(int), self.len, f) - * - * def write(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_31write(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":163 - * def write(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "w") # <<<<<<<<<<<<<< - * self.write_handle(f) - * fclose(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":164 - * cdef FILE* f - * f = fopen(filename, "w") - * self.write_handle(f) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":165 - * f = fopen(filename, "w") - * self.write_handle(f) - * fclose(f) # <<<<<<<<<<<<<< - * - * cdef void read_handle(self, FILE* f): - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":167 - * fclose(f) - * - * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< - * (self.arr) - * fread(&(self.len), sizeof(int), 1, f) - */ - -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) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("read_handle", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":168 - * - * cdef void read_handle(self, FILE* f): - * (self.arr) # <<<<<<<<<<<<<< - * fread(&(self.len), sizeof(int), 1, f) - * self.arr = malloc(self.len * sizeof(int)) - */ - __pyx_v_self->arr; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":169 - * cdef void read_handle(self, FILE* f): - * (self.arr) - * fread(&(self.len), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * self.arr = malloc(self.len * sizeof(int)) - * self.size = self.len - */ - fread((&__pyx_v_self->len), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":170 - * (self.arr) - * fread(&(self.len), sizeof(int), 1, f) - * self.arr = malloc(self.len * sizeof(int)) # <<<<<<<<<<<<<< - * self.size = self.len - * fread(self.arr, sizeof(int), self.len, f) - */ - __pyx_v_self->arr = ((int *)malloc((__pyx_v_self->len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":171 - * fread(&(self.len), sizeof(int), 1, f) - * self.arr = malloc(self.len * sizeof(int)) - * self.size = self.len # <<<<<<<<<<<<<< - * fread(self.arr, sizeof(int), self.len, f) - * - */ - __pyx_t_1 = __pyx_v_self->len; - __pyx_v_self->size = __pyx_t_1; - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":172 - * self.arr = malloc(self.len * sizeof(int)) - * self.size = self.len - * fread(self.arr, sizeof(int), self.len, f) # <<<<<<<<<<<<<< - * - * def read(self, char* filename): - */ - fread(__pyx_v_self->arr, (sizeof(int)), __pyx_v_self->len, __pyx_v_f); - - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read (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[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.IntList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_33read(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":174 - * fread(self.arr, sizeof(int), self.len, f) - * - * def read(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_33read(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":176 - * def read(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "r") # <<<<<<<<<<<<<< - * self.read_handle(f) - * fclose(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":177 - * cdef FILE* f - * f = fopen(filename, "r") - * self.read_handle(f) # <<<<<<<<<<<<<< - * fclose(f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":178 - * f = fopen(filename, "r") - * self.read_handle(f) - * fclose(f) # <<<<<<<<<<<<<< - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __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_2sa_3_sa_9StringMap___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":13 - * cdef int index(self, char *s) - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.vocab = stringmap_new() - * - */ - -static int __pyx_pf_4cdec_2sa_3_sa_9StringMap___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":14 - * - * def __cinit__(self): - * self.vocab = stringmap_new() # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_self->vocab = stringmap_new(); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static void __pyx_pw_4cdec_2sa_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_4cdec_2sa_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":16 - * self.vocab = stringmap_new() - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * stringmap_delete(self.vocab) - * - */ - -static void __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":17 - * - * def __dealloc__(self): - * stringmap_delete(self.vocab) # <<<<<<<<<<<<<< - * - * cdef char *word(self, int i): - */ - stringmap_delete(__pyx_v_self->vocab); - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":19 - * stringmap_delete(self.vocab) - * - * cdef char *word(self, int i): # <<<<<<<<<<<<<< - * return stringmap_word(self.vocab, i) - * - */ - -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) { - char *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("word", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":20 - * - * cdef char *word(self, int i): - * return stringmap_word(self.vocab, i) # <<<<<<<<<<<<<< - * - * cdef int index(self, char *s): - */ - __pyx_r = stringmap_word(__pyx_v_self->vocab, __pyx_v_i); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":22 - * return stringmap_word(self.vocab, i) - * - * cdef int index(self, char *s): # <<<<<<<<<<<<<< - * return stringmap_index(self.vocab, s) - */ - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("index", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":23 - * - * cdef int index(self, char *s): - * return stringmap_index(self.vocab, s) # <<<<<<<<<<<<<< - */ - __pyx_r = stringmap_index(__pyx_v_self->vocab, __pyx_v_s); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_from_binary = 0; - PyObject *__pyx_v_from_text = 0; - PyObject *__pyx_v_side = 0; - int __pyx_v_use_sent_id; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__side,&__pyx_n_s__use_sent_id,0}; - PyObject* values[4] = {0,0,0,0}; - - /* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< - * self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1} - * self.id2word = ["END_OF_FILE", "END_OF_LINE"] - */ - values[0] = ((PyObject *)Py_None); - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__from_binary); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_text); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_sent_id); - if (value) { values[3] = 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[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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_from_binary = values[0]; - __pyx_v_from_text = values[1]; - __pyx_v_side = values[2]; - if (values[3]) { - __pyx_v_use_sent_id = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_use_sent_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_use_sent_id = ((int)0); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_side, __pyx_v_use_sent_id); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side, int __pyx_v_use_sent_id) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - long __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/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} # <<<<<<<<<<<<<< - * self.id2word = ["END_OF_FILE", "END_OF_LINE"] - * self.data = IntList(1000,1000) - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __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__END_OF_FILE), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__END_OF_LINE), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(__pyx_v_self->word2id); - __Pyx_DECREF(__pyx_v_self->word2id); - __pyx_v_self->word2id = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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"] # <<<<<<<<<<<<<< - * self.data = IntList(1000,1000) - * self.sent_id = IntList(1000,1000) - */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__END_OF_FILE)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__END_OF_FILE)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__END_OF_FILE)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__END_OF_LINE)); - PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__END_OF_LINE)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__END_OF_LINE)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(__pyx_v_self->id2word); - __Pyx_DECREF(__pyx_v_self->id2word); - __pyx_v_self->id2word = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * self.sent_id = IntList(1000,1000) - * self.sent_index = IntList(1000,1000) - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->data); - __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); - __pyx_v_self->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * self.sent_index = IntList(1000,1000) - * self.use_sent_id = use_sent_id - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->sent_id); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_id)); - __pyx_v_self->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":22 - * self.data = IntList(1000,1000) - * self.sent_id = IntList(1000,1000) - * self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<< - * self.use_sent_id = use_sent_id - * if from_binary: - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_13), 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_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->sent_index); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); - __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * if from_binary: - * self.read_binary(from_binary) - */ - __pyx_v_self->use_sent_id = __pyx_v_use_sent_id; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":24 - * self.sent_index = IntList(1000,1000) - * self.use_sent_id = use_sent_id - * if from_binary: # <<<<<<<<<<<<<< - * self.read_binary(from_binary) - * elif from_text: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":26 - * if from_binary: - * self.read_binary(from_binary) - * elif from_text: # <<<<<<<<<<<<<< - * if side: - * self.read_bitext(from_text, (0 if side == 'source' else 1)) - */ - __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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":27 - * self.read_binary(from_binary) - * elif from_text: - * if side: # <<<<<<<<<<<<<< - * self.read_bitext(from_text, (0 if side == 'source' else 1)) - * else: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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 = PyObject_RichCompare(__pyx_v_side, ((PyObject *)__pyx_n_s__source), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __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[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_2) { - __pyx_t_5 = 0; - } else { - __pyx_t_5 = 1; - } - __pyx_t_3 = PyInt_FromLong(__pyx_t_5); 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_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); - __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":30 - * self.read_bitext(from_text, (0 if side == 'source' else 1)) - * else: - * self.read_text(from_text) # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __pyx_L4:; - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":32 - * self.read_text(from_text) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return len(self.data) - * - */ - -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__len__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":33 - * - * def __len__(self): - * return len(self.data) # <<<<<<<<<<<<<< - * - * def get_sentence_id(self, i): - */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->data); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_5get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_5get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_sentence_id (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":35 - * return len(self.data) - * - * def get_sentence_id(self, i): # <<<<<<<<<<<<<< - * return self.sent_id.arr[i] - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_sentence_id", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":36 - * - * def get_sentence_id(self, i): - * return self.sent_id.arr[i] # <<<<<<<<<<<<<< - * - * def get_sentence(self, i): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((__pyx_v_self->sent_id->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_sentence_id", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_sentence (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":38 - * return self.sent_id.arr[i] - * - * def get_sentence(self, i): # <<<<<<<<<<<<<< - * cdef int j, start, stop - * sent = [] - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { - int __pyx_v_start; - int __pyx_v_stop; - PyObject *__pyx_v_sent = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __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("get_sentence", 0); - __Pyx_INCREF(__pyx_v_i); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":40 - * def get_sentence(self, i): - * cdef int j, start, stop - * sent = [] # <<<<<<<<<<<<<< - * start = self.sent_index.arr[i] - * stop = self.sent_index.arr[i+1] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_sent = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":41 - * cdef int j, start, stop - * sent = [] - * start = self.sent_index.arr[i] # <<<<<<<<<<<<<< - * stop = self.sent_index.arr[i+1] - * for i from start <= i < stop: - */ - __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]); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":42 - * sent = [] - * start = self.sent_index.arr[i] - * stop = self.sent_index.arr[i+1] # <<<<<<<<<<<<<< - * for i from start <= i < stop: - * sent.append(self.id2word[self.data.arr[i]]) - */ - __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_stop = (__pyx_v_self->sent_index->arr[__pyx_t_2]); - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * sent.append(self.id2word[self.data.arr[i]]) - * return sent - */ - __pyx_t_3 = __pyx_v_stop; - for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { - __pyx_t_1 = PyInt_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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]]) # <<<<<<<<<<<<<< - * return sent - * - */ - __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 = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->id2word, (__pyx_v_self->data->arr[__pyx_t_2]), sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_sent, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__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;} - } - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * sent.append(self.id2word[self.data.arr[i]]) - * return sent - */ - __pyx_t_1 = PyInt_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":45 - * for i from start <= i < stop: - * sent.append(self.id2word[self.data.arr[i]]) - * return sent # <<<<<<<<<<<<<< - * - * def get_id(self, word): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_sent)); - __pyx_r = ((PyObject *)__pyx_v_sent); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_sentence", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_sent); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_9get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_9get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_id (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_word)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":47 - * return sent - * - * def get_id(self, word): # <<<<<<<<<<<<<< - * if not word in self.word2id: - * self.word2id[word] = len(self.id2word) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_id", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":48 - * - * def get_id(self, word): - * if not word in self.word2id: # <<<<<<<<<<<<<< - * self.word2id[word] = len(self.id2word) - * self.id2word.append(word) - */ - __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_word, __pyx_v_self->word2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":49 - * def get_id(self, word): - * if not word in self.word2id: - * self.word2id[word] = len(self.id2word) # <<<<<<<<<<<<<< - * self.id2word.append(word) - * return self.word2id[word] - */ - __pyx_t_3 = __pyx_v_self->id2word; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (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; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":50 - * if not word in self.word2id: - * self.word2id[word] = len(self.id2word) - * self.id2word.append(word) # <<<<<<<<<<<<<< - * return self.word2id[word] - * - */ - __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_self->id2word, __pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":51 - * self.word2id[word] = len(self.id2word) - * self.id2word.append(word) - * return self.word2id[word] # <<<<<<<<<<<<<< - * - * def __getitem__(self, loc): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyObject_GetItem(__pyx_v_self->word2id, __pyx_v_word); if (!__pyx_t_3) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_id", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":53 - * return self.word2id[word] - * - * def __getitem__(self, loc): # <<<<<<<<<<<<<< - * return self.id2word[self.data.arr[loc]] - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":54 - * - * def __getitem__(self, loc): - * return self.id2word[self.data.arr[loc]] # <<<<<<<<<<<<<< - * - * def get_sentence_bounds(self, loc): - */ - __Pyx_XDECREF(__pyx_r); - __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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->id2word, (__pyx_v_self->data->arr[__pyx_t_1]), sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_13get_sentence_bounds(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_13get_sentence_bounds(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_sentence_bounds (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":56 - * return self.id2word[self.data.arr[loc]] - * - * 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]) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { - int __pyx_v_sid; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - 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("get_sentence_bounds", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":57 - * - * 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]) - * - */ - __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]); - - /* "/home/mdenkows/cdec/python/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]) # <<<<<<<<<<<<<< - * - * def write_text(self, char* filename): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong((__pyx_v_self->sent_index->arr[__pyx_v_sid])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong((__pyx_v_self->sent_index->arr[(__pyx_v_sid + 1)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __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[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_sentence_bounds", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[3]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":60 - * return (self.sent_index.arr[sid], self.sent_index.arr[sid+1]) - * - * def write_text(self, char* filename): # <<<<<<<<<<<<<< - * with open(filename, "w") as f: - * for w_id in self.data: - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_w_id = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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_12 = NULL; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_text", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61 - * - * def write_text(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * for w_id in self.data: - * if w_id > 1: - */ - /*with:*/ { - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __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__w)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); - __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_INCREF(__pyx_t_4); - __pyx_v_f = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/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; - } 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_GOTREF(__pyx_t_4); - __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; - } - for (;;) { - if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_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 - } else { - __pyx_t_1 = __pyx_t_9(__pyx_t_4); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_w_id); - __pyx_v_w_id = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":63 - * 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 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __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(((PyObject *)__pyx_t_11)); - __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_GOTREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L18; - } - __pyx_L18:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_16), 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_L19:; - } - __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; - 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_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61 - * - * def write_text(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * for w_id in self.data: - * if w_id > 1: - */ - /*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;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = PyTuple_New(3); 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_1); - __Pyx_INCREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __Pyx_INCREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_13 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_GIVEREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_12); - __Pyx_GIVEREF(__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_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L22; - } - __pyx_L22:; - __Pyx_DECREF(((PyObject *)__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_11); __pyx_t_11 = 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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_3) { - __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_17, 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_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L23; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L1_error; - __pyx_L23:; - } - - __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_12); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_w_id); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_17read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_17read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":68 - * f.write("\n") - * - * def read_text(self, char* filename): # <<<<<<<<<<<<<< - * with gzip_or_text(filename) as fp: - * self.read_text_data(fp) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { - PyObject *__pyx_v_fp = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_text", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69 - * - * def read_text(self, char* filename): - * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< - * self.read_text_data(fp) - * - */ - /*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_GOTREF(((PyObject *)__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_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_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_4 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_INCREF(__pyx_t_1); - __pyx_v_fp = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":70 - * def read_text(self, char* filename): - * with gzip_or_text(filename) as fp: - * self.read_text_data(fp) # <<<<<<<<<<<<<< - * - * def read_bitext(self, char* filename, int side): - */ - __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; - goto __pyx_L14_try_end; - __pyx_L7_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69 - * - * def read_text(self, char* filename): - * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< - * self.read_text_data(fp) - * - */ - /*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;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_New(3); 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_INCREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_10 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__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_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L18; - } - __pyx_L18:; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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_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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_4) { - __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_18, 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_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L19; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L1_error; - __pyx_L19:; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_fp); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_19read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_19read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - char *__pyx_v_filename; - int __pyx_v_side; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_bitext (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__side,0}; - PyObject* values[2] = {0,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__filename)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_bitext", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_bitext") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_filename = __Pyx_PyObject_AsString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_side = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_side == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_bitext", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), __pyx_v_filename, __pyx_v_side); - __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 */ - -/* "/home/mdenkows/cdec/python/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) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_11read_bitext_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_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_2_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_2_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_1_read_bitext *) __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_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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)) { - __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; - } - 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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_line); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_line); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_line = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __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_GetItemInt(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_side, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __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_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("genexpr", __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; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":72 - * self.read_text_data(fp) - * - * def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<< - * with gzip_or_text(filename) as fp: - * data = (line.split(' ||| ')[side] for line in fp) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename, int __pyx_v_side) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *__pyx_cur_scope; - PyObject *__pyx_v_data = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_bitext", 0); - __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_side = __pyx_v_side; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73 - * - * 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) - */ - /*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_GOTREF(((PyObject *)__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_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_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_4 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_XGOTREF(__pyx_t_7); - /*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; - - /* "/home/mdenkows/cdec/python/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; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * def read_text_data(self, data): - */ - __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; - goto __pyx_L14_try_end; - __pyx_L7_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73 - * - * 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) - */ - /*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;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyTuple_New(3); 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_INCREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_10 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__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_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L18; - } - __pyx_L18:; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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_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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_4) { - __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_21, 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_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L19; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L1_error; - __pyx_L19:; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_data); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_21read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_21read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_text_data (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_data)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":77 - * self.read_text_data(data) - * - * def read_text_data(self, data): # <<<<<<<<<<<<<< - * cdef int word_count = 0 - * for line_num, line in enumerate(data): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_data) { - int __pyx_v_word_count; - PyObject *__pyx_v_line_num = NULL; - PyObject *__pyx_v_line = NULL; - PyObject *__pyx_v_word = NULL; - PyObject *__pyx_r = NULL; - __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_6 = NULL; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_text_data", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":78 - * - * def read_text_data(self, data): - * cdef int word_count = 0 # <<<<<<<<<<<<<< - * for line_num, line in enumerate(data): - * self.sent_index.append(word_count) - */ - __pyx_v_word_count = 0; - - /* "/home/mdenkows/cdec/python/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_INCREF(__pyx_int_0); - __pyx_t_1 = __pyx_int_0; - if (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; - } - 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 - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF(__pyx_v_line); - __pyx_v_line = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_line_num); - __pyx_v_line_num = __pyx_t_1; - __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":80 - * cdef int word_count = 0 - * 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)) - */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_word_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __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; - - /* "/home/mdenkows/cdec/python/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_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); 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_6); __pyx_t_6 = 0; - if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - for (;;) { - if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; 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_6, __pyx_t_7); __pyx_t_7++; 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_8 && PyTuple_CheckExact(__pyx_t_6)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; 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_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_5 = __pyx_t_8(__pyx_t_6); - if (unlikely(!__pyx_t_5)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF(__pyx_v_word); - __pyx_v_word = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_id); 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_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_word); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_word); - __Pyx_GIVEREF(__pyx_v_word); - __pyx_t_10 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_9), NULL); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/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_11 = (__pyx_v_self->use_sent_id != 0); - if (__pyx_t_11) { - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":84 - * self.data.append(self.get_id(word)) - * if self.use_sent_id: - * self.sent_id.append(line_num) # <<<<<<<<<<<<<< - * word_count = word_count + 1 - * self.data.append(1) - */ - __pyx_t_9 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_id), __pyx_v_line_num); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":85 - * if self.use_sent_id: - * self.sent_id.append(line_num) - * word_count = word_count + 1 # <<<<<<<<<<<<<< - * self.data.append(1) - * if self.use_sent_id: - */ - __pyx_v_word_count = (__pyx_v_word_count + 1); - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":86 - * self.sent_id.append(line_num) - * word_count = word_count + 1 - * self.data.append(1) # <<<<<<<<<<<<<< - * if self.use_sent_id: - * self.sent_id.append(line_num) - */ - __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/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_11 = (__pyx_v_self->use_sent_id != 0); - if (__pyx_t_11) { - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":88 - * self.data.append(1) - * if self.use_sent_id: - * self.sent_id.append(line_num) # <<<<<<<<<<<<<< - * word_count = word_count + 1 - * self.data.append(0) - */ - __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_id), __pyx_v_line_num); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":89 - * if self.use_sent_id: - * self.sent_id.append(line_num) - * word_count = word_count + 1 # <<<<<<<<<<<<<< - * self.data.append(0) - * self.sent_index.append(word_count) - */ - __pyx_v_word_count = (__pyx_v_word_count + 1); - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":90 - * self.sent_id.append(line_num) - * word_count = word_count + 1 - * self.data.append(0) # <<<<<<<<<<<<<< - * self.sent_index.append(word_count) - * - */ - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_int_0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":91 - * word_count = word_count + 1 - * self.data.append(0) - * self.sent_index.append(word_count) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_word_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __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_2); __pyx_t_2 = 0; - - __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_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text_data", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_line_num); - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XDECREF(__pyx_v_word); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_23read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_23read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[3]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":94 - * - * - * def read_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_binary", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":96 - * def read_binary(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "r") # <<<<<<<<<<<<<< - * self.read_handle(f) - * fclose(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":97 - * cdef FILE* f - * f = fopen(filename, "r") - * self.read_handle(f) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":98 - * f = fopen(filename, "r") - * self.read_handle(f) - * fclose(f) # <<<<<<<<<<<<<< - * - * cdef void read_handle(self, FILE* f): - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":100 - * fclose(f) - * - * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< - * cdef int num_words, word_len - * cdef unsigned i - */ - -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) { - int __pyx_v_num_words; - int __pyx_v_word_len; - CYTHON_UNUSED unsigned int __pyx_v_i; - char *__pyx_v_word; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - unsigned int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - 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_RefNannySetupContext("read_handle", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":105 - * cdef char* word - * - * self.data.read_handle(f) # <<<<<<<<<<<<<< - * self.sent_index.read_handle(f) - * self.sent_id.read_handle(f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->read_handle(__pyx_v_self->data, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":106 - * - * self.data.read_handle(f) - * self.sent_index.read_handle(f) # <<<<<<<<<<<<<< - * self.sent_id.read_handle(f) - * fread(&(num_words), sizeof(int), 1, f) - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":107 - * self.data.read_handle(f) - * self.sent_index.read_handle(f) - * self.sent_id.read_handle(f) # <<<<<<<<<<<<<< - * fread(&(num_words), sizeof(int), 1, f) - * for i in range(num_words): - */ - ((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); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * for i in range(num_words): - * fread(&(word_len), sizeof(int), 1, f) - */ - fread((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< - * fread(&(word_len), sizeof(int), 1, f) - * word = malloc (word_len * sizeof(char)) - */ - __pyx_t_1 = __pyx_v_num_words; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/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) # <<<<<<<<<<<<<< - * word = malloc (word_len * sizeof(char)) - * fread(word, sizeof(char), word_len, f) - */ - fread((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":111 - * for i in range(num_words): - * fread(&(word_len), sizeof(int), 1, f) - * word = malloc (word_len * sizeof(char)) # <<<<<<<<<<<<<< - * fread(word, sizeof(char), word_len, f) - * self.word2id[word] = len(self.id2word) - */ - __pyx_v_word = ((char *)malloc((__pyx_v_word_len * (sizeof(char))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":112 - * fread(&(word_len), sizeof(int), 1, f) - * word = malloc (word_len * sizeof(char)) - * fread(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< - * self.word2id[word] = len(self.id2word) - * self.id2word.append(word) - */ - fread(__pyx_v_word, (sizeof(char)), __pyx_v_word_len, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":113 - * word = malloc (word_len * sizeof(char)) - * fread(word, sizeof(char), word_len, f) - * self.word2id[word] = len(self.id2word) # <<<<<<<<<<<<<< - * self.id2word.append(word) - * free(word) - */ - __pyx_t_3 = __pyx_v_self->id2word; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_word); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyObject_SetItem(__pyx_v_self->word2id, ((PyObject *)__pyx_t_5), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":114 - * fread(word, sizeof(char), word_len, f) - * self.word2id[word] = len(self.id2word) - * self.id2word.append(word) # <<<<<<<<<<<<<< - * free(word) - * if len(self.sent_id) == 0: - */ - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->id2word, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":115 - * self.word2id[word] = len(self.id2word) - * self.id2word.append(word) - * free(word) # <<<<<<<<<<<<<< - * if len(self.sent_id) == 0: - * self.use_sent_id = False - */ - free(__pyx_v_word); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":116 - * self.id2word.append(word) - * free(word) - * if len(self.sent_id) == 0: # <<<<<<<<<<<<<< - * self.use_sent_id = False - * else: - */ - __pyx_t_5 = ((PyObject *)__pyx_v_self->sent_id); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_4 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = ((__pyx_t_4 == 0) != 0); - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":117 - * free(word) - * if len(self.sent_id) == 0: - * self.use_sent_id = False # <<<<<<<<<<<<<< - * else: - * self.use_sent_id = True - */ - __pyx_v_self->use_sent_id = 0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":119 - * self.use_sent_id = False - * else: - * self.use_sent_id = True # <<<<<<<<<<<<<< - * - * cdef void write_handle(self, FILE* f): - */ - __pyx_v_self->use_sent_id = 1; - } - __pyx_L5:; - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_WriteUnraisable("cdec.sa._sa.DataArray.read_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":121 - * self.use_sent_id = True - * - * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< - * cdef int word_len - * cdef int num_words - */ - -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) { - int __pyx_v_word_len; - int __pyx_v_num_words; - PyObject *__pyx_v_word = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *(*__pyx_t_4)(PyObject *); - Py_ssize_t __pyx_t_5; - char *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_handle", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":125 - * cdef int num_words - * - * self.data.write_handle(f) # <<<<<<<<<<<<<< - * self.sent_index.write_handle(f) - * self.sent_id.write_handle(f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->write_handle(__pyx_v_self->data, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":126 - * - * self.data.write_handle(f) - * self.sent_index.write_handle(f) # <<<<<<<<<<<<<< - * self.sent_id.write_handle(f) - * num_words = len(self.id2word) - 2 - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":127 - * self.data.write_handle(f) - * self.sent_index.write_handle(f) - * self.sent_id.write_handle(f) # <<<<<<<<<<<<<< - * num_words = len(self.id2word) - 2 - * fwrite(&(num_words), sizeof(int), 1, f) - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":128 - * self.sent_index.write_handle(f) - * self.sent_id.write_handle(f) - * num_words = len(self.id2word) - 2 # <<<<<<<<<<<<<< - * fwrite(&(num_words), sizeof(int), 1, f) - * for word in self.id2word[2:]: - */ - __pyx_t_1 = __pyx_v_self->id2word; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_num_words = (__pyx_t_2 - 2); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * for word in self.id2word[2:]: - * word_len = len(word) + 1 - */ - fwrite((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_self->id2word, 2, 0, NULL, NULL, &__pyx_k_slice_22, 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)) { - __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_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 - } 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(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_word); - __pyx_v_word = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":131 - * 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) - * fwrite(word, sizeof(char), word_len, f) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":132 - * for word in self.id2word[2:]: - * word_len = len(word) + 1 - * fwrite(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * fwrite(word, sizeof(char), word_len, f) - * - */ - fwrite((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":133 - * word_len = len(word) + 1 - * fwrite(&(word_len), sizeof(int), 1, f) - * fwrite(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< - * - * def write_binary(self, char* filename): - */ - __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); - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("cdec.sa._sa.DataArray.write_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_word); - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_25write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_25write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":135 - * fwrite(word, sizeof(char), word_len, f) - * - * def write_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_binary", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":137 - * def write_binary(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "w") # <<<<<<<<<<<<<< - * self.write_handle(f) - * fclose(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":138 - * cdef FILE* f - * f = fopen(filename, "w") - * self.write_handle(f) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":139 - * f = fopen(filename, "w") - * self.write_handle(f) - * fclose(f) # <<<<<<<<<<<<<< - * - * def write_enhanced_handle(self, f): - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_27write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_27write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_enhanced_handle (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_f)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":141 - * fclose(f) - * - * def write_enhanced_handle(self, f): # <<<<<<<<<<<<<< - * for i in self.data: - * f.write("%d " %i) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f) { - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_word = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_enhanced_handle", 0); - - /* "/home/mdenkows/cdec/python/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))) { - __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; - } - 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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__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(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":144 - * for i in self.data: - * f.write("%d " %i) - * f.write("\n") # <<<<<<<<<<<<<< - * for i in self.sent_index: - * f.write("%d " %i) - */ - __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_24), 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/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; - __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; - } - 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 - } else { - __pyx_t_1 = __pyx_t_3(__pyx_t_5); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_25), 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; - - /* "/home/mdenkows/cdec/python/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; - __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; - } - 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 - } else { - __pyx_t_5 = __pyx_t_3(__pyx_t_6); - if (unlikely(!__pyx_t_5)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":149 - * f.write("\n") - * for i in self.sent_id: - * f.write("%d " %i) # <<<<<<<<<<<<<< - * f.write("\n") - * for word in self.id2word: - */ - __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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_26), 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_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/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)) { - __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; - } - 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 - } else { - __pyx_t_6 = __pyx_t_3(__pyx_t_4); - if (unlikely(!__pyx_t_6)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_XDECREF(__pyx_v_word); - __pyx_v_word = __pyx_t_6; - __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/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 (!__pyx_t_1) {__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_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_word); - PyTuple_SET_ITEM(__pyx_t_5, 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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_27), ((PyObject *)__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(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__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, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__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; - __Pyx_DECREF(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":153 - * for word in self.id2word: - * f.write("%s %d " % (word, self.word2id[word])) - * f.write("\n") # <<<<<<<<<<<<<< - * - * def write_enhanced(self, char* filename): - */ - __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 = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __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; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_enhanced_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_word); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_29write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_29write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[3]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":155 - * f.write("\n") - * - * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< - * with open(filename, "w") as f: - * self.write_enhanced_handle(self, f) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_enhanced", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * self.write_enhanced_handle(self, f) - */ - /*with:*/ { - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __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__w)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); - __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_INCREF(__pyx_t_4); - __pyx_v_f = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/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_29); 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_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_INCREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_f); - __Pyx_GIVEREF(__pyx_v_f); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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; - 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * self.write_enhanced_handle(self, f) - */ - /*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); - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_New(3); 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_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_10 = PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GIVEREF(__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_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L18; - } - __pyx_L18:; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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; - 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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_3) { - __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_30, 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_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L19; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L1_error; - __pyx_L19:; - } - - __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_AddTraceback("cdec.sa._sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":10 - * - * cdef class DataArray: - * cdef public word2id # <<<<<<<<<<<<<< - * cdef public id2word - * cdef public IntList data - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->word2id); - __pyx_r = __pyx_v_self->word2id; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->word2id); - __Pyx_DECREF(__pyx_v_self->word2id); - __pyx_v_self->word2id = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->word2id); - __Pyx_DECREF(__pyx_v_self->word2id); - __pyx_v_self->word2id = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":11 - * cdef class DataArray: - * cdef public word2id - * cdef public id2word # <<<<<<<<<<<<<< - * cdef public IntList data - * cdef public IntList sent_id - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->id2word); - __pyx_r = __pyx_v_self->id2word; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->id2word); - __Pyx_DECREF(__pyx_v_self->id2word); - __pyx_v_self->id2word = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->id2word); - __Pyx_DECREF(__pyx_v_self->id2word); - __pyx_v_self->id2word = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":12 - * cdef public word2id - * cdef public id2word - * cdef public IntList data # <<<<<<<<<<<<<< - * cdef public IntList sent_id - * cdef public IntList sent_index - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4data___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->data)); - __pyx_r = ((PyObject *)__pyx_v_self->data); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->data); - __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); - __pyx_v_self->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_value); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.DataArray.data.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->data); - __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); - __pyx_v_self->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":13 - * cdef public id2word - * cdef public IntList data - * cdef public IntList sent_id # <<<<<<<<<<<<<< - * cdef public IntList sent_index - * cdef bint use_sent_id - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->sent_id)); - __pyx_r = ((PyObject *)__pyx_v_self->sent_id); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->sent_id); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_id)); - __pyx_v_self->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_value); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.DataArray.sent_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->sent_id); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_id)); - __pyx_v_self->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":14 - * cdef public IntList data - * cdef public IntList sent_id - * cdef public IntList sent_index # <<<<<<<<<<<<<< - * cdef bint use_sent_id - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->sent_index)); - __pyx_r = ((PyObject *)__pyx_v_self->sent_index); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->sent_index); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); - __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_value); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.DataArray.sent_index.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->sent_index); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); - __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("link", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":16 - * cdef int link(self, int i, int j): - * """Integerizes an alignment link pair""" - * return i * ALIGNMENT_CODE + j # <<<<<<<<<<<<<< - * - * def unlink(self, link): - */ - __pyx_r = ((__pyx_v_i * __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE) + __pyx_v_j); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link); /*proto*/ -static char __pyx_doc_4cdec_2sa_3_sa_9Alignment_unlink[] = "De-integerizes an alignment link pair"; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("unlink (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_link)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":18 - * return i * ALIGNMENT_CODE + j - * - * def unlink(self, link): # <<<<<<<<<<<<<< - * """De-integerizes an alignment link pair""" - * return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link) { - 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("unlink", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":20 - * def unlink(self, link): - * """De-integerizes an alignment link pair""" - * return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE) # <<<<<<<<<<<<<< - * - * cdef _unlink(self, int link, int* f, int* e): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_link, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Remainder(__pyx_v_link, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __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); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.Alignment.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":22 - * return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE) - * - * cdef _unlink(self, int link, int* f, int* e): # <<<<<<<<<<<<<< - * f[0] = link / ALIGNMENT_CODE - * e[0] = link % ALIGNMENT_CODE - */ - -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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_unlink", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":23 - * - * cdef _unlink(self, int link, int* f, int* e): - * f[0] = link / ALIGNMENT_CODE # <<<<<<<<<<<<<< - * e[0] = link % ALIGNMENT_CODE - * - */ - if (unlikely(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_link))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_f[0]) = __Pyx_div_int(__pyx_v_link, __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":24 - * cdef _unlink(self, int link, int* f, int* e): - * f[0] = link / ALIGNMENT_CODE - * e[0] = link % ALIGNMENT_CODE # <<<<<<<<<<<<<< - * - * def get_sent_links(self, int sent_id): - */ - if (unlikely(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - (__pyx_v_e[0]) = __Pyx_mod_int(__pyx_v_link, __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.Alignment._unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id) { - int __pyx_v_sent_id; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_sent_links (wrapper)", 0); - assert(__pyx_arg_sent_id); { - __pyx_v_sent_id = __Pyx_PyInt_AsInt(__pyx_arg_sent_id); if (unlikely((__pyx_v_sent_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((int)__pyx_v_sent_id)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":26 - * e[0] = link % ALIGNMENT_CODE - * - * def get_sent_links(self, int sent_id): # <<<<<<<<<<<<<< - * cdef IntList sent_links - * cdef int* arr - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id) { - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_sent_links = 0; - int *__pyx_v_arr; - int __pyx_v_arr_len; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_sent_links", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":30 - * cdef int* arr - * cdef int arr_len - * sent_links = IntList() # <<<<<<<<<<<<<< - * arr = self._get_sent_links(sent_id, &arr_len) - * sent_links._extend_arr(arr, arr_len*2) - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_sent_links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":31 - * cdef int arr_len - * sent_links = IntList() - * arr = self._get_sent_links(sent_id, &arr_len) # <<<<<<<<<<<<<< - * sent_links._extend_arr(arr, arr_len*2) - * free(arr) - */ - __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)); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * free(arr) - * return sent_links - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":33 - * arr = self._get_sent_links(sent_id, &arr_len) - * sent_links._extend_arr(arr, arr_len*2) - * free(arr) # <<<<<<<<<<<<<< - * return sent_links - * - */ - free(__pyx_v_arr); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":34 - * sent_links._extend_arr(arr, arr_len*2) - * free(arr) - * return sent_links # <<<<<<<<<<<<<< - * - * cdef int* _get_sent_links(self, int sent_id, int* num_links): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_sent_links)); - __pyx_r = ((PyObject *)__pyx_v_sent_links); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_sent_links); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":36 - * return sent_links - * - * cdef int* _get_sent_links(self, int sent_id, int* num_links): # <<<<<<<<<<<<<< - * cdef int* sent_links - * cdef int i, start, end - */ - -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) { - int *__pyx_v_sent_links; - int __pyx_v_i; - int __pyx_v_start; - int __pyx_v_end; - int *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_get_sent_links", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":39 - * cdef int* sent_links - * cdef int i, start, end - * start = self.sent_index.arr[sent_id] # <<<<<<<<<<<<<< - * end = self.sent_index.arr[sent_id+1] - * num_links[0] = end - start - */ - __pyx_v_start = (__pyx_v_self->sent_index->arr[__pyx_v_sent_id]); - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * num_links[0] = end - start - * sent_links = malloc(2*num_links[0]*sizeof(int)) - */ - __pyx_v_end = (__pyx_v_self->sent_index->arr[(__pyx_v_sent_id + 1)]); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * sent_links = malloc(2*num_links[0]*sizeof(int)) - * for i from 0 <= i < num_links[0]: - */ - (__pyx_v_num_links[0]) = (__pyx_v_end - __pyx_v_start); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":42 - * end = self.sent_index.arr[sent_id+1] - * num_links[0] = end - start - * sent_links = 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) - */ - __pyx_v_sent_links = ((int *)malloc(((2 * (__pyx_v_num_links[0])) * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":43 - * num_links[0] = end - start - * sent_links = 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) - * return sent_links - */ - __pyx_t_1 = (__pyx_v_num_links[0]); - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":44 - * sent_links = 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) # <<<<<<<<<<<<<< - * return sent_links - * - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->_unlink(__pyx_v_self, (__pyx_v_self->links->arr[(__pyx_v_start + __pyx_v_i)]), (__pyx_v_sent_links + (2 * __pyx_v_i)), ((__pyx_v_sent_links + (2 * __pyx_v_i)) + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * - * def __cinit__(self, from_binary=None, from_text=None): - */ - __pyx_r = __pyx_v_sent_links; - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("cdec.sa._sa.Alignment._get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_from_binary = 0; - PyObject *__pyx_v_from_text = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,0}; - PyObject* values[2] = {0,0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":47 - * return sent_links - * - * def __cinit__(self, from_binary=None, from_text=None): # <<<<<<<<<<<<<< - * self.links = IntList(1000,1000) - * self.sent_index = IntList(1000,1000) - */ - values[0] = ((PyObject *)Py_None); - values[1] = ((PyObject *)Py_None); - 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__from_binary); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_text); - if (value) { values[1] = 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[4]; __pyx_lineno = 47; __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_from_binary = values[0]; - __pyx_v_from_text = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - 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("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":48 - * - * def __cinit__(self, from_binary=None, from_text=None): - * self.links = IntList(1000,1000) # <<<<<<<<<<<<<< - * self.sent_index = IntList(1000,1000) - * if from_binary: - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->links); - __Pyx_DECREF(((PyObject *)__pyx_v_self->links)); - __pyx_v_self->links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * if from_binary: - * self.read_binary(from_binary) - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->sent_index); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); - __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":50 - * self.links = IntList(1000,1000) - * self.sent_index = IntList(1000,1000) - * if from_binary: # <<<<<<<<<<<<<< - * self.read_binary(from_binary) - * elif from_text: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":52 - * if from_binary: - * self.read_binary(from_binary) - * elif from_text: # <<<<<<<<<<<<<< - * self.read_text(from_text) - * - */ - __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) { - - /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":55 - * self.read_text(from_text) - * - * def read_text(self, char* filename): # <<<<<<<<<<<<<< - * with gzip_or_text(filename) as f: - * for line in f: - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_line = NULL; - PyObject *__pyx_v_pairs = NULL; - PyObject *__pyx_v_pair = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_j = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - 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 = NULL; - PyObject *(*__pyx_t_15)(PyObject *); - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - PyObject *__pyx_t_19 = NULL; - int __pyx_t_20; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_text", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56 - * - * def read_text(self, char* filename): - * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< - * for line in f: - * 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_GOTREF(((PyObject *)__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_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_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_4 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_INCREF(__pyx_t_1); - __pyx_v_f = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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; - } 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; - } - 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 - } else { - __pyx_t_2 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __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_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":59 - * for line in f: - * self.sent_index.append(len(self.links)) - * pairs = line.split() # <<<<<<<<<<<<<< - * for pair in pairs: - * (i, j) = map(int, pair.split('-')) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__split); 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_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_v_pairs); - __pyx_v_pairs = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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_2 = __pyx_v_pairs; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext; - } - for (;;) { - if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __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_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - #endif - } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __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_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - #endif - } else { - __pyx_t_3 = __pyx_t_11(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF(__pyx_v_pair); - __pyx_v_pair = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":61 - * pairs = line.split() - * for pair in pairs: - * (i, j) = map(int, pair.split('-')) # <<<<<<<<<<<<<< - * self.links.append(self.link(i, j)) - * self.sent_index.append(len(self.links)) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s__split); 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_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); 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_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); - __pyx_t_13 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_13); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); 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_t_13 = PySequence_ITEM(sequence, 1); 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); - #endif - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_14 = PyObject_GetIter(__pyx_t_12); 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_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_3)) goto __pyx_L20_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L20_unpacking_failed; - __Pyx_GOTREF(__pyx_t_13); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_15 = NULL; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - goto __pyx_L21_unpacking_done; - __pyx_L20_unpacking_failed:; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_15 = 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_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_13; - __pyx_t_13 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":62 - * for pair in pairs: - * (i, j) = map(int, pair.split('-')) - * self.links.append(self.link(i, j)) # <<<<<<<<<<<<<< - * self.sent_index.append(len(self.links)) - * - */ - __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_v_j); 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_12 = PyInt_FromLong(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->link(__pyx_v_self, __pyx_t_16, __pyx_t_17)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->links), __pyx_t_12); 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_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __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; - } - __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; - goto __pyx_L14_try_end; - __pyx_L7_error:; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56 - * - * def read_text(self, char* filename): - * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< - * for line in f: - * self.sent_index.append(len(self.links)) - */ - /*except:*/ { - __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_t_19 = PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_18 = __Pyx_PyObject_IsTrue(__pyx_t_19); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - if (__pyx_t_18 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __pyx_t_20 = ((!(__pyx_t_18 != 0)) != 0); - if (__pyx_t_20) { - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_13); - __Pyx_ErrRestore(__pyx_t_2, __pyx_t_1, __pyx_t_13); - __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_13 = 0; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L24; - } - __pyx_L24:; - __Pyx_DECREF(((PyObject *)__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; - __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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_4) { - __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_35, 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_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_20 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L25; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L1_error; - __pyx_L25:; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XDECREF(__pyx_v_pairs); - __Pyx_XDECREF(__pyx_v_pair); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_j); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":65 - * self.sent_index.append(len(self.links)) - * - * def read_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_binary", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":67 - * def read_binary(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "r") # <<<<<<<<<<<<<< - * self.links.read_handle(f) - * self.sent_index.read_handle(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":68 - * cdef FILE* f - * f = fopen(filename, "r") - * self.links.read_handle(f) # <<<<<<<<<<<<<< - * self.sent_index.read_handle(f) - * fclose(f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->read_handle(__pyx_v_self->links, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":69 - * f = fopen(filename, "r") - * self.links.read_handle(f) - * self.sent_index.read_handle(f) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":70 - * self.links.read_handle(f) - * self.sent_index.read_handle(f) - * fclose(f) # <<<<<<<<<<<<<< - * - * def write_text(self, char* filename): - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":72 - * fclose(f) - * - * def write_text(self, char* filename): # <<<<<<<<<<<<<< - * with open(filename, "w") as f: - * sent_num = 0 - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_sent_num = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_link = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73 - * - * def write_text(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * sent_num = 0 - * for i, link in enumerate(self.links): - */ - /*with:*/ { - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __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__w)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); - __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_INCREF(__pyx_t_4); - __pyx_v_f = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":74 - * def write_text(self, char* filename): - * with open(filename, "w") as f: - * sent_num = 0 # <<<<<<<<<<<<<< - * for i, link in enumerate(self.links): - * while i >= self.sent_index[sent_num]: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_sent_num = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/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_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; - } 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_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - 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 - } else { - __pyx_t_2 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF(__pyx_v_link); - __pyx_v_link = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_INCREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_4; - __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); - __pyx_t_4 = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":76 - * sent_num = 0 - * for i, link in enumerate(self.links): - * while i >= self.sent_index[sent_num]: # <<<<<<<<<<<<<< - * f.write("\n") - * sent_num = sent_num + 1 - */ - while (1) { - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->sent_index), __pyx_v_sent_num); if (!__pyx_t_2) {__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_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; - if (!__pyx_t_11) break; - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_36), 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_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":78 - * while i >= self.sent_index[sent_num]: - * f.write("\n") - * sent_num = sent_num + 1 # <<<<<<<<<<<<<< - * f.write("%d-%d " % self.unlink(link)) - * f.write("\n") - */ - __pyx_t_2 = PyNumber_Add(__pyx_v_sent_num, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_sent_num); - __pyx_v_sent_num = __pyx_t_2; - __pyx_t_2 = 0; - } - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_10, ((PyObject *)__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_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), __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(((PyObject *)__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[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__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(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":80 - * sent_num = sent_num + 1 - * f.write("%d-%d " % self.unlink(link)) - * f.write("\n") # <<<<<<<<<<<<<< - * - * def write_binary(self, char* filename): - */ - __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 = 80; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 80; __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; - } - __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; - 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_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73 - * - * def write_text(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * sent_num = 0 - * for i, link in enumerate(self.links): - */ - /*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;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = PyTuple_New(3); 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_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_14 = PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; - 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_GIVEREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GIVEREF(__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_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L22; - } - __pyx_L22:; - __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __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; - 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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_3) { - __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_39, 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_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_15 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L23; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L1_error; - __pyx_L23:; - } - - __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_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_sent_num); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_link); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[4]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":82 - * f.write("\n") - * - * def write_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_binary", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":84 - * def write_binary(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "w") # <<<<<<<<<<<<<< - * self.links.write_handle(f) - * self.sent_index.write_handle(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":85 - * cdef FILE* f - * f = fopen(filename, "w") - * self.links.write_handle(f) # <<<<<<<<<<<<<< - * self.sent_index.write_handle(f) - * fclose(f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->write_handle(__pyx_v_self->links, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":86 - * f = fopen(filename, "w") - * self.links.write_handle(f) - * self.sent_index.write_handle(f) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":87 - * self.links.write_handle(f) - * self.sent_index.write_handle(f) - * fclose(f) # <<<<<<<<<<<<<< - * - * def write_enhanced(self, char* filename): - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[4]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":89 - * fclose(f) - * - * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< - * with open(filename, "w") as f: - * for link in self.links: - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_link = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_enhanced", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * for link in self.links: - * f.write("%d " % link) - */ - /*with:*/ { - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __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__w)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); - __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_INCREF(__pyx_t_4); - __pyx_v_f = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/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; - } 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_GOTREF(__pyx_t_4); - __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; - } - for (;;) { - if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_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 - } else { - __pyx_t_1 = __pyx_t_9(__pyx_t_4); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_link); - __pyx_v_link = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":93 - * for link in self.links: - * f.write("%d " % link) - * f.write("\n") # <<<<<<<<<<<<<< - * for i in self.sent_index: - * f.write("%d " % i) - */ - __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_40), 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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; - } 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; - } - 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 - } else { - __pyx_t_4 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_41), 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_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; - 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_10); __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * for link in self.links: - * f.write("%d " % link) - */ - /*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_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_12); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __pyx_t_13 = ((!(__pyx_t_11 != 0)) != 0); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__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; - {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L22; - } - __pyx_L22:; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_3) { - __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_42, 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_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_13 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L23; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L1_error; - __pyx_L23:; - } - - __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_10); - __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_link); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static char __pyx_doc_4cdec_2sa_3_sa_9Alignment_16alignment[] = "Return all (e,f) pairs for sentence i"; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("alignment (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":98 - * f.write("\n") - * - * def alignment(self, i): # <<<<<<<<<<<<<< - * """Return all (e,f) pairs for sentence i""" - * cdef int j, start, end - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i) { - int __pyx_v_j; - int __pyx_v_start; - int __pyx_v_end; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("alignment", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":101 - * """Return all (e,f) pairs for sentence i""" - * cdef int j, start, end - * result = [] # <<<<<<<<<<<<<< - * start = self.sent_index.arr[i] - * end = self.sent_index.arr[i+1] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_result = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":102 - * cdef int j, start, end - * result = [] - * start = self.sent_index.arr[i] # <<<<<<<<<<<<<< - * end = self.sent_index.arr[i+1] - * for j from start <= j < end: - */ - __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]); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":103 - * result = [] - * start = self.sent_index.arr[i] - * end = self.sent_index.arr[i+1] # <<<<<<<<<<<<<< - * for j from start <= j < end: - * result.append(self.unlink(self.links.arr[j])) - */ - __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_end = (__pyx_v_self->sent_index->arr[__pyx_t_2]); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":104 - * start = self.sent_index.arr[i] - * 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_3 = __pyx_v_end; - for (__pyx_v_j = __pyx_v_start; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { - - /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong((__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_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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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(((PyObject *)__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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":106 - * for j from start <= j < end: - * result.append(self.unlink(self.links.arr[j])) - * return result # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("cdec.sa._sa.Alignment.alignment", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":15 - * int val - * - * cdef _node* new_node(int key): # <<<<<<<<<<<<<< - * cdef _node* n - * n = <_node*> malloc(sizeof(_node)) - */ - -static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int __pyx_v_key) { - struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_v_n; - struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("new_node", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":17 - * cdef _node* new_node(int key): - * cdef _node* n - * n = <_node*> malloc(sizeof(_node)) # <<<<<<<<<<<<<< - * n.smaller = NULL - * n.bigger = NULL - */ - __pyx_v_n = ((struct __pyx_t_4cdec_2sa_3_sa__node *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__node)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":18 - * cdef _node* n - * n = <_node*> malloc(sizeof(_node)) - * n.smaller = NULL # <<<<<<<<<<<<<< - * n.bigger = NULL - * n.key = key - */ - __pyx_v_n->smaller = NULL; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":19 - * n = <_node*> malloc(sizeof(_node)) - * n.smaller = NULL - * n.bigger = NULL # <<<<<<<<<<<<<< - * n.key = key - * n.val = 0 - */ - __pyx_v_n->bigger = NULL; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":20 - * n.smaller = NULL - * n.bigger = NULL - * n.key = key # <<<<<<<<<<<<<< - * n.val = 0 - * return n - */ - __pyx_v_n->key = __pyx_v_key; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":21 - * n.bigger = NULL - * n.key = key - * n.val = 0 # <<<<<<<<<<<<<< - * return n - * - */ - __pyx_v_n->val = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":22 - * n.key = key - * n.val = 0 - * return n # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_n; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":25 - * - * - * cdef del_node(_node* n): # <<<<<<<<<<<<<< - * if n.smaller != NULL: - * del_node(n.smaller) - */ - -static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_v_n) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("del_node", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":26 - * - * cdef del_node(_node* n): - * if n.smaller != NULL: # <<<<<<<<<<<<<< - * del_node(n.smaller) - * if n.bigger != NULL: - */ - __pyx_t_1 = ((__pyx_v_n->smaller != NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":27 - * cdef del_node(_node* n): - * if n.smaller != NULL: - * del_node(n.smaller) # <<<<<<<<<<<<<< - * if n.bigger != NULL: - * del_node(n.bigger) - */ - __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_del_node(__pyx_v_n->smaller); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 27; __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:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":28 - * if n.smaller != NULL: - * del_node(n.smaller) - * if n.bigger != NULL: # <<<<<<<<<<<<<< - * del_node(n.bigger) - * free(n) - */ - __pyx_t_1 = ((__pyx_v_n->bigger != NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":29 - * del_node(n.smaller) - * if n.bigger != NULL: - * del_node(n.bigger) # <<<<<<<<<<<<<< - * free(n) - * - */ - __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_del_node(__pyx_v_n->bigger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 29; __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:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":30 - * if n.bigger != NULL: - * del_node(n.bigger) - * free(n) # <<<<<<<<<<<<<< - * - * cdef int* get_val(_node* n, int key): - */ - free(__pyx_v_n); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.del_node", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":32 - * free(n) - * - * cdef int* get_val(_node* n, int key): # <<<<<<<<<<<<<< - * if key == n.key: - * return &n.val - */ - -static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_v_n, int __pyx_v_key) { - int *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_val", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":33 - * - * cdef int* get_val(_node* n, int key): - * if key == n.key: # <<<<<<<<<<<<<< - * return &n.val - * elif key < n.key: - */ - __pyx_t_1 = ((__pyx_v_key == __pyx_v_n->key) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":34 - * cdef int* get_val(_node* n, int key): - * if key == n.key: - * return &n.val # <<<<<<<<<<<<<< - * elif key < n.key: - * if n.smaller == NULL: - */ - __pyx_r = (&__pyx_v_n->val); - goto __pyx_L0; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":35 - * if key == n.key: - * return &n.val - * elif key < n.key: # <<<<<<<<<<<<<< - * if n.smaller == NULL: - * n.smaller = new_node(key) - */ - __pyx_t_1 = ((__pyx_v_key < __pyx_v_n->key) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":36 - * return &n.val - * elif key < n.key: - * if n.smaller == NULL: # <<<<<<<<<<<<<< - * n.smaller = new_node(key) - * return &(n.smaller.val) - */ - __pyx_t_1 = ((__pyx_v_n->smaller == NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":37 - * elif key < n.key: - * if n.smaller == NULL: - * n.smaller = new_node(key) # <<<<<<<<<<<<<< - * return &(n.smaller.val) - * return get_val(n.smaller, key) - */ - __pyx_v_n->smaller = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_key); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":38 - * if n.smaller == NULL: - * n.smaller = new_node(key) - * return &(n.smaller.val) # <<<<<<<<<<<<<< - * return get_val(n.smaller, key) - * else: - */ - __pyx_r = (&__pyx_v_n->smaller->val); - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":39 - * n.smaller = new_node(key) - * return &(n.smaller.val) - * return get_val(n.smaller, key) # <<<<<<<<<<<<<< - * else: - * if n.bigger == NULL: - */ - __pyx_r = __pyx_f_4cdec_2sa_3_sa_get_val(__pyx_v_n->smaller, __pyx_v_key); - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":41 - * return get_val(n.smaller, key) - * else: - * if n.bigger == NULL: # <<<<<<<<<<<<<< - * n.bigger = new_node(key) - * return &(n.bigger.val) - */ - __pyx_t_1 = ((__pyx_v_n->bigger == NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":42 - * else: - * if n.bigger == NULL: - * n.bigger = new_node(key) # <<<<<<<<<<<<<< - * return &(n.bigger.val) - * return get_val(n.bigger, key) - */ - __pyx_v_n->bigger = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_key); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":43 - * if n.bigger == NULL: - * n.bigger = new_node(key) - * return &(n.bigger.val) # <<<<<<<<<<<<<< - * return get_val(n.bigger, key) - * - */ - __pyx_r = (&__pyx_v_n->bigger->val); - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":44 - * n.bigger = new_node(key) - * return &(n.bigger.val) - * return get_val(n.bigger, key) # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_f_4cdec_2sa_3_sa_get_val(__pyx_v_n->bigger, __pyx_v_key); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_from_text = 0; - PyObject *__pyx_v_from_data = 0; - PyObject *__pyx_v_from_binary = 0; - PyObject *__pyx_v_earray = 0; - PyObject *__pyx_v_fsarray = 0; - PyObject *__pyx_v_alignment = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_text,&__pyx_n_s__from_data,&__pyx_n_s__from_binary,&__pyx_n_s__earray,&__pyx_n_s__fsarray,&__pyx_n_s__alignment,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54 - * cdef id2eword, id2fword, eword2id, fword2id - * - * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< - * earray=None, fsarray=None, alignment=None): - * self.id2eword = [] - */ - values[0] = ((PyObject *)Py_None); - values[1] = __pyx_k_43; - values[2] = ((PyObject *)Py_None); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":55 - * - * def __cinit__(self, from_text=None, from_data=False, from_binary=None, - * earray=None, fsarray=None, alignment=None): # <<<<<<<<<<<<<< - * self.id2eword = [] - * self.id2fword = [] - */ - values[3] = ((PyObject *)Py_None); - values[4] = ((PyObject *)Py_None); - values[5] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__from_text); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_data); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_binary); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__earray); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alignment); - if (value) { values[5] = 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 = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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_from_text = values[0]; - __pyx_v_from_data = values[1]; - __pyx_v_from_binary = values[2]; - __pyx_v_earray = values[3]; - __pyx_v_fsarray = values[4]; - __pyx_v_alignment = values[5]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __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); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54 - * cdef id2eword, id2fword, eword2id, fword2id - * - * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< - * earray=None, fsarray=None, alignment=None): - * self.id2eword = [] - */ - -static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_from_text, PyObject *__pyx_v_from_data, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_earray, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_alignment) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - 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("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/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 = [] # <<<<<<<<<<<<<< - * self.id2fword = [] - * self.eword2id = {} - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(__pyx_v_self->id2eword); - __Pyx_DECREF(__pyx_v_self->id2eword); - __pyx_v_self->id2eword = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":57 - * earray=None, fsarray=None, alignment=None): - * self.id2eword = [] - * self.id2fword = [] # <<<<<<<<<<<<<< - * self.eword2id = {} - * self.fword2id = {} - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(__pyx_v_self->id2fword); - __Pyx_DECREF(__pyx_v_self->id2fword); - __pyx_v_self->id2fword = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":58 - * self.id2eword = [] - * self.id2fword = [] - * self.eword2id = {} # <<<<<<<<<<<<<< - * self.fword2id = {} - * self.e_index = IntList() - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(__pyx_v_self->eword2id); - __Pyx_DECREF(__pyx_v_self->eword2id); - __pyx_v_self->eword2id = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":59 - * self.id2fword = [] - * self.eword2id = {} - * self.fword2id = {} # <<<<<<<<<<<<<< - * self.e_index = IntList() - * self.f_index = IntList() - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(__pyx_v_self->fword2id); - __Pyx_DECREF(__pyx_v_self->fword2id); - __pyx_v_self->fword2id = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":60 - * self.eword2id = {} - * self.fword2id = {} - * self.e_index = IntList() # <<<<<<<<<<<<<< - * self.f_index = IntList() - * self.col1 = FloatList() - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((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_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __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_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":61 - * self.fword2id = {} - * self.e_index = IntList() - * self.f_index = IntList() # <<<<<<<<<<<<<< - * self.col1 = FloatList() - * self.col2 = FloatList() - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); 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_GIVEREF(__pyx_t_1); - __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_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":62 - * self.e_index = IntList() - * self.f_index = IntList() - * self.col1 = FloatList() # <<<<<<<<<<<<<< - * self.col2 = FloatList() - * if from_binary: - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), NULL); 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_GIVEREF(__pyx_t_1); - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":63 - * self.f_index = IntList() - * self.col1 = FloatList() - * self.col2 = FloatList() # <<<<<<<<<<<<<< - * if from_binary: - * self.read_binary(from_binary) - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__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_GIVEREF(__pyx_t_1); - __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_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":64 - * self.col1 = FloatList() - * self.col2 = FloatList() - * if from_binary: # <<<<<<<<<<<<<< - * self.read_binary(from_binary) - * elif from_data: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":66 - * if from_binary: - * self.read_binary(from_binary) - * elif from_data: # <<<<<<<<<<<<<< - * self.compute_from_data(fsarray, earray, alignment) - * else: - */ - __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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":67 - * self.read_binary(from_binary) - * elif from_data: - * self.compute_from_data(fsarray, earray, alignment) # <<<<<<<<<<<<<< - * else: - * self.read_text(from_text) - */ - 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; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/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 - */ - -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) { - int __pyx_v_sent_id; - int __pyx_v_num_links; - int __pyx_v_l; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_f_i; - int __pyx_v_e_j; - int __pyx_v_I; - int __pyx_v_J; - int __pyx_v_V_E; - int __pyx_v_V_F; - int __pyx_v_num_pairs; - int *__pyx_v_fsent; - int *__pyx_v_esent; - int *__pyx_v_links; - int *__pyx_v_ealigned; - int *__pyx_v_faligned; - struct __pyx_t_4cdec_2sa_3_sa__node **__pyx_v_dict; - int *__pyx_v_fmargin; - int *__pyx_v_emargin; - int *__pyx_v_count; - int __pyx_v_null_word; - PyObject *__pyx_v_word = NULL; - PyObject *__pyx_v_id = NULL; - PyObject *__pyx_v_num_sents = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - 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("compute_from_data", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":79 - * cdef int null_word - * - * null_word = 0 # <<<<<<<<<<<<<< - * for word in fsa.darray.id2word: # I miss list comprehensions - * self.id2fword.append(word) - */ - __pyx_v_null_word = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":80 - * - * 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)) { - __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_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - for (;;) { - if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_word); - __pyx_v_word = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":81 - * 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_4 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_word); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":82 - * 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 (__Pyx_SetItemInt(__pyx_v_self->id2fword, __pyx_v_null_word, ((PyObject *)__pyx_n_s__NULL), sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":83 - * self.id2fword.append(word) - * self.id2fword[null_word] = "NULL" - * for id, word in enumerate(self.id2fword): # <<<<<<<<<<<<<< - * self.fword2id[word] = id - * - */ - __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_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_GOTREF(__pyx_t_4); - __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; - } - 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_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __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_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__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_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __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_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_5 = __pyx_t_3(__pyx_t_4); - if (unlikely(!__pyx_t_5)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF(__pyx_v_word); - __pyx_v_word = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_id); - __pyx_v_id = __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 = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":84 - * self.id2fword[null_word] = "NULL" - * for id, word in enumerate(self.id2fword): - * self.fword2id[word] = id # <<<<<<<<<<<<<< - * - * for word in eda.id2word: - */ - if (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;} - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":86 - * 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)) { - __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_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - for (;;) { - if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_word); - __pyx_v_word = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":87 - * - * for word in eda.id2word: - * self.id2eword.append(word) # <<<<<<<<<<<<<< - * self.id2eword[null_word] = "NULL" - * for id, word in enumerate(self.id2eword): - */ - __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_word); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":88 - * 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 (__Pyx_SetItemInt(__pyx_v_self->id2eword, __pyx_v_null_word, ((PyObject *)__pyx_n_s__NULL), sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":89 - * self.id2eword.append(word) - * self.id2eword[null_word] = "NULL" - * for id, word in enumerate(self.id2eword): # <<<<<<<<<<<<<< - * self.eword2id[word] = id - * - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_1 = __pyx_int_0; - if (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_GOTREF(__pyx_t_4); - __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; - } - 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_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __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_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__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_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __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_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_5 = __pyx_t_3(__pyx_t_4); - if (unlikely(!__pyx_t_5)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF(__pyx_v_word); - __pyx_v_word = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_id); - __pyx_v_id = __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":90 - * self.id2eword[null_word] = "NULL" - * for id, word in enumerate(self.id2eword): - * self.eword2id[word] = id # <<<<<<<<<<<<<< - * - * num_pairs = 0 - */ - if (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;} - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":92 - * self.eword2id[word] = id - * - * num_pairs = 0 # <<<<<<<<<<<<<< - * - * V_E = len(eda.id2word) - */ - __pyx_v_num_pairs = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":94 - * num_pairs = 0 - * - * V_E = len(eda.id2word) # <<<<<<<<<<<<<< - * V_F = len(fsa.darray.id2word) - * fmargin = malloc(V_F*sizeof(int)) - */ - __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_V_E = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":95 - * - * V_E = len(eda.id2word) - * V_F = len(fsa.darray.id2word) # <<<<<<<<<<<<<< - * fmargin = malloc(V_F*sizeof(int)) - * emargin = malloc(V_E*sizeof(int)) - */ - __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_V_F = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":96 - * V_E = len(eda.id2word) - * V_F = len(fsa.darray.id2word) - * fmargin = malloc(V_F*sizeof(int)) # <<<<<<<<<<<<<< - * emargin = malloc(V_E*sizeof(int)) - * memset(fmargin, 0, V_F*sizeof(int)) - */ - __pyx_v_fmargin = ((int *)malloc((__pyx_v_V_F * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":97 - * V_F = len(fsa.darray.id2word) - * fmargin = malloc(V_F*sizeof(int)) - * emargin = malloc(V_E*sizeof(int)) # <<<<<<<<<<<<<< - * memset(fmargin, 0, V_F*sizeof(int)) - * memset(emargin, 0, V_E*sizeof(int)) - */ - __pyx_v_emargin = ((int *)malloc((__pyx_v_V_E * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":98 - * fmargin = malloc(V_F*sizeof(int)) - * emargin = malloc(V_E*sizeof(int)) - * memset(fmargin, 0, V_F*sizeof(int)) # <<<<<<<<<<<<<< - * memset(emargin, 0, V_E*sizeof(int)) - * - */ - memset(__pyx_v_fmargin, 0, (__pyx_v_V_F * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":99 - * emargin = malloc(V_E*sizeof(int)) - * memset(fmargin, 0, V_F*sizeof(int)) - * memset(emargin, 0, V_E*sizeof(int)) # <<<<<<<<<<<<<< - * - * dict = <_node**> malloc(V_F*sizeof(_node*)) - */ - memset(__pyx_v_emargin, 0, (__pyx_v_V_E * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":101 - * memset(emargin, 0, V_E*sizeof(int)) - * - * dict = <_node**> malloc(V_F*sizeof(_node*)) # <<<<<<<<<<<<<< - * memset(dict, 0, V_F*sizeof(_node*)) - * - */ - __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 *))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":102 - * - * dict = <_node**> malloc(V_F*sizeof(_node*)) - * memset(dict, 0, V_F*sizeof(_node*)) # <<<<<<<<<<<<<< - * - * num_sents = len(fsa.darray.sent_index) - */ - memset(__pyx_v_dict, 0, (__pyx_v_V_F * (sizeof(struct __pyx_t_4cdec_2sa_3_sa__node *)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":104 - * memset(dict, 0, V_F*sizeof(_node*)) - * - * num_sents = len(fsa.darray.sent_index) # <<<<<<<<<<<<<< - * for sent_id from 0 <= sent_id < num_sents-1: - * - */ - __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_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_GOTREF(__pyx_t_1); - __pyx_v_num_sents = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":105 - * - * 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_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 105; __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_6; __pyx_v_sent_id++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":107 - * for sent_id from 0 <= sent_id < num_sents-1: - * - * 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 = malloc(I*sizeof(int)) - */ - __pyx_v_fsent = (__pyx_v_fsa->darray->data->arr + (__pyx_v_fsa->darray->sent_index->arr[__pyx_v_sent_id])); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":108 - * - * 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 = malloc(I*sizeof(int)) - * memset(faligned, 0, I*sizeof(int)) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":109 - * 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 = malloc(I*sizeof(int)) # <<<<<<<<<<<<<< - * memset(faligned, 0, I*sizeof(int)) - * - */ - __pyx_v_faligned = ((int *)malloc((__pyx_v_I * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":110 - * I = fsa.darray.sent_index.arr[sent_id+1] - fsa.darray.sent_index.arr[sent_id] - 1 - * faligned = malloc(I*sizeof(int)) - * memset(faligned, 0, I*sizeof(int)) # <<<<<<<<<<<<<< - * - * esent = eda.data.arr + eda.sent_index.arr[sent_id] - */ - memset(__pyx_v_faligned, 0, (__pyx_v_I * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":112 - * memset(faligned, 0, I*sizeof(int)) - * - * 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 = malloc(J*sizeof(int)) - */ - __pyx_v_esent = (__pyx_v_eda->data->arr + (__pyx_v_eda->sent_index->arr[__pyx_v_sent_id])); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":113 - * - * 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 = malloc(J*sizeof(int)) - * memset(ealigned, 0, J*sizeof(int)) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":114 - * 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 = malloc(J*sizeof(int)) # <<<<<<<<<<<<<< - * memset(ealigned, 0, J*sizeof(int)) - * - */ - __pyx_v_ealigned = ((int *)malloc((__pyx_v_J * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":115 - * J = eda.sent_index.arr[sent_id+1] - eda.sent_index.arr[sent_id] - 1 - * ealigned = malloc(J*sizeof(int)) - * memset(ealigned, 0, J*sizeof(int)) # <<<<<<<<<<<<<< - * - * links = aa._get_sent_links(sent_id, &num_links) - */ - memset(__pyx_v_ealigned, 0, (__pyx_v_J * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":117 - * memset(ealigned, 0, J*sizeof(int)) - * - * links = aa._get_sent_links(sent_id, &num_links) # <<<<<<<<<<<<<< - * - * for l from 0 <= l < num_links: - */ - __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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":119 - * links = aa._get_sent_links(sent_id, &num_links) - * - * for l from 0 <= l < num_links: # <<<<<<<<<<<<<< - * i = links[l*2] - * j = links[l*2+1] - */ - __pyx_t_7 = __pyx_v_num_links; - for (__pyx_v_l = 0; __pyx_v_l < __pyx_t_7; __pyx_v_l++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":120 - * - * for l from 0 <= l < num_links: - * i = links[l*2] # <<<<<<<<<<<<<< - * j = links[l*2+1] - * if i >= I or j >= J: - */ - __pyx_v_i = (__pyx_v_links[(__pyx_v_l * 2)]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":121 - * for l from 0 <= l < num_links: - * 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)) - */ - __pyx_v_j = (__pyx_v_links[((__pyx_v_l * 2) + 1)]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":122 - * 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_8 = ((__pyx_v_i >= __pyx_v_I) != 0); - if (!__pyx_t_8) { - __pyx_t_9 = ((__pyx_v_j >= __pyx_v_J) != 0); - __pyx_t_10 = __pyx_t_9; - } else { - __pyx_t_10 = __pyx_t_8; - } - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":123 - * 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 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyInt_FromLong(__pyx_v_I); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_11 = PyInt_FromLong(__pyx_v_J); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PyInt_FromLong((__pyx_v_sent_id + 1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = PyTuple_New(5); 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); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - 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); - __pyx_t_1 = 0; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_11 = 0; - __pyx_t_12 = 0; - __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __Pyx_DECREF(((PyObject *)__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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __Pyx_Raise(__pyx_t_12, 0, 0, 0); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L15; - } - __pyx_L15:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":124 - * 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] - * fmargin[f_i] = fmargin[f_i]+1 - */ - __pyx_v_f_i = (__pyx_v_fsent[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":125 - * 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] # <<<<<<<<<<<<<< - * fmargin[f_i] = fmargin[f_i]+1 - * emargin[e_j] = emargin[e_j]+1 - */ - __pyx_v_e_j = (__pyx_v_esent[__pyx_v_j]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":126 - * f_i = fsent[i] - * e_j = esent[j] - * fmargin[f_i] = fmargin[f_i]+1 # <<<<<<<<<<<<<< - * emargin[e_j] = emargin[e_j]+1 - * if dict[f_i] == NULL: - */ - (__pyx_v_fmargin[__pyx_v_f_i]) = ((__pyx_v_fmargin[__pyx_v_f_i]) + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":127 - * e_j = esent[j] - * 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) - */ - (__pyx_v_emargin[__pyx_v_e_j]) = ((__pyx_v_emargin[__pyx_v_e_j]) + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":128 - * 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_10 = (((__pyx_v_dict[__pyx_v_f_i]) == NULL) != 0); - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":129 - * emargin[e_j] = emargin[e_j]+1 - * if dict[f_i] == NULL: - * dict[f_i] = new_node(e_j) # <<<<<<<<<<<<<< - * dict[f_i].val = 1 - * num_pairs = num_pairs + 1 - */ - (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_e_j); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":130 - * if dict[f_i] == NULL: - * dict[f_i] = new_node(e_j) - * dict[f_i].val = 1 # <<<<<<<<<<<<<< - * num_pairs = num_pairs + 1 - * else: - */ - (__pyx_v_dict[__pyx_v_f_i])->val = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":131 - * dict[f_i] = new_node(e_j) - * dict[f_i].val = 1 - * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< - * else: - * count = get_val(dict[f_i], e_j) - */ - __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); - goto __pyx_L16; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":133 - * num_pairs = num_pairs + 1 - * else: - * count = get_val(dict[f_i], e_j) # <<<<<<<<<<<<<< - * if count[0] == 0: - * num_pairs = num_pairs + 1 - */ - __pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_e_j); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":134 - * 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_10 = (((__pyx_v_count[0]) == 0) != 0); - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":135 - * count = get_val(dict[f_i], e_j) - * if count[0] == 0: - * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< - * count[0] = count[0] + 1 - * # add count - */ - __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); - goto __pyx_L17; - } - __pyx_L17:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":136 - * if count[0] == 0: - * num_pairs = num_pairs + 1 - * count[0] = count[0] + 1 # <<<<<<<<<<<<<< - * # add count - * faligned[i] = 1 - */ - (__pyx_v_count[0]) = ((__pyx_v_count[0]) + 1); - } - __pyx_L16:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":138 - * count[0] = count[0] + 1 - * # add count - * faligned[i] = 1 # <<<<<<<<<<<<<< - * ealigned[j] = 1 - * for i from 0 <= i < I: - */ - (__pyx_v_faligned[__pyx_v_i]) = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":139 - * # add count - * faligned[i] = 1 - * ealigned[j] = 1 # <<<<<<<<<<<<<< - * for i from 0 <= i < I: - * if faligned[i] == 0: - */ - (__pyx_v_ealigned[__pyx_v_j]) = 1; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":140 - * faligned[i] = 1 - * ealigned[j] = 1 - * for i from 0 <= i < I: # <<<<<<<<<<<<<< - * if faligned[i] == 0: - * f_i = fsent[i] - */ - __pyx_t_7 = __pyx_v_I; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":141 - * 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_10 = (((__pyx_v_faligned[__pyx_v_i]) == 0) != 0); - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":142 - * for i from 0 <= i < I: - * if faligned[i] == 0: - * f_i = fsent[i] # <<<<<<<<<<<<<< - * fmargin[f_i] = fmargin[f_i] + 1 - * emargin[null_word] = emargin[null_word] + 1 - */ - __pyx_v_f_i = (__pyx_v_fsent[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":143 - * if faligned[i] == 0: - * f_i = fsent[i] - * fmargin[f_i] = fmargin[f_i] + 1 # <<<<<<<<<<<<<< - * emargin[null_word] = emargin[null_word] + 1 - * if dict[f_i] == NULL: - */ - (__pyx_v_fmargin[__pyx_v_f_i]) = ((__pyx_v_fmargin[__pyx_v_f_i]) + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":144 - * f_i = fsent[i] - * 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) - */ - (__pyx_v_emargin[__pyx_v_null_word]) = ((__pyx_v_emargin[__pyx_v_null_word]) + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":145 - * 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_10 = (((__pyx_v_dict[__pyx_v_f_i]) == NULL) != 0); - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":146 - * emargin[null_word] = emargin[null_word] + 1 - * if dict[f_i] == NULL: - * dict[f_i] = new_node(null_word) # <<<<<<<<<<<<<< - * dict[f_i].val = 1 - * num_pairs = num_pairs + 1 - */ - (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_null_word); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":147 - * if dict[f_i] == NULL: - * dict[f_i] = new_node(null_word) - * dict[f_i].val = 1 # <<<<<<<<<<<<<< - * num_pairs = num_pairs + 1 - * else: - */ - (__pyx_v_dict[__pyx_v_f_i])->val = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":148 - * dict[f_i] = new_node(null_word) - * dict[f_i].val = 1 - * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< - * else: - * count = get_val(dict[f_i], null_word) - */ - __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); - goto __pyx_L21; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":150 - * num_pairs = num_pairs + 1 - * else: - * count = get_val(dict[f_i], null_word) # <<<<<<<<<<<<<< - * if count[0] == 0: - * num_pairs = num_pairs + 1 - */ - __pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_null_word); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":151 - * 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_10 = (((__pyx_v_count[0]) == 0) != 0); - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":152 - * count = get_val(dict[f_i], null_word) - * if count[0] == 0: - * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< - * count[0] = count[0] + 1 - * for j from 0 <= j < J: - */ - __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); - goto __pyx_L22; - } - __pyx_L22:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":153 - * if count[0] == 0: - * num_pairs = num_pairs + 1 - * count[0] = count[0] + 1 # <<<<<<<<<<<<<< - * for j from 0 <= j < J: - * if ealigned[j] == 0: - */ - (__pyx_v_count[0]) = ((__pyx_v_count[0]) + 1); - } - __pyx_L21:; - goto __pyx_L20; - } - __pyx_L20:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":154 - * num_pairs = num_pairs + 1 - * count[0] = count[0] + 1 - * for j from 0 <= j < J: # <<<<<<<<<<<<<< - * if ealigned[j] == 0: - * e_j = esent[j] - */ - __pyx_t_7 = __pyx_v_J; - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_7; __pyx_v_j++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":155 - * 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_10 = (((__pyx_v_ealigned[__pyx_v_j]) == 0) != 0); - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":156 - * for j from 0 <= j < J: - * if ealigned[j] == 0: - * e_j = esent[j] # <<<<<<<<<<<<<< - * fmargin[null_word] = fmargin[null_word] + 1 - * emargin[e_j] = emargin[e_j] + 1 - */ - __pyx_v_e_j = (__pyx_v_esent[__pyx_v_j]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":157 - * if ealigned[j] == 0: - * e_j = esent[j] - * fmargin[null_word] = fmargin[null_word] + 1 # <<<<<<<<<<<<<< - * emargin[e_j] = emargin[e_j] + 1 - * if dict[null_word] == NULL: - */ - (__pyx_v_fmargin[__pyx_v_null_word]) = ((__pyx_v_fmargin[__pyx_v_null_word]) + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":158 - * e_j = esent[j] - * 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) - */ - (__pyx_v_emargin[__pyx_v_e_j]) = ((__pyx_v_emargin[__pyx_v_e_j]) + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":159 - * 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_10 = (((__pyx_v_dict[__pyx_v_null_word]) == NULL) != 0); - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":160 - * emargin[e_j] = emargin[e_j] + 1 - * if dict[null_word] == NULL: - * dict[null_word] = new_node(e_j) # <<<<<<<<<<<<<< - * dict[null_word].val = 1 - * num_pairs = num_pairs + 1 - */ - (__pyx_v_dict[__pyx_v_null_word]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_e_j); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":161 - * if dict[null_word] == NULL: - * dict[null_word] = new_node(e_j) - * dict[null_word].val = 1 # <<<<<<<<<<<<<< - * num_pairs = num_pairs + 1 - * else: - */ - (__pyx_v_dict[__pyx_v_null_word])->val = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":162 - * dict[null_word] = new_node(e_j) - * dict[null_word].val = 1 - * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< - * else: - * count = get_val(dict[null_word], e_j) - */ - __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); - goto __pyx_L26; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":164 - * num_pairs = num_pairs + 1 - * else: - * count = get_val(dict[null_word], e_j) # <<<<<<<<<<<<<< - * if count[0] == 0: - * num_pairs = num_pairs + 1 - */ - __pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_null_word]), __pyx_v_e_j); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":165 - * 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_10 = (((__pyx_v_count[0]) == 0) != 0); - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":166 - * count = get_val(dict[null_word], e_j) - * if count[0] == 0: - * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< - * count[0] = count[0] + 1 - * free(links) - */ - __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); - goto __pyx_L27; - } - __pyx_L27:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":167 - * if count[0] == 0: - * num_pairs = num_pairs + 1 - * count[0] = count[0] + 1 # <<<<<<<<<<<<<< - * free(links) - * free(faligned) - */ - (__pyx_v_count[0]) = ((__pyx_v_count[0]) + 1); - } - __pyx_L26:; - goto __pyx_L25; - } - __pyx_L25:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":168 - * num_pairs = num_pairs + 1 - * count[0] = count[0] + 1 - * free(links) # <<<<<<<<<<<<<< - * free(faligned) - * free(ealigned) - */ - free(__pyx_v_links); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":169 - * count[0] = count[0] + 1 - * free(links) - * free(faligned) # <<<<<<<<<<<<<< - * free(ealigned) - * self.f_index = IntList(initial_len=V_F) - */ - free(__pyx_v_faligned); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":170 - * free(links) - * free(faligned) - * free(ealigned) # <<<<<<<<<<<<<< - * self.f_index = IntList(initial_len=V_F) - * self.e_index = IntList(initial_len=num_pairs) - */ - free(__pyx_v_ealigned); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":171 - * 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __pyx_t_13 = PyInt_FromLong(__pyx_v_V_F); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(((PyObject *)__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_13); - __pyx_t_13 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":172 - * 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_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); - __pyx_t_12 = PyInt_FromLong(__pyx_v_num_pairs); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":173 - * 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __pyx_t_13 = PyInt_FromLong(__pyx_v_num_pairs); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(((PyObject *)__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_13); - __pyx_t_13 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":174 - * 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_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_13)); - __pyx_t_12 = PyInt_FromLong(__pyx_v_num_pairs); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":176 - * self.col2 = FloatList(initial_len=num_pairs) - * - * num_pairs = 0 # <<<<<<<<<<<<<< - * for i from 0 <= i < V_F: - * #self.f_index[i] = num_pairs - */ - __pyx_v_num_pairs = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":177 - * - * num_pairs = 0 - * for i from 0 <= i < V_F: # <<<<<<<<<<<<<< - * #self.f_index[i] = num_pairs - * self.f_index.set(i, num_pairs) - */ - __pyx_t_6 = __pyx_v_V_F; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":179 - * for i from 0 <= i < V_F: - * #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) - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":180 - * #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_10 = (((__pyx_v_dict[__pyx_v_i]) != NULL) != 0); - if (__pyx_t_10) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":181 - * 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_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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":182 - * 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_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 = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L30; - } - __pyx_L30:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":183 - * self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin) - * del_node(dict[i]) - * free(fmargin) # <<<<<<<<<<<<<< - * free(emargin) - * free(dict) - */ - free(__pyx_v_fmargin); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":184 - * del_node(dict[i]) - * free(fmargin) - * free(emargin) # <<<<<<<<<<<<<< - * free(dict) - * return - */ - free(__pyx_v_emargin); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":185 - * free(fmargin) - * free(emargin) - * free(dict) # <<<<<<<<<<<<<< - * return - * - */ - free(__pyx_v_dict); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":186 - * free(emargin) - * free(dict) - * return # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.compute_from_data", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_word); - __Pyx_XDECREF(__pyx_v_id); - __Pyx_XDECREF(__pyx_v_num_sents); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":189 - * - * - * cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin): # <<<<<<<<<<<<<< - * cdef int loc - * if n.smaller != NULL: - */ - -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) { - int __pyx_v_loc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_add_node", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":191 - * cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin): - * cdef int loc - * if n.smaller != NULL: # <<<<<<<<<<<<<< - * self._add_node(n.smaller, num_pairs, fmargin, emargin) - * loc = num_pairs[0] - */ - __pyx_t_1 = ((__pyx_v_n->smaller != NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":192 - * 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_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":193 - * if n.smaller != NULL: - * self._add_node(n.smaller, num_pairs, fmargin, emargin) - * loc = num_pairs[0] # <<<<<<<<<<<<<< - * self.e_index.set(loc, n.key) - * self.col1.set(loc, float(n.val)/fmargin) - */ - __pyx_v_loc = (__pyx_v_num_pairs[0]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":194 - * self._add_node(n.smaller, num_pairs, fmargin, emargin) - * loc = num_pairs[0] - * 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])) - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":195 - * loc = num_pairs[0] - * 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])) - * num_pairs[0] = loc + 1 - */ - if (unlikely(__pyx_v_fmargin == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":196 - * 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])) # <<<<<<<<<<<<<< - * num_pairs[0] = loc + 1 - * if n.bigger != NULL: - */ - if (unlikely(((double)(__pyx_v_emargin[__pyx_v_n->key])) == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __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])))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":197 - * self.col1.set(loc, float(n.val)/fmargin) - * self.col2.set(loc, float(n.val)/float(emargin[n.key])) - * num_pairs[0] = loc + 1 # <<<<<<<<<<<<<< - * if n.bigger != NULL: - * self._add_node(n.bigger, num_pairs, fmargin, emargin) - */ - (__pyx_v_num_pairs[0]) = (__pyx_v_loc + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":198 - * self.col2.set(loc, float(n.val)/float(emargin[n.key])) - * num_pairs[0] = loc + 1 - * if n.bigger != NULL: # <<<<<<<<<<<<<< - * self._add_node(n.bigger, num_pairs, fmargin, emargin) - * - */ - __pyx_t_1 = ((__pyx_v_n->bigger != NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":199 - * 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_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L4; - } - __pyx_L4:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.BiLex._add_node", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":202 - * - * - * def write_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_binary", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":204 - * def write_binary(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "w") # <<<<<<<<<<<<<< - * self.f_index.write_handle(f) - * self.e_index.write_handle(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":205 - * cdef FILE* f - * f = fopen(filename, "w") - * self.f_index.write_handle(f) # <<<<<<<<<<<<<< - * self.e_index.write_handle(f) - * self.col1.write_handle(f) - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":206 - * f = fopen(filename, "w") - * self.f_index.write_handle(f) - * self.e_index.write_handle(f) # <<<<<<<<<<<<<< - * self.col1.write_handle(f) - * self.col2.write_handle(f) - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":207 - * self.f_index.write_handle(f) - * self.e_index.write_handle(f) - * self.col1.write_handle(f) # <<<<<<<<<<<<<< - * self.col2.write_handle(f) - * self.write_wordlist(self.id2fword, f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->write_handle(__pyx_v_self->col1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":208 - * self.e_index.write_handle(f) - * self.col1.write_handle(f) - * self.col2.write_handle(f) # <<<<<<<<<<<<<< - * self.write_wordlist(self.id2fword, f) - * self.write_wordlist(self.id2eword, f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->write_handle(__pyx_v_self->col2, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":209 - * self.col1.write_handle(f) - * self.col2.write_handle(f) - * self.write_wordlist(self.id2fword, f) # <<<<<<<<<<<<<< - * self.write_wordlist(self.id2eword, f) - * fclose(f) - */ - __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_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":210 - * self.col2.write_handle(f) - * self.write_wordlist(self.id2fword, f) - * self.write_wordlist(self.id2eword, f) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - __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_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":211 - * self.write_wordlist(self.id2fword, f) - * self.write_wordlist(self.id2eword, f) - * fclose(f) # <<<<<<<<<<<<<< - * - * - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":214 - * - * - * cdef write_wordlist(self, wordlist, FILE* f): # <<<<<<<<<<<<<< - * cdef int word_len - * cdef int num_words - */ - -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) { - int __pyx_v_word_len; - int __pyx_v_num_words; - PyObject *__pyx_v_word = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - char *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_wordlist", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":218 - * 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_v_num_words = __pyx_t_1; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":219 - * - * num_words = len(wordlist) - * fwrite(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * for word in wordlist: - * word_len = len(word) + 1 - */ - fwrite((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":220 - * 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)) { - __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_GOTREF(__pyx_t_2); - __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; - } - 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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_2); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_word); - __pyx_v_word = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":221 - * fwrite(&(num_words), sizeof(int), 1, f) - * for word in wordlist: - * word_len = len(word) + 1 # <<<<<<<<<<<<<< - * fwrite(&(word_len), sizeof(int), 1, f) - * fwrite(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_v_word_len = (__pyx_t_5 + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":222 - * for word in wordlist: - * word_len = len(word) + 1 - * fwrite(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * fwrite(word, sizeof(char), word_len, f) - * - */ - fwrite((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":223 - * word_len = len(word) + 1 - * fwrite(&(word_len), sizeof(int), 1, f) - * fwrite(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;} - fwrite(((char *)__pyx_t_6), (sizeof(char)), __pyx_v_word_len, __pyx_v_f); - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_word); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":226 - * - * - * cdef read_wordlist(self, word2id, id2word, FILE* f): # <<<<<<<<<<<<<< - * cdef int num_words - * cdef int word_len - */ - -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) { - int __pyx_v_num_words; - int __pyx_v_word_len; - char *__pyx_v_word; - CYTHON_UNUSED long __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - Py_ssize_t __pyx_t_2; - 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("read_wordlist", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":231 - * cdef char* word - * - * fread(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * for i from 0 <= i < num_words: - * fread(&(word_len), sizeof(int), 1, f) - */ - fread((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":232 - * - * fread(&(num_words), sizeof(int), 1, f) - * for i from 0 <= i < num_words: # <<<<<<<<<<<<<< - * fread(&(word_len), sizeof(int), 1, f) - * word = malloc (word_len * sizeof(char)) - */ - __pyx_t_1 = __pyx_v_num_words; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":233 - * fread(&(num_words), sizeof(int), 1, f) - * for i from 0 <= i < num_words: - * fread(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * word = malloc (word_len * sizeof(char)) - * fread(word, sizeof(char), word_len, f) - */ - fread((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":234 - * for i from 0 <= i < num_words: - * fread(&(word_len), sizeof(int), 1, f) - * word = malloc (word_len * sizeof(char)) # <<<<<<<<<<<<<< - * fread(word, sizeof(char), word_len, f) - * word2id[word] = len(id2word) - */ - __pyx_v_word = ((char *)malloc((__pyx_v_word_len * (sizeof(char))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":235 - * fread(&(word_len), sizeof(int), 1, f) - * word = malloc (word_len * sizeof(char)) - * fread(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< - * word2id[word] = len(id2word) - * id2word.append(word) - */ - fread(__pyx_v_word, (sizeof(char)), __pyx_v_word_len, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":236 - * word = 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_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_GOTREF(((PyObject *)__pyx_t_4)); - if (PyObject_SetItem(__pyx_v_word2id, ((PyObject *)__pyx_t_4), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":237 - * 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_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_id2word, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 237; __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_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":238 - * word2id[word] = len(id2word) - * id2word.append(word) - * free(word) # <<<<<<<<<<<<<< - * - * def read_binary(self, char* filename): - */ - free(__pyx_v_word); - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":240 - * free(word) - * - * def read_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - 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("read_binary", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":242 - * def read_binary(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "r") # <<<<<<<<<<<<<< - * self.f_index.read_handle(f) - * self.e_index.read_handle(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":243 - * cdef FILE* f - * f = fopen(filename, "r") - * self.f_index.read_handle(f) # <<<<<<<<<<<<<< - * self.e_index.read_handle(f) - * self.col1.read_handle(f) - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":244 - * f = fopen(filename, "r") - * self.f_index.read_handle(f) - * self.e_index.read_handle(f) # <<<<<<<<<<<<<< - * self.col1.read_handle(f) - * self.col2.read_handle(f) - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":245 - * self.f_index.read_handle(f) - * self.e_index.read_handle(f) - * self.col1.read_handle(f) # <<<<<<<<<<<<<< - * self.col2.read_handle(f) - * self.read_wordlist(self.fword2id, self.id2fword, f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->read_handle(__pyx_v_self->col1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":246 - * self.e_index.read_handle(f) - * self.col1.read_handle(f) - * self.col2.read_handle(f) # <<<<<<<<<<<<<< - * self.read_wordlist(self.fword2id, self.id2fword, f) - * self.read_wordlist(self.eword2id, self.id2eword, f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->read_handle(__pyx_v_self->col2, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":247 - * self.col1.read_handle(f) - * self.col2.read_handle(f) - * self.read_wordlist(self.fword2id, self.id2fword, f) # <<<<<<<<<<<<<< - * self.read_wordlist(self.eword2id, self.id2eword, f) - * fclose(f) - */ - __pyx_t_1 = __pyx_v_self->fword2id; - __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_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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":248 - * self.col2.read_handle(f) - * self.read_wordlist(self.fword2id, self.id2fword, f) - * self.read_wordlist(self.eword2id, self.id2eword, f) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - __pyx_t_3 = __pyx_v_self->eword2id; - __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_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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":249 - * self.read_wordlist(self.fword2id, self.id2fword, f) - * self.read_wordlist(self.eword2id, self.id2eword, f) - * fclose(f) # <<<<<<<<<<<<<< - * - * - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_e_id (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_eword)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":252 - * - * - * def get_e_id(self, eword): # <<<<<<<<<<<<<< - * if eword not in self.eword2id: - * e_id = len(self.id2eword) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword) { - PyObject *__pyx_v_e_id = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_e_id", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":253 - * - * 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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":254 - * def get_e_id(self, eword): - * if eword not in self.eword2id: - * e_id = len(self.id2eword) # <<<<<<<<<<<<<< - * self.id2eword.append(eword) - * self.eword2id[eword] = e_id - */ - __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 = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); 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_v_e_id = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":255 - * 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_3 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_eword); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":256 - * e_id = len(self.id2eword) - * self.id2eword.append(eword) - * self.eword2id[eword] = e_id # <<<<<<<<<<<<<< - * return self.eword2id[eword] - * - */ - if (PyObject_SetItem(__pyx_v_self->eword2id, __pyx_v_eword, __pyx_v_e_id) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":257 - * self.id2eword.append(eword) - * self.eword2id[eword] = e_id - * return self.eword2id[eword] # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_e_id", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_e_id); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_f_id (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_fword)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":260 - * - * - * def get_f_id(self, fword): # <<<<<<<<<<<<<< - * if fword not in self.fword2id: - * f_id = len(self.id2fword) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword) { - PyObject *__pyx_v_f_id = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_f_id", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":261 - * - * 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 = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":262 - * def get_f_id(self, fword): - * if fword not in self.fword2id: - * f_id = len(self.id2fword) # <<<<<<<<<<<<<< - * self.id2fword.append(fword) - * self.fword2id[fword] = f_id - */ - __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 = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_f_id = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":263 - * 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_3 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_fword); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":264 - * f_id = len(self.id2fword) - * self.id2fword.append(fword) - * self.fword2id[fword] = f_id # <<<<<<<<<<<<<< - * return self.fword2id[fword] - * - */ - if (PyObject_SetItem(__pyx_v_self->fword2id, __pyx_v_fword, __pyx_v_f_id) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":265 - * self.id2fword.append(fword) - * self.fword2id[fword] = f_id - * return self.fword2id[fword] # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_f_id", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_f_id); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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 = 268; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":268 - * - * - * def read_text(self, char* filename): # <<<<<<<<<<<<<< - * cdef i, j, w, e_id, f_id, n_f, n_e, N - * cdef IntList fcount - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { - PyObject *__pyx_v_i = 0; - PyObject *__pyx_v_j = 0; - PyObject *__pyx_v_e_id = 0; - PyObject *__pyx_v_f_id = 0; - PyObject *__pyx_v_n_f = 0; - PyObject *__pyx_v_N = 0; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_fcount = 0; - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_line = NULL; - PyObject *__pyx_v_fword = NULL; - PyObject *__pyx_v_eword = NULL; - PyObject *__pyx_v_score1 = NULL; - PyObject *__pyx_v_score2 = NULL; - PyObject *__pyx_v_index = NULL; - PyObject *__pyx_v_b = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *(*__pyx_t_14)(PyObject *); - Py_ssize_t __pyx_t_15; - int __pyx_t_16; - Py_ssize_t __pyx_t_17; - long __pyx_t_18; - long __pyx_t_19; - int __pyx_t_20; - double __pyx_t_21; - PyObject *__pyx_t_22 = NULL; - int __pyx_t_23; - int __pyx_t_24; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_text", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":272 - * cdef IntList fcount - * - * fcount = IntList() # <<<<<<<<<<<<<< - * with gzip_or_text(filename) as f: - * # first loop merely establishes size of array objects - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 272; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273 - * - * fcount = IntList() - * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< - * # first loop merely establishes size of array objects - * 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 = 273; __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 = 273; __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[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __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_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_INCREF(__pyx_t_1); - __pyx_v_f = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":275 - * 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; - } 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 = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - 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 = 275; __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 = 275; __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 = 275; __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 = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - #endif - } else { - __pyx_t_2 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __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_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":276 - * # 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 = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __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_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 4)) { - if (size > 4) __Pyx_RaiseTooManyValuesError(4); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __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_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_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_12); - #else - Py_ssize_t i; - PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_10,&__pyx_t_11,&__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 = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(item); - *(temps[i]) = item; - } - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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 = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; - __Pyx_GOTREF(item); - *(temps[index]) = item; - } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __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:; - __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 = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_L19_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_fword); - __pyx_v_fword = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_v_eword); - __pyx_v_eword = __pyx_t_10; - __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_v_score1); - __pyx_v_score1 = __pyx_t_11; - __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_v_score2); - __pyx_v_score2 = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":277 - * 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 = 277; __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 = 277; __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_v_f_id); - __pyx_v_f_id = __pyx_t_11; - __pyx_t_11 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":278 - * (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 = 278; __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 = 278; __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 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_v_e_id); - __pyx_v_e_id = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":279 - * f_id = self.get_f_id(fword) - * e_id = self.get_e_id(eword) - * while f_id >= len(fcount): # <<<<<<<<<<<<<< - * fcount.append(0) - * 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 = 279; __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 = 279; __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 = 279; __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (!__pyx_t_16) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":280 - * 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_12 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_fcount), __pyx_int_0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":281 - * 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 = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - (__pyx_v_fcount->arr[__pyx_t_17]) = ((__pyx_v_fcount->arr[__pyx_t_15]) + 1); - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":284 - * - * # Allocate space for dictionary in arrays - * N = 0 # <<<<<<<<<<<<<< - * n_f = len(fcount) - * self.f_index = IntList(initial_len=n_f+1) - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_N = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":285 - * # 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 = 285; __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 = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_n_f = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":286 - * 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 = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__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 = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":287 - * 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_18 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19++) { - __pyx_t_12 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":288 - * 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_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __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 = 288; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_20; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":289 - * 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 = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_12 = PyInt_FromLong((__pyx_v_fcount->arr[__pyx_t_8])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __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 = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_v_N); - __pyx_v_N = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":290 - * 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 = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - (__pyx_v_fcount->arr[__pyx_t_8]) = 0; - __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":287 - * 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 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":291 - * 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_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __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 = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_20; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":292 - * 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 = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); 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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":293 - * 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 = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); 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(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":294 - * 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 = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":297 - * - * # 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 = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_45), NULL); 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_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":298 - * # 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; - } 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 = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - 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 = 298; __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 = 298; __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 = 298; __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 = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - #endif - } else { - __pyx_t_12 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_12)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_12); - } - __Pyx_XDECREF(__pyx_v_line); - __pyx_v_line = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":299 - * 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 = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_3 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __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; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 4)) { - if (size > 4) __Pyx_RaiseTooManyValuesError(4); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __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_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_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_2); - #else - Py_ssize_t i; - PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__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 = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(item); - *(temps[i]) = item; - } - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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 = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; - __Pyx_GOTREF(item); - *(temps[index]) = item; - } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __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:; - __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 = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_L27_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_fword); - __pyx_v_fword = __pyx_t_12; - __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_v_eword); - __pyx_v_eword = __pyx_t_11; - __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_v_score1); - __pyx_v_score1 = __pyx_t_10; - __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_v_score2); - __pyx_v_score2 = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":300 - * 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 = 300; __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 = 300; __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_v_f_id); - __pyx_v_f_id = __pyx_t_10; - __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":301 - * (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 = 301; __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 = 301; __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 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_v_e_id); - __pyx_v_e_id = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":302 - * 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 = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_3 = PyInt_FromLong(((__pyx_v_self->f_index->arr[__pyx_t_15]) + (__pyx_v_fcount->arr[__pyx_t_17]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_index); - __pyx_v_index = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":303 - * 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_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __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 = 303; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - (__pyx_v_fcount->arr[__pyx_t_15]) = ((__pyx_v_fcount->arr[__pyx_t_17]) + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":304 - * 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 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_e_id); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_e_id); - __Pyx_GIVEREF(__pyx_v_e_id); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - (__pyx_v_self->e_index->arr[__pyx_t_17]) = __pyx_t_20; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":305 - * 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_21 = __Pyx_PyObject_AsDouble(__pyx_v_score1); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_2 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(((PyObject *)__pyx_v_self->col1), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":306 - * self.e_index.arr[index] = int(e_id) - * self.col1[index] = float(score1) - * self.col2[index] = float(score2) # <<<<<<<<<<<<<< - * - * # Sort buckets by eword - */ - __pyx_t_21 = __Pyx_PyObject_AsDouble(__pyx_v_score2); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_2 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(((PyObject *)__pyx_v_self->col2), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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; - 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_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273 - * - * fcount = IntList() - * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< - * # first loop merely establishes size of array objects - * for line in f: - */ - /*except:*/ { - __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_22 = PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_22); - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_22); - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __pyx_t_23 = ((!(__pyx_t_16 != 0)) != 0); - if (__pyx_t_23) { - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3); - __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L30; - } - __pyx_L30:; - __Pyx_DECREF(((PyObject *)__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; - __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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_4) { - __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_46, NULL); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_23 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L31; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L1_error; - __pyx_L31:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":309 - * - * # 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 = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_19; __pyx_t_18++) { - __pyx_t_3 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_b); - __pyx_v_b = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":310 - * # 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 = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":311 - * 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_3 = PyNumber_Add(__pyx_v_b, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":312 - * i = self.f_index.arr[b] - * j = self.f_index.arr[b+1] - * self.qsort(i,j, "") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_24 = __Pyx_PyInt_AsInt(__pyx_v_j); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_20, __pyx_t_24, ((PyObject *)__pyx_kp_s_47)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_b); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":309 - * - * # 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_3 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_b); - __pyx_v_b = __pyx_t_3; - __pyx_t_3 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_j); - __Pyx_XDECREF(__pyx_v_e_id); - __Pyx_XDECREF(__pyx_v_f_id); - __Pyx_XDECREF(__pyx_v_n_f); - __Pyx_XDECREF(__pyx_v_N); - __Pyx_XDECREF((PyObject *)__pyx_v_fcount); - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XDECREF(__pyx_v_fword); - __Pyx_XDECREF(__pyx_v_eword); - __Pyx_XDECREF(__pyx_v_score1); - __Pyx_XDECREF(__pyx_v_score2); - __Pyx_XDECREF(__pyx_v_index); - __Pyx_XDECREF(__pyx_v_b); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":315 - * - * - * cdef swap(self, int i, int j): # <<<<<<<<<<<<<< - * cdef int itmp - * cdef float ftmp - */ - -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) { - int __pyx_v_itmp; - float __pyx_v_ftmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("swap", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":319 - * cdef float ftmp - * - * if i == j: # <<<<<<<<<<<<<< - * return - * - */ - __pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":320 - * - * if i == j: - * return # <<<<<<<<<<<<<< - * - * itmp = self.e_index.arr[i] - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":322 - * return - * - * itmp = self.e_index.arr[i] # <<<<<<<<<<<<<< - * self.e_index.arr[i] = self.e_index.arr[j] - * self.e_index.arr[j] = itmp - */ - __pyx_v_itmp = (__pyx_v_self->e_index->arr[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":323 - * - * itmp = self.e_index.arr[i] - * self.e_index.arr[i] = self.e_index.arr[j] # <<<<<<<<<<<<<< - * self.e_index.arr[j] = itmp - * - */ - (__pyx_v_self->e_index->arr[__pyx_v_i]) = (__pyx_v_self->e_index->arr[__pyx_v_j]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":324 - * itmp = self.e_index.arr[i] - * self.e_index.arr[i] = self.e_index.arr[j] - * self.e_index.arr[j] = itmp # <<<<<<<<<<<<<< - * - * ftmp = self.col1.arr[i] - */ - (__pyx_v_self->e_index->arr[__pyx_v_j]) = __pyx_v_itmp; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":326 - * self.e_index.arr[j] = itmp - * - * ftmp = self.col1.arr[i] # <<<<<<<<<<<<<< - * self.col1.arr[i] = self.col1.arr[j] - * self.col1.arr[j] = ftmp - */ - __pyx_v_ftmp = (__pyx_v_self->col1->arr[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":327 - * - * ftmp = self.col1.arr[i] - * self.col1.arr[i] = self.col1.arr[j] # <<<<<<<<<<<<<< - * self.col1.arr[j] = ftmp - * - */ - (__pyx_v_self->col1->arr[__pyx_v_i]) = (__pyx_v_self->col1->arr[__pyx_v_j]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":328 - * ftmp = self.col1.arr[i] - * self.col1.arr[i] = self.col1.arr[j] - * self.col1.arr[j] = ftmp # <<<<<<<<<<<<<< - * - * ftmp = self.col2.arr[i] - */ - (__pyx_v_self->col1->arr[__pyx_v_j]) = __pyx_v_ftmp; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":330 - * self.col1.arr[j] = ftmp - * - * ftmp = self.col2.arr[i] # <<<<<<<<<<<<<< - * self.col2.arr[i] = self.col2.arr[j] - * self.col2.arr[j] = ftmp - */ - __pyx_v_ftmp = (__pyx_v_self->col2->arr[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":331 - * - * ftmp = self.col2.arr[i] - * self.col2.arr[i] = self.col2.arr[j] # <<<<<<<<<<<<<< - * self.col2.arr[j] = ftmp - * - */ - (__pyx_v_self->col2->arr[__pyx_v_i]) = (__pyx_v_self->col2->arr[__pyx_v_j]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":332 - * ftmp = self.col2.arr[i] - * self.col2.arr[i] = self.col2.arr[j] - * self.col2.arr[j] = ftmp # <<<<<<<<<<<<<< - * - * - */ - (__pyx_v_self->col2->arr[__pyx_v_j]) = __pyx_v_ftmp; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":335 - * - * - * cdef qsort(self, int i, int j, pad): # <<<<<<<<<<<<<< - * cdef int pval, p - * - */ - -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) { - int __pyx_v_pval; - int __pyx_v_p; - long __pyx_v_k; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("qsort", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":338 - * cdef int pval, p - * - * if i > j: # <<<<<<<<<<<<<< - * raise Exception("Sort error in CLex") - * if i == j: #empty interval - */ - __pyx_t_1 = ((__pyx_v_i > __pyx_v_j) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":339 - * - * if i > j: - * raise Exception("Sort error in CLex") # <<<<<<<<<<<<<< - * if i == j: #empty interval - * return - */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 339; __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 = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":340 - * if i > j: - * raise Exception("Sort error in CLex") - * if i == j: #empty interval # <<<<<<<<<<<<<< - * return - * if i == j-1: # singleton interval - */ - __pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":341 - * raise Exception("Sort error in CLex") - * if i == j: #empty interval - * return # <<<<<<<<<<<<<< - * if i == j-1: # singleton interval - * return - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":342 - * if i == j: #empty interval - * return - * if i == j-1: # singleton interval # <<<<<<<<<<<<<< - * return - * - */ - __pyx_t_1 = ((__pyx_v_i == (__pyx_v_j - 1)) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":343 - * return - * if i == j-1: # singleton interval - * return # <<<<<<<<<<<<<< - * - * p = (i+j)/2 - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":345 - * return - * - * p = (i+j)/2 # <<<<<<<<<<<<<< - * pval = self.e_index.arr[p] - * self.swap(i, p) - */ - __pyx_v_p = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":346 - * - * p = (i+j)/2 - * pval = self.e_index.arr[p] # <<<<<<<<<<<<<< - * self.swap(i, p) - * p = i - */ - __pyx_v_pval = (__pyx_v_self->e_index->arr[__pyx_v_p]); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":347 - * 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 = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":348 - * pval = self.e_index.arr[p] - * self.swap(i, p) - * p = i # <<<<<<<<<<<<<< - * for k from i+1 <= k < j: - * if pval >= self.e_index.arr[k]: - */ - __pyx_v_p = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":349 - * self.swap(i, p) - * p = i - * for k from i+1 <= k < j: # <<<<<<<<<<<<<< - * if pval >= self.e_index.arr[k]: - * self.swap(p+1, k) - */ - __pyx_t_3 = __pyx_v_j; - for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":350 - * p = i - * for k from i+1 <= k < j: - * if pval >= self.e_index.arr[k]: # <<<<<<<<<<<<<< - * self.swap(p+1, k) - * self.swap(p, p+1) - */ - __pyx_t_1 = ((__pyx_v_pval >= (__pyx_v_self->e_index->arr[__pyx_v_k])) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":351 - * 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 = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":352 - * 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 = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":353 - * self.swap(p+1, k) - * self.swap(p, p+1) - * p = p + 1 # <<<<<<<<<<<<<< - * self.qsort(i,p, pad+" ") - * self.qsort(p+1,j, pad+" ") - */ - __pyx_v_p = (__pyx_v_p + 1); - goto __pyx_L8; - } - __pyx_L8:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":354 - * 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, ((PyObject *)__pyx_kp_s_50)); 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_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 = 354; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":355 - * p = p + 1 - * self.qsort(i,p, pad+" ") - * self.qsort(p+1,j, pad+" ") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 355; __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 = 355; __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; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.qsort", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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 = 358; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":358 - * - * - * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< - * with open(filename, "w") as f: - * for i in self.f_index: - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_s1 = NULL; - PyObject *__pyx_v_s2 = NULL; - PyObject *__pyx_v_w = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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_12 = NULL; - PyObject *(*__pyx_t_13)(PyObject *); - int __pyx_t_14; - 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_enhanced", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * for i in self.f_index: - * 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 = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __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__w)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_INCREF(__pyx_t_4); - __pyx_v_f = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":360 - * 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; - } 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 = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; - } - for (;;) { - if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_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 = 360; __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 = 360; __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 = 360; __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 = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - #endif - } else { - __pyx_t_1 = __pyx_t_9(__pyx_t_4); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":361 - * 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 = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":362 - * 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 = 362; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __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_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":363 - * 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 = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_self->e_index)); - PyTuple_SET_ITEM(__pyx_t_2, 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)); - __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)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->col2)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__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; - } 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 = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; - } - __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 = 363; __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 = 363; __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 = 363; __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 = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - #endif - } else { - __pyx_t_4 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __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); - } 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_INCREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_11); - #else - __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __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 = 363; __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 = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_11); - #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 = 363; __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_GOTREF(__pyx_t_11); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __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_t_13 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_L21_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_10; - __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_v_s1); - __pyx_v_s1 = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_v_s2); - __pyx_v_s2 = __pyx_t_11; - __pyx_t_11 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":364 - * 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 = 364; __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 = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_INCREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - __Pyx_INCREF(__pyx_v_s1); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_s1); - __Pyx_GIVEREF(__pyx_v_s1); - __Pyx_INCREF(__pyx_v_s2); - PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_s2); - __Pyx_GIVEREF(__pyx_v_s2); - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__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 = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":365 - * 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 = 365; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __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_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":366 - * 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_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; - } 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 = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; - } - 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 = 366; __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 = 366; __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 = 366; __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 = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - #endif - } else { - __pyx_t_11 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_11)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_11); - } - __Pyx_XDECREF(__pyx_v_w); - __pyx_v_w = __pyx_t_11; - __pyx_t_11 = 0; - __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_i); - __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 = 366; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":367 - * 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 = 367; __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 = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - __Pyx_INCREF(__pyx_v_w); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_w); - __Pyx_GIVEREF(__pyx_v_w); - __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __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[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":368 - * 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 = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":369 - * 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_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; - } 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 = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - 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 = 369; __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 = 369; __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 = 369; __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 = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - #endif - } else { - __pyx_t_10 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_10)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_10); - } - __Pyx_XDECREF(__pyx_v_w); - __pyx_v_w = __pyx_t_10; - __pyx_t_10 = 0; - __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_i); - __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 = 369; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":370 - * 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 = 370; __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 = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - __Pyx_INCREF(__pyx_v_w); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_w); - __Pyx_GIVEREF(__pyx_v_w); - __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_11)); - __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[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__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; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":371 - * 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 = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_56), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 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; - goto __pyx_L14_try_end; - __pyx_L7_error:; - __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_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * for i in self.f_index: - * f.write("%d " % i) - */ - /*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 = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_15); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __pyx_t_16 = ((!(__pyx_t_14 != 0)) != 0); - if (__pyx_t_16) { - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__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 = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L28; - } - __pyx_L28:; - __Pyx_DECREF(((PyObject *)__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; - 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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_3) { - __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_57, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __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[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L29; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L1_error; - __pyx_L29:; - } - - __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_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_s1); - __Pyx_XDECREF(__pyx_v_s2); - __Pyx_XDECREF(__pyx_v_w); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fword = 0; - PyObject *__pyx_v_eword = 0; - PyObject *__pyx_v_col = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_score (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fword,&__pyx_n_s__eword,&__pyx_n_s__col,0}; - PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__fword)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 374; __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 = 374; __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 = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_fword = values[0]; - __pyx_v_eword = values[1]; - __pyx_v_col = values[2]; - } - 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 = 374; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), __pyx_v_fword, __pyx_v_eword, __pyx_v_col); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":374 - * - * - * def get_score(self, fword, eword, col): # <<<<<<<<<<<<<< - * cdef e_id, f_id, low, high, midpoint, val - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col) { - PyObject *__pyx_v_e_id = 0; - PyObject *__pyx_v_f_id = 0; - PyObject *__pyx_v_low = 0; - PyObject *__pyx_v_high = 0; - PyObject *__pyx_v_midpoint = 0; - PyObject *__pyx_v_val = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - 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("get_score", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":377 - * 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 = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":378 - * - * if eword not in self.eword2id: - * return None # <<<<<<<<<<<<<< - * if fword not in self.fword2id: - * return None - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":379 - * 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 = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":380 - * return None - * if fword not in self.fword2id: - * return None # <<<<<<<<<<<<<< - * f_id = self.fword2id[fword] - * e_id = self.eword2id[eword] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":381 - * 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 (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_f_id = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":382 - * 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 (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_e_id = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":383 - * 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 = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_low = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":384 - * 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 = 384; __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 = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_high = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":385 - * low = self.f_index.arr[f_id] - * high = self.f_index.arr[f_id+1] - * while high - low > 0: # <<<<<<<<<<<<<< - * midpoint = (low+high)/2 - * 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 = 385; __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 = 385; __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 = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!__pyx_t_1) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":386 - * 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 = 386; __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 = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_v_midpoint); - __pyx_v_midpoint = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":387 - * 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 = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromLong((__pyx_v_self->e_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_val); - __pyx_v_val = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":388 - * 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 = 388; __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 = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":389 - * 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 = 389; __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":390 - * if val == e_id: - * if col == 0: - * return self.col1.arr[midpoint] # <<<<<<<<<<<<<< - * if col == 1: - * 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 = 390; __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 = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":391 - * 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 = 391; __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 = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":392 - * return self.col1.arr[midpoint] - * if col == 1: - * return self.col2.arr[midpoint] # <<<<<<<<<<<<<< - * if val > e_id: - * 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 = 392; __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 = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - goto __pyx_L9; - } - __pyx_L9:; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":393 - * 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 = 393; __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 = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":394 - * return self.col2.arr[midpoint] - * if val > e_id: - * high = midpoint # <<<<<<<<<<<<<< - * if val < e_id: - * low = midpoint + 1 - */ - __Pyx_INCREF(__pyx_v_midpoint); - __Pyx_DECREF(__pyx_v_high); - __pyx_v_high = __pyx_v_midpoint; - goto __pyx_L10; - } - __pyx_L10:; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":395 - * 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 = 395; __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 = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":396 - * 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 = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_low); - __pyx_v_low = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L11; - } - __pyx_L11:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":397 - * if val < e_id: - * low = midpoint + 1 - * return None # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_e_id); - __Pyx_XDECREF(__pyx_v_f_id); - __Pyx_XDECREF(__pyx_v_low); - __Pyx_XDECREF(__pyx_v_high); - __Pyx_XDECREF(__pyx_v_midpoint); - __Pyx_XDECREF(__pyx_v_val); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static char __pyx_doc_4cdec_2sa_3_sa_5BiLex_16write_text[] = "Note: does not guarantee writing the dictionary in the original order"; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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 = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":400 - * - * - * def write_text(self, char* filename): # <<<<<<<<<<<<<< - * """Note: does not guarantee writing the dictionary in the original order""" - * cdef i, N, e_id, f_id - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { - PyObject *__pyx_v_i = 0; - PyObject *__pyx_v_N = 0; - PyObject *__pyx_v_e_id = 0; - PyObject *__pyx_v_f_id = 0; - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_score1 = NULL; - PyObject *__pyx_v_score2 = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - long __pyx_t_9; - long __pyx_t_10; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_text", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404 - * cdef i, N, e_id, f_id - * - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * N = len(self.e_index) - * 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 = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __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__w)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_INCREF(__pyx_t_4); - __pyx_v_f = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":405 - * - * with open(filename, "w") as f: - * N = len(self.e_index) # <<<<<<<<<<<<<< - * f_id = 0 - * for i from 0 <= i < N: - */ - __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 = 405; __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 = 405; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_N = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":406 - * with open(filename, "w") as f: - * N = len(self.e_index) - * f_id = 0 # <<<<<<<<<<<<<< - * for i from 0 <= i < N: - * while self.f_index.arr[f_id+1] == i: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_f_id = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":407 - * 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_AsLong(__pyx_v_N); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10++) { - __pyx_t_4 = PyInt_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":408 - * f_id = 0 - * 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] - */ - 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 = 408; __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 = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __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 = 408; __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 = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_11) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":409 - * 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 = 409; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_f_id); - __pyx_v_f_id = __pyx_t_1; - __pyx_t_1 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":410 - * 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 = 410; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __pyx_t_1 = PyInt_FromLong((__pyx_v_self->e_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_e_id); - __pyx_v_e_id = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":411 - * 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 = 411; __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 = 411; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_score1); - __pyx_v_score1 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":412 - * 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 = 412; __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 = 412; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_score2); - __pyx_v_score2 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":413 - * 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 = 413; __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 (!__pyx_t_4) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __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 (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __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 = 413; __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_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_score1); - PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_v_score1); - __Pyx_GIVEREF(__pyx_v_score1); - __Pyx_INCREF(__pyx_v_score2); - PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_v_score2); - __Pyx_GIVEREF(__pyx_v_score2); - __pyx_t_4 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_58), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(((PyObject *)__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 = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":407 - * 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 = PyInt_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_2 = 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; - 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_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404 - * cdef i, N, e_id, f_id - * - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * N = len(self.e_index) - * f_id = 0 - */ - /*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 = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_13 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __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 = 404; __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_GIVEREF(__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 = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L22; - } - __pyx_L22:; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __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; - 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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_3) { - __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_59, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L23; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L1_error; - __pyx_L23:; - } - - __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_12); - __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_N); - __Pyx_XDECREF(__pyx_v_e_id); - __Pyx_XDECREF(__pyx_v_f_id); - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_score1); - __Pyx_XDECREF(__pyx_v_score2); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":21 - * cdef int LOWER_MASK[32] - * - * cdef void _init_lower_mask(): # <<<<<<<<<<<<<< - * cdef unsigned i - * cdef int mask = 0 - */ - -static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void) { - unsigned int __pyx_v_i; - int __pyx_v_mask; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - unsigned int __pyx_t_2; - __Pyx_RefNannySetupContext("_init_lower_mask", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":23 - * cdef void _init_lower_mask(): - * cdef unsigned i - * cdef int mask = 0 # <<<<<<<<<<<<<< - * for i in range(MIN_BOTTOM_SIZE): - * mask = (mask << 1) + 1 - */ - __pyx_v_mask = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":24 - * cdef unsigned i - * cdef int mask = 0 - * for i in range(MIN_BOTTOM_SIZE): # <<<<<<<<<<<<<< - * mask = (mask << 1) + 1 - * LOWER_MASK[i] = mask - */ - __pyx_t_1 = __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":25 - * cdef int mask = 0 - * for i in range(MIN_BOTTOM_SIZE): - * mask = (mask << 1) + 1 # <<<<<<<<<<<<<< - * LOWER_MASK[i] = mask - * - */ - __pyx_v_mask = ((__pyx_v_mask << 1) + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":26 - * for i in range(MIN_BOTTOM_SIZE): - * mask = (mask << 1) + 1 - * LOWER_MASK[i] = mask # <<<<<<<<<<<<<< - * - * _init_lower_mask() - */ - (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[__pyx_v_i]) = __pyx_v_mask; - } - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":37 - * - * - * cdef _BitSet* new_BitSet(): # <<<<<<<<<<<<<< - * cdef _BitSet* b - * - */ - -static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(void) { - struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b; - struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("new_BitSet", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":40 - * cdef _BitSet* b - * - * b = <_BitSet*> malloc(sizeof(_BitSet)) # <<<<<<<<<<<<<< - * b.bitset = 0 - * b.min_val = -1 - */ - __pyx_v_b = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__BitSet)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":41 - * - * b = <_BitSet*> malloc(sizeof(_BitSet)) - * b.bitset = 0 # <<<<<<<<<<<<<< - * b.min_val = -1 - * b.max_val = -1 - */ - __pyx_v_b->bitset = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":42 - * b = <_BitSet*> malloc(sizeof(_BitSet)) - * b.bitset = 0 - * b.min_val = -1 # <<<<<<<<<<<<<< - * b.max_val = -1 - * b.size = 0 - */ - __pyx_v_b->min_val = -1; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":43 - * b.bitset = 0 - * b.min_val = -1 - * b.max_val = -1 # <<<<<<<<<<<<<< - * b.size = 0 - * return b - */ - __pyx_v_b->max_val = -1; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":44 - * b.min_val = -1 - * b.max_val = -1 - * b.size = 0 # <<<<<<<<<<<<<< - * return b - * - */ - __pyx_v_b->size = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":45 - * b.max_val = -1 - * b.size = 0 - * return b # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_b; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":48 - * - * - * cdef int bitset_findsucc(_BitSet* b, int i): # <<<<<<<<<<<<<< - * cdef int bitset, mask - * cdef int low, high, mid - */ - -static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { - int __pyx_v_bitset; - int __pyx_v_mask; - int __pyx_v_low; - int __pyx_v_high; - int __pyx_v_mid; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("bitset_findsucc", 0); - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":53 - * - * if b.max_val == -1 or i >= b.max_val: - * return -1 # <<<<<<<<<<<<<< - * if i < b.min_val: - * return b.min_val - */ - __pyx_r = -1; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":55 - * return -1 - * if i < b.min_val: - * return b.min_val # <<<<<<<<<<<<<< - * - * bitset = b.bitset & ~LOWER_MASK[i] - */ - __pyx_r = __pyx_v_b->min_val; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":57 - * return b.min_val - * - * bitset = b.bitset & ~LOWER_MASK[i] # <<<<<<<<<<<<<< - * low = i+1 - * high = b.max_val+1 - */ - __pyx_v_bitset = (__pyx_v_b->bitset & (~(__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[__pyx_v_i]))); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":58 - * - * bitset = b.bitset & ~LOWER_MASK[i] - * low = i+1 # <<<<<<<<<<<<<< - * high = b.max_val+1 - * while low < high-1: - */ - __pyx_v_low = (__pyx_v_i + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":59 - * bitset = b.bitset & ~LOWER_MASK[i] - * low = i+1 - * high = b.max_val+1 # <<<<<<<<<<<<<< - * while low < high-1: - * mid = (high + low)/2 - */ - __pyx_v_high = (__pyx_v_b->max_val + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":60 - * low = i+1 - * high = b.max_val+1 - * while low < high-1: # <<<<<<<<<<<<<< - * mid = (high + low)/2 - * 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":61 - * high = b.max_val+1 - * while low < high-1: - * mid = (high + low)/2 # <<<<<<<<<<<<<< - * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) - * if bitset & mask == 0: - */ - __pyx_v_mid = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":62 - * while low < high-1: - * mid = (high + low)/2 - * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) # <<<<<<<<<<<<<< - * if bitset & mask == 0: - * low = mid - */ - __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)]))); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":64 - * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) - * if bitset & mask == 0: - * low = mid # <<<<<<<<<<<<<< - * else: - * bitset = bitset & mask - */ - __pyx_v_low = __pyx_v_mid; - goto __pyx_L7; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":66 - * low = mid - * else: - * bitset = bitset & mask # <<<<<<<<<<<<<< - * high = mid - * return low - */ - __pyx_v_bitset = (__pyx_v_bitset & __pyx_v_mask); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":67 - * else: - * bitset = bitset & mask - * high = mid # <<<<<<<<<<<<<< - * return low - * - */ - __pyx_v_high = __pyx_v_mid; - } - __pyx_L7:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":68 - * bitset = bitset & mask - * high = mid - * return low # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_low; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":71 - * - * - * cdef int bitset_insert(_BitSet* b, int i): # <<<<<<<<<<<<<< - * cdef int val - * - */ - -static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { - int __pyx_v_val; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("bitset_insert", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":74 - * cdef int val - * - * val = 1 << i # <<<<<<<<<<<<<< - * if b.bitset & val == 0: - * b.bitset = b.bitset | val - */ - __pyx_v_val = (1 << __pyx_v_i); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":75 - * - * val = 1 << i - * if b.bitset & val == 0: # <<<<<<<<<<<<<< - * b.bitset = b.bitset | val - * if b.size == 0: - */ - __pyx_t_1 = (((__pyx_v_b->bitset & __pyx_v_val) == 0) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":76 - * val = 1 << i - * if b.bitset & val == 0: - * b.bitset = b.bitset | val # <<<<<<<<<<<<<< - * if b.size == 0: - * b.min_val = i - */ - __pyx_v_b->bitset = (__pyx_v_b->bitset | __pyx_v_val); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":77 - * if b.bitset & val == 0: - * b.bitset = b.bitset | val - * if b.size == 0: # <<<<<<<<<<<<<< - * b.min_val = i - * b.max_val = i - */ - __pyx_t_1 = ((__pyx_v_b->size == 0) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":78 - * b.bitset = b.bitset | val - * if b.size == 0: - * b.min_val = i # <<<<<<<<<<<<<< - * b.max_val = i - * else: - */ - __pyx_v_b->min_val = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":79 - * if b.size == 0: - * b.min_val = i - * b.max_val = i # <<<<<<<<<<<<<< - * else: - * if i < b.min_val: - */ - __pyx_v_b->max_val = __pyx_v_i; - goto __pyx_L4; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":81 - * b.max_val = i - * else: - * if i < b.min_val: # <<<<<<<<<<<<<< - * b.min_val = i - * if i > b.max_val: - */ - __pyx_t_1 = ((__pyx_v_i < __pyx_v_b->min_val) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":82 - * else: - * if i < b.min_val: - * b.min_val = i # <<<<<<<<<<<<<< - * if i > b.max_val: - * b.max_val = i - */ - __pyx_v_b->min_val = __pyx_v_i; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":83 - * if i < b.min_val: - * b.min_val = i - * if i > b.max_val: # <<<<<<<<<<<<<< - * b.max_val = i - * b.size = b.size + 1 - */ - __pyx_t_1 = ((__pyx_v_i > __pyx_v_b->max_val) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":84 - * b.min_val = i - * if i > b.max_val: - * b.max_val = i # <<<<<<<<<<<<<< - * b.size = b.size + 1 - * return 1 - */ - __pyx_v_b->max_val = __pyx_v_i; - goto __pyx_L6; - } - __pyx_L6:; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":85 - * if i > b.max_val: - * b.max_val = i - * b.size = b.size + 1 # <<<<<<<<<<<<<< - * return 1 - * return 0 - */ - __pyx_v_b->size = (__pyx_v_b->size + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":86 - * b.max_val = i - * b.size = b.size + 1 - * return 1 # <<<<<<<<<<<<<< - * return 0 - * - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":87 - * b.size = b.size + 1 - * return 1 - * return 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 0; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":90 - * - * - * cdef int bitset_contains(_BitSet* b, int i): # <<<<<<<<<<<<<< - * cdef int val - * - */ - -static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { - int __pyx_v_val; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("bitset_contains", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":93 - * cdef int val - * - * val = 1 << i # <<<<<<<<<<<<<< - * if b.bitset & val == 0: - * return 0 - */ - __pyx_v_val = (1 << __pyx_v_i); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":94 - * - * val = 1 << i - * if b.bitset & val == 0: # <<<<<<<<<<<<<< - * return 0 - * else: - */ - __pyx_t_1 = (((__pyx_v_b->bitset & __pyx_v_val) == 0) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":95 - * val = 1 << i - * if b.bitset & val == 0: - * return 0 # <<<<<<<<<<<<<< - * else: - * return 1 - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":97 - * return 0 - * else: - * return 1 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 1; - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":104 - * cdef int next_val - * - * def __next__(self): # <<<<<<<<<<<<<< - * cdef int ret_val - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *__pyx_v_self) { - int __pyx_v_ret_val; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__next__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":107 - * cdef int ret_val - * - * if self.next_val == -1: # <<<<<<<<<<<<<< - * raise StopIteration() - * ret_val = self.next_val - */ - __pyx_t_1 = ((__pyx_v_self->next_val == -1) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_builtin_StopIteration, ((PyObject *)__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_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;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":109 - * if self.next_val == -1: - * raise StopIteration() - * ret_val = self.next_val # <<<<<<<<<<<<<< - * self.next_val = bitset_findsucc(self.b, ret_val) - * return ret_val - */ - __pyx_t_3 = __pyx_v_self->next_val; - __pyx_v_ret_val = __pyx_t_3; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":110 - * raise StopIteration() - * ret_val = self.next_val - * self.next_val = bitset_findsucc(self.b, ret_val) # <<<<<<<<<<<<<< - * return ret_val - * - */ - __pyx_v_self->next_val = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_v_ret_val); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":111 - * ret_val = self.next_val - * self.next_val = bitset_findsucc(self.b, ret_val) - * return ret_val # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(__pyx_v_ret_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 111; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.BitSetIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __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_2sa_3_sa_6BitSet___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":122 - * cdef _BitSet* b - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.b = new_BitSet() - * - */ - -static int __pyx_pf_4cdec_2sa_3_sa_6BitSet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":123 - * - * def __cinit__(self): - * self.b = new_BitSet() # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_self->b = __pyx_f_4cdec_2sa_3_sa_new_BitSet(); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static void __pyx_pw_4cdec_2sa_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_4cdec_2sa_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":125 - * self.b = new_BitSet() - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * free(self.b) - * - */ - -static void __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":126 - * - * def __dealloc__(self): - * free(self.b) # <<<<<<<<<<<<<< - * - * def __iter__(self): - */ - free(__pyx_v_self->b); - - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":128 - * free(self.b) - * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef BitSetIterator it - * it = BitSetIterator() - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { - struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *__pyx_v_it = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_t_2; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__iter__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":130 - * def __iter__(self): - * cdef BitSetIterator it - * it = BitSetIterator() # <<<<<<<<<<<<<< - * it.b = self.b - * it.next_val = self.b.min_val - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_BitSetIterator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_it = ((struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":131 - * cdef BitSetIterator it - * it = BitSetIterator() - * it.b = self.b # <<<<<<<<<<<<<< - * it.next_val = self.b.min_val - * return it - */ - __pyx_t_2 = __pyx_v_self->b; - __pyx_v_it->b = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":132 - * it = BitSetIterator() - * it.b = self.b - * it.next_val = self.b.min_val # <<<<<<<<<<<<<< - * return it - * - */ - __pyx_t_3 = __pyx_v_self->b->min_val; - __pyx_v_it->next_val = __pyx_t_3; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":133 - * it.b = self.b - * it.next_val = self.b.min_val - * return it # <<<<<<<<<<<<<< - * - * def insert(self, i): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_it)); - __pyx_r = ((PyObject *)__pyx_v_it); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.BitSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_it); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("insert (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":135 - * return it - * - * def insert(self, i): # <<<<<<<<<<<<<< - * return bitset_insert(self.b, i) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("insert", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":136 - * - * def insert(self, i): - * return bitset_insert(self.b, i) # <<<<<<<<<<<<<< - * - * def findsucc(self, i): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_bitset_insert(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 136; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.BitSet.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("findsucc (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":138 - * return bitset_insert(self.b, i) - * - * def findsucc(self, i): # <<<<<<<<<<<<<< - * return bitset_findsucc(self.b, i) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("findsucc", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":139 - * - * def findsucc(self, i): - * return bitset_findsucc(self.b, i) # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.BitSet.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":141 - * return bitset_findsucc(self.b, i) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return dec2bin(self.b.bitset)+" ("+str(self.b.size)+","+str(self.b.min_val)+","+str(self.b.max_val)+")" - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "/home/mdenkows/cdec/python/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)+")" # <<<<<<<<<<<<<< - * - * def min(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_2sa_3_sa_dec2bin(__pyx_v_self->b->bitset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->b->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_2), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_3, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromLong(__pyx_v_self->b->min_val); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->b->max_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __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*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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_t_2 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.BitSet.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("min (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< - * return self.b.min_val - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__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("min", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":145 - * - * def min(self): - * return self.b.min_val # <<<<<<<<<<<<<< - * - * def max(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->b->min_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.BitSet.min", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("max (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":147 - * return self.b.min_val - * - * def max(self): # <<<<<<<<<<<<<< - * return self.b.max_val - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__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("max", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":148 - * - * def max(self): - * return self.b.max_val # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->b->max_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.BitSet.max", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":150 - * return self.b.max_val - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.b.size - * - */ - -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":151 - * - * def __len__(self): - * return self.b.size # <<<<<<<<<<<<<< - * - * def __contains__(self, i): - */ - __pyx_r = __pyx_v_self->b->size; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":153 - * return self.b.size - * - * def __contains__(self, i): # <<<<<<<<<<<<<< - * return bool(bitset_contains(self.b, i)) - * - */ - -static int __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__contains__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":154 - * - * def __contains__(self, i): - * return bool(bitset_contains(self.b, i)) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_bitset_contains(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = (!(!__pyx_t_3)); - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.BitSet.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":157 - * - * - * cdef str dec2bin(long i): # <<<<<<<<<<<<<< - * cdef str result = "" - * cdef unsigned d - */ - -static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) { - PyObject *__pyx_v_result = 0; - CYTHON_UNUSED unsigned int __pyx_v_d; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - unsigned 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("dec2bin", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":158 - * - * cdef str dec2bin(long i): - * cdef str result = "" # <<<<<<<<<<<<<< - * cdef unsigned d - * for d in range(MIN_BOTTOM_SIZE): - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_47)); - __pyx_v_result = __pyx_kp_s_47; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":160 - * cdef str result = "" - * cdef unsigned d - * for d in range(MIN_BOTTOM_SIZE): # <<<<<<<<<<<<<< - * if i & LOWER_MASK[0] == 0: - * result = "0"+result - */ - __pyx_t_1 = __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_d = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":161 - * cdef unsigned d - * for d in range(MIN_BOTTOM_SIZE): - * if i & LOWER_MASK[0] == 0: # <<<<<<<<<<<<<< - * result = "0"+result - * else: - */ - __pyx_t_3 = (((__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[0])) == 0) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":162 - * for d in range(MIN_BOTTOM_SIZE): - * if i & LOWER_MASK[0] == 0: - * result = "0"+result # <<<<<<<<<<<<<< - * else: - * result = "1"+result - */ - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s__0), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":164 - * result = "0"+result - * else: - * result = "1"+result # <<<<<<<<<<<<<< - * i = i >> 1 - * return result - */ - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s__1), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":165 - * else: - * result = "1"+result - * i = i >> 1 # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_v_i = (__pyx_v_i >> 1); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":166 - * result = "1"+result - * i = i >> 1 - * return result # <<<<<<<<<<<<<< - * - * cdef struct _VEB: - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.dec2bin", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":177 - * void** bottom - * - * cdef _VEB* new_VEB(int n): # <<<<<<<<<<<<<< - * cdef _VEB* veb - * cdef int num_bits, num_top_bits, i - */ - -static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __pyx_v_n) { - struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb; - int __pyx_v_num_bits; - struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_r; - __Pyx_RefNannyDeclarations - double __pyx_t_1; - double __pyx_t_2; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("new_VEB", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":181 - * cdef int num_bits, num_top_bits, i - * - * veb = <_VEB*> malloc(sizeof(_VEB)) # <<<<<<<<<<<<<< - * - * num_bits = int(ceil(log(n) / log(2))) - */ - __pyx_v_veb = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__VEB)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":183 - * veb = <_VEB*> malloc(sizeof(_VEB)) - * - * num_bits = int(ceil(log(n) / log(2))) # <<<<<<<<<<<<<< - * veb.num_bottom_bits = num_bits/2 - * if veb.num_bottom_bits < MIN_BOTTOM_BITS: - */ - __pyx_t_1 = log(__pyx_v_n); - __pyx_t_2 = log(2.0); - if (unlikely(__pyx_t_2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[6]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_num_bits = ((int)ceil((__pyx_t_1 / __pyx_t_2))); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":184 - * - * num_bits = int(ceil(log(n) / log(2))) - * veb.num_bottom_bits = num_bits/2 # <<<<<<<<<<<<<< - * if veb.num_bottom_bits < MIN_BOTTOM_BITS: - * veb.num_bottom_bits = MIN_BOTTOM_BITS - */ - __pyx_v_veb->num_bottom_bits = __Pyx_div_long(__pyx_v_num_bits, 2); - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * veb.num_bottom_bits = MIN_BOTTOM_BITS - * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 - */ - __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits < __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 - * - */ - __pyx_v_veb->num_bottom_bits = __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * - * veb.bottom = malloc(veb.top_universe_size * sizeof(void*)) - */ - __pyx_v_veb->top_universe_size = ((__pyx_v_n >> __pyx_v_veb->num_bottom_bits) + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":189 - * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 - * - * veb.bottom = malloc(veb.top_universe_size * sizeof(void*)) # <<<<<<<<<<<<<< - * memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) - * - */ - __pyx_v_veb->bottom = ((void **)malloc((__pyx_v_veb->top_universe_size * (sizeof(void *))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":190 - * - * veb.bottom = malloc(veb.top_universe_size * sizeof(void*)) - * memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) # <<<<<<<<<<<<<< - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - */ - memset(__pyx_v_veb->bottom, 0, (__pyx_v_veb->top_universe_size * (sizeof(void *)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":192 - * memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< - * veb.top = new_VEB(veb.top_universe_size) - * else: - */ - __pyx_t_3 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":193 - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - * veb.top = new_VEB(veb.top_universe_size) # <<<<<<<<<<<<<< - * else: - * veb.top = new_BitSet() - */ - __pyx_v_veb->top = __pyx_f_4cdec_2sa_3_sa_new_VEB(__pyx_v_veb->top_universe_size); - goto __pyx_L4; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":195 - * veb.top = new_VEB(veb.top_universe_size) - * else: - * veb.top = new_BitSet() # <<<<<<<<<<<<<< - * - * veb.max_val = -1 - */ - __pyx_v_veb->top = __pyx_f_4cdec_2sa_3_sa_new_BitSet(); - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":197 - * veb.top = new_BitSet() - * - * veb.max_val = -1 # <<<<<<<<<<<<<< - * veb.min_val = -1 - * veb.size = 0 - */ - __pyx_v_veb->max_val = -1; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":198 - * - * veb.max_val = -1 - * veb.min_val = -1 # <<<<<<<<<<<<<< - * veb.size = 0 - * return veb - */ - __pyx_v_veb->min_val = -1; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":199 - * veb.max_val = -1 - * veb.min_val = -1 - * veb.size = 0 # <<<<<<<<<<<<<< - * return veb - * - */ - __pyx_v_veb->size = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":200 - * veb.min_val = -1 - * veb.size = 0 - * return veb # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_veb; - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("cdec.sa._sa.new_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":203 - * - * - * cdef int VEB_insert(_VEB* veb, int i): # <<<<<<<<<<<<<< - * cdef _VEB* subv - * cdef _BitSet* subb - */ - -static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { - struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_subv; - struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_subb; - int __pyx_v_a; - int __pyx_v_b; - int __pyx_v_tmp; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("VEB_insert", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":208 - * cdef int a, b, tmp - * - * if veb.size == 0: # <<<<<<<<<<<<<< - * veb.min_val = i - * veb.max_val = i - */ - __pyx_t_1 = ((__pyx_v_veb->size == 0) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":209 - * - * if veb.size == 0: - * veb.min_val = i # <<<<<<<<<<<<<< - * veb.max_val = i - * elif i == veb.min_val or i == veb.max_val: - */ - __pyx_v_veb->min_val = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":210 - * if veb.size == 0: - * veb.min_val = i - * veb.max_val = i # <<<<<<<<<<<<<< - * elif i == veb.min_val or i == veb.max_val: - * return 0 - */ - __pyx_v_veb->max_val = __pyx_v_i; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":212 - * veb.max_val = i - * elif i == veb.min_val or i == veb.max_val: - * return 0 # <<<<<<<<<<<<<< - * else: - * if i < veb.min_val: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":215 - * else: - * if i < veb.min_val: - * tmp = i # <<<<<<<<<<<<<< - * i = veb.min_val - * veb.min_val = tmp - */ - __pyx_v_tmp = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/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; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":217 - * tmp = i - * i = veb.min_val - * veb.min_val = tmp # <<<<<<<<<<<<<< - * a = i >> veb.num_bottom_bits - * b = i & LOWER_MASK[veb.num_bottom_bits-1] - */ - __pyx_v_veb->min_val = __pyx_v_tmp; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":218 - * i = veb.min_val - * veb.min_val = tmp - * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< - * b = i & LOWER_MASK[veb.num_bottom_bits-1] - * if veb.bottom[a] == NULL: - */ - __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":219 - * veb.min_val = tmp - * 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: - */ - __pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":222 - * if veb.bottom[a] == NULL: - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - * subv = <_VEB*> veb.top # <<<<<<<<<<<<<< - * VEB_insert(subv, a) - * else: - */ - __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":223 - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - * subv = <_VEB*> veb.top - * VEB_insert(subv, a) # <<<<<<<<<<<<<< - * else: - * subb = <_BitSet*> veb.top - */ - __pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_a); - goto __pyx_L6; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":225 - * VEB_insert(subv, a) - * else: - * subb = <_BitSet*> veb.top # <<<<<<<<<<<<<< - * bitset_insert(subb, a) - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - */ - __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":226 - * else: - * 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) - */ - __pyx_f_4cdec_2sa_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_a); - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * else: - * 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; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":230 - * veb.bottom[a] = new_VEB(1 << veb.num_bottom_bits) - * else: - * veb.bottom[a] = new_BitSet() # <<<<<<<<<<<<<< - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - * subv = <_VEB*> veb.bottom[a] - */ - (__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_4cdec_2sa_3_sa_new_BitSet(); - } - __pyx_L7:; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":232 - * veb.bottom[a] = new_BitSet() - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - * subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<< - * if VEB_insert(subv, b) == 0: - * return 0 - */ - __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":234 - * subv = <_VEB*> veb.bottom[a] - * if VEB_insert(subv, b) == 0: - * return 0 # <<<<<<<<<<<<<< - * else: - * subb = <_BitSet*> veb.bottom[a] - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L9; - } - __pyx_L9:; - goto __pyx_L8; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":236 - * return 0 - * else: - * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< - * if bitset_insert(subb, b) == 0: - * return 0 - */ - __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":238 - * subb = <_BitSet*> veb.bottom[a] - * if bitset_insert(subb, b) == 0: - * return 0 # <<<<<<<<<<<<<< - * - * if i > veb.max_val: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L10; - } - __pyx_L10:; - } - __pyx_L8:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":241 - * - * if i > veb.max_val: - * veb.max_val = i # <<<<<<<<<<<<<< - * veb.size = veb.size + 1 - * return 1 - */ - __pyx_v_veb->max_val = __pyx_v_i; - goto __pyx_L11; - } - __pyx_L11:; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":242 - * if i > veb.max_val: - * veb.max_val = i - * veb.size = veb.size + 1 # <<<<<<<<<<<<<< - * return 1 - * - */ - __pyx_v_veb->size = (__pyx_v_veb->size + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":243 - * veb.max_val = i - * veb.size = veb.size + 1 - * return 1 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":246 - * - * - * cdef del_VEB(_VEB* veb): # <<<<<<<<<<<<<< - * cdef int i - * - */ - -static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb) { - int __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("del_VEB", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":249 - * cdef int i - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< - * i = (<_VEB*> veb.top).min_val - * else: - */ - __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":250 - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - * i = (<_VEB*> veb.top).min_val # <<<<<<<<<<<<<< - * else: - * i = (<_BitSet*> veb.top).min_val - */ - __pyx_t_2 = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top)->min_val; - __pyx_v_i = __pyx_t_2; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":252 - * i = (<_VEB*> veb.top).min_val - * else: - * i = (<_BitSet*> veb.top).min_val # <<<<<<<<<<<<<< - * - * while i != -1: - */ - __pyx_t_2 = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top)->min_val; - __pyx_v_i = __pyx_t_2; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":254 - * i = (<_BitSet*> veb.top).min_val - * - * while i != -1: # <<<<<<<<<<<<<< - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - * del_VEB(<_VEB*> veb.bottom[i]) - */ - while (1) { - __pyx_t_1 = ((__pyx_v_i != -1) != 0); - if (!__pyx_t_1) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":255 - * - * while i != -1: - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<< - * del_VEB(<_VEB*> veb.bottom[i]) - * else: - */ - __pyx_t_1 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":256 - * while i != -1: - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - * del_VEB(<_VEB*> veb.bottom[i]) # <<<<<<<<<<<<<< - * else: - * free(<_BitSet*> veb.bottom[i]) - */ - __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_del_VEB(((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_i]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":258 - * del_VEB(<_VEB*> veb.bottom[i]) - * else: - * free(<_BitSet*> veb.bottom[i]) # <<<<<<<<<<<<<< - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - */ - free(((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_i]))); - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":260 - * free(<_BitSet*> veb.bottom[i]) - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< - * i = VEB_findsucc(<_VEB*> veb.top, i) - * else: - */ - __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":261 - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - * i = VEB_findsucc(<_VEB*> veb.top, i) # <<<<<<<<<<<<<< - * else: - * i = bitset_findsucc(<_BitSet*> veb.top, i) - */ - __pyx_v_i = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top), __pyx_v_i); - goto __pyx_L7; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":263 - * i = VEB_findsucc(<_VEB*> veb.top, i) - * else: - * i = bitset_findsucc(<_BitSet*> veb.top, i) # <<<<<<<<<<<<<< - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - */ - __pyx_v_i = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top), __pyx_v_i); - } - __pyx_L7:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":265 - * i = bitset_findsucc(<_BitSet*> veb.top, i) - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< - * del_VEB(<_VEB*> veb.top) - * else: - */ - __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":266 - * - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - * del_VEB(<_VEB*> veb.top) # <<<<<<<<<<<<<< - * else: - * free(<_BitSet*> veb.top) - */ - __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_del_VEB(((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":268 - * del_VEB(<_VEB*> veb.top) - * else: - * free(<_BitSet*> veb.top) # <<<<<<<<<<<<<< - * free(veb.bottom) - * free(veb) - */ - free(((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top)); - } - __pyx_L8:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":269 - * else: - * free(<_BitSet*> veb.top) - * free(veb.bottom) # <<<<<<<<<<<<<< - * free(veb) - * - */ - free(__pyx_v_veb->bottom); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":270 - * free(<_BitSet*> veb.top) - * free(veb.bottom) - * free(veb) # <<<<<<<<<<<<<< - * - * - */ - free(__pyx_v_veb); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.del_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":273 - * - * - * cdef int VEB_findsucc(_VEB* veb, int i): # <<<<<<<<<<<<<< - * cdef _VEB* subv - * cdef _BitSet* subb - */ - -static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { - struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_subv; - struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_subb; - int __pyx_v_a; - int __pyx_v_b; - int __pyx_v_j; - int __pyx_v_c; - int __pyx_v_found; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("VEB_findsucc", 0); - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":279 - * - * if veb.max_val == -1 or i>=veb.max_val: - * return -1 # <<<<<<<<<<<<<< - * if i < veb.min_val: - * return veb.min_val - */ - __pyx_r = -1; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":281 - * return -1 - * if i < veb.min_val: - * return veb.min_val # <<<<<<<<<<<<<< - * - * a = i >> veb.num_bottom_bits - */ - __pyx_r = __pyx_v_veb->min_val; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":283 - * return veb.min_val - * - * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< - * b = i & LOWER_MASK[veb.num_bottom_bits-1] - * found = 0 - */ - __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":284 - * - * a = i >> veb.num_bottom_bits - * b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<< - * found = 0 - * if veb.bottom[a] != NULL: - */ - __pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":285 - * a = i >> veb.num_bottom_bits - * b = i & LOWER_MASK[veb.num_bottom_bits-1] - * found = 0 # <<<<<<<<<<<<<< - * if veb.bottom[a] != NULL: - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - */ - __pyx_v_found = 0; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":288 - * if veb.bottom[a] != NULL: - * 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) - */ - __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * found = 1 - * else: - */ - __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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":291 - * if subv.max_val > b: - * j = (a << veb.num_bottom_bits) + VEB_findsucc(subv, b) - * found = 1 # <<<<<<<<<<<<<< - * else: - * subb = <_BitSet*> veb.bottom[a] - */ - __pyx_v_found = 1; - goto __pyx_L7; - } - __pyx_L7:; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":293 - * found = 1 - * else: - * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< - * if subb.max_val > b: - * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) - */ - __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * found = 1 - * if found==0: - */ - __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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":296 - * if subb.max_val > b: - * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) - * found = 1 # <<<<<<<<<<<<<< - * if found==0: - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - */ - __pyx_v_found = 1; - goto __pyx_L8; - } - __pyx_L8:; - } - __pyx_L6:; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":299 - * if found==0: - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - * subv = <_VEB*> veb.top # <<<<<<<<<<<<<< - * c = VEB_findsucc(subv, a) - * else: - */ - __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":300 - * if veb.top_universe_size > MIN_BOTTOM_SIZE: - * subv = <_VEB*> veb.top - * c = VEB_findsucc(subv, a) # <<<<<<<<<<<<<< - * else: - * subb = <_BitSet*> veb.top - */ - __pyx_v_c = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_a); - goto __pyx_L10; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":302 - * c = VEB_findsucc(subv, a) - * else: - * subb = <_BitSet*> veb.top # <<<<<<<<<<<<<< - * c = bitset_findsucc(subb, a) - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - */ - __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":303 - * else: - * subb = <_BitSet*> veb.top - * c = bitset_findsucc(subb, a) # <<<<<<<<<<<<<< - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - * subv = <_VEB*> veb.bottom[c] - */ - __pyx_v_c = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_a); - } - __pyx_L10:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":305 - * 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 - * else: - */ - __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_c])); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * else: - * 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; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":308 - * j = (c << veb.num_bottom_bits) + subv.min_val - * else: - * subb = <_BitSet*> veb.bottom[c] # <<<<<<<<<<<<<< - * j = (c << veb.num_bottom_bits) + subb.min_val - * return j - */ - __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_c])); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":309 - * else: - * subb = <_BitSet*> veb.bottom[c] - * j = (c << veb.num_bottom_bits) + subb.min_val # <<<<<<<<<<<<<< - * return j - * - */ - __pyx_v_j = ((__pyx_v_c << __pyx_v_veb->num_bottom_bits) + __pyx_v_subb->min_val); - } - __pyx_L11:; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":310 - * subb = <_BitSet*> veb.bottom[c] - * j = (c << veb.num_bottom_bits) + subb.min_val - * return j # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_j; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":313 - * - * - * cdef int VEB_contains(_VEB* veb, int i): # <<<<<<<<<<<<<< - * cdef _VEB* subv - * cdef _BitSet* subb - */ - -static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { - struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_subv; - struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_subb; - int __pyx_v_a; - int __pyx_v_b; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("VEB_contains", 0); - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_2 = __pyx_t_1; - } - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":319 - * - * if veb.size == 0 or i < veb.min_val or i > veb.max_val: - * return 0 # <<<<<<<<<<<<<< - * - * if veb.min_val == i: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":322 - * - * if veb.min_val == i: - * return 1 # <<<<<<<<<<<<<< - * else: - * if veb.size == 1: - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L4; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":325 - * else: - * if veb.size == 1: - * return 0 # <<<<<<<<<<<<<< - * - * a = i >> veb.num_bottom_bits - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":327 - * return 0 - * - * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< - * b = i & LOWER_MASK[veb.num_bottom_bits-1] - * if veb.bottom[a] == NULL: - */ - __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":328 - * - * a = i >> veb.num_bottom_bits - * b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<< - * if veb.bottom[a] == NULL: - * return 0 - */ - __pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":330 - * b = i & LOWER_MASK[veb.num_bottom_bits-1] - * if veb.bottom[a] == NULL: - * return 0 # <<<<<<<<<<<<<< - * else: - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":333 - * else: - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - * subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<< - * return VEB_contains(subv, b) - * else: - */ - __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":334 - * if veb.num_bottom_bits > MIN_BOTTOM_BITS: - * subv = <_VEB*> veb.bottom[a] - * return VEB_contains(subv, b) # <<<<<<<<<<<<<< - * else: - * subb = <_BitSet*> veb.bottom[a] - */ - __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_contains(__pyx_v_subv, __pyx_v_b); - goto __pyx_L0; - goto __pyx_L7; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":336 - * return VEB_contains(subv, b) - * else: - * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< - * return bitset_contains(subb, b) - * - */ - __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":337 - * else: - * subb = <_BitSet*> veb.bottom[a] - * return bitset_contains(subb, b) # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_f_4cdec_2sa_3_sa_bitset_contains(__pyx_v_subb, __pyx_v_b); - goto __pyx_L0; - } - __pyx_L7:; - } - __pyx_L6:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(((struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":344 - * cdef int next_val - * - * def __next__(self): # <<<<<<<<<<<<<< - * cdef int ret_val - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *__pyx_v_self) { - int __pyx_v_ret_val; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__next__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":347 - * cdef int ret_val - * - * if self.next_val == -1: # <<<<<<<<<<<<<< - * raise StopIteration() - * ret_val = self.next_val - */ - __pyx_t_1 = ((__pyx_v_self->next_val == -1) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_builtin_StopIteration, ((PyObject *)__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_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;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":349 - * if self.next_val == -1: - * raise StopIteration() - * ret_val = self.next_val # <<<<<<<<<<<<<< - * self.next_val = VEB_findsucc(self.v, ret_val) - * return ret_val - */ - __pyx_t_3 = __pyx_v_self->next_val; - __pyx_v_ret_val = __pyx_t_3; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":350 - * raise StopIteration() - * ret_val = self.next_val - * self.next_val = VEB_findsucc(self.v, ret_val) # <<<<<<<<<<<<<< - * return ret_val - * - */ - __pyx_v_self->next_val = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->v, __pyx_v_ret_val); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":351 - * ret_val = self.next_val - * self.next_val = VEB_findsucc(self.v, ret_val) - * return ret_val # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(__pyx_v_ret_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 351; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.VEBIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_size; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; - PyObject* values[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 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__size)) != 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[6]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.VEB.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), __pyx_v_size); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":360 - * cdef int _first(self) - * - * def __cinit__(self, int size): # <<<<<<<<<<<<<< - * self.veb = new_VEB(size) - * - */ - -static int __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, int __pyx_v_size) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":361 - * - * def __cinit__(self, int size): - * self.veb = new_VEB(size) # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_self->veb = __pyx_f_4cdec_2sa_3_sa_new_VEB(__pyx_v_size); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static void __pyx_pw_4cdec_2sa_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_4cdec_2sa_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":363 - * self.veb = new_VEB(size) - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * del_VEB(self.veb) - * - */ - -static void __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":364 - * - * def __dealloc__(self): - * del_VEB(self.veb) # <<<<<<<<<<<<<< - * - * def __iter__(self): - */ - __pyx_t_1 = __pyx_f_4cdec_2sa_3_sa_del_VEB(__pyx_v_self->veb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.VEB.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":366 - * del_VEB(self.veb) - * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef VEBIterator it - * it = VEBIterator() - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { - struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *__pyx_v_it = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_t_2; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__iter__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":368 - * def __iter__(self): - * cdef VEBIterator it - * it = VEBIterator() # <<<<<<<<<<<<<< - * it.v = self.veb - * it.next_val = self.veb.min_val - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_VEBIterator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_it = ((struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":369 - * cdef VEBIterator it - * it = VEBIterator() - * it.v = self.veb # <<<<<<<<<<<<<< - * it.next_val = self.veb.min_val - * return it - */ - __pyx_t_2 = __pyx_v_self->veb; - __pyx_v_it->v = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":370 - * it = VEBIterator() - * it.v = self.veb - * it.next_val = self.veb.min_val # <<<<<<<<<<<<<< - * return it - * - */ - __pyx_t_3 = __pyx_v_self->veb->min_val; - __pyx_v_it->next_val = __pyx_t_3; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":371 - * it.v = self.veb - * it.next_val = self.veb.min_val - * return it # <<<<<<<<<<<<<< - * - * def insert(self, i): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_it)); - __pyx_r = ((PyObject *)__pyx_v_it); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.VEB.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_it); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("insert (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":373 - * return it - * - * def insert(self, i): # <<<<<<<<<<<<<< - * return VEB_insert(self.veb, i) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("insert", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":374 - * - * def insert(self, i): - * return VEB_insert(self.veb, i) # <<<<<<<<<<<<<< - * - * cdef int _insert(self, int i): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 374; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.VEB.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":376 - * return VEB_insert(self.veb, i) - * - * cdef int _insert(self, int i): # <<<<<<<<<<<<<< - * return VEB_insert(self.veb, i) - * - */ - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_insert", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":377 - * - * cdef int _insert(self, int i): - * return VEB_insert(self.veb, i) # <<<<<<<<<<<<<< - * - * def findsucc(self, i): - */ - __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_v_i); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("findsucc (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":379 - * return VEB_insert(self.veb, i) - * - * def findsucc(self, i): # <<<<<<<<<<<<<< - * return VEB_findsucc(self.veb, i) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("findsucc", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":380 - * - * def findsucc(self, i): - * return VEB_findsucc(self.veb, i) # <<<<<<<<<<<<<< - * - * cdef int _first(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.VEB.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":382 - * return VEB_findsucc(self.veb, i) - * - * cdef int _first(self): # <<<<<<<<<<<<<< - * return self.veb.min_val - * - */ - -static int __pyx_f_4cdec_2sa_3_sa_3VEB__first(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_first", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":383 - * - * cdef int _first(self): - * return self.veb.min_val # <<<<<<<<<<<<<< - * - * cdef int _findsucc(self, int i): - */ - __pyx_r = __pyx_v_self->veb->min_val; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":385 - * return self.veb.min_val - * - * cdef int _findsucc(self, int i): # <<<<<<<<<<<<<< - * return VEB_findsucc(self.veb, i) - * - */ - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_findsucc", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":386 - * - * cdef int _findsucc(self, int i): - * return VEB_findsucc(self.veb, i) # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_v_i); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":388 - * return VEB_findsucc(self.veb, i) - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.veb.size - * - */ - -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":389 - * - * def __len__(self): - * return self.veb.size # <<<<<<<<<<<<<< - * - * def __contains__(self, i): - */ - __pyx_r = __pyx_v_self->veb->size; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":391 - * return self.veb.size - * - * def __contains__(self, i): # <<<<<<<<<<<<<< - * return VEB_contains(self.veb, i) - */ - -static int __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__contains__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":392 - * - * def __contains__(self, i): - * return VEB_contains(self.veb, i) # <<<<<<<<<<<<<< - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_contains(__pyx_v_self->veb, __pyx_t_1); - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.VEB.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sa = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sa,0}; - PyObject* values[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 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__sa)) != 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[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_sa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.LCP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sa), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "sa", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_LCP *)__pyx_v_self), __pyx_v_sa); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":9 - * cdef IntList lcp - * - * def __cinit__(self, SuffixArray sa): # <<<<<<<<<<<<<< - * cdef int i, k, j, h, n - * cdef IntList rank - */ - -static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_LCP *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sa) { - int __pyx_v_i; - int __pyx_v_k; - int __pyx_v_j; - int __pyx_v_h; - int __pyx_v_n; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_rank = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":13 - * cdef IntList rank - * - * logger.info("Constructing LCP array") # <<<<<<<<<<<<<< - * self.sa = sa - * n = self.sa.sa.len - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 13; __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[9]; __pyx_lineno = 13; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 13; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":14 - * - * logger.info("Constructing LCP array") - * self.sa = sa # <<<<<<<<<<<<<< - * n = self.sa.sa.len - * self.lcp = IntList(initial_len=n) - */ - __Pyx_INCREF(((PyObject *)__pyx_v_sa)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_sa)); - __Pyx_GOTREF(__pyx_v_self->sa); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); - __pyx_v_self->sa = __pyx_v_sa; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":15 - * logger.info("Constructing LCP array") - * self.sa = sa - * n = self.sa.sa.len # <<<<<<<<<<<<<< - * self.lcp = IntList(initial_len=n) - * - */ - __pyx_t_3 = __pyx_v_self->sa->sa->len; - __pyx_v_n = __pyx_t_3; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":16 - * self.sa = sa - * n = self.sa.sa.len - * self.lcp = IntList(initial_len=n) # <<<<<<<<<<<<<< - * - * rank = IntList(initial_len=n) - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->lcp); - __Pyx_DECREF(((PyObject *)__pyx_v_self->lcp)); - __pyx_v_self->lcp = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":18 - * self.lcp = IntList(initial_len=n) - * - * rank = IntList(initial_len=n) # <<<<<<<<<<<<<< - * for i from 0 <= i < n: - * rank.arr[sa.sa.arr[i]] = i - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":19 - * - * rank = IntList(initial_len=n) - * for i from 0 <= i < n: # <<<<<<<<<<<<<< - * rank.arr[sa.sa.arr[i]] = i - * - */ - __pyx_t_3 = __pyx_v_n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":20 - * rank = IntList(initial_len=n) - * for i from 0 <= i < n: - * rank.arr[sa.sa.arr[i]] = i # <<<<<<<<<<<<<< - * - * h = 0 - */ - (__pyx_v_rank->arr[(__pyx_v_sa->sa->arr[__pyx_v_i])]) = __pyx_v_i; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":22 - * rank.arr[sa.sa.arr[i]] = i - * - * h = 0 # <<<<<<<<<<<<<< - * for i from 0 <= i < n: - * k = rank.arr[i] - */ - __pyx_v_h = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":23 - * - * h = 0 - * for i from 0 <= i < n: # <<<<<<<<<<<<<< - * k = rank.arr[i] - * if k == 0: - */ - __pyx_t_3 = __pyx_v_n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":24 - * h = 0 - * for i from 0 <= i < n: - * k = rank.arr[i] # <<<<<<<<<<<<<< - * if k == 0: - * self.lcp.arr[k] = -1 - */ - __pyx_v_k = (__pyx_v_rank->arr[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":25 - * for i from 0 <= i < n: - * k = rank.arr[i] - * if k == 0: # <<<<<<<<<<<<<< - * self.lcp.arr[k] = -1 - * else: - */ - __pyx_t_4 = ((__pyx_v_k == 0) != 0); - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":26 - * k = rank.arr[i] - * if k == 0: - * self.lcp.arr[k] = -1 # <<<<<<<<<<<<<< - * else: - * j = sa.sa.arr[k-1] - */ - (__pyx_v_self->lcp->arr[__pyx_v_k]) = -1; - goto __pyx_L7; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":28 - * self.lcp.arr[k] = -1 - * 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]: - * h = h+1 - */ - __pyx_v_j = (__pyx_v_sa->sa->arr[(__pyx_v_k - 1)]); - - /* "/home/mdenkows/cdec/python/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]: # <<<<<<<<<<<<<< - * h = h+1 - * 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; - } else { - __pyx_t_5 = __pyx_t_4; - } - if (!__pyx_t_5) break; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * self.lcp.arr[k] = h - * if h > 0: - */ - __pyx_v_h = (__pyx_v_h + 1); - } - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * if h > 0: - * h = h-1 - */ - (__pyx_v_self->lcp->arr[__pyx_v_k]) = __pyx_v_h; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":33 - * self.lcp.arr[k] = h - * if h > 0: - * h = h-1 # <<<<<<<<<<<<<< - * logger.info("LCP array completed") - * - */ - __pyx_v_h = (__pyx_v_h - 1); - goto __pyx_L10; - } - __pyx_L10:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":34 - * if h > 0: - * h = h-1 - * logger.info("LCP array completed") # <<<<<<<<<<<<<< - * - * def compute_stats(self, int max_n): - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 34; __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[9]; __pyx_lineno = 34; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 34; __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; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.LCP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_rank); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n); /*proto*/ -static char __pyx_doc_4cdec_2sa_3_sa_3LCP_2compute_stats[] = "Note: the output of this function is not exact. In\n particular, the frequency associated with each word is \n not guaranteed to be correct. This is due to a bit of\n laxness in the design; the function is intended only to\n obtain a list of the most frequent words; for this \n purpose it is perfectly fine"; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n) { - int __pyx_v_max_n; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("compute_stats (wrapper)", 0); - assert(__pyx_arg_max_n); { - __pyx_v_max_n = __Pyx_PyInt_AsInt(__pyx_arg_max_n); if (unlikely((__pyx_v_max_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3LCP_2compute_stats(((struct __pyx_obj_4cdec_2sa_3_sa_LCP *)__pyx_v_self), ((int)__pyx_v_max_n)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":36 - * logger.info("LCP array completed") - * - * def compute_stats(self, int max_n): # <<<<<<<<<<<<<< - * """Note: the output of this function is not exact. In - * particular, the frequency associated with each word is - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_3LCP_2compute_stats(struct __pyx_obj_4cdec_2sa_3_sa_LCP *__pyx_v_self, int __pyx_v_max_n) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("compute_stats", 0); - __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, __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_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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(); - return __pyx_r; -} - -static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - 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; - 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_L26_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[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":48 - * cdef VEB veb - * - * N = self.sa.sa.len # <<<<<<<<<<<<<< - * - * ngram_starts = [] - */ - __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->sa->sa->len; - __pyx_cur_scope->__pyx_v_N = __pyx_t_1; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":50 - * N = self.sa.sa.len - * - * ngram_starts = [] # <<<<<<<<<<<<<< - * for n from 0 <= n < max_n: - * ngram_starts.append(IntList(initial_len=N)) - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_cur_scope->__pyx_v_ngram_starts = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":51 - * - * ngram_starts = [] - * for n from 0 <= n < max_n: # <<<<<<<<<<<<<< - * ngram_starts.append(IntList(initial_len=N)) - * - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":52 - * ngram_starts = [] - * for n from 0 <= n < max_n: - * ngram_starts.append(IntList(initial_len=N)) # <<<<<<<<<<<<<< - * - * run_start = IntList(initial_len=max_n) - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_ngram_starts, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":54 - * ngram_starts.append(IntList(initial_len=N)) - * - * run_start = IntList(initial_len=max_n) # <<<<<<<<<<<<<< - * veb = VEB(N) - * - */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_max_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_run_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":55 - * - * run_start = IntList(initial_len=max_n) - * veb = VEB(N) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < N: - */ - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __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[9]; __pyx_lineno = 55; __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_2sa_3_sa_VEB)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":57 - * veb = VEB(N) - * - * for i from 0 <= i < N: # <<<<<<<<<<<<<< - * h = self.lcp.arr[i] - * if h < 0: - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":58 - * - * for i from 0 <= i < N: - * h = self.lcp.arr[i] # <<<<<<<<<<<<<< - * if h < 0: - * h = 0 - */ - __pyx_cur_scope->__pyx_v_h = (__pyx_cur_scope->__pyx_v_self->lcp->arr[__pyx_cur_scope->__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":59 - * for i from 0 <= i < N: - * h = self.lcp.arr[i] - * if h < 0: # <<<<<<<<<<<<<< - * h = 0 - * for n from h <= n < max_n: - */ - __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_h < 0) != 0); - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":60 - * h = self.lcp.arr[i] - * if h < 0: - * h = 0 # <<<<<<<<<<<<<< - * for n from h <= n < max_n: - * rs = run_start.arr[n] - */ - __pyx_cur_scope->__pyx_v_h = 0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":61 - * if h < 0: - * h = 0 - * for n from h <= n < max_n: # <<<<<<<<<<<<<< - * rs = run_start.arr[n] - * run_start.arr[n] = i - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":62 - * h = 0 - * for n from h <= n < max_n: - * rs = run_start.arr[n] # <<<<<<<<<<<<<< - * run_start.arr[n] = i - * freq = i - rs - */ - __pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_run_start->arr[__pyx_cur_scope->__pyx_v_n]); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":63 - * for n from h <= n < max_n: - * rs = run_start.arr[n] - * run_start.arr[n] = i # <<<<<<<<<<<<<< - * freq = i - rs - * if freq > 1000: # arbitrary, but see note below - */ - (__pyx_cur_scope->__pyx_v_run_start->arr[__pyx_cur_scope->__pyx_v_n]) = __pyx_cur_scope->__pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":64 - * rs = run_start.arr[n] - * run_start.arr[n] = i - * freq = i - rs # <<<<<<<<<<<<<< - * if freq > 1000: # arbitrary, but see note below - * veb._insert(freq) - */ - __pyx_cur_scope->__pyx_v_freq = (__pyx_cur_scope->__pyx_v_i - __pyx_cur_scope->__pyx_v_rs); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":65 - * run_start.arr[n] = i - * freq = i - rs - * if freq > 1000: # arbitrary, but see note below # <<<<<<<<<<<<<< - * veb._insert(freq) - * ngram_start = ngram_starts[n] - */ - __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_freq > 1000) != 0); - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":66 - * freq = i - rs - * if freq > 1000: # arbitrary, but see note below - * veb._insert(freq) # <<<<<<<<<<<<<< - * ngram_start = ngram_starts[n] - * while ngram_start.arr[freq] > 0: - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":67 - * if freq > 1000: # arbitrary, but see note below - * veb._insert(freq) - * ngram_start = ngram_starts[n] # <<<<<<<<<<<<<< - * while ngram_start.arr[freq] > 0: - * freq = freq + 1 # cheating a bit, should be ok for sparse histogram - */ - __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_starts), __pyx_cur_scope->__pyx_v_n, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":68 - * veb._insert(freq) - * ngram_start = ngram_starts[n] - * while ngram_start.arr[freq] > 0: # <<<<<<<<<<<<<< - * freq = freq + 1 # cheating a bit, should be ok for sparse histogram - * ngram_start.arr[freq] = rs - */ - while (1) { - __pyx_t_5 = (((__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_freq]) > 0) != 0); - if (!__pyx_t_5) break; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * ngram_start.arr[freq] = rs - * i = veb.veb.min_val - */ - __pyx_cur_scope->__pyx_v_freq = (__pyx_cur_scope->__pyx_v_freq + 1); - } - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * i = veb.veb.min_val - * while i != -1: - */ - (__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_freq]) = __pyx_cur_scope->__pyx_v_rs; - goto __pyx_L11; - } - __pyx_L11:; - } - } - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * while i != -1: - * ii = veb._findsucc(i) - */ - __pyx_t_1 = __pyx_cur_scope->__pyx_v_veb->veb->min_val; - __pyx_cur_scope->__pyx_v_i = __pyx_t_1; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":72 - * ngram_start.arr[freq] = rs - * i = veb.veb.min_val - * while i != -1: # <<<<<<<<<<<<<< - * ii = veb._findsucc(i) - * for n from 0 <= n < max_n: - */ - while (1) { - __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_i != -1) != 0); - if (!__pyx_t_5) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":73 - * i = veb.veb.min_val - * while i != -1: - * ii = veb._findsucc(i) # <<<<<<<<<<<<<< - * for n from 0 <= n < max_n: - * ngram_start = ngram_starts[n] - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":74 - * while i != -1: - * ii = veb._findsucc(i) - * for n from 0 <= n < max_n: # <<<<<<<<<<<<<< - * ngram_start = ngram_starts[n] - * iii = i - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":75 - * ii = veb._findsucc(i) - * for n from 0 <= n < max_n: - * ngram_start = ngram_starts[n] # <<<<<<<<<<<<<< - * iii = i - * rs = ngram_start.arr[iii] - */ - __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_starts), __pyx_cur_scope->__pyx_v_n, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":76 - * for n from 0 <= n < max_n: - * ngram_start = ngram_starts[n] - * iii = i # <<<<<<<<<<<<<< - * rs = ngram_start.arr[iii] - * while (ii==-1 or iii < ii) and rs != 0: - */ - __pyx_cur_scope->__pyx_v_iii = __pyx_cur_scope->__pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":77 - * ngram_start = ngram_starts[n] - * iii = i - * rs = ngram_start.arr[iii] # <<<<<<<<<<<<<< - * while (ii==-1 or iii < ii) and rs != 0: - * j = self.sa.sa.arr[rs] - */ - __pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_iii]); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":78 - * iii = i - * rs = ngram_start.arr[iii] - * while (ii==-1 or iii < ii) and rs != 0: # <<<<<<<<<<<<<< - * j = self.sa.sa.arr[rs] - * 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; - } else { - __pyx_t_8 = __pyx_t_5; - } - if (__pyx_t_8) { - __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_rs != 0) != 0); - __pyx_t_7 = __pyx_t_5; - } else { - __pyx_t_7 = __pyx_t_8; - } - if (!__pyx_t_7) break; - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * valid = 1 - * for k from 0 <= k < n+1: - */ - __pyx_cur_scope->__pyx_v_j = (__pyx_cur_scope->__pyx_v_self->sa->sa->arr[__pyx_cur_scope->__pyx_v_rs]); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":80 - * while (ii==-1 or iii < ii) and rs != 0: - * j = self.sa.sa.arr[rs] - * valid = 1 # <<<<<<<<<<<<<< - * for k from 0 <= k < n+1: - * if self.sa.darray.data.arr[j+k] < 2: - */ - __pyx_cur_scope->__pyx_v_valid = 1; - - /* "/home/mdenkows/cdec/python/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++) { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":83 - * for k from 0 <= k < n+1: - * 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)]) - */ - __pyx_cur_scope->__pyx_v_valid = 0; - goto __pyx_L22; - } - __pyx_L22:; - } - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":85 - * valid = 0 - * if valid: - * ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)]) # <<<<<<<<<<<<<< - * yield i, n+1, ngram - * iii = iii + 1 - */ - __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_cur_scope->__pyx_v_k = __pyx_t_6; - __pyx_t_3 = PyInt_FromLong((__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); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_t_3 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_cur_scope->__pyx_v_ngram = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * iii = iii + 1 - * rs = ngram_start.arr[iii] - */ - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyInt_FromLong((__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_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram)); - PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_cur_scope->__pyx_v_ngram)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram)); - __pyx_t_3 = 0; - __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_10); - __pyx_t_10 = 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_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; - } - __pyx_L23:; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * rs = ngram_start.arr[iii] - * i = ii - */ - __pyx_cur_scope->__pyx_v_iii = (__pyx_cur_scope->__pyx_v_iii + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":88 - * yield i, n+1, ngram - * iii = iii + 1 - * rs = ngram_start.arr[iii] # <<<<<<<<<<<<<< - * i = ii - */ - __pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_iii]); - } - } - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":89 - * iii = iii + 1 - * rs = ngram_start.arr[iii] - * i = ii # <<<<<<<<<<<<<< - */ - __pyx_cur_scope->__pyx_v_i = __pyx_cur_scope->__pyx_v_ii; - } - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __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_2sa_3_sa_8Alphabet___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":12 - * cdef dict id2sym - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.terminals = StringMap() - * self.nonterminals = StringMap() - */ - -static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { - 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("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":13 - * - * def __cinit__(self): - * self.terminals = StringMap() # <<<<<<<<<<<<<< - * self.nonterminals = StringMap() - * self.id2sym = {} - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->terminals); - __Pyx_DECREF(((PyObject *)__pyx_v_self->terminals)); - __pyx_v_self->terminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":14 - * def __cinit__(self): - * self.terminals = StringMap() - * self.nonterminals = StringMap() # <<<<<<<<<<<<<< - * self.id2sym = {} - * self.first_nonterminal = -1 - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->nonterminals); - __Pyx_DECREF(((PyObject *)__pyx_v_self->nonterminals)); - __pyx_v_self->nonterminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":15 - * self.terminals = StringMap() - * self.nonterminals = StringMap() - * self.id2sym = {} # <<<<<<<<<<<<<< - * self.first_nonterminal = -1 - * - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(__pyx_v_self->id2sym); - __Pyx_DECREF(((PyObject *)__pyx_v_self->id2sym)); - __pyx_v_self->id2sym = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":16 - * self.nonterminals = StringMap() - * self.id2sym = {} - * self.first_nonterminal = -1 # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_self->first_nonterminal = -1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.Alphabet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static void __pyx_pw_4cdec_2sa_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_4cdec_2sa_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_4cdec_2sa_3_sa_8Alphabet_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":18 - * self.first_nonterminal = -1 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * pass - * - */ - -static void __pyx_pf_4cdec_2sa_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":21 - * pass - * - * cdef int isvar(self, int sym): # <<<<<<<<<<<<<< - * return sym < 0 - * - */ - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("isvar", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":22 - * - * cdef int isvar(self, int sym): - * return sym < 0 # <<<<<<<<<<<<<< - * - * cdef int isword(self, int sym): - */ - __pyx_r = (__pyx_v_sym < 0); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":24 - * return sym < 0 - * - * cdef int isword(self, int sym): # <<<<<<<<<<<<<< - * return sym >= 0 - * - */ - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("isword", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":25 - * - * cdef int isword(self, int sym): - * return sym >= 0 # <<<<<<<<<<<<<< - * - * cdef int getindex(self, int sym): - */ - __pyx_r = (__pyx_v_sym >= 0); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":27 - * return sym >= 0 - * - * cdef int getindex(self, int sym): # <<<<<<<<<<<<<< - * return -sym & INDEX_MASK - * - */ - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getindex", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":28 - * - * cdef int getindex(self, int sym): - * return -sym & INDEX_MASK # <<<<<<<<<<<<<< - * - * cdef int setindex(self, int sym, int ind): - */ - __pyx_r = ((-__pyx_v_sym) & __pyx_v_4cdec_2sa_3_sa_INDEX_MASK); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":30 - * return -sym & INDEX_MASK - * - * cdef int setindex(self, int sym, int ind): # <<<<<<<<<<<<<< - * return -(-sym & ~INDEX_MASK | ind) - * - */ - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("setindex", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":31 - * - * cdef int setindex(self, int sym, int ind): - * return -(-sym & ~INDEX_MASK | ind) # <<<<<<<<<<<<<< - * - * cdef int clearindex(self, int sym): - */ - __pyx_r = (-(((-__pyx_v_sym) & (~__pyx_v_4cdec_2sa_3_sa_INDEX_MASK)) | __pyx_v_ind)); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":33 - * return -(-sym & ~INDEX_MASK | ind) - * - * cdef int clearindex(self, int sym): # <<<<<<<<<<<<<< - * return -(-sym& ~INDEX_MASK) - * - */ - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clearindex", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":34 - * - * cdef int clearindex(self, int sym): - * return -(-sym& ~INDEX_MASK) # <<<<<<<<<<<<<< - * - * cdef int match(self, int sym1, int sym2): - */ - __pyx_r = (-((-__pyx_v_sym) & (~__pyx_v_4cdec_2sa_3_sa_INDEX_MASK))); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":36 - * return -(-sym& ~INDEX_MASK) - * - * cdef int match(self, int sym1, int sym2): # <<<<<<<<<<<<<< - * return self.clearindex(sym1) == self.clearindex(sym2); - * - */ - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("match", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":37 - * - * cdef int match(self, int sym1, int sym2): - * return self.clearindex(sym1) == self.clearindex(sym2); # <<<<<<<<<<<<<< - * - * cdef char* tocat(self, int sym): - */ - __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; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":39 - * return self.clearindex(sym1) == self.clearindex(sym2); - * - * cdef char* tocat(self, int sym): # <<<<<<<<<<<<<< - * return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) - * - */ - -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) { - char *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("tocat", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":40 - * - * cdef char* tocat(self, int sym): - * return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) # <<<<<<<<<<<<<< - * - * cdef int fromcat(self, char *s): - */ - __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; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":42 - * return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) - * - * cdef int fromcat(self, char *s): # <<<<<<<<<<<<<< - * cdef int i - * i = self.nonterminals.index(s) - */ - -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) { - int __pyx_v_i; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("fromcat", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":44 - * cdef int fromcat(self, char *s): - * cdef int i - * i = self.nonterminals.index(s) # <<<<<<<<<<<<<< - * if self.first_nonterminal == -1: - * self.first_nonterminal = i - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":45 - * cdef int i - * i = self.nonterminals.index(s) - * if self.first_nonterminal == -1: # <<<<<<<<<<<<<< - * self.first_nonterminal = i - * if i > self.last_nonterminal: - */ - __pyx_t_1 = ((__pyx_v_self->first_nonterminal == -1) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":46 - * i = self.nonterminals.index(s) - * if self.first_nonterminal == -1: - * self.first_nonterminal = i # <<<<<<<<<<<<<< - * if i > self.last_nonterminal: - * self.last_nonterminal = i - */ - __pyx_v_self->first_nonterminal = __pyx_v_i; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":47 - * if self.first_nonterminal == -1: - * self.first_nonterminal = i - * if i > self.last_nonterminal: # <<<<<<<<<<<<<< - * self.last_nonterminal = i - * return -(i+1 << INDEX_SHIFT) - */ - __pyx_t_1 = ((__pyx_v_i > __pyx_v_self->last_nonterminal) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":48 - * self.first_nonterminal = i - * if i > self.last_nonterminal: - * self.last_nonterminal = i # <<<<<<<<<<<<<< - * return -(i+1 << INDEX_SHIFT) - * - */ - __pyx_v_self->last_nonterminal = __pyx_v_i; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":49 - * if i > self.last_nonterminal: - * self.last_nonterminal = i - * return -(i+1 << INDEX_SHIFT) # <<<<<<<<<<<<<< - * - * cdef char* tostring(self, int sym): - */ - __pyx_r = (-((__pyx_v_i + 1) << __pyx_v_4cdec_2sa_3_sa_INDEX_SHIFT)); - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":51 - * return -(i+1 << INDEX_SHIFT) - * - * cdef char* tostring(self, int sym): # <<<<<<<<<<<<<< - * cdef int ind - * if self.isvar(sym): - */ - -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) { - int __pyx_v_ind; - char *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - char *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("tostring", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":53 - * cdef char* tostring(self, int sym): - * cdef int ind - * if self.isvar(sym): # <<<<<<<<<<<<<< - * if sym in self.id2sym: - * return self.id2sym[sym] - */ - __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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":54 - * cdef int ind - * if self.isvar(sym): - * if sym in self.id2sym: # <<<<<<<<<<<<<< - * return self.id2sym[sym] - * ind = self.getindex(sym) - */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_sym); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = (__Pyx_PyDict_Contains(__pyx_t_2, ((PyObject *)__pyx_v_self->id2sym), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = (__pyx_t_1 != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":55 - * if self.isvar(sym): - * if sym in self.id2sym: - * return self.id2sym[sym] # <<<<<<<<<<<<<< - * ind = self.getindex(sym) - * if ind > 0: - */ - if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":56 - * if sym in self.id2sym: - * return self.id2sym[sym] - * ind = self.getindex(sym) # <<<<<<<<<<<<<< - * if ind > 0: - * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) - */ - __pyx_v_ind = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->getindex(__pyx_v_self, __pyx_v_sym); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":57 - * return self.id2sym[sym] - * ind = self.getindex(sym) - * if ind > 0: # <<<<<<<<<<<<<< - * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) - * else: - */ - __pyx_t_3 = ((__pyx_v_ind > 0) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":58 - * ind = self.getindex(sym) - * if ind > 0: - * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) # <<<<<<<<<<<<<< - * else: - * self.id2sym[sym] = "[%s]" % self.tocat(sym) - */ - __pyx_t_2 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->tocat(__pyx_v_self, __pyx_v_sym)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_5 = PyInt_FromLong(__pyx_v_ind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __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[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_66), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, ((PyObject *)__pyx_t_5), sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":60 - * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) - * else: - * self.id2sym[sym] = "[%s]" % self.tocat(sym) # <<<<<<<<<<<<<< - * return self.id2sym[sym] - * else: - */ - __pyx_t_5 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->tocat(__pyx_v_self, __pyx_v_sym)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, ((PyObject *)__pyx_t_6), sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":61 - * else: - * self.id2sym[sym] = "[%s]" % self.tocat(sym) - * return self.id2sym[sym] # <<<<<<<<<<<<<< - * else: - * return self.terminals.word(sym) - */ - if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_6); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_4; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":63 - * return self.id2sym[sym] - * else: - * return self.terminals.word(sym) # <<<<<<<<<<<<<< - * - * cdef int fromstring(self, char *s, bint terminal): - */ - __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->word(__pyx_v_self->terminals, __pyx_v_sym); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("cdec.sa._sa.Alphabet.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":65 - * return self.terminals.word(sym) - * - * cdef int fromstring(self, char *s, bint terminal): # <<<<<<<<<<<<<< - * """Warning: this method is allowed to alter s.""" - * cdef char *comma - */ - -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) { - char *__pyx_v_comma; - int __pyx_v_n; - char *__pyx_v_sep; - PyObject *__pyx_v_s1 = NULL; - int __pyx_r; - __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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fromstring", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":69 - * cdef char *comma - * cdef int n - * n = strlen(s) # <<<<<<<<<<<<<< - * cdef char *sep - * sep = strstr(s,"_SEP_") - */ - __pyx_v_n = strlen(__pyx_v_s); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":71 - * n = strlen(s) - * cdef char *sep - * sep = strstr(s,"_SEP_") # <<<<<<<<<<<<<< - * if n >= 3 and s[0] == c'[' and s[n-1] == c']' and sep == NULL: - * if terminal: - */ - __pyx_v_sep = strstr(__pyx_v_s, __pyx_k___SEP_); - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_2 = __pyx_t_1; - } - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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(((PyObject *)__pyx_t_6)); - __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_kp_s_68), ((PyObject *)__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(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_v_s1 = __pyx_t_7; - __pyx_t_7 = 0; - - /* "/home/mdenkows/cdec/python/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); - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":76 - * s1 = "\\"+s - * return self.terminals.index(s1) - * s[n-1] = c'\0' # <<<<<<<<<<<<<< - * s = s + 1 - * comma = strrchr(s, c',') - */ - (__pyx_v_s[(__pyx_v_n - 1)]) = '\x00'; - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":77 - * return self.terminals.index(s1) - * s[n-1] = c'\0' - * s = s + 1 # <<<<<<<<<<<<<< - * comma = strrchr(s, c',') - * if comma != NULL: - */ - __pyx_v_s = (__pyx_v_s + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":78 - * s[n-1] = c'\0' - * s = s + 1 - * comma = strrchr(s, c',') # <<<<<<<<<<<<<< - * if comma != NULL: - * comma[0] = c'\0' - */ - __pyx_v_comma = strrchr(__pyx_v_s, ','); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":80 - * comma = strrchr(s, c',') - * if comma != NULL: - * comma[0] = c'\0' # <<<<<<<<<<<<<< - * return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) - * else: - */ - (__pyx_v_comma[0]) = '\x00'; - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":81 - * if comma != NULL: - * comma[0] = c'\0' - * return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) # <<<<<<<<<<<<<< - * else: - * return self.fromcat(s) - */ - __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->setindex(__pyx_v_self, ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->fromcat(__pyx_v_self, __pyx_v_s), strtol((__pyx_v_comma + 1), NULL, 10)); - goto __pyx_L0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":83 - * return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) - * else: - * return self.fromcat(s) # <<<<<<<<<<<<<< - * else: - * return self.terminals.index(s) - */ - __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->fromcat(__pyx_v_self, __pyx_v_s); - goto __pyx_L0; - } - __pyx_L5:; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":85 - * return self.fromcat(s) - * else: - * return self.terminals.index(s) # <<<<<<<<<<<<<< - * - * cdef Alphabet ALPHABET = Alphabet() - */ - __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_v_s); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("cdec.sa._sa.Alphabet.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_s1); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8Alphabet_9terminals___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":8 - * - * cdef class Alphabet: - * cdef readonly StringMap terminals, nonterminals # <<<<<<<<<<<<<< - * cdef int first_nonterminal, last_nonterminal - * cdef dict id2sym - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->terminals)); - __pyx_r = ((PyObject *)__pyx_v_self->terminals); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8Alphabet_12nonterminals___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->nonterminals)); - __pyx_r = ((PyObject *)__pyx_v_self->nonterminals); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":89 - * cdef Alphabet ALPHABET = Alphabet() - * - * cdef char* sym_tostring(int sym): # <<<<<<<<<<<<<< - * return ALPHABET.tostring(sym) - * - */ - -static char *__pyx_f_4cdec_2sa_3_sa_sym_tostring(int __pyx_v_sym) { - char *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_tostring", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":90 - * - * cdef char* sym_tostring(int sym): - * return ALPHABET.tostring(sym) # <<<<<<<<<<<<<< - * - * cdef char* sym_tocat(int 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; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":92 - * return ALPHABET.tostring(sym) - * - * cdef char* sym_tocat(int sym): # <<<<<<<<<<<<<< - * return ALPHABET.tocat(sym) - * - */ - -static char *__pyx_f_4cdec_2sa_3_sa_sym_tocat(int __pyx_v_sym) { - char *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_tocat", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":93 - * - * cdef char* sym_tocat(int sym): - * return ALPHABET.tocat(sym) # <<<<<<<<<<<<<< - * - * cdef int sym_isvar(int 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; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":95 - * return ALPHABET.tocat(sym) - * - * cdef int sym_isvar(int sym): # <<<<<<<<<<<<<< - * return ALPHABET.isvar(sym) - * - */ - -static int __pyx_f_4cdec_2sa_3_sa_sym_isvar(int __pyx_v_sym) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_isvar", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":96 - * - * cdef int sym_isvar(int sym): - * return ALPHABET.isvar(sym) # <<<<<<<<<<<<<< - * - * cdef int sym_getindex(int 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; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":98 - * return ALPHABET.isvar(sym) - * - * cdef int sym_getindex(int sym): # <<<<<<<<<<<<<< - * return ALPHABET.getindex(sym) - * - */ - -static int __pyx_f_4cdec_2sa_3_sa_sym_getindex(int __pyx_v_sym) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_getindex", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":99 - * - * cdef int sym_getindex(int sym): - * return ALPHABET.getindex(sym) # <<<<<<<<<<<<<< - * - * cdef int sym_setindex(int sym, int id): - */ - __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; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":101 - * return ALPHABET.getindex(sym) - * - * cdef int sym_setindex(int sym, int id): # <<<<<<<<<<<<<< - * return ALPHABET.setindex(sym, id) - * - */ - -static int __pyx_f_4cdec_2sa_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_setindex", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":102 - * - * cdef int sym_setindex(int sym, int id): - * return ALPHABET.setindex(sym, id) # <<<<<<<<<<<<<< - * - * cdef int sym_fromstring(char* string, bint terminal): - */ - __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; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":104 - * return ALPHABET.setindex(sym, id) - * - * cdef int sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<< - * return ALPHABET.fromstring(string, terminal) - * - */ - -static int __pyx_f_4cdec_2sa_3_sa_sym_fromstring(char *__pyx_v_string, int __pyx_v_terminal) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("sym_fromstring", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":105 - * - * cdef int sym_fromstring(char* string, bint terminal): - * return ALPHABET.fromstring(string, terminal) # <<<<<<<<<<<<<< - * - * def isvar(sym): - */ - __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; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* 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 PyObject *__pyx_pw_4cdec_2sa_3_sa_5isvar(PyObject *__pyx_self, PyObject *__pyx_v_sym) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("isvar (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4isvar(__pyx_self, ((PyObject *)__pyx_v_sym)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107 - * return ALPHABET.fromstring(string, terminal) - * - * def isvar(sym): # <<<<<<<<<<<<<< - * return sym_isvar(sym) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sym) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("isvar", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":108 - * - * def isvar(sym): - * return sym_isvar(sym) # <<<<<<<<<<<<<< - * - * def make_lattice(words): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_sym); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.isvar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_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 PyObject *__pyx_pw_4cdec_2sa_3_sa_7make_lattice(PyObject *__pyx_self, PyObject *__pyx_v_words) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("make_lattice (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6make_lattice(__pyx_self, ((PyObject *)__pyx_v_words)); - __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 */ - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111 - * - * def make_lattice(words): - * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< - * return tuple(((word, None, 1), ) for word in word_ids) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_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_5_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_5_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_4_make_lattice *) __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_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - char *__pyx_t_5; - 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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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)) { - __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; - } - 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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_word = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_cur_scope->__pyx_v_word); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("genexpr", __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_2sa_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * def decode_lattice(lattice): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_3genexpr(PyObject *__pyx_self) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_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_6_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_6_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_4_make_lattice *) __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_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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)) { - __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; - } - 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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_word = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_word); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_word); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_word); - __Pyx_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __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)); - __pyx_t_4 = 0; - __pyx_r = ((PyObject *)__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; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("genexpr", __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; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110 - * return sym_isvar(sym) - * - * def make_lattice(words): # <<<<<<<<<<<<<< - * word_ids = (sym_fromstring(word, True) for word in words) - * return tuple(((word, None, 1), ) for word in word_ids) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("make_lattice", 0); - __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_words = __pyx_v_words; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_words); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_words); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111 - * - * def make_lattice(words): - * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< - * return tuple(((word, None, 1), ) for word in word_ids) - * - */ - __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12make_lattice_genexpr(((PyObject*)__pyx_cur_scope)); 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_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_word_ids = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * def decode_lattice(lattice): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12make_lattice_3genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __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*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.make_lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_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 PyObject *__pyx_pw_4cdec_2sa_3_sa_9decode_lattice(PyObject *__pyx_self, PyObject *__pyx_v_lattice) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("decode_lattice (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8decode_lattice(__pyx_self, ((PyObject *)__pyx_v_lattice)); - __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 */ - -/* "/home/mdenkows/cdec/python/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) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_lattice_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_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_8_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_8_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_7_decode_lattice *) __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_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *(*__pyx_t_9)(PyObject *); - Py_ssize_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - Py_ssize_t __pyx_t_12; - PyObject *(*__pyx_t_13)(PyObject *); - int __pyx_t_14; - 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_L12_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[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/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): - */ - 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;} } - if (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; - } - for (;;) { - - /* "/home/mdenkows/cdec/python/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 (!__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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); - __pyx_t_7 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); - index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = NULL; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_unpacking_done; - __pyx_L6_unpacking_failed:; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L7_unpacking_done:; - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_sym = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_weight); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_weight); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_cur_scope->__pyx_v_weight = __pyx_t_6; - __pyx_t_6 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_dist); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_dist); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_cur_scope->__pyx_v_dist = __pyx_t_7; - __pyx_t_7 = 0; - - /* "/home/mdenkows/cdec/python/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): - */ - 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)) { - __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; - } - 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 - } else { - __pyx_t_7 = __pyx_t_11(__pyx_t_4); - if (unlikely(!__pyx_t_7)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_arc); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_arc); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_cur_scope->__pyx_v_arc = __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)) { - __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; - } - 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 - } else { - __pyx_t_6 = __pyx_t_13(__pyx_t_7); - if (unlikely(!__pyx_t_6)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_node); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_cur_scope->__pyx_v_node = __pyx_t_6; - __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/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_t_14 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_14)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __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_INCREF(__pyx_cur_scope->__pyx_v_weight); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_cur_scope->__pyx_v_weight); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_weight); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_dist); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_cur_scope->__pyx_v_dist); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_dist); - __pyx_t_6 = 0; - __pyx_r = ((PyObject *)__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; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_t_3 = __pyx_t_4; - __Pyx_XGIVEREF(__pyx_t_7); - __pyx_cur_scope->__pyx_t_4 = __pyx_t_7; - __pyx_cur_scope->__pyx_t_5 = __pyx_t_10; - __pyx_cur_scope->__pyx_t_6 = __pyx_t_11; - __pyx_cur_scope->__pyx_t_7 = __pyx_t_12; - __pyx_cur_scope->__pyx_t_8 = __pyx_t_13; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L12_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - __pyx_t_4 = __pyx_cur_scope->__pyx_t_3; - __pyx_cur_scope->__pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_t_4); - __pyx_t_7 = __pyx_cur_scope->__pyx_t_4; - __pyx_cur_scope->__pyx_t_4 = 0; - __Pyx_XGOTREF(__pyx_t_7); - __pyx_t_10 = __pyx_cur_scope->__pyx_t_5; - __pyx_t_11 = __pyx_cur_scope->__pyx_t_6; - __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;} - } - __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; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_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); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114 - * return tuple(((word, None, 1), ) for word in word_ids) - * - * 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) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("decode_lattice", 0); - __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_lattice = __pyx_v_lattice; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lattice); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lattice); - - /* "/home/mdenkows/cdec/python/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_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_14decode_lattice_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __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*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.decode_lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_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 PyObject *__pyx_pw_4cdec_2sa_3_sa_11decode_sentence(PyObject *__pyx_self, PyObject *__pyx_v_lattice) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("decode_sentence (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_10decode_sentence(__pyx_self, ((PyObject *)__pyx_v_lattice)); - __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 */ - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119 - * - * def decode_sentence(lattice): - * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< - * - * def encode_words(words): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_15decode_sentence_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_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_10_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_10_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_9_decode_sentence *) __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_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - 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_L10_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[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)) { - __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; - } - 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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 1)) { - if (size > 1) __Pyx_RaiseTooManyValuesError(1); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - } - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; - index = 0; __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), 1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __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; - __pyx_L6_unpacking_failed:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L7_unpacking_done:; - } - if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { - PyObject* sequence = __pyx_t_5; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __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_8 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_6 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); - __pyx_t_9 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - #else - __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - #endif - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); - index = 1; __pyx_t_8 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - index = 2; __pyx_t_9 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L9_unpacking_done; - __pyx_L8_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_7 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L9_unpacking_done:; - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_cur_scope->__pyx_v_sym = __pyx_t_6; - __pyx_t_6 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v__); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v__); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_cur_scope->__pyx_v__ = __pyx_t_8; - __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v__); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v__); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_cur_scope->__pyx_v__ = __pyx_t_9; - __pyx_t_9 = 0; - __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_11)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L10_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("genexpr", __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; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118 - * for arc in node for node in lattice) - * - * def decode_sentence(lattice): # <<<<<<<<<<<<<< - * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("decode_sentence", 0); - __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_lattice = __pyx_v_lattice; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lattice); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lattice); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119 - * - * def decode_sentence(lattice): - * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< - * - * def encode_words(words): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_15decode_sentence_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __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*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.decode_sentence", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_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 PyObject *__pyx_pw_4cdec_2sa_3_sa_13encode_words(PyObject *__pyx_self, PyObject *__pyx_v_words) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("encode_words (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_12encode_words(__pyx_self, ((PyObject *)__pyx_v_words)); - __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 */ - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122 - * - * def encode_words(words): - * return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< - * - * def decode_words(syms): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_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_12_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_12_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_11_encode_words *) __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_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - char *__pyx_t_5; - 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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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)) { - __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; - } - 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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_word = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_cur_scope->__pyx_v_word); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("genexpr", __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; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121 - * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) - * - * def encode_words(words): # <<<<<<<<<<<<<< - * return tuple(sym_fromstring(word, True) for word in words) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("encode_words", 0); - __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_words = __pyx_v_words; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_words); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_words); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122 - * - * def encode_words(words): - * return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< - * - * def decode_words(syms): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12encode_words_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __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*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.encode_words", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_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 PyObject *__pyx_pw_4cdec_2sa_3_sa_15decode_words(PyObject *__pyx_self, PyObject *__pyx_v_syms) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("decode_words (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14decode_words(__pyx_self, ((PyObject *)__pyx_v_syms)); - __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 */ - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":125 - * - * def decode_words(syms): - * return tuple(sym_tostring(sym) for sym in syms) # <<<<<<<<<<<<<< - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_12decode_words_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_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_14_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_14_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_13_decode_words *) __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_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - 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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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)) { - __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; - } - 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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_sym = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("genexpr", __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; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124 - * return tuple(sym_fromstring(word, True) for word in words) - * - * def decode_words(syms): # <<<<<<<<<<<<<< - * return tuple(sym_tostring(sym) for sym in syms) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_syms) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("decode_words", 0); - __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_syms = __pyx_v_syms; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_syms); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_syms); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":125 - * - * def decode_words(syms): - * return tuple(sym_tostring(sym) for sym in syms) # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12decode_words_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __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*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.decode_words", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_words = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__words,0}; - PyObject* values[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 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__words)) != 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[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_words = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), __pyx_v_words); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":6 - * cdef class Phrase: - * - * def __cinit__(self, words): # <<<<<<<<<<<<<< - * cdef int i, j, n, n_vars - * n_vars = 0 - */ - -static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_n; - int __pyx_v_n_vars; - int __pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":8 - * def __cinit__(self, words): - * cdef int i, j, n, n_vars - * n_vars = 0 # <<<<<<<<<<<<<< - * n = len(words) - * self.syms = malloc(n*sizeof(int)) - */ - __pyx_v_n_vars = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":9 - * cdef int i, j, n, n_vars - * n_vars = 0 - * n = len(words) # <<<<<<<<<<<<<< - * self.syms = malloc(n*sizeof(int)) - * for i from 0 <= i < n: - */ - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":10 - * n_vars = 0 - * n = len(words) - * self.syms = malloc(n*sizeof(int)) # <<<<<<<<<<<<<< - * for i from 0 <= i < n: - * self.syms[i] = words[i] - */ - __pyx_v_self->syms = ((int *)malloc((__pyx_v_n * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":11 - * n = len(words) - * self.syms = malloc(n*sizeof(int)) - * for i from 0 <= i < n: # <<<<<<<<<<<<<< - * self.syms[i] = words[i] - * if sym_isvar(self.syms[i]): - */ - __pyx_t_2 = __pyx_v_n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":12 - * self.syms = malloc(n*sizeof(int)) - * for i from 0 <= i < n: - * self.syms[i] = words[i] # <<<<<<<<<<<<<< - * if sym_isvar(self.syms[i]): - * n_vars += 1 - */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_words, __pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - (__pyx_v_self->syms[__pyx_v_i]) = __pyx_t_4; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":13 - * for i from 0 <= i < n: - * self.syms[i] = words[i] - * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< - * n_vars += 1 - * self.n = n - */ - __pyx_t_5 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":14 - * self.syms[i] = words[i] - * if sym_isvar(self.syms[i]): - * n_vars += 1 # <<<<<<<<<<<<<< - * self.n = n - * self.n_vars = n_vars - */ - __pyx_v_n_vars = (__pyx_v_n_vars + 1); - goto __pyx_L5; - } - __pyx_L5:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":15 - * if sym_isvar(self.syms[i]): - * n_vars += 1 - * self.n = n # <<<<<<<<<<<<<< - * self.n_vars = n_vars - * self.varpos = malloc(n_vars*sizeof(int)) - */ - __pyx_v_self->n = __pyx_v_n; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":16 - * n_vars += 1 - * self.n = n - * self.n_vars = n_vars # <<<<<<<<<<<<<< - * self.varpos = malloc(n_vars*sizeof(int)) - * j = 0 - */ - __pyx_v_self->n_vars = __pyx_v_n_vars; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":17 - * self.n = n - * self.n_vars = n_vars - * self.varpos = malloc(n_vars*sizeof(int)) # <<<<<<<<<<<<<< - * j = 0 - * for i from 0 <= i < n: - */ - __pyx_v_self->varpos = ((int *)malloc((__pyx_v_n_vars * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":18 - * self.n_vars = n_vars - * self.varpos = malloc(n_vars*sizeof(int)) - * j = 0 # <<<<<<<<<<<<<< - * for i from 0 <= i < n: - * if sym_isvar(self.syms[i]): - */ - __pyx_v_j = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":19 - * self.varpos = malloc(n_vars*sizeof(int)) - * j = 0 - * for i from 0 <= i < n: # <<<<<<<<<<<<<< - * if sym_isvar(self.syms[i]): - * self.varpos[j] = i - */ - __pyx_t_2 = __pyx_v_n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":20 - * j = 0 - * for i from 0 <= i < n: - * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< - * self.varpos[j] = i - * j = j + 1 - */ - __pyx_t_5 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":21 - * for i from 0 <= i < n: - * if sym_isvar(self.syms[i]): - * self.varpos[j] = i # <<<<<<<<<<<<<< - * j = j + 1 - * - */ - (__pyx_v_self->varpos[__pyx_v_j]) = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":22 - * if sym_isvar(self.syms[i]): - * self.varpos[j] = i - * j = j + 1 # <<<<<<<<<<<<<< - * - * def __dealloc__(self): - */ - __pyx_v_j = (__pyx_v_j + 1); - goto __pyx_L8; - } - __pyx_L8:; - } - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static void __pyx_pw_4cdec_2sa_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_4cdec_2sa_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":24 - * j = j + 1 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * free(self.syms) - * free(self.varpos) - */ - -static void __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":25 - * - * def __dealloc__(self): - * free(self.syms) # <<<<<<<<<<<<<< - * free(self.varpos) - * - */ - free(__pyx_v_self->syms); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":26 - * def __dealloc__(self): - * free(self.syms) - * free(self.varpos) # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - free(__pyx_v_self->varpos); - - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":28 - * free(self.varpos) - * - * def __str__(self): # <<<<<<<<<<<<<< - * strs = [] - * cdef int i, s - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { - PyObject *__pyx_v_strs = NULL; - int __pyx_v_i; - int __pyx_v_s; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":29 - * - * def __str__(self): - * strs = [] # <<<<<<<<<<<<<< - * cdef int i, s - * for i from 0 <= i < self.n: - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_strs = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":31 - * strs = [] - * cdef int i, s - * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< - * s = self.syms[i] - * strs.append(sym_tostring(s)) - */ - __pyx_t_2 = __pyx_v_self->n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":32 - * cdef int i, s - * for i from 0 <= i < self.n: - * s = self.syms[i] # <<<<<<<<<<<<<< - * strs.append(sym_tostring(s)) - * return ' '.join(strs) - */ - __pyx_v_s = (__pyx_v_self->syms[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":33 - * for i from 0 <= i < self.n: - * s = self.syms[i] - * strs.append(sym_tostring(s)) # <<<<<<<<<<<<<< - * return ' '.join(strs) - * - */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_strs, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":34 - * s = self.syms[i] - * strs.append(sym_tostring(s)) - * return ' '.join(strs) # <<<<<<<<<<<<<< - * - * def handle(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 34; __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[7]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_v_strs)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_strs)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_strs)); - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_strs); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_4cdec_2sa_3_sa_6Phrase_6handle[] = "return a hashable representation that normalizes the ordering\n of the nonterminal indices"; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("handle (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":36 - * return ' '.join(strs) - * - * def handle(self): # <<<<<<<<<<<<<< - * """return a hashable representation that normalizes the ordering - * of the nonterminal indices""" - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { - PyObject *__pyx_v_norm = NULL; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_s; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("handle", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":39 - * """return a hashable representation that normalizes the ordering - * of the nonterminal indices""" - * norm = [] # <<<<<<<<<<<<<< - * cdef int i, j, s - * i = 1 - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_norm = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":41 - * norm = [] - * cdef int i, j, s - * i = 1 # <<<<<<<<<<<<<< - * j = 0 - * for j from 0 <= j < self.n: - */ - __pyx_v_i = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":42 - * cdef int i, j, s - * i = 1 - * j = 0 # <<<<<<<<<<<<<< - * for j from 0 <= j < self.n: - * s = self.syms[j] - */ - __pyx_v_j = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":43 - * i = 1 - * j = 0 - * for j from 0 <= j < self.n: # <<<<<<<<<<<<<< - * s = self.syms[j] - * if sym_isvar(s): - */ - __pyx_t_2 = __pyx_v_self->n; - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":44 - * j = 0 - * for j from 0 <= j < self.n: - * s = self.syms[j] # <<<<<<<<<<<<<< - * if sym_isvar(s): - * s = sym_setindex(s,i) - */ - __pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":45 - * for j from 0 <= j < self.n: - * s = self.syms[j] - * if sym_isvar(s): # <<<<<<<<<<<<<< - * s = sym_setindex(s,i) - * i = i + 1 - */ - __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_s) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":46 - * s = self.syms[j] - * if sym_isvar(s): - * s = sym_setindex(s,i) # <<<<<<<<<<<<<< - * i = i + 1 - * norm.append(s) - */ - __pyx_v_s = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":47 - * if sym_isvar(s): - * s = sym_setindex(s,i) - * i = i + 1 # <<<<<<<<<<<<<< - * norm.append(s) - * return tuple(norm) - */ - __pyx_v_i = (__pyx_v_i + 1); - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":48 - * s = sym_setindex(s,i) - * i = i + 1 - * norm.append(s) # <<<<<<<<<<<<<< - * return tuple(norm) - * - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_norm, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":49 - * i = i + 1 - * norm.append(s) - * return tuple(norm) # <<<<<<<<<<<<<< - * - * def strhandle(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)PyList_AsTuple(__pyx_v_norm)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.handle", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_norm); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("strhandle (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":51 - * return tuple(norm) - * - * def strhandle(self): # <<<<<<<<<<<<<< - * norm = [] - * cdef int i, j, s - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { - PyObject *__pyx_v_norm = NULL; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_s; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("strhandle", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":52 - * - * def strhandle(self): - * norm = [] # <<<<<<<<<<<<<< - * cdef int i, j, s - * i = 1 - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_norm = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":54 - * norm = [] - * cdef int i, j, s - * i = 1 # <<<<<<<<<<<<<< - * j = 0 - * for j from 0 <= j < self.n: - */ - __pyx_v_i = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":55 - * cdef int i, j, s - * i = 1 - * j = 0 # <<<<<<<<<<<<<< - * for j from 0 <= j < self.n: - * s = self.syms[j] - */ - __pyx_v_j = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":56 - * i = 1 - * j = 0 - * for j from 0 <= j < self.n: # <<<<<<<<<<<<<< - * s = self.syms[j] - * if sym_isvar(s): - */ - __pyx_t_2 = __pyx_v_self->n; - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":57 - * j = 0 - * for j from 0 <= j < self.n: - * s = self.syms[j] # <<<<<<<<<<<<<< - * if sym_isvar(s): - * s = sym_setindex(s,i) - */ - __pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":58 - * for j from 0 <= j < self.n: - * s = self.syms[j] - * if sym_isvar(s): # <<<<<<<<<<<<<< - * s = sym_setindex(s,i) - * i = i + 1 - */ - __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_s) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":59 - * s = self.syms[j] - * if sym_isvar(s): - * s = sym_setindex(s,i) # <<<<<<<<<<<<<< - * i = i + 1 - * norm.append(sym_tostring(s)) - */ - __pyx_v_s = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":60 - * if sym_isvar(s): - * s = sym_setindex(s,i) - * i = i + 1 # <<<<<<<<<<<<<< - * norm.append(sym_tostring(s)) - * return ' '.join(norm) - */ - __pyx_v_i = (__pyx_v_i + 1); - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":61 - * s = sym_setindex(s,i) - * i = i + 1 - * norm.append(sym_tostring(s)) # <<<<<<<<<<<<<< - * return ' '.join(norm) - * - */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_norm, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":62 - * i = i + 1 - * norm.append(sym_tostring(s)) - * return ' '.join(norm) # <<<<<<<<<<<<<< - * - * def arity(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __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[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_v_norm)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_norm)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_norm)); - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.strhandle", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_norm); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("arity (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_10arity(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":64 - * return ' '.join(norm) - * - * def arity(self): # <<<<<<<<<<<<<< - * return self.n_vars - * - */ - -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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":65 - * - * def arity(self): - * return self.n_vars # <<<<<<<<<<<<<< - * - * def getvarpos(self, i): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__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; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getvarpos (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":67 - * return self.n_vars - * - * def getvarpos(self, i): # <<<<<<<<<<<<<< - * if 0 <= i < self.n_vars: - * return self.varpos[i] - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { - 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_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("getvarpos", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":68 - * - * def getvarpos(self, i): - * if 0 <= i < self.n_vars: # <<<<<<<<<<<<<< - * return self.varpos[i] - * else: - */ - __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 = PyInt_FromLong(__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_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":69 - * def getvarpos(self, i): - * if 0 <= i < self.n_vars: - * return self.varpos[i] # <<<<<<<<<<<<<< - * else: - * 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 = PyInt_FromLong((__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_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":71 - * return self.varpos[i] - * else: - * raise IndexError # <<<<<<<<<<<<<< - * - * def getvar(self, i): - */ - __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.getvarpos", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getvar (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":73 - * raise IndexError - * - * def getvar(self, i): # <<<<<<<<<<<<<< - * if 0 <= i < self.n_vars: - * return self.syms[self.varpos[i]] - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { - 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_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("getvar", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":74 - * - * def getvar(self, i): - * if 0 <= i < self.n_vars: # <<<<<<<<<<<<<< - * return self.syms[self.varpos[i]] - * else: - */ - __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 = PyInt_FromLong(__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_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":75 - * def getvar(self, i): - * if 0 <= i < self.n_vars: - * return self.syms[self.varpos[i]] # <<<<<<<<<<<<<< - * else: - * 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 = PyInt_FromLong((__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_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":77 - * return self.syms[self.varpos[i]] - * else: - * raise IndexError # <<<<<<<<<<<<<< - * - * cdef int chunkpos(self, int k): - */ - __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); - {__pyx_filename = __pyx_f[7]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.getvar", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":79 - * raise IndexError - * - * cdef int chunkpos(self, int k): # <<<<<<<<<<<<<< - * if k == 0: - * return 0 - */ - -int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, int __pyx_v_k) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("chunkpos", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":80 - * - * cdef int chunkpos(self, int k): - * if k == 0: # <<<<<<<<<<<<<< - * return 0 - * else: - */ - __pyx_t_1 = ((__pyx_v_k == 0) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":81 - * cdef int chunkpos(self, int k): - * if k == 0: - * return 0 # <<<<<<<<<<<<<< - * else: - * return self.varpos[k-1]+1 - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":83 - * return 0 - * else: - * return self.varpos[k-1]+1 # <<<<<<<<<<<<<< - * - * cdef int chunklen(self, int k): - */ - __pyx_r = ((__pyx_v_self->varpos[(__pyx_v_k - 1)]) + 1); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":85 - * return self.varpos[k-1]+1 - * - * cdef int chunklen(self, int k): # <<<<<<<<<<<<<< - * if self.n_vars == 0: - * return self.n - */ - -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; - __Pyx_RefNannySetupContext("chunklen", 0); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":87 - * cdef int chunklen(self, int k): - * if self.n_vars == 0: - * return self.n # <<<<<<<<<<<<<< - * elif k == 0: - * return self.varpos[0] - */ - __pyx_r = __pyx_v_self->n; - goto __pyx_L0; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":89 - * return self.n - * elif k == 0: - * return self.varpos[0] # <<<<<<<<<<<<<< - * elif k == self.n_vars: - * return self.n-self.varpos[k-1]-1 - */ - __pyx_r = (__pyx_v_self->varpos[0]); - goto __pyx_L0; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":91 - * return self.varpos[0] - * elif k == self.n_vars: - * return self.n-self.varpos[k-1]-1 # <<<<<<<<<<<<<< - * else: - * return self.varpos[k]-self.varpos[k-1]-1 - */ - __pyx_r = ((__pyx_v_self->n - (__pyx_v_self->varpos[(__pyx_v_k - 1)])) - 1); - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":93 - * return self.n-self.varpos[k-1]-1 - * else: - * return self.varpos[k]-self.varpos[k-1]-1 # <<<<<<<<<<<<<< - * - * def clen(self, k): - */ - __pyx_r = (((__pyx_v_self->varpos[__pyx_v_k]) - (__pyx_v_self->varpos[(__pyx_v_k - 1)])) - 1); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clen (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_k)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":95 - * return self.varpos[k]-self.varpos[k-1]-1 - * - * def clen(self, k): # <<<<<<<<<<<<<< - * return self.chunklen(k) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("clen", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":96 - * - * def clen(self, k): - * return self.chunklen(k) # <<<<<<<<<<<<<< - * - * def getchunk(self, ci): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_k); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunklen(__pyx_v_self, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 96; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.clen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getchunk (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_ci)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":98 - * return self.chunklen(k) - * - * def getchunk(self, ci): # <<<<<<<<<<<<<< - * cdef int start, stop - * start = self.chunkpos(ci) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci) { - int __pyx_v_start; - int __pyx_v_stop; - PyObject *__pyx_v_chunk = NULL; - int __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("getchunk", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":100 - * def getchunk(self, ci): - * cdef int start, stop - * start = self.chunkpos(ci) # <<<<<<<<<<<<<< - * stop = start+self.chunklen(ci) - * chunk = [] - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":101 - * cdef int start, stop - * start = self.chunkpos(ci) - * stop = start+self.chunklen(ci) # <<<<<<<<<<<<<< - * chunk = [] - * for i from start <= i < stop: - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":102 - * start = self.chunkpos(ci) - * stop = start+self.chunklen(ci) - * chunk = [] # <<<<<<<<<<<<<< - * for i from start <= i < stop: - * chunk.append(self.syms[i]) - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_chunk = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":103 - * stop = start+self.chunklen(ci) - * chunk = [] - * for i from start <= i < stop: # <<<<<<<<<<<<<< - * chunk.append(self.syms[i]) - * return chunk - */ - __pyx_t_1 = __pyx_v_stop; - for (__pyx_v_i = __pyx_v_start; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":104 - * chunk = [] - * for i from start <= i < stop: - * chunk.append(self.syms[i]) # <<<<<<<<<<<<<< - * return chunk - * - */ - __pyx_t_2 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_chunk, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":105 - * for i from start <= i < stop: - * chunk.append(self.syms[i]) - * return chunk # <<<<<<<<<<<<<< - * - * def __cmp__(self, other): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_chunk)); - __pyx_r = ((PyObject *)__pyx_v_chunk); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.getchunk", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_chunk); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -#if PY_MAJOR_VERSION < 3 -static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cmp__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_other)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -#endif /*!(#if PY_MAJOR_VERSION < 3)*/ - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":107 - * return chunk - * - * def __cmp__(self, other): # <<<<<<<<<<<<<< - * cdef Phrase otherp - * cdef int i - */ - -#if PY_MAJOR_VERSION < 3 -static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other) { - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_otherp = 0; - int __pyx_v_i; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cmp__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":110 - * cdef Phrase otherp - * cdef int i - * otherp = other # <<<<<<<<<<<<<< - * for i from 0 <= i < min(self.n, otherp.n): - * if self.syms[i] < otherp.syms[i]: - */ - if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_4cdec_2sa_3_sa_Phrase))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_other); - __pyx_v_otherp = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_other); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":111 - * cdef int i - * otherp = other - * for i from 0 <= i < min(self.n, otherp.n): # <<<<<<<<<<<<<< - * if self.syms[i] < otherp.syms[i]: - * return -1 - */ - __pyx_t_1 = __pyx_v_otherp->n; - __pyx_t_2 = __pyx_v_self->n; - if (((__pyx_t_1 < __pyx_t_2) != 0)) { - __pyx_t_3 = __pyx_t_1; - } else { - __pyx_t_3 = __pyx_t_2; - } - __pyx_t_1 = __pyx_t_3; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":112 - * otherp = other - * for i from 0 <= i < min(self.n, otherp.n): - * if self.syms[i] < otherp.syms[i]: # <<<<<<<<<<<<<< - * return -1 - * elif self.syms[i] > otherp.syms[i]: - */ - __pyx_t_4 = (((__pyx_v_self->syms[__pyx_v_i]) < (__pyx_v_otherp->syms[__pyx_v_i])) != 0); - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":113 - * for i from 0 <= i < min(self.n, otherp.n): - * if self.syms[i] < otherp.syms[i]: - * return -1 # <<<<<<<<<<<<<< - * elif self.syms[i] > otherp.syms[i]: - * return 1 - */ - __pyx_r = -1; - goto __pyx_L0; - goto __pyx_L5; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":114 - * if self.syms[i] < otherp.syms[i]: - * return -1 - * elif self.syms[i] > otherp.syms[i]: # <<<<<<<<<<<<<< - * return 1 - * if self.n < otherp.n: - */ - __pyx_t_4 = (((__pyx_v_self->syms[__pyx_v_i]) > (__pyx_v_otherp->syms[__pyx_v_i])) != 0); - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":115 - * return -1 - * elif self.syms[i] > otherp.syms[i]: - * return 1 # <<<<<<<<<<<<<< - * if self.n < otherp.n: - * return -1 - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":116 - * elif self.syms[i] > otherp.syms[i]: - * return 1 - * if self.n < otherp.n: # <<<<<<<<<<<<<< - * return -1 - * elif self.n > otherp.n: - */ - __pyx_t_4 = ((__pyx_v_self->n < __pyx_v_otherp->n) != 0); - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":117 - * return 1 - * if self.n < otherp.n: - * return -1 # <<<<<<<<<<<<<< - * elif self.n > otherp.n: - * return 1 - */ - __pyx_r = -1; - goto __pyx_L0; - goto __pyx_L6; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":118 - * if self.n < otherp.n: - * return -1 - * elif self.n > otherp.n: # <<<<<<<<<<<<<< - * return 1 - * else: - */ - __pyx_t_4 = ((__pyx_v_self->n > __pyx_v_otherp->n) != 0); - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":119 - * return -1 - * elif self.n > otherp.n: - * return 1 # <<<<<<<<<<<<<< - * else: - * return 0 - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":121 - * return 1 - * else: - * return 0 # <<<<<<<<<<<<<< - * - * def __hash__(self): - */ - __pyx_r = 0; - goto __pyx_L0; - } - __pyx_L6:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.Phrase.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_otherp); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -#endif /*!(#if PY_MAJOR_VERSION < 3)*/ - -/* Python wrapper */ -static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self); /*proto*/ -static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self) { - Py_hash_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":123 - * return 0 - * - * def __hash__(self): # <<<<<<<<<<<<<< - * cdef int i - * cdef unsigned h - */ - -static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { - int __pyx_v_i; - unsigned int __pyx_v_h; - Py_hash_t __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("__hash__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":126 - * cdef int i - * cdef unsigned h - * h = 0 # <<<<<<<<<<<<<< - * for i from 0 <= i < self.n: - * if self.syms[i] > 0: - */ - __pyx_v_h = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":127 - * cdef unsigned h - * h = 0 - * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< - * if self.syms[i] > 0: - * h = (h << 1) + self.syms[i] - */ - __pyx_t_1 = __pyx_v_self->n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":128 - * h = 0 - * for i from 0 <= i < self.n: - * if self.syms[i] > 0: # <<<<<<<<<<<<<< - * h = (h << 1) + self.syms[i] - * else: - */ - __pyx_t_2 = (((__pyx_v_self->syms[__pyx_v_i]) > 0) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":129 - * for i from 0 <= i < self.n: - * if self.syms[i] > 0: - * h = (h << 1) + self.syms[i] # <<<<<<<<<<<<<< - * else: - * h = (h << 1) + -self.syms[i] - */ - __pyx_v_h = ((__pyx_v_h << 1) + (__pyx_v_self->syms[__pyx_v_i])); - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":131 - * h = (h << 1) + self.syms[i] - * else: - * h = (h << 1) + -self.syms[i] # <<<<<<<<<<<<<< - * return h - * - */ - __pyx_v_h = ((__pyx_v_h << 1) + (-(__pyx_v_self->syms[__pyx_v_i]))); - } - __pyx_L5:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":132 - * else: - * h = (h << 1) + -self.syms[i] - * return h # <<<<<<<<<<<<<< - * - * def __len__(self): - */ - __pyx_r = __pyx_v_h; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":134 - * return h - * - * def __len__(self): # <<<<<<<<<<<<<< - * return self.n - * - */ - -static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { - Py_ssize_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":135 - * - * def __len__(self): - * return self.n # <<<<<<<<<<<<<< - * - * def __getitem__(self, i): - */ - __pyx_r = __pyx_v_self->n; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":137 - * return self.n - * - * def __getitem__(self, i): # <<<<<<<<<<<<<< - * return self.syms[i] - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":138 - * - * def __getitem__(self, i): - * return self.syms[i] # <<<<<<<<<<<<<< - * - * def __iter__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((__pyx_v_self->syms[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 138; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.__getitem__", __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_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_28__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":140 - * return self.syms[i] - * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef int i - * for i from 0 <= i < self.n: - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_28__iter__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__iter__", 0); - __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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(); - return __pyx_r; -} - -static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - int __pyx_t_1; - PyObject *__pyx_t_2 = 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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":142 - * def __iter__(self): - * cdef int i - * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< - * yield self.syms[i] - * - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":143 - * cdef int i - * for i from 0 <= i < self.n: - * yield self.syms[i] # <<<<<<<<<<<<<< - * - * def subst(self, start, children): - */ - __pyx_t_2 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_self->syms[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 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_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_start = 0; - PyObject *__pyx_v_children = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("subst (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__children,0}; - PyObject* values[2] = {0,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__start)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__children)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subst") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_start = values[0]; - __pyx_v_children = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), __pyx_v_start, __pyx_v_children); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":145 - * yield self.syms[i] - * - * def subst(self, start, children): # <<<<<<<<<<<<<< - * cdef int i - * for i from 0 <= i < self.n: - */ - -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) { - int __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - long __pyx_t_3; - 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("subst", 0); - __Pyx_INCREF(__pyx_v_start); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":147 - * def subst(self, start, children): - * cdef int i - * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< - * if sym_isvar(self.syms[i]): - * start = start + children[sym_getindex(self.syms[i])-1] - */ - __pyx_t_1 = __pyx_v_self->n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":148 - * cdef int i - * for i from 0 <= i < self.n: - * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< - * start = start + children[sym_getindex(self.syms[i])-1] - * else: - */ - __pyx_t_2 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * else: - * start = start + (self.syms[i],) - */ - __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_getindex((__pyx_v_self->syms[__pyx_v_i])) - 1); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_children, __pyx_t_3, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_start); - __pyx_v_start = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":151 - * start = start + children[sym_getindex(self.syms[i])-1] - * else: - * start = start + (self.syms[i],) # <<<<<<<<<<<<<< - * return start - * - */ - __pyx_t_5 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 151; __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[7]; __pyx_lineno = 151; __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 = PyNumber_Add(__pyx_v_start, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_start); - __pyx_v_start = __pyx_t_5; - __pyx_t_5 = 0; - } - __pyx_L5:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":152 - * else: - * start = start + (self.syms[i],) - * return start # <<<<<<<<<<<<<< - * - * property words: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_start); - __pyx_r = __pyx_v_start; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_start); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":155 - * - * property words: - * def __get__(self): # <<<<<<<<<<<<<< - * return [sym_tostring(w) for w in self if not sym_isvar(w)] - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { - PyObject *__pyx_v_w = NULL; - PyObject *__pyx_r = NULL; - __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; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "/home/mdenkows/cdec/python/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: - */ - __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))) { - __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; - } - 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 - } else { - __pyx_t_5 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_5)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF(__pyx_v_w); - __pyx_v_w = __pyx_t_5; - __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_6) != 0)) != 0); - if (__pyx_t_7) { - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - goto __pyx_L5; - } - __pyx_L5:; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("cdec.sa._sa.Phrase.words.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_w); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_lhs; - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_f = 0; - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_e = 0; - PyObject *__pyx_v_scores = 0; - PyObject *__pyx_v_word_alignments = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (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__word_alignments,0}; - PyObject* values[5] = {0,0,0,0,0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":160 - * cdef class Rule: - * - * 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 - */ - values[3] = ((PyObject *)Py_None); - values[4] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__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--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __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;} - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word_alignments); - if (value) { values[4] = 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[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_lhs = __Pyx_PyInt_AsInt(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_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]; - __pyx_v_word_alignments = values[4]; - } - 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_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;} - __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); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - 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("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":161 - * - * 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 - * self.f = f - */ - __pyx_t_1 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_lhs) != 0)) != 0); - if (__pyx_t_1) { - __pyx_t_2 = PyInt_FromLong(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__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_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__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;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":162 - * 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 # <<<<<<<<<<<<<< - * self.f = f - * self.e = e - */ - __pyx_v_self->lhs = __pyx_v_lhs; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":163 - * if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs) - * self.lhs = lhs - * self.f = f # <<<<<<<<<<<<<< - * self.e = e - * self.word_alignments = word_alignments - */ - __Pyx_INCREF(((PyObject *)__pyx_v_f)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); - __Pyx_GOTREF(__pyx_v_self->f); - __Pyx_DECREF(((PyObject *)__pyx_v_self->f)); - __pyx_v_self->f = __pyx_v_f; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":164 - * self.lhs = lhs - * self.f = f - * self.e = e # <<<<<<<<<<<<<< - * self.word_alignments = word_alignments - * self.scores = scores - */ - __Pyx_INCREF(((PyObject *)__pyx_v_e)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_e)); - __Pyx_GOTREF(__pyx_v_self->e); - __Pyx_DECREF(((PyObject *)__pyx_v_self->e)); - __pyx_v_self->e = __pyx_v_e; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":165 - * self.f = f - * self.e = e - * self.word_alignments = word_alignments # <<<<<<<<<<<<<< - * self.scores = scores - * - */ - __Pyx_INCREF(__pyx_v_word_alignments); - __Pyx_GIVEREF(__pyx_v_word_alignments); - __Pyx_GOTREF(__pyx_v_self->word_alignments); - __Pyx_DECREF(__pyx_v_self->word_alignments); - __pyx_v_self->word_alignments = __pyx_v_word_alignments; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":166 - * 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;} - __Pyx_INCREF(__pyx_v_scores); - __Pyx_GIVEREF(__pyx_v_scores); - __Pyx_GOTREF(__pyx_v_self->scores); - __Pyx_DECREF(((PyObject *)__pyx_v_self->scores)); - __pyx_v_self->scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_scores); - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.Rule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self); /*proto*/ -static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self) { - Py_hash_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_2__hash__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":168 - * self.scores = scores - * - * def __hash__(self): # <<<<<<<<<<<<<< - * return hash((self.lhs, self.f, self.e)) - * - */ - -static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_4Rule_2__hash__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { - Py_hash_t __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_hash_t __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__hash__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":169 - * - * def __hash__(self): - * return hash((self.lhs, self.f, self.e)) # <<<<<<<<<<<<<< - * - * def __cmp__(self, Rule other): - */ - __pyx_t_1 = PyInt_FromLong(__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_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_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_self->f)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->f)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->f)); - __Pyx_INCREF(((PyObject *)__pyx_v_self->e)); - 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(((PyObject *)__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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.Rule.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -#if PY_MAJOR_VERSION < 3 -static int __pyx_pw_4cdec_2sa_3_sa_4Rule_5__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_4Rule_5__cmp__(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; - 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;} - __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)); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -#endif /*!(#if PY_MAJOR_VERSION < 3)*/ - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":171 - * return hash((self.lhs, self.f, self.e)) - * - * 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)) - */ - -#if PY_MAJOR_VERSION < 3 -static int __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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cmp__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":172 - * - * 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 = PyInt_FromLong(__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_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_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_self->f)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->f)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->f)); - __Pyx_INCREF(((PyObject *)__pyx_v_self->e)); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->e)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->e)); - __Pyx_INCREF(__pyx_v_self->word_alignments); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->word_alignments); - __Pyx_GIVEREF(__pyx_v_self->word_alignments); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":173 - * 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 = PyInt_FromLong(__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_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_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_other->f)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_other->f)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_other->f)); - __Pyx_INCREF(((PyObject *)__pyx_v_other->e)); - PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_other->e)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_other->e)); - __Pyx_INCREF(__pyx_v_self->word_alignments); - PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_self->word_alignments); - __Pyx_GIVEREF(__pyx_v_self->word_alignments); - __pyx_t_1 = 0; - __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_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__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_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.Rule.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -#endif /*!(#if PY_MAJOR_VERSION < 3)*/ - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { - 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("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;} - __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)); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":175 - * (other.lhs, other.f, other.e, self.word_alignments)) - * - * def fmerge(self, Phrase f): # <<<<<<<<<<<<<< - * if self.f == f: - * self.f = f - */ - -static PyObject *__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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fmerge", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":176 - * - * 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":177 - * def fmerge(self, Phrase f): - * if self.f == f: - * self.f = f # <<<<<<<<<<<<<< - * - * def arity(self): - */ - __Pyx_INCREF(((PyObject *)__pyx_v_f)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); - __Pyx_GOTREF(__pyx_v_self->f); - __Pyx_DECREF(((PyObject *)__pyx_v_self->f)); - __pyx_v_self->f = __pyx_v_f; - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.Rule.fmerge", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("arity (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":179 - * self.f = f - * - * def arity(self): # <<<<<<<<<<<<<< - * return self.f.arity() - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("arity", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":180 - * - * def arity(self): - * return self.f.arity() # <<<<<<<<<<<<<< - * - * 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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.Rule.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_11__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_11__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__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 */ - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186 - * 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) - * - */ - -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; - 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); - 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_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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); - 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 *); - 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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; - #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 - } else { - __pyx_t_2 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_a); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_a); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_a = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_71), __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(((PyObject *)__pyx_t_2)); - __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_1 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("genexpr", __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; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":182 - * return self.f.arity() - * - * def __str__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] - */ - -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; - PyObject *__pyx_v_fields = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_lineno = 0; - 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); - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":184 - * 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_GOTREF(((PyObject *)__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_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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__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_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__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_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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__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_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__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_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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__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_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__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_GOTREF(__pyx_t_2); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyList_SET_ITEM(__pyx_t_2, 3, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_1 = 0; - __pyx_t_3 = 0; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_v_fields = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":185 - * 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())) - * return ' ||| '.join(fields) - */ - __pyx_t_6 = (__pyx_cur_scope->__pyx_v_self->word_alignments != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186 - * 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_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); 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_t_5 = __pyx_pf_4cdec_2sa_3_sa_4Rule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __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[7]; __pyx_lineno = 186; __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_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":187 - * if self.word_alignments is not None: - * fields.append(' '.join('%d-%d' % a for a in self.alignments())) - * return ' ||| '.join(fields) # <<<<<<<<<<<<<< - * - * def alignments(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_19), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __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[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_v_fields)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fields)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fields)); - __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("cdec.sa._sa.Rule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_fields); - __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); /* proto */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("alignments (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_12alignments(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":189 - * return ' ||| '.join(fields) - * - * def alignments(self): # <<<<<<<<<<<<<< - * for point in self.word_alignments: - * yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE - */ - -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; - 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); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = 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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":190 - * - * 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)) { - __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_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - for (;;) { - if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_point); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_point); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_point = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":191 - * def alignments(self): - * for point in self.word_alignments: - * yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE # <<<<<<<<<<<<<< - */ - __pyx_t_4 = PyInt_FromLong(__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_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_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__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_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_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_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_1f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cdec/sa/_sa.pxd":37 - * cdef class Rule: - * cdef int lhs - * cdef readonly Phrase f, e # <<<<<<<<<<<<<< - * cdef FeatureVector scores - * cdef int n_scores - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1f___get__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->f)); - __pyx_r = ((PyObject *)__pyx_v_self->f); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_1e___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1e___get__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->e)); - __pyx_r = ((PyObject *)__pyx_v_self->e); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":21 - * int arr_len - * - * cdef _Trie_Node* new_trie_node(): # <<<<<<<<<<<<<< - * cdef _Trie_Node* node - * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) - */ - -static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie_node(void) { - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("new_trie_node", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":23 - * cdef _Trie_Node* new_trie_node(): - * cdef _Trie_Node* node - * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) # <<<<<<<<<<<<<< - * node.root = NULL - * node.arr_len = 0 - */ - __pyx_v_node = ((struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":24 - * cdef _Trie_Node* node - * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) - * node.root = NULL # <<<<<<<<<<<<<< - * node.arr_len = 0 - * node.arr = malloc(sizeof(0*sizeof(int))) - */ - __pyx_v_node->root = NULL; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":25 - * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) - * node.root = NULL - * node.arr_len = 0 # <<<<<<<<<<<<<< - * node.arr = malloc(sizeof(0*sizeof(int))) - * return node - */ - __pyx_v_node->arr_len = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":26 - * node.root = NULL - * node.arr_len = 0 - * node.arr = malloc(sizeof(0*sizeof(int))) # <<<<<<<<<<<<<< - * return node - * - */ - __pyx_v_node->arr = ((int *)malloc((sizeof((0 * (sizeof(int))))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":27 - * node.arr_len = 0 - * node.arr = malloc(sizeof(0*sizeof(int))) - * return node # <<<<<<<<<<<<<< - * - * cdef _Trie_Edge* new_trie_edge(int val): - */ - __pyx_r = __pyx_v_node; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":29 - * return node - * - * cdef _Trie_Edge* new_trie_edge(int val): # <<<<<<<<<<<<<< - * cdef _Trie_Edge* edge - * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) - */ - -static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie_edge(int __pyx_v_val) { - struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_edge; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("new_trie_edge", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":31 - * cdef _Trie_Edge* new_trie_edge(int val): - * cdef _Trie_Edge* edge - * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) # <<<<<<<<<<<<<< - * edge.node = new_trie_node() - * edge.bigger = NULL - */ - __pyx_v_edge = ((struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":32 - * cdef _Trie_Edge* edge - * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) - * edge.node = new_trie_node() # <<<<<<<<<<<<<< - * edge.bigger = NULL - * edge.smaller = NULL - */ - __pyx_v_edge->node = __pyx_f_4cdec_2sa_3_sa_new_trie_node(); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":33 - * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) - * edge.node = new_trie_node() - * edge.bigger = NULL # <<<<<<<<<<<<<< - * edge.smaller = NULL - * edge.val = val - */ - __pyx_v_edge->bigger = NULL; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":34 - * edge.node = new_trie_node() - * edge.bigger = NULL - * edge.smaller = NULL # <<<<<<<<<<<<<< - * edge.val = val - * return edge - */ - __pyx_v_edge->smaller = NULL; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":35 - * edge.bigger = NULL - * edge.smaller = NULL - * edge.val = val # <<<<<<<<<<<<<< - * return edge - * - */ - __pyx_v_edge->val = __pyx_v_val; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":36 - * edge.smaller = NULL - * edge.val = val - * return edge # <<<<<<<<<<<<<< - * - * cdef free_trie_node(_Trie_Node* node): - */ - __pyx_r = __pyx_v_edge; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":38 - * return edge - * - * cdef free_trie_node(_Trie_Node* node): # <<<<<<<<<<<<<< - * if node != NULL: - * free_trie_edge(node.root) - */ - -static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_node(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("free_trie_node", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":39 - * - * cdef free_trie_node(_Trie_Node* node): - * if node != NULL: # <<<<<<<<<<<<<< - * free_trie_edge(node.root) - * free(node.arr) - */ - __pyx_t_1 = ((__pyx_v_node != NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":40 - * cdef free_trie_node(_Trie_Node* node): - * if node != NULL: - * free_trie_edge(node.root) # <<<<<<<<<<<<<< - * free(node.arr) - * - */ - __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_edge(__pyx_v_node->root); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":41 - * if node != NULL: - * free_trie_edge(node.root) - * free(node.arr) # <<<<<<<<<<<<<< - * - * cdef free_trie_edge(_Trie_Edge* edge): - */ - free(__pyx_v_node->arr); - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.free_trie_node", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":43 - * free(node.arr) - * - * cdef free_trie_edge(_Trie_Edge* edge): # <<<<<<<<<<<<<< - * if edge != NULL: - * free_trie_node(edge.node) - */ - -static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_edge) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("free_trie_edge", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":44 - * - * cdef free_trie_edge(_Trie_Edge* edge): - * if edge != NULL: # <<<<<<<<<<<<<< - * free_trie_node(edge.node) - * free_trie_edge(edge.bigger) - */ - __pyx_t_1 = ((__pyx_v_edge != NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":45 - * cdef free_trie_edge(_Trie_Edge* edge): - * if edge != NULL: - * free_trie_node(edge.node) # <<<<<<<<<<<<<< - * free_trie_edge(edge.bigger) - * free_trie_edge(edge.smaller) - */ - __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_node(__pyx_v_edge->node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":46 - * if edge != NULL: - * free_trie_node(edge.node) - * free_trie_edge(edge.bigger) # <<<<<<<<<<<<<< - * free_trie_edge(edge.smaller) - * - */ - __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_edge(__pyx_v_edge->bigger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":47 - * free_trie_node(edge.node) - * free_trie_edge(edge.bigger) - * free_trie_edge(edge.smaller) # <<<<<<<<<<<<<< - * - * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): - */ - __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_edge(__pyx_v_edge->smaller); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 47; __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:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.free_trie_edge", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":49 - * free_trie_edge(edge.smaller) - * - * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): # <<<<<<<<<<<<<< - * cdef _Trie_Edge* cur - * cur = node.root - */ - -static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_find(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { - struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_cur; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; - __Pyx_RefNannyDeclarations - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":51 - * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): - * cdef _Trie_Edge* cur - * cur = node.root # <<<<<<<<<<<<<< - * while cur != NULL and cur.val != val: - * if val > cur.val: - */ - __pyx_t_1 = __pyx_v_node->root; - __pyx_v_cur = __pyx_t_1; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":52 - * cdef _Trie_Edge* cur - * cur = node.root - * while cur != NULL and cur.val != val: # <<<<<<<<<<<<<< - * if val > cur.val: - * 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; - } else { - __pyx_t_4 = __pyx_t_2; - } - if (!__pyx_t_4) break; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":54 - * while cur != NULL and cur.val != val: - * if val > cur.val: - * cur = cur.bigger # <<<<<<<<<<<<<< - * elif val < cur.val: - * cur = cur.smaller - */ - __pyx_t_1 = __pyx_v_cur->bigger; - __pyx_v_cur = __pyx_t_1; - goto __pyx_L5; - } - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":56 - * cur = cur.bigger - * elif val < cur.val: - * cur = cur.smaller # <<<<<<<<<<<<<< - * if cur == NULL: - * return NULL - */ - __pyx_t_1 = __pyx_v_cur->smaller; - __pyx_v_cur = __pyx_t_1; - goto __pyx_L5; - } - __pyx_L5:; - } - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":58 - * cur = cur.smaller - * if cur == NULL: - * return NULL # <<<<<<<<<<<<<< - * else: - * return cur.node - */ - __pyx_r = NULL; - goto __pyx_L0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":60 - * return NULL - * else: - * return cur.node # <<<<<<<<<<<<<< - * - * cdef trie_node_data_append(_Trie_Node* node, int val): - */ - __pyx_r = __pyx_v_cur->node; - goto __pyx_L0; - } - __pyx_L6:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":62 - * return cur.node - * - * cdef trie_node_data_append(_Trie_Node* node, int val): # <<<<<<<<<<<<<< - * cdef int new_len - * new_len = node.arr_len + 1 - */ - -static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { - int __pyx_v_new_len; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("trie_node_data_append", 0); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * node.arr = realloc(node.arr, new_len*sizeof(int)) - * node.arr[node.arr_len] = val - */ - __pyx_v_new_len = (__pyx_v_node->arr_len + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":65 - * cdef int new_len - * new_len = node.arr_len + 1 - * node.arr = realloc(node.arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< - * node.arr[node.arr_len] = val - * node.arr_len = new_len - */ - __pyx_v_node->arr = ((int *)realloc(__pyx_v_node->arr, (__pyx_v_new_len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":66 - * new_len = node.arr_len + 1 - * node.arr = realloc(node.arr, new_len*sizeof(int)) - * node.arr[node.arr_len] = val # <<<<<<<<<<<<<< - * node.arr_len = new_len - * - */ - (__pyx_v_node->arr[__pyx_v_node->arr_len]) = __pyx_v_val; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":67 - * node.arr = realloc(node.arr, new_len*sizeof(int)) - * node.arr[node.arr_len] = val - * node.arr_len = new_len # <<<<<<<<<<<<<< - * - * cdef trie_node_data_extend(_Trie_Node* node, int* vals, int num_vals): - */ - __pyx_v_node->arr_len = __pyx_v_new_len; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":69 - * node.arr_len = new_len - * - * cdef trie_node_data_extend(_Trie_Node* node, int* vals, int num_vals): # <<<<<<<<<<<<<< - * cdef int new_len - * new_len = node.arr_len + num_vals - */ - -static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_extend(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int *__pyx_v_vals, int __pyx_v_num_vals) { - int __pyx_v_new_len; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("trie_node_data_extend", 0); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * node.arr = realloc(node.arr, new_len*sizeof(int)) - * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) - */ - __pyx_v_new_len = (__pyx_v_node->arr_len + __pyx_v_num_vals); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":72 - * cdef int new_len - * new_len = node.arr_len + num_vals - * node.arr = realloc(node.arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< - * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) - * node.arr_len = new_len - */ - __pyx_v_node->arr = ((int *)realloc(__pyx_v_node->arr, (__pyx_v_new_len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":73 - * new_len = node.arr_len + num_vals - * node.arr = realloc(node.arr, new_len*sizeof(int)) - * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) # <<<<<<<<<<<<<< - * node.arr_len = new_len - * - */ - memcpy((__pyx_v_node->arr + __pyx_v_node->arr_len), __pyx_v_vals, (__pyx_v_num_vals * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":74 - * node.arr = realloc(node.arr, new_len*sizeof(int)) - * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) - * node.arr_len = new_len # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_node->arr_len = __pyx_v_new_len; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":77 - * - * - * cdef _Trie_Node* trie_insert(_Trie_Node* node, int val): # <<<<<<<<<<<<<< - * cdef _Trie_Edge** cur - * cur = &node.root - */ - -static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_insert(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { - struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge **__pyx_v_cur; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("trie_insert", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":79 - * cdef _Trie_Node* trie_insert(_Trie_Node* node, int val): - * cdef _Trie_Edge** cur - * cur = &node.root # <<<<<<<<<<<<<< - * while cur[0] != NULL and cur[0].val != val: - * if val > cur[0].val: - */ - __pyx_v_cur = (&__pyx_v_node->root); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":80 - * cdef _Trie_Edge** cur - * cur = &node.root - * while cur[0] != NULL and cur[0].val != val: # <<<<<<<<<<<<<< - * if val > cur[0].val: - * 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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (!__pyx_t_3) break; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":82 - * while cur[0] != NULL and cur[0].val != val: - * if val > cur[0].val: - * cur = &cur[0].bigger # <<<<<<<<<<<<<< - * elif val < cur[0].val: - * cur = &cur[0].smaller - */ - __pyx_v_cur = (&(__pyx_v_cur[0])->bigger); - goto __pyx_L5; - } - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":84 - * cur = &cur[0].bigger - * elif val < cur[0].val: - * cur = &cur[0].smaller # <<<<<<<<<<<<<< - * if cur[0] == NULL: - * cur[0] = new_trie_edge(val) - */ - __pyx_v_cur = (&(__pyx_v_cur[0])->smaller); - goto __pyx_L5; - } - __pyx_L5:; - } - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":86 - * cur = &cur[0].smaller - * if cur[0] == NULL: - * cur[0] = new_trie_edge(val) # <<<<<<<<<<<<<< - * return cur[0].node - * - */ - (__pyx_v_cur[0]) = __pyx_f_4cdec_2sa_3_sa_new_trie_edge(__pyx_v_val); - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":87 - * if cur[0] == NULL: - * cur[0] = new_trie_edge(val) - * return cur[0].node # <<<<<<<<<<<<<< - * - * cdef trie_node_to_map(_Trie_Node* node, result, prefix, int include_zeros): - */ - __pyx_r = (__pyx_v_cur[0])->node; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":89 - * return cur[0].node - * - * cdef trie_node_to_map(_Trie_Node* node, result, prefix, int include_zeros): # <<<<<<<<<<<<<< - * cdef IntList arr - * - */ - -static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, PyObject *__pyx_v_result, PyObject *__pyx_v_prefix, int __pyx_v_include_zeros) { - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("trie_node_to_map", 0); - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_2 = (__pyx_v_include_zeros != 0); - } - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":93 - * - * if include_zeros or node.arr_len > 0: - * arr = IntList() # <<<<<<<<<<<<<< - * free(arr.arr) - * arr.arr = malloc(node.arr_len * sizeof(int)) - */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":94 - * if include_zeros or node.arr_len > 0: - * arr = IntList() - * free(arr.arr) # <<<<<<<<<<<<<< - * arr.arr = malloc(node.arr_len * sizeof(int)) - * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) - */ - free(__pyx_v_arr->arr); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":95 - * arr = IntList() - * free(arr.arr) - * arr.arr = malloc(node.arr_len * sizeof(int)) # <<<<<<<<<<<<<< - * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) - * arr.len = node.arr_len - */ - __pyx_v_arr->arr = ((int *)malloc((__pyx_v_node->arr_len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":96 - * free(arr.arr) - * arr.arr = malloc(node.arr_len * sizeof(int)) - * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) # <<<<<<<<<<<<<< - * arr.len = node.arr_len - * arr.size = node.arr_len - */ - memcpy(__pyx_v_arr->arr, __pyx_v_node->arr, (__pyx_v_node->arr_len * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":97 - * arr.arr = malloc(node.arr_len * sizeof(int)) - * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) - * arr.len = node.arr_len # <<<<<<<<<<<<<< - * arr.size = node.arr_len - * result[prefix] = arr - */ - __pyx_t_4 = __pyx_v_node->arr_len; - __pyx_v_arr->len = __pyx_t_4; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * result[prefix] = arr - * trie_edge_to_map(node.root, result, prefix, include_zeros) - */ - __pyx_t_4 = __pyx_v_node->arr_len; - __pyx_v_arr->size = __pyx_t_4; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":99 - * arr.len = node.arr_len - * arr.size = node.arr_len - * result[prefix] = arr # <<<<<<<<<<<<<< - * trie_edge_to_map(node.root, result, prefix, include_zeros) - * - */ - if (PyObject_SetItem(__pyx_v_result, __pyx_v_prefix, ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":100 - * arr.size = node.arr_len - * result[prefix] = arr - * trie_edge_to_map(node.root, result, prefix, include_zeros) # <<<<<<<<<<<<<< - * - * cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros): - */ - __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(__pyx_v_node->root, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.trie_node_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_arr); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< - * if edge != NULL: - * trie_edge_to_map(edge.smaller, result, prefix, include_zeros) - */ - -static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_edge, PyObject *__pyx_v_result, PyObject *__pyx_v_prefix, int __pyx_v_include_zeros) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - 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("trie_edge_to_map", 0); - __Pyx_INCREF(__pyx_v_prefix); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":103 - * - * 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) - * trie_edge_to_map(edge.bigger, result, prefix, include_zeros) - */ - __pyx_t_1 = ((__pyx_v_edge != NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * trie_edge_to_map(edge.bigger, result, prefix, include_zeros) - * prefix = prefix + (edge.val,) - */ - __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(__pyx_v_edge->smaller, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * prefix = prefix + (edge.val,) - * trie_node_to_map(edge.node, result, prefix, include_zeros) - */ - __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(__pyx_v_edge->bigger, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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,) # <<<<<<<<<<<<<< - * trie_node_to_map(edge.node, result, prefix, include_zeros) - * - */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_edge->val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 106; __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[11]; __pyx_lineno = 106; __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 = PyNumber_Add(__pyx_v_prefix, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 106; __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_v_prefix); - __pyx_v_prefix = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * cdef class TrieMap: - */ - __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_node_to_map(__pyx_v_edge->node, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 107; __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:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.trie_edge_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_prefix); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_alphabet_size; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alphabet_size,0}; - PyObject* values[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 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__alphabet_size)) != 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[11]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_alphabet_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_alphabet_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.TrieMap.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), __pyx_v_alphabet_size); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":114 - * cdef int V - * - * def __cinit__(self, int alphabet_size): # <<<<<<<<<<<<<< - * self.V = alphabet_size - * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) - */ - -static int __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":115 - * - * def __cinit__(self, int alphabet_size): - * self.V = alphabet_size # <<<<<<<<<<<<<< - * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) - * memset(self.root, 0, self.V * sizeof(_Trie_Node*)) - */ - __pyx_v_self->V = __pyx_v_alphabet_size; - - /* "/home/mdenkows/cdec/python/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*)) # <<<<<<<<<<<<<< - * memset(self.root, 0, self.V * sizeof(_Trie_Node*)) - * - */ - __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 *))))); - - /* "/home/mdenkows/cdec/python/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*)) # <<<<<<<<<<<<<< - * - * - */ - memset(__pyx_v_self->root, 0, (__pyx_v_self->V * (sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *)))); - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static void __pyx_pw_4cdec_2sa_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pw_4cdec_2sa_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); - __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":120 - * - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * cdef int i - * for i from 0 <= i < self.V: - */ - -static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self) { - int __pyx_v_i; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__dealloc__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":122 - * def __dealloc__(self): - * cdef int i - * for i from 0 <= i < self.V: # <<<<<<<<<<<<<< - * if self.root[i] != NULL: - * free_trie_node(self.root[i]) - */ - __pyx_t_1 = __pyx_v_self->V; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":123 - * cdef int i - * for i from 0 <= i < self.V: - * if self.root[i] != NULL: # <<<<<<<<<<<<<< - * free_trie_node(self.root[i]) - * free(self.root) - */ - __pyx_t_2 = (((__pyx_v_self->root[__pyx_v_i]) != NULL) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":124 - * for i from 0 <= i < self.V: - * if self.root[i] != NULL: - * free_trie_node(self.root[i]) # <<<<<<<<<<<<<< - * free(self.root) - * - */ - __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_free_trie_node((__pyx_v_self->root[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L5; - } - __pyx_L5:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":125 - * if self.root[i] != NULL: - * free_trie_node(self.root[i]) - * free(self.root) # <<<<<<<<<<<<<< - * - * - */ - free(__pyx_v_self->root); - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.TrieMap.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("insert (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":128 - * - * - * def insert(self, pattern): # <<<<<<<<<<<<<< - * cdef int* p - * cdef int i, l - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { - int *__pyx_v_p; - int __pyx_v_i; - int __pyx_v_l; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("insert", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":131 - * cdef int* p - * cdef int i, l - * l = len(pattern) # <<<<<<<<<<<<<< - * p = malloc(l*sizeof(int)) - * for i from 0 <= i < l: - */ - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":132 - * cdef int i, l - * l = len(pattern) - * p = malloc(l*sizeof(int)) # <<<<<<<<<<<<<< - * for i from 0 <= i < l: - * p[i] = pattern[i] - */ - __pyx_v_p = ((int *)malloc((__pyx_v_l * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":133 - * l = len(pattern) - * p = malloc(l*sizeof(int)) - * for i from 0 <= i < l: # <<<<<<<<<<<<<< - * p[i] = pattern[i] - * self._insert(p,l) - */ - __pyx_t_2 = __pyx_v_l; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":134 - * p = malloc(l*sizeof(int)) - * for i from 0 <= i < l: - * p[i] = pattern[i] # <<<<<<<<<<<<<< - * self._insert(p,l) - * free(p) - */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pattern, __pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - (__pyx_v_p[__pyx_v_i]) = __pyx_t_4; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":135 - * for i from 0 <= i < l: - * p[i] = pattern[i] - * self._insert(p,l) # <<<<<<<<<<<<<< - * free(p) - * - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_insert(__pyx_v_self, __pyx_v_p, __pyx_v_l); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":136 - * p[i] = pattern[i] - * self._insert(p,l) - * free(p) # <<<<<<<<<<<<<< - * - * - */ - free(__pyx_v_p); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.TrieMap.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":139 - * - * - * cdef _Trie_Node* _insert(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<< - * cdef int i - * cdef _Trie_Node* node - */ - -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) { - int __pyx_v_i; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("_insert", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":142 - * cdef int i - * cdef _Trie_Node* node - * if self.root[pattern[0]] == NULL: # <<<<<<<<<<<<<< - * self.root[pattern[0]] = new_trie_node() - * node = self.root[pattern[0]] - */ - __pyx_t_1 = (((__pyx_v_self->root[(__pyx_v_pattern[0])]) == NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":143 - * cdef _Trie_Node* node - * if self.root[pattern[0]] == NULL: - * self.root[pattern[0]] = new_trie_node() # <<<<<<<<<<<<<< - * node = self.root[pattern[0]] - * for i from 1 <= i < pattern_len: - */ - (__pyx_v_self->root[(__pyx_v_pattern[0])]) = __pyx_f_4cdec_2sa_3_sa_new_trie_node(); - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":144 - * if self.root[pattern[0]] == NULL: - * self.root[pattern[0]] = new_trie_node() - * node = self.root[pattern[0]] # <<<<<<<<<<<<<< - * for i from 1 <= i < pattern_len: - * node = trie_insert(node, pattern[i]) - */ - __pyx_v_node = (__pyx_v_self->root[(__pyx_v_pattern[0])]); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":145 - * self.root[pattern[0]] = new_trie_node() - * node = self.root[pattern[0]] - * for i from 1 <= i < pattern_len: # <<<<<<<<<<<<<< - * node = trie_insert(node, pattern[i]) - * return node - */ - __pyx_t_2 = __pyx_v_pattern_len; - for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":146 - * node = self.root[pattern[0]] - * for i from 1 <= i < pattern_len: - * node = trie_insert(node, pattern[i]) # <<<<<<<<<<<<<< - * return node - * - */ - __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":147 - * for i from 1 <= i < pattern_len: - * node = trie_insert(node, pattern[i]) - * return node # <<<<<<<<<<<<<< - * - * def contains(self, pattern): - */ - __pyx_r = __pyx_v_node; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("contains (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":149 - * return node - * - * def contains(self, pattern): # <<<<<<<<<<<<<< - * cdef int* p - * cdef int i, l - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { - int *__pyx_v_p; - int __pyx_v_i; - int __pyx_v_l; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("contains", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":153 - * cdef int i, l - * cdef _Trie_Node* node - * l = len(pattern) # <<<<<<<<<<<<<< - * p = malloc(l*sizeof(int)) - * for i from 0 <= i < l: - */ - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":154 - * cdef _Trie_Node* node - * l = len(pattern) - * p = malloc(l*sizeof(int)) # <<<<<<<<<<<<<< - * for i from 0 <= i < l: - * p[i] = pattern[i] - */ - __pyx_v_p = ((int *)malloc((__pyx_v_l * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":155 - * l = len(pattern) - * p = malloc(l*sizeof(int)) - * for i from 0 <= i < l: # <<<<<<<<<<<<<< - * p[i] = pattern[i] - * node = self._contains(p,l) - */ - __pyx_t_2 = __pyx_v_l; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":156 - * p = malloc(l*sizeof(int)) - * for i from 0 <= i < l: - * p[i] = pattern[i] # <<<<<<<<<<<<<< - * node = self._contains(p,l) - * free(p) - */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pattern, __pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - (__pyx_v_p[__pyx_v_i]) = __pyx_t_4; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":157 - * for i from 0 <= i < l: - * p[i] = pattern[i] - * node = self._contains(p,l) # <<<<<<<<<<<<<< - * free(p) - * if node == NULL: - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":158 - * p[i] = pattern[i] - * node = self._contains(p,l) - * free(p) # <<<<<<<<<<<<<< - * if node == NULL: - * return False - */ - free(__pyx_v_p); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":159 - * node = self._contains(p,l) - * free(p) - * if node == NULL: # <<<<<<<<<<<<<< - * return False - * else: - */ - __pyx_t_5 = ((__pyx_v_node == NULL) != 0); - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":160 - * free(p) - * if node == NULL: - * return False # <<<<<<<<<<<<<< - * else: - * return True - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":162 - * return False - * else: - * return True # <<<<<<<<<<<<<< - * - * cdef _Trie_Node* _contains(self, int* pattern, int pattern_len): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - __pyx_L5:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.TrieMap.contains", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":164 - * return True - * - * cdef _Trie_Node* _contains(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<< - * cdef int i - * cdef _Trie_Node* node - */ - -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) { - int __pyx_v_i; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("_contains", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":167 - * cdef int i - * cdef _Trie_Node* node - * node = self.root[pattern[0]] # <<<<<<<<<<<<<< - * i = 1 - * while node != NULL and i < pattern_len: - */ - __pyx_v_node = (__pyx_v_self->root[(__pyx_v_pattern[0])]); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":168 - * cdef _Trie_Node* node - * node = self.root[pattern[0]] - * i = 1 # <<<<<<<<<<<<<< - * while node != NULL and i < pattern_len: - * node = trie_find(node, pattern[i]) - */ - __pyx_v_i = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":169 - * node = self.root[pattern[0]] - * i = 1 - * while node != NULL and i < pattern_len: # <<<<<<<<<<<<<< - * node = trie_find(node, pattern[i]) - * 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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (!__pyx_t_3) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":170 - * i = 1 - * while node != NULL and i < pattern_len: - * node = trie_find(node, pattern[i]) # <<<<<<<<<<<<<< - * i = i+1 - * return node - */ - __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_find(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":171 - * while node != NULL and i < pattern_len: - * node = trie_find(node, pattern[i]) - * i = i+1 # <<<<<<<<<<<<<< - * return node - * - */ - __pyx_v_i = (__pyx_v_i + 1); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":172 - * node = trie_find(node, pattern[i]) - * i = i+1 - * return node # <<<<<<<<<<<<<< - * - * def toMap(self, flag): - */ - __pyx_r = __pyx_v_node; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("toMap (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_flag)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":174 - * return node - * - * def toMap(self, flag): # <<<<<<<<<<<<<< - * cdef int i, include_zeros - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag) { - int __pyx_v_i; - int __pyx_v_include_zeros; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("toMap", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":177 - * cdef int i, include_zeros - * - * if flag: # <<<<<<<<<<<<<< - * include_zeros=1 - * else: - */ - __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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":178 - * - * if flag: - * include_zeros=1 # <<<<<<<<<<<<<< - * else: - * include_zeros=0 - */ - __pyx_v_include_zeros = 1; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":180 - * include_zeros=1 - * else: - * include_zeros=0 # <<<<<<<<<<<<<< - * result = {} - * for i from 0 <= i < self.V: - */ - __pyx_v_include_zeros = 0; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":181 - * else: - * include_zeros=0 - * result = {} # <<<<<<<<<<<<<< - * for i from 0 <= i < self.V: - * if self.root[i] != NULL: - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_v_result = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":182 - * include_zeros=0 - * result = {} - * for i from 0 <= i < self.V: # <<<<<<<<<<<<<< - * if self.root[i] != NULL: - * trie_node_to_map(self.root[i], result, (i,), include_zeros) - */ - __pyx_t_3 = __pyx_v_self->V; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":183 - * result = {} - * for i from 0 <= i < self.V: - * if self.root[i] != NULL: # <<<<<<<<<<<<<< - * trie_node_to_map(self.root[i], result, (i,), include_zeros) - * return result - */ - __pyx_t_1 = (((__pyx_v_self->root[__pyx_v_i]) != NULL) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_node_to_map((__pyx_v_self->root[__pyx_v_i]), ((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_4), __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L6; - } - __pyx_L6:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":185 - * if self.root[i] != NULL: - * trie_node_to_map(self.root[i], result, (i,), include_zeros) - * return result # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = ((PyObject *)__pyx_v_result); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.TrieMap.toMap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fsarray = 0; - PyObject *__pyx_v_from_stats = 0; - PyObject *__pyx_v_from_binary = 0; - PyObject *__pyx_v_precompute_rank = 0; - PyObject *__pyx_v_precompute_secondary_rank = 0; - PyObject *__pyx_v_max_length = 0; - PyObject *__pyx_v_max_nonterminals = 0; - PyObject *__pyx_v_train_max_initial_size = 0; - PyObject *__pyx_v_train_min_gap_size = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__from_stats,&__pyx_n_s__from_binary,&__pyx_n_s__precompute_rank,&__pyx_n_s_72,&__pyx_n_s__max_length,&__pyx_n_s__max_nonterminals,&__pyx_n_s_73,&__pyx_n_s__train_min_gap_size,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":200 - * cdef write_map(self, m, FILE* f) - * - * def __cinit__(self, fsarray=None, from_stats=None, from_binary=None, # <<<<<<<<<<<<<< - * precompute_rank=1000, precompute_secondary_rank=20, - * max_length=5, max_nonterminals=2, - */ - values[0] = ((PyObject *)Py_None); - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)__pyx_int_1000); - values[4] = ((PyObject *)__pyx_int_20); - values[5] = ((PyObject *)__pyx_int_5); - values[6] = ((PyObject *)__pyx_int_2); - values[7] = ((PyObject *)__pyx_int_10); - values[8] = ((PyObject *)__pyx_int_2); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__fsarray); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_stats); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_binary); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__precompute_rank); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_72); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_length); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_nonterminals); - if (value) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_73); - if (value) { values[7] = value; kw_args--; } - } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__train_min_gap_size); - if (value) { values[8] = 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[11]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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_fsarray = values[0]; - __pyx_v_from_stats = values[1]; - __pyx_v_from_binary = values[2]; - __pyx_v_precompute_rank = values[3]; - __pyx_v_precompute_secondary_rank = values[4]; - __pyx_v_max_length = values[5]; - __pyx_v_max_nonterminals = values[6]; - __pyx_v_train_max_initial_size = values[7]; - __pyx_v_train_min_gap_size = values[8]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_from_stats, __pyx_v_from_binary, __pyx_v_precompute_rank, __pyx_v_precompute_secondary_rank, __pyx_v_max_length, __pyx_v_max_nonterminals, __pyx_v_train_max_initial_size, __pyx_v_train_min_gap_size); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_from_stats, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_precompute_rank, PyObject *__pyx_v_precompute_secondary_rank, PyObject *__pyx_v_max_length, PyObject *__pyx_v_max_nonterminals, PyObject *__pyx_v_train_max_initial_size, PyObject *__pyx_v_train_min_gap_size) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - 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); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * self.precompute_secondary_rank = precompute_secondary_rank - * self.max_length = max_length - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * self.max_length = max_length - * self.max_nonterminals = max_nonterminals - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":206 - * self.precompute_rank = precompute_rank - * self.precompute_secondary_rank = precompute_secondary_rank - * self.max_length = max_length # <<<<<<<<<<<<<< - * self.max_nonterminals = max_nonterminals - * self.train_max_initial_size = train_max_initial_size - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":207 - * self.precompute_secondary_rank = precompute_secondary_rank - * self.max_length = max_length - * self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<< - * self.train_max_initial_size = train_max_initial_size - * self.train_min_gap_size = train_min_gap_size - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":208 - * self.max_length = max_length - * self.max_nonterminals = max_nonterminals - * self.train_max_initial_size = train_max_initial_size # <<<<<<<<<<<<<< - * self.train_min_gap_size = train_min_gap_size - * if from_binary: - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * if from_binary: - * self.read_binary(from_binary) - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__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; - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * self.read_binary(from_binary) - * elif from_stats: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":212 - * if from_binary: - * self.read_binary(from_binary) - * elif from_stats: # <<<<<<<<<<<<<< - * self.precompute(from_stats, fsarray) - * - */ - __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) { - - /* "/home/mdenkows/cdec/python/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_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_from_stats); - PyTuple_SET_ITEM(__pyx_t_4, 0, __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); - __Pyx_GIVEREF(__pyx_v_fsarray); - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__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_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - __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_AddTraceback("cdec.sa._sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[11]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":216 - * - * - * def read_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - 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("read_binary", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":218 - * def read_binary(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "r") # <<<<<<<<<<<<<< - * fread(&(self.precompute_rank), sizeof(int), 1, f) - * fread(&(self.precompute_secondary_rank), sizeof(int), 1, f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":219 - * cdef FILE* f - * f = fopen(filename, "r") - * 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) - */ - fread((&__pyx_v_self->precompute_rank), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * fread(&(self.max_length), sizeof(int), 1, f) - * fread(&(self.max_nonterminals), sizeof(int), 1, f) - */ - fread((&__pyx_v_self->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * fread(&(self.max_nonterminals), sizeof(int), 1, f) - * fread(&(self.train_max_initial_size), sizeof(int), 1, f) - */ - fread((&__pyx_v_self->max_length), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * fread(&(self.train_max_initial_size), sizeof(int), 1, f) - * fread(&(self.train_min_gap_size), sizeof(int), 1, f) - */ - fread((&__pyx_v_self->max_nonterminals), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * fread(&(self.train_min_gap_size), sizeof(int), 1, f) - * self.precomputed_index = self.read_map(f) - */ - fread((&__pyx_v_self->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * self.precomputed_index = self.read_map(f) - * self.precomputed_collocations = self.read_map(f) - */ - fread((&__pyx_v_self->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * self.precomputed_collocations = self.read_map(f) - * fclose(f) - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->read_map(__pyx_v_self, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __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; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->read_map(__pyx_v_self, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->precomputed_collocations); - __Pyx_DECREF(__pyx_v_self->precomputed_collocations); - __pyx_v_self->precomputed_collocations = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":227 - * self.precomputed_index = self.read_map(f) - * self.precomputed_collocations = self.read_map(f) - * fclose(f) # <<<<<<<<<<<<<< - * - * - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[11]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":230 - * - * - * def write_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_binary", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":232 - * def write_binary(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "w") # <<<<<<<<<<<<<< - * fwrite(&(self.precompute_rank), sizeof(int), 1, f) - * fwrite(&(self.precompute_secondary_rank), sizeof(int), 1, f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":233 - * cdef FILE* f - * f = fopen(filename, "w") - * 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) - */ - fwrite((&__pyx_v_self->precompute_rank), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * fwrite(&(self.max_length), sizeof(int), 1, f) - * fwrite(&(self.max_nonterminals), sizeof(int), 1, f) - */ - fwrite((&__pyx_v_self->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * fwrite(&(self.max_nonterminals), sizeof(int), 1, f) - * fwrite(&(self.train_max_initial_size), sizeof(int), 1, f) - */ - fwrite((&__pyx_v_self->max_length), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * fwrite(&(self.train_max_initial_size), sizeof(int), 1, f) - * fwrite(&(self.train_min_gap_size), sizeof(int), 1, f) - */ - fwrite((&__pyx_v_self->max_nonterminals), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * fwrite(&(self.train_min_gap_size), sizeof(int), 1, f) - * self.write_map(self.precomputed_index, f) - */ - fwrite((&__pyx_v_self->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * self.write_map(self.precomputed_index, f) - * self.write_map(self.precomputed_collocations, f) - */ - fwrite((&__pyx_v_self->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * self.write_map(self.precomputed_collocations, f) - * fclose(f) - */ - __pyx_t_1 = __pyx_v_self->precomputed_index; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->write_map(__pyx_v_self, __pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 239; __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; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - __pyx_t_2 = __pyx_v_self->precomputed_collocations; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->write_map(__pyx_v_self, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 240; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":241 - * self.write_map(self.precomputed_index, f) - * self.write_map(self.precomputed_collocations, f) - * fclose(f) # <<<<<<<<<<<<<< - * - * - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":244 - * - * - * cdef write_map(self, m, FILE* f): # <<<<<<<<<<<<<< - * cdef int i, N - * cdef IntList arr - */ - -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) { - int __pyx_v_i; - int __pyx_v_N; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr = 0; - PyObject *__pyx_v_pattern = NULL; - PyObject *__pyx_v_val = NULL; - PyObject *__pyx_v_word_id = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_map", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":248 - * cdef IntList arr - * - * N = len(m) # <<<<<<<<<<<<<< - * fwrite(&(N), sizeof(int), 1, f) - * for pattern, val in m.iteritems(): - */ - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":249 - * - * N = len(m) - * fwrite(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * for pattern, val in m.iteritems(): - * N = len(pattern) - */ - fwrite((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":250 - * N = len(m) - * fwrite(&(N), sizeof(int), 1, f) - * for pattern, val in m.iteritems(): # <<<<<<<<<<<<<< - * N = len(pattern) - * fwrite(&(N), sizeof(int), 1, f) - */ - __pyx_t_1 = 0; - if (unlikely(__pyx_v_m == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_m, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_2); - __pyx_t_2 = __pyx_t_5; - __pyx_t_5 = 0; - while (1) { - __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_3, &__pyx_t_1, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4); - if (unlikely(__pyx_t_7 == 0)) break; - if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_v_val); - __pyx_v_val = __pyx_t_6; - __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":251 - * fwrite(&(N), sizeof(int), 1, f) - * for pattern, val in m.iteritems(): - * N = len(pattern) # <<<<<<<<<<<<<< - * fwrite(&(N), sizeof(int), 1, f) - * for word_id in pattern: - */ - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":252 - * for pattern, val in m.iteritems(): - * N = len(pattern) - * fwrite(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * for word_id in pattern: - * i = word_id - */ - fwrite((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/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)) { - __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; - } - 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 - } else { - __pyx_t_5 = __pyx_t_9(__pyx_t_6); - if (unlikely(!__pyx_t_5)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":254 - * fwrite(&(N), sizeof(int), 1, f) - * for word_id in pattern: - * i = word_id # <<<<<<<<<<<<<< - * fwrite(&(i), sizeof(int), 1, f) - * arr = val - */ - __pyx_t_7 = __Pyx_PyInt_AsInt(__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":255 - * for word_id in pattern: - * i = word_id - * fwrite(&(i), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * arr = val - * arr.write_handle(f) - */ - fwrite((&__pyx_v_i), (sizeof(int)), 1, __pyx_v_f); - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":256 - * i = word_id - * fwrite(&(i), sizeof(int), 1, f) - * arr = val # <<<<<<<<<<<<<< - * arr.write_handle(f) - * - */ - if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_val); - __Pyx_XDECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_val); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":257 - * fwrite(&(i), sizeof(int), 1, f) - * arr = val - * arr.write_handle(f) # <<<<<<<<<<<<<< - * - * - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_arr->__pyx_vtab)->write_handle(__pyx_v_arr, __pyx_v_f); - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("cdec.sa._sa.Precomputation.write_map", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_arr); - __Pyx_XDECREF(__pyx_v_pattern); - __Pyx_XDECREF(__pyx_v_val); - __Pyx_XDECREF(__pyx_v_word_id); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":260 - * - * - * cdef read_map(self, FILE* f): # <<<<<<<<<<<<<< - * cdef int i, j, k, word_id, N - * cdef IntList arr - */ - -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) { - int __pyx_v_i; - CYTHON_UNUSED int __pyx_v_j; - CYTHON_UNUSED int __pyx_v_k; - int __pyx_v_word_id; - int __pyx_v_N; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr = 0; - PyObject *__pyx_v_m = NULL; - PyObject *__pyx_v_key = NULL; - 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("read_map", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":264 - * cdef IntList arr - * - * m = {} # <<<<<<<<<<<<<< - * fread(&(N), sizeof(int), 1, f) - * for j from 0 <= j < N: - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_m = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":265 - * - * m = {} - * fread(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * for j from 0 <= j < N: - * fread(&(i), sizeof(int), 1, f) - */ - fread((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":266 - * m = {} - * fread(&(N), sizeof(int), 1, f) - * for j from 0 <= j < N: # <<<<<<<<<<<<<< - * fread(&(i), sizeof(int), 1, f) - * key = () - */ - __pyx_t_2 = __pyx_v_N; - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":267 - * fread(&(N), sizeof(int), 1, f) - * for j from 0 <= j < N: - * fread(&(i), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * key = () - * for k from 0 <= k < i: - */ - fread((&__pyx_v_i), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":268 - * for j from 0 <= j < N: - * fread(&(i), sizeof(int), 1, f) - * key = () # <<<<<<<<<<<<<< - * for k from 0 <= k < i: - * fread(&(word_id), sizeof(int), 1, f) - */ - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - __Pyx_XDECREF(((PyObject *)__pyx_v_key)); - __pyx_v_key = __pyx_empty_tuple; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":269 - * fread(&(i), sizeof(int), 1, f) - * key = () - * for k from 0 <= k < i: # <<<<<<<<<<<<<< - * fread(&(word_id), sizeof(int), 1, f) - * key = key + (word_id,) - */ - __pyx_t_3 = __pyx_v_i; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":270 - * key = () - * for k from 0 <= k < i: - * fread(&(word_id), sizeof(int), 1, f) # <<<<<<<<<<<<<< - * key = key + (word_id,) - * arr = IntList() - */ - fread((&__pyx_v_word_id), (sizeof(int)), 1, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":271 - * for k from 0 <= k < i: - * fread(&(word_id), sizeof(int), 1, f) - * key = key + (word_id,) # <<<<<<<<<<<<<< - * arr = IntList() - * arr.read_handle(f) - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_word_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 271; __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[11]; __pyx_lineno = 271; __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 = PyNumber_Add(((PyObject *)__pyx_v_key), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_key)); - __pyx_v_key = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":272 - * fread(&(word_id), sizeof(int), 1, f) - * key = key + (word_id,) - * arr = IntList() # <<<<<<<<<<<<<< - * arr.read_handle(f) - * m[key] = arr - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":273 - * key = key + (word_id,) - * arr = IntList() - * arr.read_handle(f) # <<<<<<<<<<<<<< - * m[key] = arr - * return m - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_arr->__pyx_vtab)->read_handle(__pyx_v_arr, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":274 - * arr = IntList() - * arr.read_handle(f) - * m[key] = arr # <<<<<<<<<<<<<< - * return m - * - */ - if (PyDict_SetItem(((PyObject *)__pyx_v_m), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":275 - * arr.read_handle(f) - * m[key] = arr - * return m # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_m)); - __pyx_r = ((PyObject *)__pyx_v_m); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.Precomputation.read_map", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_arr); - __Pyx_XDECREF(__pyx_v_m); - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_stats = 0; - struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sarray = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("precompute (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__stats,&__pyx_n_s__sarray,0}; - PyObject* values[2] = {0,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__stats)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sarray)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("precompute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "precompute") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_stats = values[0]; - __pyx_v_sarray = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("precompute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sarray), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "sarray", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), __pyx_v_stats, __pyx_v_sarray); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":278 - * - * - * 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 - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_stats, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sarray) { - int __pyx_v_i; - int __pyx_v_l; - int __pyx_v_N; - int __pyx_v_max_pattern_len; - int __pyx_v_i1; - int __pyx_v_l1; - int __pyx_v_i2; - int __pyx_v_l2; - int __pyx_v_i3; - int __pyx_v_l3; - int __pyx_v_ptr1; - int __pyx_v_ptr2; - int __pyx_v_ptr3; - int __pyx_v_is_super; - int __pyx_v_sent_count; - int __pyx_v_max_rank; - struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_darray = 0; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_data = 0; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_queue = 0; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_cost_by_rank = 0; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_count_by_rank = 0; - struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_frequent_patterns = 0; - struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_super_frequent_patterns = 0; - struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_collocations = 0; - struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; - PyObject *__pyx_v_I_set = NULL; - PyObject *__pyx_v_J_set = NULL; - PyObject *__pyx_v_J2_set = NULL; - PyObject *__pyx_v_IJ_set = NULL; - PyObject *__pyx_v_pattern_rank = NULL; - float __pyx_v_start_time; - PyObject *__pyx_v_rank = NULL; - CYTHON_UNUSED PyObject *__pyx_v__ = NULL; - PyObject *__pyx_v_phrase = NULL; - int __pyx_v_sa_word_id; - PyObject *__pyx_v_x = NULL; - PyObject *__pyx_v_pattern1 = NULL; - PyObject *__pyx_v_pattern2 = NULL; - PyObject *__pyx_v_combined_pattern = NULL; - PyObject *__pyx_v_pattern = NULL; - PyObject *__pyx_v_arr = NULL; - PyObject *__pyx_v_s = NULL; - PyObject *__pyx_v_word_id = NULL; - PyObject *__pyx_v_chunk = NULL; - PyObject *__pyx_v_arity = NULL; - PyObject *__pyx_v_cumul_cost = NULL; - PyObject *__pyx_v_cumul_count = NULL; - PyObject *__pyx_v_num_found_patterns = NULL; - float __pyx_v_stop_time; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - 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_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *(*__pyx_t_11)(PyObject *); - int __pyx_t_12; - Py_ssize_t __pyx_t_13; - int __pyx_t_14; - Py_ssize_t __pyx_t_15; - 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 *); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("precompute", 0); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * cdef IntList data, queue, cost_by_rank, count_by_rank - * cdef TrieMap frequent_patterns, super_frequent_patterns, collocations - */ - __pyx_t_1 = ((PyObject *)__pyx_v_sarray->darray); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":285 - * cdef _Trie_Node* node - * - * data = darray.data # <<<<<<<<<<<<<< - * - * frequent_patterns = TrieMap(len(darray.id2word)) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_darray->data); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":287 - * data = darray.data - * - * frequent_patterns = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< - * super_frequent_patterns = TrieMap(len(darray.id2word)) - * collocations = TrieMap(len(darray.id2word)) - */ - __pyx_t_1 = __pyx_v_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[11]; __pyx_lineno = 287; __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[11]; __pyx_lineno = 287; __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[11]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_frequent_patterns = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":288 - * - * frequent_patterns = TrieMap(len(darray.id2word)) - * super_frequent_patterns = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< - * collocations = TrieMap(len(darray.id2word)) - * - */ - __pyx_t_1 = __pyx_v_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[11]; __pyx_lineno = 288; __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[11]; __pyx_lineno = 288; __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[11]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_super_frequent_patterns = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":289 - * frequent_patterns = TrieMap(len(darray.id2word)) - * super_frequent_patterns = TrieMap(len(darray.id2word)) - * collocations = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< - * - * I_set = set() - */ - __pyx_t_1 = __pyx_v_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[11]; __pyx_lineno = 289; __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[11]; __pyx_lineno = 289; __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[11]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_collocations = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":291 - * collocations = TrieMap(len(darray.id2word)) - * - * I_set = set() # <<<<<<<<<<<<<< - * J_set = set() - * J2_set = set() - */ - __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_I_set = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":292 - * - * I_set = set() - * J_set = set() # <<<<<<<<<<<<<< - * J2_set = set() - * IJ_set = set() - */ - __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_J_set = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":293 - * I_set = set() - * J_set = set() - * J2_set = set() # <<<<<<<<<<<<<< - * IJ_set = set() - * pattern_rank = {} - */ - __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_J2_set = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":294 - * J_set = set() - * J2_set = set() - * IJ_set = set() # <<<<<<<<<<<<<< - * pattern_rank = {} - * - */ - __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_IJ_set = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":295 - * J2_set = set() - * IJ_set = set() - * pattern_rank = {} # <<<<<<<<<<<<<< - * - * logger.info("Precomputing frequent intersections") - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_v_pattern_rank = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":297 - * pattern_rank = {} - * - * logger.info("Precomputing frequent intersections") # <<<<<<<<<<<<<< - * cdef float start_time = monitor_cpu() - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 297; __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 = 297; __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_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 297; __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; - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_start_time = __pyx_t_4; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":300 - * cdef float start_time = monitor_cpu() - * - * max_pattern_len = 0 # <<<<<<<<<<<<<< - * for rank, (_, _, phrase) in enumerate(stats): - * if rank >= self.precompute_rank: - */ - __pyx_v_max_pattern_len = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":301 - * - * max_pattern_len = 0 - * for rank, (_, _, phrase) in enumerate(stats): # <<<<<<<<<<<<<< - * if rank >= self.precompute_rank: - * 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; - } 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; - } - 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 - } else { - __pyx_t_6 = __pyx_t_5(__pyx_t_1); - if (unlikely(!__pyx_t_6)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { - PyObject* sequence = __pyx_t_6; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_7 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); - __pyx_t_9 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - #else - __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __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; - } 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_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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); - index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_11 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L6_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v__); - __pyx_v__ = __pyx_t_7; - __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_v__); - __pyx_v__ = __pyx_t_8; - __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_v_phrase); - __pyx_v_phrase = __pyx_t_9; - __pyx_t_9 = 0; - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_rank); - __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; - - /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__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_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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":303 - * for rank, (_, _, phrase) in enumerate(stats): - * if rank >= self.precompute_rank: - * break # <<<<<<<<<<<<<< - * max_pattern_len = max(max_pattern_len, len(phrase)) - * frequent_patterns.insert(phrase) - */ - goto __pyx_L4_break; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":304 - * if rank >= self.precompute_rank: - * break - * max_pattern_len = max(max_pattern_len, len(phrase)) # <<<<<<<<<<<<<< - * frequent_patterns.insert(phrase) - * I_set.add(phrase) - */ - __pyx_t_13 = PyObject_Length(__pyx_v_phrase); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = __pyx_v_max_pattern_len; - if (((__pyx_t_13 > __pyx_t_14) != 0)) { - __pyx_t_15 = __pyx_t_13; - } else { - __pyx_t_15 = __pyx_t_14; - } - __pyx_v_max_pattern_len = __pyx_t_15; - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_9, ((PyObject *)__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_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":306 - * max_pattern_len = max(max_pattern_len, len(phrase)) - * frequent_patterns.insert(phrase) - * I_set.add(phrase) # <<<<<<<<<<<<<< - * pattern_rank[phrase] = rank - * if rank < self.precompute_secondary_rank: - */ - __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;} - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":307 - * frequent_patterns.insert(phrase) - * I_set.add(phrase) - * pattern_rank[phrase] = rank # <<<<<<<<<<<<<< - * if rank < self.precompute_secondary_rank: - * super_frequent_patterns.insert(phrase) - */ - if (PyDict_SetItem(((PyObject *)__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;} - - /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__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; - if (__pyx_t_12) { - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_6, ((PyObject *)__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_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":310 - * if rank < self.precompute_secondary_rank: - * super_frequent_patterns.insert(phrase) - * J_set.add(phrase) # <<<<<<<<<<<<<< - * - * queue = IntList(increment=1000) - */ - __pyx_t_16 = PySet_Add(__pyx_v_J_set, __pyx_v_phrase); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; - } - __pyx_L8:; - } - __pyx_L4_break:; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/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(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); 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(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/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_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_77), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":315 - * - * logger.info(" Computing inverted indexes...") - * N = len(data) # <<<<<<<<<<<<<< - * for i from 0 <= i < N: - * sa_word_id = data.arr[i] - */ - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":316 - * logger.info(" Computing inverted indexes...") - * N = len(data) - * for i from 0 <= i < N: # <<<<<<<<<<<<<< - * sa_word_id = data.arr[i] - * if sa_word_id == 1: - */ - __pyx_t_14 = __pyx_v_N; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_14; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":317 - * N = len(data) - * for i from 0 <= i < N: - * sa_word_id = data.arr[i] # <<<<<<<<<<<<<< - * if sa_word_id == 1: - * queue._append(-1) - */ - __pyx_v_sa_word_id = (__pyx_v_data->arr[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":318 - * for i from 0 <= i < N: - * sa_word_id = data.arr[i] - * if sa_word_id == 1: # <<<<<<<<<<<<<< - * queue._append(-1) - * else: - */ - __pyx_t_12 = ((__pyx_v_sa_word_id == 1) != 0); - if (__pyx_t_12) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":319 - * sa_word_id = data.arr[i] - * if sa_word_id == 1: - * queue._append(-1) # <<<<<<<<<<<<<< - * else: - * for l from 1 <= l <= max_pattern_len: - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, -1); - goto __pyx_L11; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":321 - * queue._append(-1) - * else: - * for l from 1 <= l <= max_pattern_len: # <<<<<<<<<<<<<< - * node = frequent_patterns._contains(data.arr+i, l) - * if node == NULL: - */ - __pyx_t_17 = __pyx_v_max_pattern_len; - for (__pyx_v_l = 1; __pyx_v_l <= __pyx_t_17; __pyx_v_l++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":322 - * else: - * for l from 1 <= l <= max_pattern_len: - * node = frequent_patterns._contains(data.arr+i, l) # <<<<<<<<<<<<<< - * if node == NULL: - * break - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":323 - * for l from 1 <= l <= max_pattern_len: - * node = frequent_patterns._contains(data.arr+i, l) - * if node == NULL: # <<<<<<<<<<<<<< - * break - * queue._append(i) - */ - __pyx_t_12 = ((__pyx_v_node == NULL) != 0); - if (__pyx_t_12) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":324 - * node = frequent_patterns._contains(data.arr+i, l) - * if node == NULL: - * break # <<<<<<<<<<<<<< - * queue._append(i) - * queue._append(l) - */ - goto __pyx_L13_break; - goto __pyx_L14; - } - __pyx_L14:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":325 - * if node == NULL: - * break - * queue._append(i) # <<<<<<<<<<<<<< - * queue._append(l) - * trie_node_data_append(node, i) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_i); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":326 - * break - * queue._append(i) - * queue._append(l) # <<<<<<<<<<<<<< - * trie_node_data_append(node, i) - * - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_l); - - /* "/home/mdenkows/cdec/python/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_L13_break:; - } - __pyx_L11:; - } - - /* "/home/mdenkows/cdec/python/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_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_79), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":330 - * - * logger.info(" Computing collocations...") - * N = len(queue) # <<<<<<<<<<<<<< - * ptr1 = 0 - * sent_count = 0 - */ - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":331 - * logger.info(" Computing collocations...") - * N = len(queue) - * ptr1 = 0 # <<<<<<<<<<<<<< - * sent_count = 0 - * while ptr1 < N: # main loop - */ - __pyx_v_ptr1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":332 - * N = len(queue) - * ptr1 = 0 - * sent_count = 0 # <<<<<<<<<<<<<< - * while ptr1 < N: # main loop - * i1 = queue.arr[ptr1] - */ - __pyx_v_sent_count = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":333 - * ptr1 = 0 - * sent_count = 0 - * while ptr1 < N: # main loop # <<<<<<<<<<<<<< - * i1 = queue.arr[ptr1] - * if i1 > -1: - */ - while (1) { - __pyx_t_12 = ((__pyx_v_ptr1 < __pyx_v_N) != 0); - if (!__pyx_t_12) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":334 - * sent_count = 0 - * while ptr1 < N: # main loop - * i1 = queue.arr[ptr1] # <<<<<<<<<<<<<< - * if i1 > -1: - * l1 = queue.arr[ptr1+1] - */ - __pyx_v_i1 = (__pyx_v_queue->arr[__pyx_v_ptr1]); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":335 - * while ptr1 < N: # main loop - * i1 = queue.arr[ptr1] - * if i1 > -1: # <<<<<<<<<<<<<< - * l1 = queue.arr[ptr1+1] - * ptr2 = ptr1 + 2 - */ - __pyx_t_12 = ((__pyx_v_i1 > -1) != 0); - if (__pyx_t_12) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":336 - * i1 = queue.arr[ptr1] - * if i1 > -1: - * l1 = queue.arr[ptr1+1] # <<<<<<<<<<<<<< - * ptr2 = ptr1 + 2 - * while ptr2 < N: - */ - __pyx_v_l1 = (__pyx_v_queue->arr[(__pyx_v_ptr1 + 1)]); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":337 - * if i1 > -1: - * l1 = queue.arr[ptr1+1] - * ptr2 = ptr1 + 2 # <<<<<<<<<<<<<< - * while ptr2 < N: - * i2 = queue.arr[ptr2] - */ - __pyx_v_ptr2 = (__pyx_v_ptr1 + 2); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":338 - * l1 = queue.arr[ptr1+1] - * ptr2 = ptr1 + 2 - * while ptr2 < N: # <<<<<<<<<<<<<< - * i2 = queue.arr[ptr2] - * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: - */ - while (1) { - __pyx_t_12 = ((__pyx_v_ptr2 < __pyx_v_N) != 0); - if (!__pyx_t_12) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":339 - * ptr2 = ptr1 + 2 - * while ptr2 < N: - * i2 = queue.arr[ptr2] # <<<<<<<<<<<<<< - * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: - * break - */ - __pyx_v_i2 = (__pyx_v_queue->arr[__pyx_v_ptr2]); - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_19 = __pyx_t_12; - } - if (__pyx_t_19) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":341 - * i2 = queue.arr[ptr2] - * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: - * break # <<<<<<<<<<<<<< - * l2 = queue.arr[ptr2+1] - * if (i2 - i1 - l1 >= self.train_min_gap_size and - */ - goto __pyx_L19_break; - goto __pyx_L20; - } - __pyx_L20:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":342 - * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: - * 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 - */ - __pyx_v_l2 = (__pyx_v_queue->arr[(__pyx_v_ptr2 + 1)]); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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; - } - if (__pyx_t_12) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * node = trie_insert(node, -1) - * for i from i2 <= i < i2+l2: - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":347 - * l1+l2+1 <= self.max_length): - * node = collocations._insert(data.arr+i1, l1) - * node = trie_insert(node, -1) # <<<<<<<<<<<<<< - * for i from i2 <= i < i2+l2: - * node = trie_insert(node, data.arr[i]) - */ - __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":348 - * node = collocations._insert(data.arr+i1, l1) - * node = trie_insert(node, -1) - * for i from i2 <= i < i2+l2: # <<<<<<<<<<<<<< - * node = trie_insert(node, data.arr[i]) - * trie_node_data_append(node, i1) - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":349 - * node = trie_insert(node, -1) - * 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) - */ - __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); - } - - /* "/home/mdenkows/cdec/python/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; - - /* "/home/mdenkows/cdec/python/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; - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * if super_frequent_patterns._contains(data.arr+i1, l1) != NULL: - * is_super = 1 - */ - __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) { - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * is_super = 1 - * else: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * else: - * is_super = 0 - */ - __pyx_v_is_super = 1; - goto __pyx_L25; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":356 - * is_super = 1 - * else: - * is_super = 0 # <<<<<<<<<<<<<< - * ptr3 = ptr2 + 2 - * while ptr3 < N: - */ - __pyx_v_is_super = 0; - } - __pyx_L25:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":357 - * else: - * is_super = 0 - * ptr3 = ptr2 + 2 # <<<<<<<<<<<<<< - * while ptr3 < N: - * i3 = queue.arr[ptr3] - */ - __pyx_v_ptr3 = (__pyx_v_ptr2 + 2); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":358 - * is_super = 0 - * ptr3 = ptr2 + 2 - * while ptr3 < N: # <<<<<<<<<<<<<< - * i3 = queue.arr[ptr3] - * if i3 == -1 or i3 - i1 >= self.train_max_initial_size: - */ - while (1) { - __pyx_t_12 = ((__pyx_v_ptr3 < __pyx_v_N) != 0); - if (!__pyx_t_12) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":359 - * ptr3 = ptr2 + 2 - * while ptr3 < N: - * i3 = queue.arr[ptr3] # <<<<<<<<<<<<<< - * if i3 == -1 or i3 - i1 >= self.train_max_initial_size: - * break - */ - __pyx_v_i3 = (__pyx_v_queue->arr[__pyx_v_ptr3]); - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_20 = __pyx_t_12; - } - if (__pyx_t_20) { - - /* "/home/mdenkows/cdec/python/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_L28; - } - __pyx_L28:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":362 - * 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 - * i3 + l3 - i1 <= self.train_max_initial_size and - */ - __pyx_v_l3 = (__pyx_v_queue->arr[(__pyx_v_ptr3 + 1)]); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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; - } - if (__pyx_t_12) { - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_20 = (__pyx_v_is_super != 0); - } - if (__pyx_t_20) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * node = trie_insert(node, -1) - * for i from i2 <= i < i2+l2: - */ - __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); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * for i from i2 <= i < i2+l2: - * node = trie_insert(node, data.arr[i]) - */ - __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":369 - * node = collocations._insert(data.arr+i1, l1) - * node = trie_insert(node, -1) - * for i from i2 <= i < i2+l2: # <<<<<<<<<<<<<< - * node = trie_insert(node, data.arr[i]) - * node = trie_insert(node, -1) - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":370 - * node = trie_insert(node, -1) - * for i from i2 <= i < i2+l2: - * node = trie_insert(node, data.arr[i]) # <<<<<<<<<<<<<< - * node = trie_insert(node, -1) - * for i from i3 <= i < i3+l3: - */ - __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":371 - * for i from i2 <= i < i2+l2: - * node = trie_insert(node, data.arr[i]) - * node = trie_insert(node, -1) # <<<<<<<<<<<<<< - * for i from i3 <= i < i3+l3: - * node = trie_insert(node, data.arr[i]) - */ - __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":372 - * node = trie_insert(node, data.arr[i]) - * node = trie_insert(node, -1) - * for i from i3 <= i < i3+l3: # <<<<<<<<<<<<<< - * node = trie_insert(node, data.arr[i]) - * trie_node_data_append(node, i1) - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":373 - * node = trie_insert(node, -1) - * 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) - */ - __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); - } - - /* "/home/mdenkows/cdec/python/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; - - /* "/home/mdenkows/cdec/python/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; - - /* "/home/mdenkows/cdec/python/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_L30:; - goto __pyx_L29; - } - __pyx_L29:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":377 - * trie_node_data_append(node, i2) - * trie_node_data_append(node, i3) - * ptr3 = ptr3 + 2 # <<<<<<<<<<<<<< - * ptr2 = ptr2 + 2 - * ptr1 = ptr1 + 2 - */ - __pyx_v_ptr3 = (__pyx_v_ptr3 + 2); - } - __pyx_L27_break:; - goto __pyx_L24; - } - __pyx_L24:; - goto __pyx_L21; - } - __pyx_L21:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":378 - * trie_node_data_append(node, i3) - * ptr3 = ptr3 + 2 - * ptr2 = ptr2 + 2 # <<<<<<<<<<<<<< - * ptr1 = ptr1 + 2 - * else: - */ - __pyx_v_ptr2 = (__pyx_v_ptr2 + 2); - } - __pyx_L19_break:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":379 - * ptr3 = ptr3 + 2 - * ptr2 = ptr2 + 2 - * ptr1 = ptr1 + 2 # <<<<<<<<<<<<<< - * else: - * sent_count = sent_count + 1 - */ - __pyx_v_ptr1 = (__pyx_v_ptr1 + 2); - goto __pyx_L17; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":381 - * ptr1 = ptr1 + 2 - * else: - * sent_count = sent_count + 1 # <<<<<<<<<<<<<< - * if sent_count % 10000 == 0: - * logger.debug(" %d sentences", sent_count) - */ - __pyx_v_sent_count = (__pyx_v_sent_count + 1); - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":383 - * sent_count = sent_count + 1 - * if sent_count % 10000 == 0: - * logger.debug(" %d sentences", sent_count) # <<<<<<<<<<<<<< - * ptr1 = ptr1 + 1 - * - */ - __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__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_INCREF(((PyObject *)__pyx_kp_s_80)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_80)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_80)); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L35; - } - __pyx_L35:; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":384 - * if sent_count % 10000 == 0: - * logger.debug(" %d sentences", sent_count) - * ptr1 = ptr1 + 1 # <<<<<<<<<<<<<< - * - * self.precomputed_collocations = collocations.toMap(False) - */ - __pyx_v_ptr1 = (__pyx_v_ptr1 + 1); - } - __pyx_L17:; - } - - /* "/home/mdenkows/cdec/python/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_PyBool_FromLong(0); 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_t_3 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_9); - __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; - - /* "/home/mdenkows/cdec/python/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_3 = __Pyx_PyBool_FromLong(1); 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_t_1 = PyTuple_New(1); 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); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), 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_9); __pyx_t_9 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":389 - * self.precomputed_index = frequent_patterns.toMap(True) - * - * x = 0 # <<<<<<<<<<<<<< - * for pattern1 in J_set: - * for pattern2 in J_set: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_x = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/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_3 = PyObject_GetIter(((PyObject *)__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_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - for (;;) { - { - __pyx_t_1 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_pattern1); - __pyx_v_pattern1 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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_1 = PyObject_GetIter(((PyObject *)__pyx_v_J_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_21 = Py_TYPE(__pyx_t_1)->tp_iternext; - for (;;) { - { - __pyx_t_9 = __pyx_t_21(__pyx_t_1); - if (unlikely(!__pyx_t_9)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_9); - } - __Pyx_XDECREF(__pyx_v_pattern2); - __pyx_v_pattern2 = __pyx_t_9; - __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":392 - * for pattern1 in J_set: - * 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_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) { - - /* "/home/mdenkows/cdec/python/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_9 = PyNumber_Add(__pyx_v_pattern1, ((PyObject *)__pyx_k_tuple_81)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyNumber_Add(__pyx_t_9, __pyx_v_pattern2); 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_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_v_combined_pattern); - __pyx_v_combined_pattern = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":394 - * if len(pattern1) + len(pattern2) + 1 < self.max_length: - * combined_pattern = pattern1 + (-1,) + pattern2 - * J2_set.add(combined_pattern) # <<<<<<<<<<<<<< - * - * 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; - } - __pyx_L40:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/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_3 = PyObject_GetIter(((PyObject *)__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_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - for (;;) { - { - __pyx_t_1 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_pattern1); - __pyx_v_pattern1 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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_1 = PyObject_GetIter(((PyObject *)__pyx_v_I_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_21 = Py_TYPE(__pyx_t_1)->tp_iternext; - for (;;) { - { - __pyx_t_8 = __pyx_t_21(__pyx_t_1); - if (unlikely(!__pyx_t_8)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF(__pyx_v_pattern2); - __pyx_v_pattern2 = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/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(__pyx_v_x); - __pyx_v_x = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":399 - * for pattern2 in I_set: - * x = x+1 - * if len(pattern1) + len(pattern2) + 1 <= self.max_length: # <<<<<<<<<<<<<< - * combined_pattern = pattern1 + (-1,) + pattern2 - * IJ_set.add(combined_pattern) - */ - __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) { - - /* "/home/mdenkows/cdec/python/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, ((PyObject *)__pyx_k_tuple_82)); 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_9 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_v_combined_pattern); - __pyx_v_combined_pattern = __pyx_t_9; - __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":401 - * if len(pattern1) + len(pattern2) + 1 <= self.max_length: - * combined_pattern = pattern1 + (-1,) + pattern2 - * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< - * - * 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; - } - __pyx_L45:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/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_3 = PyObject_GetIter(((PyObject *)__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_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - for (;;) { - { - __pyx_t_1 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_pattern1); - __pyx_v_pattern1 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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_1 = PyObject_GetIter(((PyObject *)__pyx_v_J2_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_21 = Py_TYPE(__pyx_t_1)->tp_iternext; - for (;;) { - { - __pyx_t_9 = __pyx_t_21(__pyx_t_1); - if (unlikely(!__pyx_t_9)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_9); - } - __Pyx_XDECREF(__pyx_v_pattern2); - __pyx_v_pattern2 = __pyx_t_9; - __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/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_9 = PyNumber_Add(__pyx_v_x, __pyx_int_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_t_9; - __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":406 - * for pattern2 in J2_set: - * x = x+2 - * if len(pattern1) + len(pattern2) + 1<= self.max_length: # <<<<<<<<<<<<<< - * combined_pattern = pattern1 + (-1,) + pattern2 - * IJ_set.add(combined_pattern) - */ - __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) { - - /* "/home/mdenkows/cdec/python/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_9 = PyNumber_Add(__pyx_v_pattern1, ((PyObject *)__pyx_k_tuple_83)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyNumber_Add(__pyx_t_9, __pyx_v_pattern2); 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_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_v_combined_pattern); - __pyx_v_combined_pattern = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":408 - * if len(pattern1) + len(pattern2) + 1<= self.max_length: - * combined_pattern = pattern1 + (-1,) + pattern2 - * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< - * combined_pattern = pattern2 + (-1,) + pattern1 - * IJ_set.add(combined_pattern) - */ - __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;} - - /* "/home/mdenkows/cdec/python/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, ((PyObject *)__pyx_k_tuple_84)); 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_9 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_v_combined_pattern); - __pyx_v_combined_pattern = __pyx_t_9; - __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":410 - * IJ_set.add(combined_pattern) - * combined_pattern = pattern2 + (-1,) + pattern1 - * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< - * - * 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; - } - __pyx_L50:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":412 - * IJ_set.add(combined_pattern) - * - * N = len(pattern_rank) # <<<<<<<<<<<<<< - * cost_by_rank = IntList(initial_len=N) - * count_by_rank = IntList(initial_len=N) - */ - __pyx_t_15 = PyDict_Size(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/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_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(((PyObject *)__pyx_t_3)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_N); 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); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_cost_by_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyInt_FromLong(__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_1, ((PyObject *)__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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); 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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_count_by_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/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(): # <<<<<<<<<<<<<< - * if pattern not in IJ_set: - * s = "" - */ - __pyx_t_15 = 0; - if (unlikely(__pyx_v_self->precomputed_collocations == Py_None)) { - 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_1 = __Pyx_dict_iterator(__pyx_v_self->precomputed_collocations, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_2), (&__pyx_t_14)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_1; - __pyx_t_1 = 0; - while (1) { - __pyx_t_17 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_2, &__pyx_t_15, &__pyx_t_1, &__pyx_t_9, 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_1); - __Pyx_GOTREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_9; - __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/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, ((PyObject *)__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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":417 - * for pattern, arr in self.precomputed_collocations.iteritems(): - * if pattern not in IJ_set: - * s = "" # <<<<<<<<<<<<<< - * for word_id in pattern: - * if word_id == -1: - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_47)); - __Pyx_XDECREF(__pyx_v_s); - __pyx_v_s = ((PyObject *)__pyx_kp_s_47); - - /* "/home/mdenkows/cdec/python/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_9 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_9); __pyx_t_13 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_13 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = Py_TYPE(__pyx_t_9)->tp_iternext; - } - for (;;) { - if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_9)) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_9)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __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_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__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_9)) { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_9)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __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_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_9); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":419 - * s = "" - * for word_id in pattern: - * if word_id == -1: # <<<<<<<<<<<<<< - * s = s + "X " - * else: - */ - __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 = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); 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_1); __pyx_t_1 = 0; - if (__pyx_t_12) { - - /* "/home/mdenkows/cdec/python/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_1 = PyNumber_Add(__pyx_v_s, ((PyObject *)__pyx_kp_s_85)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_s); - __pyx_v_s = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L56; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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_1 = PyObject_GetItem(__pyx_v_darray->id2word, __pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyNumber_Add(__pyx_v_s, __pyx_t_1); 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_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_8, ((PyObject *)__pyx_kp_s_69)); 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_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_v_s); - __pyx_v_s = __pyx_t_1; - __pyx_t_1 = 0; - } - __pyx_L56:; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/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_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __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_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(2); 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_INCREF(((PyObject *)__pyx_kp_s_86)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_86)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_86)); - __Pyx_INCREF(__pyx_v_s); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_s); - __Pyx_GIVEREF(__pyx_v_s); - __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L53; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":425 - * logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s) - * else: - * chunk = () # <<<<<<<<<<<<<< - * max_rank = 0 - * arity = 0 - */ - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - __Pyx_XDECREF(((PyObject *)__pyx_v_chunk)); - __pyx_v_chunk = __pyx_empty_tuple; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":426 - * else: - * chunk = () - * max_rank = 0 # <<<<<<<<<<<<<< - * arity = 0 - * for word_id in pattern: - */ - __pyx_v_max_rank = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":427 - * chunk = () - * max_rank = 0 - * arity = 0 # <<<<<<<<<<<<<< - * for word_id in pattern: - * if word_id == -1: - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_XDECREF(__pyx_v_arity); - __pyx_v_arity = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/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)) { - __pyx_t_8 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_8); __pyx_t_13 = 0; - __pyx_t_5 = 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; - } - 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_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __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_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__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_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __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_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_9 = __pyx_t_5(__pyx_t_8); - if (unlikely(!__pyx_t_9)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_9); - } - __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_9; - __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/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_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 = 429; __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 = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_12) { - - /* "/home/mdenkows/cdec/python/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_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_17 = __pyx_v_max_rank; - __pyx_t_6 = PyInt_FromLong(__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_9, __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_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_12) { - __Pyx_INCREF(__pyx_t_9); - __pyx_t_1 = __pyx_t_9; - } else { - __pyx_t_7 = PyInt_FromLong(__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_1 = __pyx_t_7; - __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_1); 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_1); __pyx_t_1 = 0; - __pyx_v_max_rank = __pyx_t_17; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":431 - * if word_id == -1: - * max_rank = max(max_rank, pattern_rank[chunk]) - * arity = arity + 1 # <<<<<<<<<<<<<< - * chunk = () - * else: - */ - __pyx_t_1 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_arity); - __pyx_v_arity = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":432 - * max_rank = max(max_rank, pattern_rank[chunk]) - * arity = arity + 1 - * chunk = () # <<<<<<<<<<<<<< - * else: - * chunk = chunk + (word_id,) - */ - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - __Pyx_DECREF(((PyObject *)__pyx_v_chunk)); - __pyx_v_chunk = __pyx_empty_tuple; - goto __pyx_L59; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":434 - * chunk = () - * else: - * 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)) - */ - __pyx_t_1 = PyTuple_New(1); 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_INCREF(__pyx_v_word_id); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_word_id); - __Pyx_GIVEREF(__pyx_v_word_id); - __pyx_t_9 = PyNumber_Add(((PyObject *)__pyx_v_chunk), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_chunk)); - __pyx_v_chunk = ((PyObject*)__pyx_t_9); - __pyx_t_9 = 0; - } - __pyx_L59:; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":435 - * else: - * 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)) - * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) - */ - __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_17 = __pyx_v_max_rank; - __pyx_t_1 = PyInt_FromLong(__pyx_t_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_t_1, 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_1); __pyx_t_1 = 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_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_12) { - __Pyx_INCREF(__pyx_t_8); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_7 = PyInt_FromLong(__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_9 = __pyx_t_7; - __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_9); 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_9); __pyx_t_9 = 0; - __pyx_v_max_rank = __pyx_t_17; - - /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< - * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) - * - */ - __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)); - - /* "/home/mdenkows/cdec/python/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_9 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_max_rank])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __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); - __pyx_t_7 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); 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_t_1 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_7); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_9, __pyx_t_1); 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_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_17 = __Pyx_PyInt_AsInt(__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":439 - * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) - * - * cumul_cost = 0 # <<<<<<<<<<<<<< - * cumul_count = 0 - * for i from 0 <= i < N: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_cumul_cost = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":440 - * - * cumul_cost = 0 - * cumul_count = 0 # <<<<<<<<<<<<<< - * for i from 0 <= i < N: - * cumul_cost = cumul_cost + cost_by_rank.arr[i] - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_cumul_count = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":441 - * cumul_cost = 0 - * 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] - */ - __pyx_t_14 = __pyx_v_N; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_14; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/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_3 = PyInt_FromLong((__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_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_cumul_cost); - __pyx_v_cumul_cost = __pyx_t_7; - __pyx_t_7 = 0; - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * 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_7 = PyInt_FromLong((__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_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(__pyx_v_cumul_count); - __pyx_v_cumul_count = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __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_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromLong(__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_1 = PyInt_FromLong((__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_9 = PyInt_FromLong((__pyx_v_cost_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_GOTREF(__pyx_t_9); - __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_GOTREF(__pyx_t_8); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_87)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_87)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_87)); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_cumul_count); - PyTuple_SET_ITEM(__pyx_t_8, 4, __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); - __Pyx_GIVEREF(__pyx_v_cumul_cost); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); 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_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * for pattern in IJ_set: - * if pattern not in self.precomputed_collocations: - */ - __pyx_t_9 = __pyx_v_self->precomputed_collocations; - __Pyx_INCREF(__pyx_t_9); - __pyx_t_2 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_v_num_found_patterns = __pyx_t_9; - __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/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_t_9 = PyObject_GetIter(((PyObject *)__pyx_v_IJ_set)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = Py_TYPE(__pyx_t_9)->tp_iternext; - for (;;) { - { - __pyx_t_8 = __pyx_t_5(__pyx_t_9); - if (unlikely(!__pyx_t_8)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__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 (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_L64:; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - - /* "/home/mdenkows/cdec/python/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_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_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__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_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; - - /* "/home/mdenkows/cdec/python/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_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__info); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __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_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 = PyTuple_New(4); 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_INCREF(((PyObject *)__pyx_kp_s_88)); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_88)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_88)); - __Pyx_INCREF(__pyx_v_num_found_patterns); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_num_found_patterns); - __Pyx_GIVEREF(__pyx_v_num_found_patterns); - PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_7), NULL); 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_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __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_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __pyx_v_self->precomputed_index; - __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 = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(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_INCREF(((PyObject *)__pyx_kp_s_89)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_89)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_89)); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __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_8); __pyx_t_8 = 0; - __pyx_t_8 = PyFloat_FromDouble((__pyx_v_stop_time - __pyx_v_start_time)); 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); - __pyx_t_7 = PyTuple_New(2); 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_INCREF(((PyObject *)__pyx_kp_s_90)); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_90)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_90)); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_7), NULL); 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); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("cdec.sa._sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_darray); - __Pyx_XDECREF((PyObject *)__pyx_v_data); - __Pyx_XDECREF((PyObject *)__pyx_v_queue); - __Pyx_XDECREF((PyObject *)__pyx_v_cost_by_rank); - __Pyx_XDECREF((PyObject *)__pyx_v_count_by_rank); - __Pyx_XDECREF((PyObject *)__pyx_v_frequent_patterns); - __Pyx_XDECREF((PyObject *)__pyx_v_super_frequent_patterns); - __Pyx_XDECREF((PyObject *)__pyx_v_collocations); - __Pyx_XDECREF(__pyx_v_I_set); - __Pyx_XDECREF(__pyx_v_J_set); - __Pyx_XDECREF(__pyx_v_J2_set); - __Pyx_XDECREF(__pyx_v_IJ_set); - __Pyx_XDECREF(__pyx_v_pattern_rank); - __Pyx_XDECREF(__pyx_v_rank); - __Pyx_XDECREF(__pyx_v__); - __Pyx_XDECREF(__pyx_v_phrase); - __Pyx_XDECREF(__pyx_v_x); - __Pyx_XDECREF(__pyx_v_pattern1); - __Pyx_XDECREF(__pyx_v_pattern2); - __Pyx_XDECREF(__pyx_v_combined_pattern); - __Pyx_XDECREF(__pyx_v_pattern); - __Pyx_XDECREF(__pyx_v_arr); - __Pyx_XDECREF(__pyx_v_s); - __Pyx_XDECREF(__pyx_v_word_id); - __Pyx_XDECREF(__pyx_v_chunk); - __Pyx_XDECREF(__pyx_v_arity); - __Pyx_XDECREF(__pyx_v_cumul_cost); - __Pyx_XDECREF(__pyx_v_cumul_count); - __Pyx_XDECREF(__pyx_v_num_found_patterns); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_from_binary = 0; - PyObject *__pyx_v_from_text = 0; - PyObject *__pyx_v_side = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__side,0}; - PyObject* values[3] = {0,0,0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":11 - * cdef IntList ha - * - * def __cinit__(self, from_binary=None, from_text=None, side=None): # <<<<<<<<<<<<<< - * self.darray = DataArray() - * self.sa = IntList() - */ - values[0] = ((PyObject *)Py_None); - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__from_binary); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_text); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side); - if (value) { values[2] = 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[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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_from_binary = values[0]; - __pyx_v_from_text = values[1]; - __pyx_v_side = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_side); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - 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("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":12 - * - * def __cinit__(self, from_binary=None, from_text=None, side=None): - * self.darray = DataArray() # <<<<<<<<<<<<<< - * self.sa = IntList() - * self.ha = IntList() - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->darray); - __Pyx_DECREF(((PyObject *)__pyx_v_self->darray)); - __pyx_v_self->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":13 - * def __cinit__(self, from_binary=None, from_text=None, side=None): - * self.darray = DataArray() - * self.sa = IntList() # <<<<<<<<<<<<<< - * self.ha = IntList() - * if from_binary: - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->sa); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); - __pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":14 - * self.darray = DataArray() - * self.sa = IntList() - * self.ha = IntList() # <<<<<<<<<<<<<< - * if from_binary: - * self.read_binary(from_binary) - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->ha); - __Pyx_DECREF(((PyObject *)__pyx_v_self->ha)); - __pyx_v_self->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":15 - * self.sa = IntList() - * self.ha = IntList() - * if from_binary: # <<<<<<<<<<<<<< - * self.read_binary(from_binary) - * elif from_text: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":17 - * if from_binary: - * self.read_binary(from_binary) - * elif from_text: # <<<<<<<<<<<<<< - * self.read_text(from_text, side) - * - */ - __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) { - - /* "/home/mdenkows/cdec/python/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_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_INCREF(__pyx_v_side); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_side); - __Pyx_GIVEREF(__pyx_v_side); - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":20 - * self.read_text(from_text, side) - * - * def __getitem__(self, i): # <<<<<<<<<<<<<< - * return self.sa.arr[i] - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getitem__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":21 - * - * def __getitem__(self, i): - * return self.sa.arr[i] # <<<<<<<<<<<<<< - * - * def read_text(self, filename, side): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong((__pyx_v_self->sa->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 21; __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; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4cdec_2sa_3_sa_11SuffixArray_4read_text[] = "Constructs suffix array using the algorithm\n of Larsson & Sadahkane (1999)"; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_filename = 0; - PyObject *__pyx_v_side = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_text (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__side,0}; - PyObject* values[2] = {0,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__filename)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("read_text", 1, 2, 2, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_text") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_filename = values[0]; - __pyx_v_side = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_text", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_filename, __pyx_v_side); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":23 - * return self.sa.arr[i] - * - * def read_text(self, filename, side): # <<<<<<<<<<<<<< - * '''Constructs suffix array using the algorithm - * of Larsson & Sadahkane (1999)''' - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_side) { - int __pyx_v_V; - int __pyx_v_N; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_h; - int __pyx_v_a_i; - int __pyx_v_n; - int __pyx_v_current_run; - int __pyx_v_skip; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa = 0; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_word_count = 0; - float __pyx_v_sort_start_time; - float __pyx_v_start_time; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - 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; - int __pyx_t_8; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_text", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":29 - * cdef IntList isa, word_count - * - * self.darray = DataArray(from_text=filename, side=side, use_sent_id=True) # <<<<<<<<<<<<<< - * N = len(self.darray) - * V = len(self.darray.id2word) - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__from_text), __pyx_v_filename) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__side), __pyx_v_side) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__use_sent_id), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->darray); - __Pyx_DECREF(((PyObject *)__pyx_v_self->darray)); - __pyx_v_self->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":30 - * - * self.darray = DataArray(from_text=filename, side=side, use_sent_id=True) - * N = len(self.darray) # <<<<<<<<<<<<<< - * V = len(self.darray.id2word) - * - */ - __pyx_t_2 = ((PyObject *)__pyx_v_self->darray); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_N = __pyx_t_3; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * self.sa = IntList(initial_len=N) - */ - __pyx_t_2 = __pyx_v_self->darray->id2word; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_V = __pyx_t_3; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":33 - * V = len(self.darray.id2word) - * - * self.sa = IntList(initial_len=N) # <<<<<<<<<<<<<< - * self.ha = IntList(initial_len=V+1) - * - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->sa); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); - __pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":34 - * - * self.sa = IntList(initial_len=N) - * self.ha = IntList(initial_len=V+1) # <<<<<<<<<<<<<< - * - * isa = IntList(initial_len=N) - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong((__pyx_v_V + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->ha); - __Pyx_DECREF(((PyObject *)__pyx_v_self->ha)); - __pyx_v_self->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":36 - * self.ha = IntList(initial_len=V+1) - * - * isa = IntList(initial_len=N) # <<<<<<<<<<<<<< - * word_count = IntList(initial_len=V+1) - * - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_isa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":37 - * - * isa = IntList(initial_len=N) - * word_count = IntList(initial_len=V+1) # <<<<<<<<<<<<<< - * - * '''Step 1: bucket sort data''' - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong((__pyx_v_V + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_word_count = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_sort_start_time = __pyx_t_4; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * for i from 0 <= i < N: - * a_i = self.darray.data.arr[i] - */ - __pyx_v_start_time = __pyx_v_sort_start_time; - - /* "/home/mdenkows/cdec/python/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++) { - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * word_count.arr[a_i] = word_count.arr[a_i] + 1 - * - */ - __pyx_v_a_i = (__pyx_v_self->darray->data->arr[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * - * n = 0 - */ - (__pyx_v_word_count->arr[__pyx_v_a_i]) = ((__pyx_v_word_count->arr[__pyx_v_a_i]) + 1); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":46 - * word_count.arr[a_i] = word_count.arr[a_i] + 1 - * - * n = 0 # <<<<<<<<<<<<<< - * for i from 0 <= i < V+1: - * self.ha.arr[i] = n - */ - __pyx_v_n = 0; - - /* "/home/mdenkows/cdec/python/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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":48 - * n = 0 - * for i from 0 <= i < V+1: - * self.ha.arr[i] = n # <<<<<<<<<<<<<< - * n = n + word_count.arr[i] - * word_count.arr[i] = 0 - */ - (__pyx_v_self->ha->arr[__pyx_v_i]) = __pyx_v_n; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":49 - * for i from 0 <= i < V+1: - * self.ha.arr[i] = n - * n = n + word_count.arr[i] # <<<<<<<<<<<<<< - * word_count.arr[i] = 0 - * - */ - __pyx_v_n = (__pyx_v_n + (__pyx_v_word_count->arr[__pyx_v_i])); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":50 - * self.ha.arr[i] = n - * n = n + word_count.arr[i] - * word_count.arr[i] = 0 # <<<<<<<<<<<<<< - * - * for i from 0 <= i < N: - */ - (__pyx_v_word_count->arr[__pyx_v_i]) = 0; - } - - /* "/home/mdenkows/cdec/python/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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":53 - * - * 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 - * isa.arr[i] = self.ha.arr[a_i + 1] - 1 # bucket pointer is last index in bucket - */ - __pyx_v_a_i = (__pyx_v_self->darray->data->arr[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * 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 - */ - (__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; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * word_count.arr[a_i] = word_count.arr[a_i] + 1 - * - */ - (__pyx_v_isa->arr[__pyx_v_i]) = ((__pyx_v_self->ha->arr[(__pyx_v_a_i + 1)]) - 1); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * - * '''Determine size of initial runs''' - */ - (__pyx_v_word_count->arr[__pyx_v_a_i]) = ((__pyx_v_word_count->arr[__pyx_v_a_i]) + 1); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":59 - * - * '''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: - */ - __pyx_v_current_run = 0; - - /* "/home/mdenkows/cdec/python/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++) { - - /* "/home/mdenkows/cdec/python/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; - } else { - __pyx_t_9 = __pyx_t_7; - } - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * else: - * if current_run > 0: - */ - __pyx_v_current_run = (__pyx_v_current_run + 1); - goto __pyx_L11; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":65 - * else: - * if current_run > 0: - * self.sa.arr[self.ha.arr[i] - current_run] = -current_run # <<<<<<<<<<<<<< - * current_run = 0 - * - */ - (__pyx_v_self->sa->arr[((__pyx_v_self->ha->arr[__pyx_v_i]) - __pyx_v_current_run)]) = (-__pyx_v_current_run); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":66 - * if current_run > 0: - * self.sa.arr[self.ha.arr[i] - current_run] = -current_run - * current_run = 0 # <<<<<<<<<<<<<< - * - * logger.info(" Bucket sort took %f seconds", (monitor_cpu() - sort_start_time)) - */ - __pyx_v_current_run = 0; - goto __pyx_L12; - } - __pyx_L12:; - } - __pyx_L11:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":68 - * current_run = 0 - * - * logger.info(" Bucket sort took %f seconds", (monitor_cpu() - sort_start_time)) # <<<<<<<<<<<<<< - * - * '''Step 2: prefix-doubling sort''' - */ - __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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_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_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_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_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_91)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_91)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_91)); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":71 - * - * '''Step 2: prefix-doubling sort''' - * h = 1 # <<<<<<<<<<<<<< - * while self.sa.arr[0] != -N: - * sort_start_time = monitor_cpu() - */ - __pyx_v_h = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":72 - * '''Step 2: prefix-doubling sort''' - * h = 1 - * while self.sa.arr[0] != -N: # <<<<<<<<<<<<<< - * sort_start_time = monitor_cpu() - * 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; - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_11, ((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__pyx_v_h); 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_INCREF(((PyObject *)__pyx_kp_s_92)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_92)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__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(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":75 - * sort_start_time = monitor_cpu() - * logger.debug(" Refining, sort depth = %d", h) - * i = 0 # <<<<<<<<<<<<<< - * skip = 0 - * while i < N: - */ - __pyx_v_i = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":76 - * logger.debug(" Refining, sort depth = %d", h) - * i = 0 - * skip = 0 # <<<<<<<<<<<<<< - * while i < N: - * if self.sa.arr[i] < 0: - */ - __pyx_v_skip = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":77 - * i = 0 - * skip = 0 - * while i < N: # <<<<<<<<<<<<<< - * if self.sa.arr[i] < 0: - * skip = skip + self.sa.arr[i] - */ - while (1) { - __pyx_t_9 = ((__pyx_v_i < __pyx_v_N) != 0); - if (!__pyx_t_9) break; - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":79 - * while i < N: - * if self.sa.arr[i] < 0: - * skip = skip + self.sa.arr[i] # <<<<<<<<<<<<<< - * i = i - self.sa.arr[i] - * else: - */ - __pyx_v_skip = (__pyx_v_skip + (__pyx_v_self->sa->arr[__pyx_v_i])); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":80 - * if self.sa.arr[i] < 0: - * skip = skip + self.sa.arr[i] - * i = i - self.sa.arr[i] # <<<<<<<<<<<<<< - * else: - * if skip < 0: - */ - __pyx_v_i = (__pyx_v_i - (__pyx_v_self->sa->arr[__pyx_v_i])); - goto __pyx_L17; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":83 - * else: - * if skip < 0: - * self.sa.arr[i+skip] = skip # <<<<<<<<<<<<<< - * skip = 0 - * j = isa.arr[self.sa.arr[i]] - */ - (__pyx_v_self->sa->arr[(__pyx_v_i + __pyx_v_skip)]) = __pyx_v_skip; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":84 - * if skip < 0: - * self.sa.arr[i+skip] = skip - * skip = 0 # <<<<<<<<<<<<<< - * j = isa.arr[self.sa.arr[i]] - * self.q3sort(i, j, h, isa) - */ - __pyx_v_skip = 0; - goto __pyx_L18; - } - __pyx_L18:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":85 - * self.sa.arr[i+skip] = skip - * skip = 0 - * j = isa.arr[self.sa.arr[i]] # <<<<<<<<<<<<<< - * self.q3sort(i, j, h, isa) - * i = j+1 - */ - __pyx_v_j = (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_i])]); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":86 - * skip = 0 - * j = isa.arr[self.sa.arr[i]] - * self.q3sort(i, j, h, isa) # <<<<<<<<<<<<<< - * i = j+1 - * if skip < 0: - */ - __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 = PyInt_FromLong(__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 = PyInt_FromLong(__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 = PyInt_FromLong(__pyx_v_h); 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_GIVEREF(__pyx_t_10); - __Pyx_INCREF(((PyObject *)__pyx_v_isa)); - PyTuple_SET_ITEM(__pyx_t_12, 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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":87 - * j = isa.arr[self.sa.arr[i]] - * self.q3sort(i, j, h, isa) - * i = j+1 # <<<<<<<<<<<<<< - * if skip < 0: - * self.sa.arr[i+skip] = skip - */ - __pyx_v_i = (__pyx_v_j + 1); - } - __pyx_L17:; - } - - /* "/home/mdenkows/cdec/python/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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":89 - * i = j+1 - * if skip < 0: - * self.sa.arr[i+skip] = skip # <<<<<<<<<<<<<< - * h = h * 2 - * 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; - } - __pyx_L19:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":90 - * if skip < 0: - * self.sa.arr[i+skip] = skip - * h = h * 2 # <<<<<<<<<<<<<< - * logger.debug(" Refinement took %f seconds", (monitor_cpu() - sort_start_time)) - * - */ - __pyx_v_h = (__pyx_v_h * 2); - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_10, ((PyObject *)__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_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_GOTREF(__pyx_t_11); - __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_INCREF(((PyObject *)__pyx_kp_s_93)); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_kp_s_93)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_93)); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__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(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_95), 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; - - /* "/home/mdenkows/cdec/python/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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":96 - * logger.info(" Finalizing sort...") - * for i from 0 <= i < N: - * j = isa.arr[i] # <<<<<<<<<<<<<< - * self.sa.arr[j] = i - * logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time)) - */ - __pyx_v_j = (__pyx_v_isa->arr[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":97 - * for i from 0 <= i < N: - * j = isa.arr[i] - * self.sa.arr[j] = i # <<<<<<<<<<<<<< - * logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time)) - * - */ - (__pyx_v_self->sa->arr[__pyx_v_j]) = __pyx_v_i; - } - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_11, ((PyObject *)__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_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_GOTREF(__pyx_t_11); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_96)); - PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_kp_s_96)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_96)); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__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(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - __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_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_isa); - __Pyx_XDECREF((PyObject *)__pyx_v_word_count); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4cdec_2sa_3_sa_11SuffixArray_6q3sort[] = "This is a ternary quicksort. It divides the array into\n three partitions: items less than the pivot, items equal\n to pivot, and items greater than pivot. The first and last\n of these partitions are then recursively sorted"; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_h; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa = 0; - PyObject *__pyx_v_pad = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("q3sort (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i,&__pyx_n_s__j,&__pyx_n_s__h,&__pyx_n_s__isa,&__pyx_n_s__pad,0}; - PyObject* values[5] = {0,0,0,0,0}; - values[4] = ((PyObject *)__pyx_kp_s_47); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__i)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 2); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__isa)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 3); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pad); - if (value) { values[4] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "q3sort") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_i = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_j = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_j == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_h = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_isa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)values[3]); - __pyx_v_pad = values[4]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isa), __pyx_ptype_4cdec_2sa_3_sa_IntList, 1, "isa", 0))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_i, __pyx_v_j, __pyx_v_h, __pyx_v_isa, __pyx_v_pad); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/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=""): # <<<<<<<<<<<<<< - * '''This is a ternary quicksort. It divides the array into - * three partitions: items less than the pivot, items equal - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_v_h, struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa, PyObject *__pyx_v_pad) { - int __pyx_v_k; - int __pyx_v_midpoint; - int __pyx_v_pval; - int __pyx_v_phead; - int __pyx_v_ptail; - int __pyx_v_tmp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - long __pyx_t_5; - 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("q3sort", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":107 - * cdef int k, midpoint, pval, phead, ptail, tmp - * - * 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 - */ - __pyx_t_1 = (((__pyx_v_j - __pyx_v_i) < -1) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":108 - * - * 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 - * return - */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __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[12]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_97), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[12]; __pyx_lineno = 108; __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_Exception, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __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); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * return - * if (j-i == 0): # recursive base case -- singleton interval - */ - __pyx_t_1 = (((__pyx_v_j - __pyx_v_i) == -1) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * if (j-i == 0): # recursive base case -- singleton interval - * isa.arr[self.sa.arr[i]] = i - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * isa.arr[self.sa.arr[i]] = i - * self.sa.arr[i] = -1 - */ - __pyx_t_1 = (((__pyx_v_j - __pyx_v_i) == 0) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":112 - * return - * if (j-i == 0): # recursive base case -- singleton interval - * isa.arr[self.sa.arr[i]] = i # <<<<<<<<<<<<<< - * self.sa.arr[i] = -1 - * return - */ - (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_i])]) = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * return - * - */ - (__pyx_v_self->sa->arr[__pyx_v_i]) = -1; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":114 - * isa.arr[self.sa.arr[i]] = i - * self.sa.arr[i] = -1 - * return # <<<<<<<<<<<<<< - * - * # NOTE: choosing the first item as a pivot value resulted in - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * pval = isa.arr[self.sa.arr[midpoint] + h] - * if i != midpoint: - */ - __pyx_v_midpoint = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2); - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * if i != midpoint: - * tmp = self.sa.arr[midpoint] - */ - __pyx_v_pval = (__pyx_v_isa->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_h)]); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":125 - * midpoint = (i+j)/2 - * pval = isa.arr[self.sa.arr[midpoint] + h] - * if i != midpoint: # <<<<<<<<<<<<<< - * tmp = self.sa.arr[midpoint] - * self.sa.arr[midpoint] = self.sa.arr[i] - */ - __pyx_t_1 = ((__pyx_v_i != __pyx_v_midpoint) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":126 - * pval = isa.arr[self.sa.arr[midpoint] + h] - * if i != midpoint: - * tmp = self.sa.arr[midpoint] # <<<<<<<<<<<<<< - * self.sa.arr[midpoint] = self.sa.arr[i] - * self.sa.arr[i] = tmp - */ - __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_midpoint]); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":127 - * if i != midpoint: - * tmp = self.sa.arr[midpoint] - * self.sa.arr[midpoint] = self.sa.arr[i] # <<<<<<<<<<<<<< - * self.sa.arr[i] = tmp - * phead = i - */ - (__pyx_v_self->sa->arr[__pyx_v_midpoint]) = (__pyx_v_self->sa->arr[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":128 - * tmp = self.sa.arr[midpoint] - * self.sa.arr[midpoint] = self.sa.arr[i] - * self.sa.arr[i] = tmp # <<<<<<<<<<<<<< - * phead = i - * ptail = i - */ - (__pyx_v_self->sa->arr[__pyx_v_i]) = __pyx_v_tmp; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":129 - * self.sa.arr[midpoint] = self.sa.arr[i] - * self.sa.arr[i] = tmp - * phead = i # <<<<<<<<<<<<<< - * ptail = i - * - */ - __pyx_v_phead = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":130 - * self.sa.arr[i] = tmp - * phead = i - * ptail = i # <<<<<<<<<<<<<< - * - * # find the three partitions. phead marks the first element - */ - __pyx_v_ptail = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * if isa.arr[self.sa.arr[k] + h] < pval: - * if k > ptail+1: - */ - __pyx_t_5 = (__pyx_v_j + 1); - for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * if k > ptail+1: - * tmp = self.sa.arr[phead] - */ - __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) { - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * tmp = self.sa.arr[phead] - * self.sa.arr[phead] = self.sa.arr[k] - */ - __pyx_t_1 = ((__pyx_v_k > (__pyx_v_ptail + 1)) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":137 - * if isa.arr[self.sa.arr[k] + h] < pval: - * if k > ptail+1: - * tmp = self.sa.arr[phead] # <<<<<<<<<<<<<< - * self.sa.arr[phead] = self.sa.arr[k] - * self.sa.arr[k] = self.sa.arr[ptail+1] - */ - __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_phead]); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":138 - * if k > ptail+1: - * tmp = self.sa.arr[phead] - * self.sa.arr[phead] = self.sa.arr[k] # <<<<<<<<<<<<<< - * self.sa.arr[k] = self.sa.arr[ptail+1] - * self.sa.arr[ptail+1] = tmp - */ - (__pyx_v_self->sa->arr[__pyx_v_phead]) = (__pyx_v_self->sa->arr[__pyx_v_k]); - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * self.sa.arr[ptail+1] = tmp - * else: # k == ptail+1 - */ - (__pyx_v_self->sa->arr[__pyx_v_k]) = (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * else: # k == ptail+1 - * tmp = self.sa.arr[phead] - */ - (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]) = __pyx_v_tmp; - goto __pyx_L10; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":142 - * self.sa.arr[ptail+1] = tmp - * else: # k == ptail+1 - * tmp = self.sa.arr[phead] # <<<<<<<<<<<<<< - * self.sa.arr[phead] = self.sa.arr[k] - * self.sa.arr[k] = tmp - */ - __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_phead]); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":143 - * else: # k == ptail+1 - * tmp = self.sa.arr[phead] - * self.sa.arr[phead] = self.sa.arr[k] # <<<<<<<<<<<<<< - * self.sa.arr[k] = tmp - * phead = phead + 1 - */ - (__pyx_v_self->sa->arr[__pyx_v_phead]) = (__pyx_v_self->sa->arr[__pyx_v_k]); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":144 - * tmp = self.sa.arr[phead] - * self.sa.arr[phead] = self.sa.arr[k] - * self.sa.arr[k] = tmp # <<<<<<<<<<<<<< - * phead = phead + 1 - * ptail = ptail + 1 - */ - (__pyx_v_self->sa->arr[__pyx_v_k]) = __pyx_v_tmp; - } - __pyx_L10:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":145 - * self.sa.arr[phead] = self.sa.arr[k] - * self.sa.arr[k] = tmp - * phead = phead + 1 # <<<<<<<<<<<<<< - * ptail = ptail + 1 - * else: - */ - __pyx_v_phead = (__pyx_v_phead + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":146 - * self.sa.arr[k] = tmp - * phead = phead + 1 - * ptail = ptail + 1 # <<<<<<<<<<<<<< - * else: - * if isa.arr[self.sa.arr[k] + h] == pval: - */ - __pyx_v_ptail = (__pyx_v_ptail + 1); - goto __pyx_L9; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":148 - * ptail = ptail + 1 - * else: - * if isa.arr[self.sa.arr[k] + h] == pval: # <<<<<<<<<<<<<< - * if k > ptail+1: - * tmp = self.sa.arr[ptail+1] - */ - __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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":149 - * else: - * if isa.arr[self.sa.arr[k] + h] == pval: - * if k > ptail+1: # <<<<<<<<<<<<<< - * tmp = self.sa.arr[ptail+1] - * self.sa.arr[ptail+1] = self.sa.arr[k] - */ - __pyx_t_1 = ((__pyx_v_k > (__pyx_v_ptail + 1)) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * self.sa.arr[ptail+1] = self.sa.arr[k] - * self.sa.arr[k] = tmp - */ - __pyx_v_tmp = (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]); - - /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< - * self.sa.arr[k] = tmp - * ptail = ptail + 1 - */ - (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]) = (__pyx_v_self->sa->arr[__pyx_v_k]); - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * ptail = ptail + 1 - * - */ - (__pyx_v_self->sa->arr[__pyx_v_k]) = __pyx_v_tmp; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":153 - * self.sa.arr[ptail+1] = self.sa.arr[k] - * self.sa.arr[k] = tmp - * ptail = ptail + 1 # <<<<<<<<<<<<<< - * - * # recursively sort smaller suffixes - */ - __pyx_v_ptail = (__pyx_v_ptail + 1); - goto __pyx_L11; - } - __pyx_L11:; - } - __pyx_L9:; - } - - /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__pyx_v_i); 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 = PyInt_FromLong((__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_GOTREF(__pyx_t_2); - __pyx_t_6 = PyInt_FromLong(__pyx_v_h); 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, ((PyObject *)__pyx_kp_s_50)); 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_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_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_INCREF(((PyObject *)__pyx_v_isa)); - PyTuple_SET_ITEM(__pyx_t_8, 3, ((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; - __pyx_t_2 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * isa.arr[self.sa.arr[k]] = ptail - * if phead == ptail: - */ - __pyx_t_5 = (__pyx_v_ptail + 1); - for (__pyx_v_k = __pyx_v_phead; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - - /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< - * if phead == ptail: - * self.sa.arr[phead] = -1 - */ - (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_k])]) = __pyx_v_ptail; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":162 - * for k from phead <= k < ptail+1: - * isa.arr[self.sa.arr[k]] = ptail - * if phead == ptail: # <<<<<<<<<<<<<< - * self.sa.arr[phead] = -1 - * - */ - __pyx_t_1 = ((__pyx_v_phead == __pyx_v_ptail) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":163 - * isa.arr[self.sa.arr[k]] = ptail - * if phead == ptail: - * self.sa.arr[phead] = -1 # <<<<<<<<<<<<<< - * - * # recursively sort larger suffixes - */ - (__pyx_v_self->sa->arr[__pyx_v_phead]) = -1; - goto __pyx_L15; - } - __pyx_L15:; - - /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong((__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_GOTREF(__pyx_t_8); - __pyx_t_3 = PyInt_FromLong(__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 = PyInt_FromLong(__pyx_v_h); 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, ((PyObject *)__pyx_kp_s_50)); 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_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); - __Pyx_INCREF(((PyObject *)__pyx_v_isa)); - PyTuple_SET_ITEM(__pyx_t_4, 3, ((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); - __pyx_t_8 = 0; - __pyx_t_3 = 0; - __pyx_t_6 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_9write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_9write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[12]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":169 - * - * - * def write_text(self, char* filename): # <<<<<<<<<<<<<< - * self.darray.write_text(filename) - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { - 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("write_text", 0); - - /* "/home/mdenkows/cdec/python/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_GOTREF(((PyObject *)__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_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_11read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_11read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[12]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":172 - * self.darray.write_text(filename) - * - * def read_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE *f - * f = fopen(filename, "r") - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_binary", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":174 - * def read_binary(self, char* filename): - * cdef FILE *f - * f = fopen(filename, "r") # <<<<<<<<<<<<<< - * self.darray.read_handle(f) - * self.sa.read_handle(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":175 - * cdef FILE *f - * f = fopen(filename, "r") - * self.darray.read_handle(f) # <<<<<<<<<<<<<< - * self.sa.read_handle(f) - * self.ha.read_handle(f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->read_handle(__pyx_v_self->darray, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":176 - * f = fopen(filename, "r") - * self.darray.read_handle(f) - * self.sa.read_handle(f) # <<<<<<<<<<<<<< - * self.ha.read_handle(f) - * fclose(f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->read_handle(__pyx_v_self->sa, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":177 - * self.darray.read_handle(f) - * self.sa.read_handle(f) - * self.ha.read_handle(f) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->read_handle(__pyx_v_self->ha, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":178 - * self.sa.read_handle(f) - * self.ha.read_handle(f) - * fclose(f) # <<<<<<<<<<<<<< - * - * def write_binary(self, char* filename): - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[12]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":180 - * fclose(f) - * - * def write_binary(self, char* filename): # <<<<<<<<<<<<<< - * cdef FILE* f - * f = fopen(filename, "w") - */ - -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) { - FILE *__pyx_v_f; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("write_binary", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":182 - * def write_binary(self, char* filename): - * cdef FILE* f - * f = fopen(filename, "w") # <<<<<<<<<<<<<< - * self.darray.write_handle(f) - * self.sa.write_handle(f) - */ - __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":183 - * cdef FILE* f - * f = fopen(filename, "w") - * self.darray.write_handle(f) # <<<<<<<<<<<<<< - * self.sa.write_handle(f) - * self.ha.write_handle(f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->write_handle(__pyx_v_self->darray, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":184 - * f = fopen(filename, "w") - * self.darray.write_handle(f) - * self.sa.write_handle(f) # <<<<<<<<<<<<<< - * self.ha.write_handle(f) - * fclose(f) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->write_handle(__pyx_v_self->sa, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":185 - * self.darray.write_handle(f) - * self.sa.write_handle(f) - * self.ha.write_handle(f) # <<<<<<<<<<<<<< - * fclose(f) - * - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->write_handle(__pyx_v_self->ha, __pyx_v_f); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":186 - * self.sa.write_handle(f) - * self.ha.write_handle(f) - * fclose(f) # <<<<<<<<<<<<<< - * - * def write_enhanced(self, char* filename): - */ - fclose(__pyx_v_f); - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { - char *__pyx_v_filename; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __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[12]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":188 - * fclose(f) - * - * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< - * with open(filename, "w") as f: - * self.darray.write_enhanced_handle(f) - */ - -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) { - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_a_i = NULL; - PyObject *__pyx_v_w_i = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("write_enhanced", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * self.darray.write_enhanced_handle(f) - * for a_i in self.sa: - */ - /*with:*/ { - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __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__w)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); - __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - /*try:*/ { - __Pyx_INCREF(__pyx_t_4); - __pyx_v_f = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/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_29); 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_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 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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; - } 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; - } - 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 - } else { - __pyx_t_1 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_a_i); - __pyx_v_a_i = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_98), NULL); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/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; - } 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; - } - 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 - } else { - __pyx_t_2 = __pyx_t_9(__pyx_t_4); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF(__pyx_v_w_i); - __pyx_v_w_i = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__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(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/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_GOTREF(__pyx_t_4); - __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_99), 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_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; - 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_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * self.darray.write_enhanced_handle(f) - * for a_i in self.sa: - */ - /*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); - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); 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_INCREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_12); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - __pyx_t_13 = ((!(__pyx_t_11 != 0)) != 0); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GIVEREF(__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_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} - goto __pyx_L22; - } - __pyx_L22:; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __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; - 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); - 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_L14_try_end:; - } - } - /*finally:*/ { - if (__pyx_t_3) { - __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_100, 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_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_13 < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - goto __pyx_L23; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L1_error; - __pyx_L23:; - } - - __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_10); - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_a_i); - __Pyx_XDECREF(__pyx_v_w_i); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":198 - * f.write("\n") - * - * cdef int __search_high(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<< - * cdef int midpoint - * - */ - -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) { - int __pyx_v_midpoint; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__search_high", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":201 - * cdef int midpoint - * - * if low >= high: # <<<<<<<<<<<<<< - * return high - * midpoint = (high + low) / 2 - */ - __pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":202 - * - * if low >= high: - * return high # <<<<<<<<<<<<<< - * midpoint = (high + low) / 2 - * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: - */ - __pyx_r = __pyx_v_high; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":203 - * if low >= high: - * return high - * 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) - */ - __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":204 - * return high - * 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) - * else: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * else: - * return self.__search_high(word_id, offset, low, midpoint) - */ - __pyx_r = ((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 + 1), __pyx_v_high); - goto __pyx_L0; - goto __pyx_L4; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * cdef int __search_low(self, int word_id, int offset, int low, int high): - */ - __pyx_r = ((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_low, __pyx_v_midpoint); - goto __pyx_L0; - } - __pyx_L4:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< - * cdef int midpoint - * - */ - -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) { - int __pyx_v_midpoint; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("__search_low", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":212 - * cdef int midpoint - * - * if low >= high: # <<<<<<<<<<<<<< - * return high - * midpoint = (high + low) / 2 - */ - __pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":213 - * - * if low >= high: - * return high # <<<<<<<<<<<<<< - * midpoint = (high + low) / 2 - * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: - */ - __pyx_r = __pyx_v_high; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":214 - * if low >= high: - * return high - * 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) - */ - __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":215 - * return high - * 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) - * else: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * else: - * return self.__search_low(word_id, offset, midpoint+1, high) - */ - __pyx_r = ((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); - goto __pyx_L0; - goto __pyx_L4; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint): - */ - __pyx_r = ((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_midpoint + 1), __pyx_v_high); - goto __pyx_L0; - } - __pyx_L4:; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< - * return (self.__search_low(word_id, offset, low, midpoint), - * self.__search_high(word_id, offset, midpoint, high)) - */ - -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) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get_range", 0); - - /* "/home/mdenkows/cdec/python/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), # <<<<<<<<<<<<<< - * self.__search_high(word_id, offset, midpoint, high)) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((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); - - /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< - * - * cdef __lookup_helper(self, int word_id, int offset, int low, int high): - */ - __pyx_t_2 = PyInt_FromLong(((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); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__get_range", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< - * cdef int midpoint - * - */ - -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) { - int __pyx_v_midpoint; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - 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("__lookup_helper", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":227 - * cdef int midpoint - * - * if offset == 0: # <<<<<<<<<<<<<< - * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) - * if low >= high: - */ - __pyx_t_1 = ((__pyx_v_offset == 0) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":228 - * - * if offset == 0: - * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) # <<<<<<<<<<<<<< - * if low >= high: - * return None - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong((__pyx_v_self->ha->arr[__pyx_v_word_id])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong((__pyx_v_self->ha->arr[(__pyx_v_word_id + 1)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 228; __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[12]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":229 - * if offset == 0: - * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) - * if low >= high: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":230 - * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) - * if low >= high: - * return None # <<<<<<<<<<<<<< - * - * midpoint = (high + low) / 2 - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":232 - * return None - * - * 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) - */ - __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":233 - * - * 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) - * if self.darray.data.arr[self.sa.arr[midpoint] + offset] > word_id: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * if self.darray.data.arr[self.sa.arr[midpoint] + offset] > word_id: - * return self.__lookup_helper(word_id, offset, low, midpoint) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___get_range(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_high, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< - * return self.__lookup_helper(word_id, offset, low, midpoint) - * else: - */ - __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) { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * else: - * return self.__lookup_helper(word_id, offset, midpoint+1, high) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * - * def lookup(self, word, int offset, int low, int high): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 238; __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_L6:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__lookup_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_17lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_17lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_word = 0; - int __pyx_v_offset; - int __pyx_v_low; - int __pyx_v_high; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lookup (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__offset,&__pyx_n_s__low,&__pyx_n_s__high,0}; - PyObject* values[4] = {0,0,0,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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__word)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 2); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 3); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lookup") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_word = values[0]; - __pyx_v_offset = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_low = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_high = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_word, __pyx_v_offset, __pyx_v_low, __pyx_v_high); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< - * cdef int wordid - * if low == -1: - */ - -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) { - PyObject *__pyx_v_word_id = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __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("lookup", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":242 - * def lookup(self, word, int offset, int low, int high): - * cdef int wordid - * if low == -1: # <<<<<<<<<<<<<< - * low = 0 - * if high == -1: - */ - __pyx_t_1 = ((__pyx_v_low == -1) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":243 - * cdef int wordid - * if low == -1: - * low = 0 # <<<<<<<<<<<<<< - * if high == -1: - * high = len(self.sa) - */ - __pyx_v_low = 0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":244 - * if low == -1: - * low = 0 - * if high == -1: # <<<<<<<<<<<<<< - * high = len(self.sa) - * if word in self.darray.word2id: - */ - __pyx_t_1 = ((__pyx_v_high == -1) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":245 - * low = 0 - * if high == -1: - * high = len(self.sa) # <<<<<<<<<<<<<< - * if word in self.darray.word2id: - * word_id = self.darray.word2id[word] - */ - __pyx_t_2 = ((PyObject *)__pyx_v_self->sa); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_high = __pyx_t_3; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":246 - * if high == -1: - * high = len(self.sa) - * if word in self.darray.word2id: # <<<<<<<<<<<<<< - * word_id = self.darray.word2id[word] - * return self.__lookup_helper(word_id, offset, low, high) - */ - __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_word, __pyx_v_self->darray->word2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = (__pyx_t_1 != 0); - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":247 - * high = len(self.sa) - * if word in self.darray.word2id: - * word_id = self.darray.word2id[word] # <<<<<<<<<<<<<< - * return self.__lookup_helper(word_id, offset, low, high) - * else: - */ - __pyx_t_2 = PyObject_GetItem(__pyx_v_self->darray->word2id, __pyx_v_word); if (!__pyx_t_2) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_word_id = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * else: - * return None - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_word_id); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_t_5, __pyx_v_offset, __pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":250 - * return self.__lookup_helper(word_id, offset, low, high) - * else: - * return None # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - } - __pyx_L5:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_word_id); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __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_2sa_3_sa_11OnlineStats___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* 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) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":56 - * self.phrases_f = defaultdict(int) - * self.phrases_e = defaultdict(int) - * self.phrases_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< - * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) - * - */ - -static PyObject *__pyx_lambda_funcdef_lambda1(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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("lambda1", 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 = 56; __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 = 56; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_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) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":57 - * self.phrases_e = defaultdict(int) - * self.phrases_fe = defaultdict(lambda: defaultdict(int)) - * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) # <<<<<<<<<<<<<< - * - * # Bilexical counts - */ - -static PyObject *__pyx_lambda_funcdef_lambda2(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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("lambda2", 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 = 57; __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 = 57; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3 = {__Pyx_NAMESTR("lambda3"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3(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_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":62 - * self.bilex_f = defaultdict(int) - * self.bilex_e = defaultdict(int) - * self.bilex_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< - * - * cdef int PRECOMPUTE = 0 - */ - -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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 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 = 62; __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 = 62; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __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; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":49 - * cdef public bilex_fe - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * # Keep track of everything that can be sampled: - * self.samples_f = defaultdict(int) - */ - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - int __pyx_r; - __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("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":51 - * 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 = 51; __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 = 51; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __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_GIVEREF(__pyx_t_3); - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":54 - * - * # 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 = 54; __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 = 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_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), 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_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->phrases_f); - __Pyx_DECREF(__pyx_v_self->phrases_f); - __pyx_v_self->phrases_f = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":55 - * # 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 = 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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_3); - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":56 - * 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 = 56; __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_101, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __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 = 56; __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(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":57 - * self.phrases_e = defaultdict(int) - * self.phrases_fe = defaultdict(lambda: defaultdict(int)) - * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) # <<<<<<<<<<<<<< - * - * # Bilexical counts - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __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_101, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __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 = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":60 - * - * # Bilexical counts - * self.bilex_f = defaultdict(int) # <<<<<<<<<<<<<< - * self.bilex_e = defaultdict(int) - * self.bilex_fe = defaultdict(lambda: defaultdict(int)) - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 60; __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 60; __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_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->bilex_f); - __Pyx_DECREF(__pyx_v_self->bilex_f); - __pyx_v_self->bilex_f = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":61 - * # Bilexical counts - * self.bilex_f = defaultdict(int) - * self.bilex_e = defaultdict(int) # <<<<<<<<<<<<<< - * self.bilex_fe = defaultdict(lambda: defaultdict(int)) - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 61; __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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->bilex_e); - __Pyx_DECREF(__pyx_v_self->bilex_e); - __pyx_v_self->bilex_e = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":62 - * self.bilex_f = defaultdict(int) - * self.bilex_e = defaultdict(int) - * self.bilex_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< - * - * cdef int PRECOMPUTE = 0 - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3, 0, __pyx_n_s_101, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __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 = 62; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __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_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->bilex_fe); - __Pyx_DECREF(__pyx_v_self->bilex_fe); - __pyx_v_self->bilex_fe = __pyx_t_3; - __pyx_t_3 = 0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":40 - * - * cdef class OnlineStats: - * cdef public samples_f # <<<<<<<<<<<<<< - * cdef public phrases_f - * cdef public phrases_e - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->samples_f); - __pyx_r = __pyx_v_self->samples_f; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __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)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->samples_f); - __Pyx_DECREF(__pyx_v_self->samples_f); - __pyx_v_self->samples_f = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->samples_f); - __Pyx_DECREF(__pyx_v_self->samples_f); - __pyx_v_self->samples_f = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":41 - * cdef class OnlineStats: - * cdef public samples_f - * cdef public phrases_f # <<<<<<<<<<<<<< - * cdef public phrases_e - * cdef public phrases_fe - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->phrases_f); - __pyx_r = __pyx_v_self->phrases_f; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->phrases_f); - __Pyx_DECREF(__pyx_v_self->phrases_f); - __pyx_v_self->phrases_f = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->phrases_f); - __Pyx_DECREF(__pyx_v_self->phrases_f); - __pyx_v_self->phrases_f = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":42 - * cdef public samples_f - * cdef public phrases_f - * cdef public phrases_e # <<<<<<<<<<<<<< - * cdef public phrases_fe - * cdef public phrases_al - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->phrases_e); - __pyx_r = __pyx_v_self->phrases_e; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->phrases_e); - __Pyx_DECREF(__pyx_v_self->phrases_e); - __pyx_v_self->phrases_e = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->phrases_e); - __Pyx_DECREF(__pyx_v_self->phrases_e); - __pyx_v_self->phrases_e = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":43 - * cdef public phrases_f - * cdef public phrases_e - * cdef public phrases_fe # <<<<<<<<<<<<<< - * cdef public phrases_al - * cdef public bilex_f - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->phrases_fe); - __pyx_r = __pyx_v_self->phrases_fe; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->phrases_fe); - __Pyx_DECREF(__pyx_v_self->phrases_fe); - __pyx_v_self->phrases_fe = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->phrases_fe); - __Pyx_DECREF(__pyx_v_self->phrases_fe); - __pyx_v_self->phrases_fe = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":44 - * cdef public phrases_e - * cdef public phrases_fe - * cdef public phrases_al # <<<<<<<<<<<<<< - * cdef public bilex_f - * cdef public bilex_e - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->phrases_al); - __pyx_r = __pyx_v_self->phrases_al; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->phrases_al); - __Pyx_DECREF(__pyx_v_self->phrases_al); - __pyx_v_self->phrases_al = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->phrases_al); - __Pyx_DECREF(__pyx_v_self->phrases_al); - __pyx_v_self->phrases_al = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":45 - * cdef public phrases_fe - * cdef public phrases_al - * cdef public bilex_f # <<<<<<<<<<<<<< - * cdef public bilex_e - * cdef public bilex_fe - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->bilex_f); - __pyx_r = __pyx_v_self->bilex_f; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->bilex_f); - __Pyx_DECREF(__pyx_v_self->bilex_f); - __pyx_v_self->bilex_f = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->bilex_f); - __Pyx_DECREF(__pyx_v_self->bilex_f); - __pyx_v_self->bilex_f = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":46 - * cdef public phrases_al - * cdef public bilex_f - * cdef public bilex_e # <<<<<<<<<<<<<< - * cdef public bilex_fe - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->bilex_e); - __pyx_r = __pyx_v_self->bilex_e; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->bilex_e); - __Pyx_DECREF(__pyx_v_self->bilex_e); - __pyx_v_self->bilex_e = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->bilex_e); - __Pyx_DECREF(__pyx_v_self->bilex_e); - __pyx_v_self->bilex_e = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":47 - * cdef public bilex_f - * cdef public bilex_e - * cdef public bilex_fe # <<<<<<<<<<<<<< - * - * def __cinit__(self): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->bilex_fe); - __pyx_r = __pyx_v_self->bilex_fe; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->bilex_fe); - __Pyx_DECREF(__pyx_v_self->bilex_fe); - __pyx_v_self->bilex_fe = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->bilex_fe); - __Pyx_DECREF(__pyx_v_self->bilex_fe); - __pyx_v_self->bilex_fe = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __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_2sa_3_sa_8TrieNode___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":74 - * cdef public children - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.children = {} - * - */ - -static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self) { - 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("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":75 - * - * def __cinit__(self): - * self.children = {} # <<<<<<<<<<<<<< - * - * cdef class ExtendedTrieNode(TrieNode): - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __Pyx_GOTREF(__pyx_v_self->children); - __Pyx_DECREF(__pyx_v_self->children); - __pyx_v_self->children = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.TrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":72 - * - * cdef class TrieNode: - * cdef public children # <<<<<<<<<<<<<< - * - * def __cinit__(self): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->children); - __pyx_r = __pyx_v_self->children; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->children); - __Pyx_DECREF(__pyx_v_self->children); - __pyx_v_self->children = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->children); - __Pyx_DECREF(__pyx_v_self->children); - __pyx_v_self->children = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_phrase = 0; - PyObject *__pyx_v_phrase_location = 0; - PyObject *__pyx_v_suffix_link = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__phrase,&__pyx_n_s__phrase_location,&__pyx_n_s__suffix_link,0}; - PyObject* values[3] = {0,0,0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":82 - * cdef public suffix_link - * - * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): # <<<<<<<<<<<<<< - * self.phrase = phrase - * self.phrase_location = phrase_location - */ - values[0] = ((PyObject *)Py_None); - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__phrase); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__phrase_location); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__suffix_link); - if (value) { values[2] = 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[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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_phrase = values[0]; - __pyx_v_phrase_location = values[1]; - __pyx_v_suffix_link = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.ExtendedTrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), __pyx_v_phrase, __pyx_v_phrase_location, __pyx_v_suffix_link); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_phrase, PyObject *__pyx_v_phrase_location, PyObject *__pyx_v_suffix_link) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":83 - * - * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): - * self.phrase = phrase # <<<<<<<<<<<<<< - * self.phrase_location = phrase_location - * self.suffix_link = suffix_link - */ - __Pyx_INCREF(__pyx_v_phrase); - __Pyx_GIVEREF(__pyx_v_phrase); - __Pyx_GOTREF(__pyx_v_self->phrase); - __Pyx_DECREF(__pyx_v_self->phrase); - __pyx_v_self->phrase = __pyx_v_phrase; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":84 - * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): - * self.phrase = phrase - * self.phrase_location = phrase_location # <<<<<<<<<<<<<< - * self.suffix_link = suffix_link - * - */ - __Pyx_INCREF(__pyx_v_phrase_location); - __Pyx_GIVEREF(__pyx_v_phrase_location); - __Pyx_GOTREF(__pyx_v_self->phrase_location); - __Pyx_DECREF(__pyx_v_self->phrase_location); - __pyx_v_self->phrase_location = __pyx_v_phrase_location; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":85 - * self.phrase = phrase - * self.phrase_location = phrase_location - * self.suffix_link = suffix_link # <<<<<<<<<<<<<< - * - * - */ - __Pyx_INCREF(__pyx_v_suffix_link); - __Pyx_GIVEREF(__pyx_v_suffix_link); - __Pyx_GOTREF(__pyx_v_self->suffix_link); - __Pyx_DECREF(__pyx_v_self->suffix_link); - __pyx_v_self->suffix_link = __pyx_v_suffix_link; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase___get__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":78 - * - * cdef class ExtendedTrieNode(TrieNode): - * cdef public phrase # <<<<<<<<<<<<<< - * cdef public phrase_location - * cdef public suffix_link - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->phrase); - __pyx_r = __pyx_v_self->phrase; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->phrase); - __Pyx_DECREF(__pyx_v_self->phrase); - __pyx_v_self->phrase = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->phrase); - __Pyx_DECREF(__pyx_v_self->phrase); - __pyx_v_self->phrase = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location___get__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":79 - * cdef class ExtendedTrieNode(TrieNode): - * cdef public phrase - * cdef public phrase_location # <<<<<<<<<<<<<< - * cdef public suffix_link - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->phrase_location); - __pyx_r = __pyx_v_self->phrase_location; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->phrase_location); - __Pyx_DECREF(__pyx_v_self->phrase_location); - __pyx_v_self->phrase_location = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->phrase_location); - __Pyx_DECREF(__pyx_v_self->phrase_location); - __pyx_v_self->phrase_location = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link___get__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":80 - * cdef public phrase - * cdef public phrase_location - * cdef public suffix_link # <<<<<<<<<<<<<< - * - * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->suffix_link); - __pyx_r = __pyx_v_self->suffix_link; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->suffix_link); - __Pyx_DECREF(__pyx_v_self->suffix_link); - __pyx_v_self->suffix_link = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->suffix_link); - __Pyx_DECREF(__pyx_v_self->suffix_link); - __pyx_v_self->suffix_link = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_extended = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__extended,0}; - PyObject* values[1] = {0}; - values[0] = __pyx_k_103; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - 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__extended); - 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[8]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_extended = values[0]; - } - 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[8]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), __pyx_v_extended); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":92 - * cdef public int count - * cdef public root - * def __cinit__(self, extended=False): # <<<<<<<<<<<<<< - * self.count = 0 - * self.extended = extended - */ - -static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":93 - * cdef public root - * def __cinit__(self, extended=False): - * self.count = 0 # <<<<<<<<<<<<<< - * self.extended = extended - * if extended: - */ - __pyx_v_self->count = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":94 - * def __cinit__(self, extended=False): - * self.count = 0 - * self.extended = extended # <<<<<<<<<<<<<< - * if extended: - * self.root = ExtendedTrieNode() - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_extended); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->extended = __pyx_t_1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":95 - * self.count = 0 - * self.extended = extended - * if extended: # <<<<<<<<<<<<<< - * self.root = ExtendedTrieNode() - * else: - */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extended); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":96 - * self.extended = extended - * if extended: - * self.root = ExtendedTrieNode() # <<<<<<<<<<<<<< - * else: - * self.root = TrieNode() - */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->root); - __Pyx_DECREF(__pyx_v_self->root); - __pyx_v_self->root = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":98 - * self.root = ExtendedTrieNode() - * else: - * self.root = TrieNode() # <<<<<<<<<<<<<< - * - * # linked list structure for storing matches in BaselineRuleFactory - */ - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->root); - __Pyx_DECREF(__pyx_v_self->root); - __pyx_v_self->root = __pyx_t_3; - __pyx_t_3 = 0; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":89 - * - * cdef class TrieTable: - * cdef public int extended # <<<<<<<<<<<<<< - * cdef public int count - * cdef public root - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->extended); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.TrieTable.extended.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->extended = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.TrieTable.extended.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":90 - * cdef class TrieTable: - * cdef public int extended - * cdef public int count # <<<<<<<<<<<<<< - * cdef public root - * def __cinit__(self, extended=False): - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.TrieTable.count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); 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->count = __pyx_t_1; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.TrieTable.count.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":91 - * cdef public int extended - * cdef public int count - * cdef public root # <<<<<<<<<<<<<< - * def __cinit__(self, extended=False): - * self.count = 0 - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->root); - __pyx_r = __pyx_v_self->root; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__", 0); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->root); - __Pyx_DECREF(__pyx_v_self->root); - __pyx_v_self->root = __pyx_v_value; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->root); - __Pyx_DECREF(__pyx_v_self->root); - __pyx_v_self->root = Py_None; - - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":118 - * - * # returns true if sent_id is contained - * cdef int contains(self, int sent_id): # <<<<<<<<<<<<<< - * return 1 - * - */ - -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) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("contains", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":119 - * # returns true if sent_id is contained - * cdef int contains(self, int sent_id): - * return 1 # <<<<<<<<<<<<<< - * - * def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, - */ - __pyx_r = 1; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_sa_low; - int __pyx_v_sa_high; - int __pyx_v_arr_low; - int __pyx_v_arr_high; - PyObject *__pyx_v_arr = 0; - int __pyx_v_num_subpatterns; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - 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}; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":122 - * - * 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 - * self.sa_high = sa_high - */ - values[4] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__sa_low); - if (value) { values[0] = value; kw_args--; } - } - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sa_high); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr_low); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr_high); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_subpatterns); - if (value) { values[5] = 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[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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; - } - } - if (values[0]) { - __pyx_v_sa_low = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_sa_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_sa_low = ((int)-1); - } - if (values[1]) { - __pyx_v_sa_high = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_sa_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_sa_high = ((int)-1); - } - if (values[2]) { - __pyx_v_arr_low = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_arr_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_arr_low = ((int)-1); - } - if (values[3]) { - __pyx_v_arr_high = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_arr_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_arr_high = ((int)-1); - } - __pyx_v_arr = values[4]; - if (values[5]) { - __pyx_v_num_subpatterns = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_num_subpatterns == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_num_subpatterns = ((int)1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __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); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":121 - * return 1 - * - * 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 - */ - -static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_self, int __pyx_v_sa_low, int __pyx_v_sa_high, int __pyx_v_arr_low, int __pyx_v_arr_high, PyObject *__pyx_v_arr, int __pyx_v_num_subpatterns) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":123 - * 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 # <<<<<<<<<<<<<< - * self.sa_high = sa_high - * self.arr_low = arr_low - */ - __pyx_v_self->sa_low = __pyx_v_sa_low; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":124 - * arr=None, int num_subpatterns=1): - * self.sa_low = sa_low - * self.sa_high = sa_high # <<<<<<<<<<<<<< - * self.arr_low = arr_low - * self.arr_high = arr_high - */ - __pyx_v_self->sa_high = __pyx_v_sa_high; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":125 - * self.sa_low = sa_low - * self.sa_high = sa_high - * self.arr_low = arr_low # <<<<<<<<<<<<<< - * self.arr_high = arr_high - * self.arr = arr - */ - __pyx_v_self->arr_low = __pyx_v_arr_low; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":126 - * self.sa_high = sa_high - * self.arr_low = arr_low - * self.arr_high = arr_high # <<<<<<<<<<<<<< - * self.arr = arr - * self.num_subpatterns = num_subpatterns - */ - __pyx_v_self->arr_high = __pyx_v_arr_high; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":127 - * self.arr_low = arr_low - * self.arr_high = arr_high - * self.arr = arr # <<<<<<<<<<<<<< - * self.num_subpatterns = num_subpatterns - * - */ - if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_arr); - __Pyx_GIVEREF(__pyx_v_arr); - __Pyx_GOTREF(__pyx_v_self->arr); - __Pyx_DECREF(((PyObject *)__pyx_v_self->arr)); - __pyx_v_self->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_arr); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":128 - * self.arr_high = arr_high - * self.arr = arr - * self.num_subpatterns = num_subpatterns # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_self->num_subpatterns = __pyx_v_num_subpatterns; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.sa._sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_v_sample_size; - struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sample_size,&__pyx_n_s__fsarray,0}; - PyObject* values[2] = {0,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__sample_size)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_sample_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_sample_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_fsarray = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)__pyx_v_self), __pyx_v_sample_size, __pyx_v_fsarray); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":138 - * cdef IntList sa - * - * def __cinit__(self, int sample_size, SuffixArray fsarray): # <<<<<<<<<<<<<< - * self.sample_size = sample_size - * self.sa = fsarray.sa - */ - -static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_self, int __pyx_v_sample_size, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - 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("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":139 - * - * def __cinit__(self, int sample_size, SuffixArray fsarray): - * self.sample_size = sample_size # <<<<<<<<<<<<<< - * self.sa = fsarray.sa - * if sample_size > 0: - */ - __pyx_v_self->sample_size = __pyx_v_sample_size; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":140 - * def __cinit__(self, int sample_size, SuffixArray fsarray): - * self.sample_size = sample_size - * self.sa = fsarray.sa # <<<<<<<<<<<<<< - * if sample_size > 0: - * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_fsarray->sa); - __Pyx_INCREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->sa); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); - __pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":141 - * self.sample_size = sample_size - * self.sa = fsarray.sa - * if sample_size > 0: # <<<<<<<<<<<<<< - * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) - * else: - */ - __pyx_t_2 = ((__pyx_v_sample_size > 0) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":142 - * 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 = 142; __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_sample_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 142; __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_104)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_104)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_104)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __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[8]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":144 - * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) - * else: - * logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<< - * - * def sample(self, PhraseLocation phrase_location): - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __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_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __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; - } - __pyx_L3:; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location); /*proto*/ -static char __pyx_doc_4cdec_2sa_3_sa_7Sampler_2sample[] = "Returns a sample of the locations for\n the phrase. If there are less than self.sample_size\n locations, return all of them; otherwise, return\n up to self.sample_size locations. In the latter case,\n we choose to sample UNIFORMLY -- that is, the locations\n are chosen at uniform intervals over the entire set, rather\n than randomly. This makes the algorithm deterministic, which\n is good for things like MERT"; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location) { - 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("sample (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_phrase_location), __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation, 1, "phrase_location", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)__pyx_v_self), ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_v_phrase_location)); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":146 - * logger.info("Sampling strategy: no sampling") - * - * def sample(self, PhraseLocation phrase_location): # <<<<<<<<<<<<<< - * '''Returns a sample of the locations for - * the phrase. If there are less than self.sample_size - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_phrase_location) { - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_sample = 0; - double __pyx_v_i; - double __pyx_v_stepsize; - int __pyx_v_num_locations; - int __pyx_v_val; - int __pyx_v_j; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":159 - * cdef int num_locations, val, j - * - * sample = IntList() # <<<<<<<<<<<<<< - * if phrase_location.arr is None: - * num_locations = phrase_location.sa_high - phrase_location.sa_low - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":160 - * - * sample = IntList() - * 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: - */ - __pyx_t_2 = (((PyObject *)__pyx_v_phrase_location->arr) == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":161 - * sample = IntList() - * 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) - */ - __pyx_v_num_locations = (__pyx_v_phrase_location->sa_high - __pyx_v_phrase_location->sa_low); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":162 - * 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; - } else { - __pyx_t_4 = __pyx_t_3; - } - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":163 - * 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: - * stepsize = float(num_locations)/float(self.sample_size) - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_extend_arr(__pyx_v_sample, (__pyx_v_self->sa->arr + __pyx_v_phrase_location->sa_low), __pyx_v_num_locations); - goto __pyx_L4; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":165 - * sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations) - * 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: - */ - if (unlikely(((double)__pyx_v_self->sample_size) == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":166 - * 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":167 - * 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 - * 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; - } else { - __pyx_t_2 = __pyx_t_4; - } - if (!__pyx_t_2) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":170 - * '''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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":171 - * effect, according to the python documentation''' - * if fmod(i,1.0) > 0.5: - * val = int(ceil(i)) # <<<<<<<<<<<<<< - * else: - * val = int(floor(i)) - */ - __pyx_v_val = ((int)ceil(__pyx_v_i)); - goto __pyx_L7; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":173 - * val = int(ceil(i)) - * else: - * val = int(floor(i)) # <<<<<<<<<<<<<< - * sample._append(self.sa.arr[val]) - * i = i + stepsize - */ - __pyx_v_val = ((int)floor(__pyx_v_i)); - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":174 - * else: - * val = int(floor(i)) - * sample._append(self.sa.arr[val]) # <<<<<<<<<<<<<< - * i = i + stepsize - * else: - */ - ((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])); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":175 - * val = int(floor(i)) - * sample._append(self.sa.arr[val]) - * i = i + stepsize # <<<<<<<<<<<<<< - * else: - * num_locations = (phrase_location.arr_high - phrase_location.arr_low) / phrase_location.num_subpatterns - */ - __pyx_v_i = (__pyx_v_i + __pyx_v_stepsize); - } - } - __pyx_L4:; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":177 - * 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); - if (unlikely(__pyx_v_phrase_location->num_subpatterns == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_phrase_location->num_subpatterns == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_num_locations = __Pyx_div_int(__pyx_t_5, __pyx_v_phrase_location->num_subpatterns); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":178 - * 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 - * else: - */ - __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; - } else { - __pyx_t_3 = __pyx_t_2; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":179 - * 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 # <<<<<<<<<<<<<< - * else: - * stepsize = float(num_locations)/float(self.sample_size) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_phrase_location->arr); - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_sample)); - __pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L8; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":181 - * sample = phrase_location.arr - * 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: - */ - if (unlikely(((double)__pyx_v_self->sample_size) == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":182 - * 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":183 - * 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 - * 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; - } else { - __pyx_t_4 = __pyx_t_3; - } - if (!__pyx_t_4) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":186 - * '''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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":187 - * effect, according to the python documentation''' - * if fmod(i,1.0) > 0.5: - * val = int(ceil(i)) # <<<<<<<<<<<<<< - * else: - * val = int(floor(i)) - */ - __pyx_v_val = ((int)ceil(__pyx_v_i)); - goto __pyx_L11; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":189 - * val = int(ceil(i)) - * else: - * 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) - */ - __pyx_v_val = ((int)floor(__pyx_v_i)); - } - __pyx_L11:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":190 - * else: - * 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) - * i = i + stepsize - */ - __pyx_v_j = (__pyx_v_phrase_location->arr_low + (__pyx_v_val * __pyx_v_phrase_location->num_subpatterns)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":191 - * 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) # <<<<<<<<<<<<<< - * i = i + stepsize - * return sample - */ - ((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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":192 - * 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 # <<<<<<<<<<<<<< - * return sample - * - */ - __pyx_v_i = (__pyx_v_i + __pyx_v_stepsize); - } - } - __pyx_L8:; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":193 - * sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns) - * i = i + stepsize - * return sample # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_sample)); - __pyx_r = ((PyObject *)__pyx_v_sample); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.Sampler.sample", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_sample); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":205 - * - * - * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): # <<<<<<<<<<<<<< - * m.arr = arr - * m.start = start - */ - -static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_m, int *__pyx_v_arr, int __pyx_v_start, int __pyx_v_step, int *__pyx_v_sent_id_arr) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("assign_matching", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":206 - * - * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): - * m.arr = arr # <<<<<<<<<<<<<< - * m.start = start - * m.end = start + step - */ - __pyx_v_m->arr = __pyx_v_arr; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":207 - * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): - * m.arr = arr - * m.start = start # <<<<<<<<<<<<<< - * m.end = start + step - * m.sent_id = sent_id_arr[arr[start]] - */ - __pyx_v_m->start = __pyx_v_start; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":208 - * m.arr = arr - * m.start = start - * m.end = start + step # <<<<<<<<<<<<<< - * m.sent_id = sent_id_arr[arr[start]] - * m.size = step - */ - __pyx_v_m->end = (__pyx_v_start + __pyx_v_step); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":209 - * m.start = start - * m.end = start + step - * m.sent_id = sent_id_arr[arr[start]] # <<<<<<<<<<<<<< - * m.size = step - * - */ - __pyx_v_m->sent_id = (__pyx_v_sent_id_arr[(__pyx_v_arr[__pyx_v_start])]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":210 - * m.end = start + step - * m.sent_id = sent_id_arr[arr[start]] - * m.size = step # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_m->size = __pyx_v_step; - - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":213 - * - * - * cdef int* append_combined_matching(int* arr, Matching* loc1, Matching* loc2, # <<<<<<<<<<<<<< - * int offset_by_one, int num_subpatterns, int* result_len): - * cdef int i, new_len - */ - -static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc1, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc2, CYTHON_UNUSED int __pyx_v_offset_by_one, int __pyx_v_num_subpatterns, int *__pyx_v_result_len) { - int __pyx_v_i; - int __pyx_v_new_len; - int *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("append_combined_matching", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":217 - * cdef int i, new_len - * - * new_len = result_len[0] + num_subpatterns # <<<<<<<<<<<<<< - * arr = realloc(arr, new_len*sizeof(int)) - * - */ - __pyx_v_new_len = ((__pyx_v_result_len[0]) + __pyx_v_num_subpatterns); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":218 - * - * new_len = result_len[0] + num_subpatterns - * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < loc1.size: - */ - __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":220 - * arr = realloc(arr, new_len*sizeof(int)) - * - * for i from 0 <= i < loc1.size: # <<<<<<<<<<<<<< - * arr[result_len[0]+i] = loc1.arr[loc1.start+i] - * if num_subpatterns > loc1.size: - */ - __pyx_t_1 = __pyx_v_loc1->size; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":221 - * - * for i from 0 <= i < loc1.size: - * arr[result_len[0]+i] = loc1.arr[loc1.start+i] # <<<<<<<<<<<<<< - * if num_subpatterns > loc1.size: - * arr[new_len-1] = loc2.arr[loc2.end-1] - */ - (__pyx_v_arr[((__pyx_v_result_len[0]) + __pyx_v_i)]) = (__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":222 - * for i from 0 <= i < loc1.size: - * arr[result_len[0]+i] = loc1.arr[loc1.start+i] - * if num_subpatterns > loc1.size: # <<<<<<<<<<<<<< - * arr[new_len-1] = loc2.arr[loc2.end-1] - * result_len[0] = new_len - */ - __pyx_t_2 = ((__pyx_v_num_subpatterns > __pyx_v_loc1->size) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":223 - * arr[result_len[0]+i] = loc1.arr[loc1.start+i] - * if num_subpatterns > loc1.size: - * arr[new_len-1] = loc2.arr[loc2.end-1] # <<<<<<<<<<<<<< - * result_len[0] = new_len - * return arr - */ - (__pyx_v_arr[(__pyx_v_new_len - 1)]) = (__pyx_v_loc2->arr[(__pyx_v_loc2->end - 1)]); - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":224 - * if num_subpatterns > loc1.size: - * arr[new_len-1] = loc2.arr[loc2.end-1] - * result_len[0] = new_len # <<<<<<<<<<<<<< - * return arr - * - */ - (__pyx_v_result_len[0]) = __pyx_v_new_len; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":225 - * arr[new_len-1] = loc2.arr[loc2.end-1] - * result_len[0] = new_len - * return arr # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_arr; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":228 - * - * - * cdef int* extend_arr(int* arr, int* arr_len, int* appendix, int appendix_len): # <<<<<<<<<<<<<< - * cdef int new_len - * - */ - -static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int *__pyx_v_appendix, int __pyx_v_appendix_len) { - int __pyx_v_new_len; - int *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("extend_arr", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":231 - * cdef int new_len - * - * new_len = arr_len[0] + appendix_len # <<<<<<<<<<<<<< - * arr = realloc(arr, new_len*sizeof(int)) - * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) - */ - __pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_appendix_len); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":232 - * - * new_len = arr_len[0] + appendix_len - * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< - * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) - * arr_len[0] = new_len - */ - __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":233 - * new_len = arr_len[0] + appendix_len - * arr = realloc(arr, new_len*sizeof(int)) - * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) # <<<<<<<<<<<<<< - * arr_len[0] = new_len - * return arr - */ - memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_appendix, (__pyx_v_appendix_len * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":234 - * arr = realloc(arr, new_len*sizeof(int)) - * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) - * arr_len[0] = new_len # <<<<<<<<<<<<<< - * return arr - * - */ - (__pyx_v_arr_len[0]) = __pyx_v_new_len; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":235 - * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) - * arr_len[0] = new_len - * return arr # <<<<<<<<<<<<<< - * - * cdef int median(int low, int high, int step): - */ - __pyx_r = __pyx_v_arr; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":237 - * return arr - * - * cdef int median(int low, int high, int step): # <<<<<<<<<<<<<< - * return low + (((high - low)/step)/2)*step - * - */ - -static int __pyx_f_4cdec_2sa_3_sa_median(int __pyx_v_low, int __pyx_v_high, int __pyx_v_step) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("median", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":238 - * - * cdef int median(int low, int high, int step): - * return low + (((high - low)/step)/2)*step # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = (__pyx_v_high - __pyx_v_low); - if (unlikely(__pyx_v_step == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_step == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_1))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_r = (__pyx_v_low + (__Pyx_div_long(__Pyx_div_int(__pyx_t_1, __pyx_v_step), 2) * __pyx_v_step)); - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("cdec.sa._sa.median", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":241 - * - * - * cdef void find_comparable_matchings(int low, int high, int* arr, int step, int loc, int* loc_minus, int* loc_plus): # <<<<<<<<<<<<<< - * # Returns (minus, plus) indices for the portion of the array - * # in which all matchings have the same first index as the one - */ - -static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_high, int *__pyx_v_arr, int __pyx_v_step, int __pyx_v_loc, int *__pyx_v_loc_minus, int *__pyx_v_loc_plus) { - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("find_comparable_matchings", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":245 - * # in which all matchings have the same first index as the one - * # starting at loc - * loc_plus[0] = loc + step # <<<<<<<<<<<<<< - * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: - * loc_plus[0] = loc_plus[0] + step - */ - (__pyx_v_loc_plus[0]) = (__pyx_v_loc + __pyx_v_step); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":246 - * # starting at loc - * loc_plus[0] = loc + step - * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: # <<<<<<<<<<<<<< - * loc_plus[0] = loc_plus[0] + step - * 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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (!__pyx_t_3) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":247 - * loc_plus[0] = loc + step - * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: - * 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]: - */ - (__pyx_v_loc_plus[0]) = ((__pyx_v_loc_plus[0]) + __pyx_v_step); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":248 - * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: - * 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]: - * loc_minus[0] = loc_minus[0] - step - */ - (__pyx_v_loc_minus[0]) = __pyx_v_loc; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":249 - * 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]: # <<<<<<<<<<<<<< - * loc_minus[0] = loc_minus[0] - step - * - */ - 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; - } else { - __pyx_t_2 = __pyx_t_3; - } - if (!__pyx_t_2) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":250 - * 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 # <<<<<<<<<<<<<< - * - * - */ - (__pyx_v_loc_minus[0]) = ((__pyx_v_loc_minus[0]) - __pyx_v_step); - } - - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_alignment = 0; - float __pyx_v_by_slack_factor; - char *__pyx_v_category; - PyObject *__pyx_v_max_chunks = 0; - unsigned int __pyx_v_max_initial_size; - unsigned int __pyx_v_max_length; - unsigned int __pyx_v_max_nonterminals; - PyObject *__pyx_v_max_target_chunks = 0; - PyObject *__pyx_v_max_target_length = 0; - unsigned int __pyx_v_min_gap_size; - PyObject *__pyx_v_precompute_file = 0; - unsigned int __pyx_v_precompute_secondary_rank; - unsigned int __pyx_v_precompute_rank; - int __pyx_v_require_aligned_terminal; - int __pyx_v_require_aligned_chunks; - unsigned int __pyx_v_train_max_initial_size; - unsigned int __pyx_v_train_min_gap_size; - int __pyx_v_tight_phrases; - int __pyx_v_use_baeza_yates; - int __pyx_v_use_collocations; - int __pyx_v_use_index; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alignment,&__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_72,&__pyx_n_s__precompute_rank,&__pyx_n_s_107,&__pyx_n_s_108,&__pyx_n_s_73,&__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[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":314 - * 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, # <<<<<<<<<<<<<< - * # maximum span of a grammar rule in TEST DATA - * unsigned max_initial_size=10, - */ - values[3] = ((PyObject *)Py_None); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":322 - * 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, # <<<<<<<<<<<<<< - * # 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, - */ - values[7] = ((PyObject *)Py_None); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":324 - * 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, # <<<<<<<<<<<<<< - * # minimum span of a nonterminal in the RHS of a rule in TEST DATA - * unsigned min_gap_size=2, - */ - values[8] = ((PyObject *)Py_None); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":328 - * unsigned min_gap_size=2, - * # filename of file containing precomputed collocations - * precompute_file=None, # <<<<<<<<<<<<<< - * # maximum frequency rank of patterns used to compute triples (don't set higher than 20). - * unsigned precompute_secondary_rank=20, - */ - values[10] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); - case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); - case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); - case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); - case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); - case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__alignment)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__by_slack_factor); - if (value) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__category); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_chunks); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_initial_size); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_length); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_nonterminals); - if (value) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_target_chunks); - if (value) { values[7] = value; kw_args--; } - } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_target_length); - if (value) { values[8] = value; kw_args--; } - } - case 9: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_gap_size); - if (value) { values[9] = value; kw_args--; } - } - case 10: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__precompute_file); - if (value) { values[10] = value; kw_args--; } - } - case 11: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_72); - if (value) { values[11] = value; kw_args--; } - } - case 12: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__precompute_rank); - if (value) { values[12] = value; kw_args--; } - } - case 13: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_107); - if (value) { values[13] = value; kw_args--; } - } - case 14: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_108); - if (value) { values[14] = value; kw_args--; } - } - case 15: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_73); - if (value) { values[15] = value; kw_args--; } - } - case 16: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__train_min_gap_size); - if (value) { values[16] = value; kw_args--; } - } - case 17: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tight_phrases); - if (value) { values[17] = value; kw_args--; } - } - case 18: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_baeza_yates); - if (value) { values[18] = value; kw_args--; } - } - case 19: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_collocations); - if (value) { values[19] = value; kw_args--; } - } - case 20: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_index); - if (value) { values[20] = 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[8]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); - case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); - case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); - case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); - case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); - case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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_alignment = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)values[0]); - if (values[1]) { - __pyx_v_by_slack_factor = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_by_slack_factor == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":310 - * Alignment alignment, - * # parameter for double-binary search; doesn't seem to matter much - * float by_slack_factor=1.0, # <<<<<<<<<<<<<< - * # name of generic nonterminal used by Hiero - * char* category="[X]", - */ - __pyx_v_by_slack_factor = ((float)1.0); - } - if (values[2]) { - __pyx_v_category = __Pyx_PyObject_AsString(values[2]); if (unlikely((!__pyx_v_category) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_category = ((char *)__pyx_k_109); - } - __pyx_v_max_chunks = values[3]; - if (values[4]) { - __pyx_v_max_initial_size = __Pyx_PyInt_AsUnsignedInt(values[4]); if (unlikely((__pyx_v_max_initial_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_max_initial_size = ((unsigned int)10); - } - if (values[5]) { - __pyx_v_max_length = __Pyx_PyInt_AsUnsignedInt(values[5]); if (unlikely((__pyx_v_max_length == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_max_length = ((unsigned int)5); - } - if (values[6]) { - __pyx_v_max_nonterminals = __Pyx_PyInt_AsUnsignedInt(values[6]); if (unlikely((__pyx_v_max_nonterminals == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_max_nonterminals = ((unsigned int)2); - } - __pyx_v_max_target_chunks = values[7]; - __pyx_v_max_target_length = values[8]; - if (values[9]) { - __pyx_v_min_gap_size = __Pyx_PyInt_AsUnsignedInt(values[9]); if (unlikely((__pyx_v_min_gap_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_min_gap_size = ((unsigned int)2); - } - __pyx_v_precompute_file = values[10]; - if (values[11]) { - __pyx_v_precompute_secondary_rank = __Pyx_PyInt_AsUnsignedInt(values[11]); if (unlikely((__pyx_v_precompute_secondary_rank == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_precompute_secondary_rank = ((unsigned int)20); - } - if (values[12]) { - __pyx_v_precompute_rank = __Pyx_PyInt_AsUnsignedInt(values[12]); if (unlikely((__pyx_v_precompute_rank == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_precompute_rank = ((unsigned int)100); - } - if (values[13]) { - __pyx_v_require_aligned_terminal = __Pyx_PyObject_IsTrue(values[13]); if (unlikely((__pyx_v_require_aligned_terminal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":334 - * unsigned precompute_rank=100, - * # require extracted rules to have at least one aligned word - * bint require_aligned_terminal=True, # <<<<<<<<<<<<<< - * # require each contiguous chunk of extracted rules to have at least one aligned word - * bint require_aligned_chunks=False, - */ - __pyx_v_require_aligned_terminal = ((int)1); - } - if (values[14]) { - __pyx_v_require_aligned_chunks = __Pyx_PyObject_IsTrue(values[14]); if (unlikely((__pyx_v_require_aligned_chunks == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":336 - * bint require_aligned_terminal=True, - * # require each contiguous chunk of extracted rules to have at least one aligned word - * bint require_aligned_chunks=False, # <<<<<<<<<<<<<< - * # maximum span of a grammar rule extracted from TRAINING DATA - * unsigned train_max_initial_size=10, - */ - __pyx_v_require_aligned_chunks = ((int)0); - } - if (values[15]) { - __pyx_v_train_max_initial_size = __Pyx_PyInt_AsUnsignedInt(values[15]); if (unlikely((__pyx_v_train_max_initial_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_train_max_initial_size = ((unsigned int)10); - } - if (values[16]) { - __pyx_v_train_min_gap_size = __Pyx_PyInt_AsUnsignedInt(values[16]); if (unlikely((__pyx_v_train_min_gap_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_train_min_gap_size = ((unsigned int)2); - } - if (values[17]) { - __pyx_v_tight_phrases = __Pyx_PyObject_IsTrue(values[17]); if (unlikely((__pyx_v_tight_phrases == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":342 - * unsigned train_min_gap_size=2, - * # False if phrases should be loose (better but slower), True otherwise - * bint tight_phrases=True, # <<<<<<<<<<<<<< - * # True to require use of double-binary alg, false otherwise - * bint use_baeza_yates=True, - */ - __pyx_v_tight_phrases = ((int)1); - } - if (values[18]) { - __pyx_v_use_baeza_yates = __Pyx_PyObject_IsTrue(values[18]); if (unlikely((__pyx_v_use_baeza_yates == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":344 - * bint tight_phrases=True, - * # True to require use of double-binary alg, false otherwise - * bint use_baeza_yates=True, # <<<<<<<<<<<<<< - * # True to enable used of precomputed collocations - * bint use_collocations=True, - */ - __pyx_v_use_baeza_yates = ((int)1); - } - if (values[19]) { - __pyx_v_use_collocations = __Pyx_PyObject_IsTrue(values[19]); if (unlikely((__pyx_v_use_collocations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":346 - * bint use_baeza_yates=True, - * # True to enable used of precomputed collocations - * bint use_collocations=True, # <<<<<<<<<<<<<< - * # True to enable use of precomputed inverted indices - * bint use_index=True): - */ - __pyx_v_use_collocations = ((int)1); - } - if (values[20]) { - __pyx_v_use_index = __Pyx_PyObject_IsTrue(values[20]); if (unlikely((__pyx_v_use_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":348 - * bint use_collocations=True, - * # True to enable use of precomputed inverted indices - * bint use_index=True): # <<<<<<<<<<<<<< - * '''Note: we make a distinction between the min_gap_size - * and max_initial_size used in test and train. The latter - */ - __pyx_v_use_index = ((int)1); - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 21, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - 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 = 308; __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_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); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":306 - * cdef online_stats - * - * def __cinit__(self, # <<<<<<<<<<<<<< - * # compiled alignment object (REQUIRED) - * Alignment alignment, - */ - -static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_alignment, float __pyx_v_by_slack_factor, char *__pyx_v_category, PyObject *__pyx_v_max_chunks, unsigned int __pyx_v_max_initial_size, unsigned int __pyx_v_max_length, unsigned int __pyx_v_max_nonterminals, PyObject *__pyx_v_max_target_chunks, PyObject *__pyx_v_max_target_length, unsigned int __pyx_v_min_gap_size, PyObject *__pyx_v_precompute_file, unsigned int __pyx_v_precompute_secondary_rank, unsigned int __pyx_v_precompute_rank, int __pyx_v_require_aligned_terminal, int __pyx_v_require_aligned_chunks, unsigned int __pyx_v_train_max_initial_size, unsigned int __pyx_v_train_min_gap_size, int __pyx_v_tight_phrases, int __pyx_v_use_baeza_yates, int __pyx_v_use_collocations, int __pyx_v_use_index) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":354 - * 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 # <<<<<<<<<<<<<< - * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) - * if alignment is None: - */ - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 354; __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 = 354; __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_2sa_3_sa_TrieTable)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->rules); - __Pyx_DECREF(((PyObject *)__pyx_v_self->rules)); - __pyx_v_self->rules = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":355 - * them to be the same, therefore we don't either.''' - * self.rules = TrieTable(True) # cache - * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) # <<<<<<<<<<<<<< - * if alignment is None: - * raise Exception("Must specify an alignment object") - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->rules->root); - __Pyx_DECREF(__pyx_v_self->rules->root); - __pyx_v_self->rules->root = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":356 - * self.rules = TrieTable(True) # cache - * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) - * if alignment is None: # <<<<<<<<<<<<<< - * raise Exception("Must specify an alignment object") - * self.alignment = alignment - */ - __pyx_t_3 = (((PyObject *)__pyx_v_alignment) == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":357 - * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) - * if alignment is None: - * raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<< - * self.alignment = alignment - * - */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 357; __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[8]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":358 - * if alignment is None: - * raise Exception("Must specify an alignment object") - * self.alignment = alignment # <<<<<<<<<<<<<< - * - * # grammar parameters and settings - */ - __Pyx_INCREF(((PyObject *)__pyx_v_alignment)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_alignment)); - __Pyx_GOTREF(__pyx_v_self->alignment); - __Pyx_DECREF(((PyObject *)__pyx_v_self->alignment)); - __pyx_v_self->alignment = __pyx_v_alignment; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":362 - * # grammar parameters and settings - * # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero - * self.max_length = max_length # <<<<<<<<<<<<<< - * self.max_nonterminals = max_nonterminals - * self.max_initial_size = max_initial_size - */ - __pyx_v_self->max_length = __pyx_v_max_length; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":363 - * # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero - * self.max_length = max_length - * self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<< - * self.max_initial_size = max_initial_size - * self.train_max_initial_size = train_max_initial_size - */ - __pyx_v_self->max_nonterminals = __pyx_v_max_nonterminals; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":364 - * self.max_length = max_length - * self.max_nonterminals = max_nonterminals - * self.max_initial_size = max_initial_size # <<<<<<<<<<<<<< - * self.train_max_initial_size = train_max_initial_size - * self.min_gap_size = min_gap_size - */ - __pyx_v_self->max_initial_size = __pyx_v_max_initial_size; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":365 - * self.max_nonterminals = max_nonterminals - * self.max_initial_size = max_initial_size - * 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 - */ - __pyx_v_self->train_max_initial_size = __pyx_v_train_max_initial_size; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":366 - * self.max_initial_size = max_initial_size - * 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 - * self.category = sym_fromstring(category, False) - */ - __pyx_v_self->min_gap_size = __pyx_v_min_gap_size; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":367 - * 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 # <<<<<<<<<<<<<< - * self.category = sym_fromstring(category, False) - * - */ - __pyx_v_self->train_min_gap_size = __pyx_v_train_min_gap_size; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":368 - * self.min_gap_size = min_gap_size - * self.train_min_gap_size = train_min_gap_size - * self.category = sym_fromstring(category, False) # <<<<<<<<<<<<<< - * - * if max_chunks is None: - */ - __pyx_v_self->category = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_v_category, 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":370 - * self.category = sym_fromstring(category, False) - * - * if max_chunks is None: # <<<<<<<<<<<<<< - * self.max_chunks = self.max_nonterminals + 1 - * else: - */ - __pyx_t_4 = (__pyx_v_max_chunks == Py_None); - __pyx_t_3 = (__pyx_t_4 != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":371 - * - * if max_chunks is None: - * self.max_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<< - * else: - * self.max_chunks = max_chunks - */ - __pyx_v_self->max_chunks = (__pyx_v_self->max_nonterminals + 1); - goto __pyx_L4; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":373 - * self.max_chunks = self.max_nonterminals + 1 - * else: - * self.max_chunks = max_chunks # <<<<<<<<<<<<<< - * - * if max_target_chunks is None: - */ - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_chunks); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->max_chunks = __pyx_t_5; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":375 - * self.max_chunks = max_chunks - * - * if max_target_chunks is None: # <<<<<<<<<<<<<< - * self.max_target_chunks = self.max_nonterminals + 1 - * else: - */ - __pyx_t_3 = (__pyx_v_max_target_chunks == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":376 - * - * if max_target_chunks is None: - * self.max_target_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<< - * else: - * self.max_target_chunks = max_target_chunks - */ - __pyx_v_self->max_target_chunks = (__pyx_v_self->max_nonterminals + 1); - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":378 - * self.max_target_chunks = self.max_nonterminals + 1 - * else: - * self.max_target_chunks = max_target_chunks # <<<<<<<<<<<<<< - * - * if max_target_length is None: - */ - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_target_chunks); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->max_target_chunks = __pyx_t_5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":380 - * self.max_target_chunks = max_target_chunks - * - * if max_target_length is None: # <<<<<<<<<<<<<< - * self.max_target_length = max_initial_size - * else: - */ - __pyx_t_4 = (__pyx_v_max_target_length == Py_None); - __pyx_t_3 = (__pyx_t_4 != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":381 - * - * if max_target_length is None: - * self.max_target_length = max_initial_size # <<<<<<<<<<<<<< - * else: - * self.max_target_length = max_target_length - */ - __pyx_v_self->max_target_length = __pyx_v_max_initial_size; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":383 - * self.max_target_length = max_initial_size - * else: - * self.max_target_length = max_target_length # <<<<<<<<<<<<<< - * - * # algorithmic parameters and settings - */ - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_target_length); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->max_target_length = __pyx_t_5; - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":386 - * - * # algorithmic parameters and settings - * self.precomputed_collocations = {} # <<<<<<<<<<<<<< - * self.precomputed_index = {} - * self.use_index = use_index - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __Pyx_GOTREF(__pyx_v_self->precomputed_collocations); - __Pyx_DECREF(__pyx_v_self->precomputed_collocations); - __pyx_v_self->precomputed_collocations = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":387 - * # algorithmic parameters and settings - * self.precomputed_collocations = {} - * self.precomputed_index = {} # <<<<<<<<<<<<<< - * self.use_index = use_index - * self.use_collocations = use_collocations - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __Pyx_GOTREF(__pyx_v_self->precomputed_index); - __Pyx_DECREF(__pyx_v_self->precomputed_index); - __pyx_v_self->precomputed_index = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":388 - * self.precomputed_collocations = {} - * self.precomputed_index = {} - * self.use_index = use_index # <<<<<<<<<<<<<< - * self.use_collocations = use_collocations - * self.max_rank = {} - */ - __pyx_v_self->use_index = __pyx_v_use_index; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":389 - * self.precomputed_index = {} - * self.use_index = use_index - * self.use_collocations = use_collocations # <<<<<<<<<<<<<< - * self.max_rank = {} - * self.precompute_file = precompute_file - */ - __pyx_v_self->use_collocations = __pyx_v_use_collocations; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":390 - * self.use_index = use_index - * self.use_collocations = use_collocations - * self.max_rank = {} # <<<<<<<<<<<<<< - * self.precompute_file = precompute_file - * self.precompute_rank = precompute_rank - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __Pyx_GOTREF(__pyx_v_self->max_rank); - __Pyx_DECREF(__pyx_v_self->max_rank); - __pyx_v_self->max_rank = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":391 - * self.use_collocations = use_collocations - * self.max_rank = {} - * self.precompute_file = precompute_file # <<<<<<<<<<<<<< - * self.precompute_rank = precompute_rank - * self.precompute_secondary_rank = precompute_secondary_rank - */ - __Pyx_INCREF(__pyx_v_precompute_file); - __Pyx_GIVEREF(__pyx_v_precompute_file); - __Pyx_GOTREF(__pyx_v_self->precompute_file); - __Pyx_DECREF(__pyx_v_self->precompute_file); - __pyx_v_self->precompute_file = __pyx_v_precompute_file; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":392 - * self.max_rank = {} - * self.precompute_file = precompute_file - * self.precompute_rank = precompute_rank # <<<<<<<<<<<<<< - * self.precompute_secondary_rank = precompute_secondary_rank - * self.use_baeza_yates = use_baeza_yates - */ - __pyx_v_self->precompute_rank = __pyx_v_precompute_rank; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":393 - * self.precompute_file = precompute_file - * self.precompute_rank = precompute_rank - * self.precompute_secondary_rank = precompute_secondary_rank # <<<<<<<<<<<<<< - * self.use_baeza_yates = use_baeza_yates - * self.by_slack_factor = by_slack_factor - */ - __pyx_v_self->precompute_secondary_rank = __pyx_v_precompute_secondary_rank; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":394 - * self.precompute_rank = precompute_rank - * self.precompute_secondary_rank = precompute_secondary_rank - * self.use_baeza_yates = use_baeza_yates # <<<<<<<<<<<<<< - * self.by_slack_factor = by_slack_factor - * self.tight_phrases = tight_phrases - */ - __pyx_v_self->use_baeza_yates = __pyx_v_use_baeza_yates; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":395 - * self.precompute_secondary_rank = precompute_secondary_rank - * self.use_baeza_yates = use_baeza_yates - * self.by_slack_factor = by_slack_factor # <<<<<<<<<<<<<< - * self.tight_phrases = tight_phrases - * - */ - __pyx_v_self->by_slack_factor = __pyx_v_by_slack_factor; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":396 - * self.use_baeza_yates = use_baeza_yates - * self.by_slack_factor = by_slack_factor - * self.tight_phrases = tight_phrases # <<<<<<<<<<<<<< - * - * if require_aligned_chunks: - */ - __pyx_v_self->tight_phrases = __pyx_v_tight_phrases; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":398 - * self.tight_phrases = tight_phrases - * - * if require_aligned_chunks: # <<<<<<<<<<<<<< - * # one condition is a stronger version of the other. - * self.require_aligned_chunks = self.require_aligned_terminal = True - */ - __pyx_t_3 = (__pyx_v_require_aligned_chunks != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":400 - * if require_aligned_chunks: - * # one condition is a stronger version of the other. - * self.require_aligned_chunks = self.require_aligned_terminal = True # <<<<<<<<<<<<<< - * elif require_aligned_terminal: - * self.require_aligned_chunks = False - */ - __pyx_v_self->require_aligned_chunks = 1; - __pyx_v_self->require_aligned_terminal = 1; - goto __pyx_L7; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":401 - * # one condition is a stronger version of the other. - * self.require_aligned_chunks = self.require_aligned_terminal = True - * elif require_aligned_terminal: # <<<<<<<<<<<<<< - * self.require_aligned_chunks = False - * self.require_aligned_terminal = True - */ - __pyx_t_3 = (__pyx_v_require_aligned_terminal != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":402 - * self.require_aligned_chunks = self.require_aligned_terminal = True - * elif require_aligned_terminal: - * self.require_aligned_chunks = False # <<<<<<<<<<<<<< - * self.require_aligned_terminal = True - * else: - */ - __pyx_v_self->require_aligned_chunks = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":403 - * elif require_aligned_terminal: - * self.require_aligned_chunks = False - * self.require_aligned_terminal = True # <<<<<<<<<<<<<< - * else: - * self.require_aligned_chunks = self.require_aligned_terminal = False - */ - __pyx_v_self->require_aligned_terminal = 1; - goto __pyx_L7; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":405 - * self.require_aligned_terminal = True - * else: - * self.require_aligned_chunks = self.require_aligned_terminal = False # <<<<<<<<<<<<<< - * - * # diagnostics - */ - __pyx_v_self->require_aligned_chunks = 0; - __pyx_v_self->require_aligned_terminal = 0; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":408 - * - * # diagnostics - * self.prev_norm_prefix = () # <<<<<<<<<<<<<< - * - * self.findexes = IntList(initial_len=10) - */ - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); - __Pyx_GOTREF(__pyx_v_self->prev_norm_prefix); - __Pyx_DECREF(__pyx_v_self->prev_norm_prefix); - __pyx_v_self->prev_norm_prefix = ((PyObject *)__pyx_empty_tuple); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":410 - * self.prev_norm_prefix = () - * - * self.findexes = IntList(initial_len=10) # <<<<<<<<<<<<<< - * self.findexes1 = IntList(initial_len=10) - * - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->findexes); - __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes)); - __pyx_v_self->findexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":411 - * - * self.findexes = IntList(initial_len=10) - * self.findexes1 = IntList(initial_len=10) # <<<<<<<<<<<<<< - * - * # Online stats - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->findexes1); - __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes1)); - __pyx_v_self->findexes1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":416 - * - * # True after data is added - * self.online = False # <<<<<<<<<<<<<< - * self.online_stats = defaultdict(OnlineStats) - * - */ - __pyx_v_self->online = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":417 - * # 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 = 417; __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 = 417; __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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_6); - __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_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure[] = "This gives the RuleFactory access to the Context object.\n Here we also use it to precompute the most expensive intersections\n in the corpus quickly."; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray = 0; - struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_edarray = 0; - struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_sampler = 0; - struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_scorer = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("configure (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__edarray,&__pyx_n_s__sampler,&__pyx_n_s__scorer,0}; - PyObject* values[4] = {0,0,0,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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__fsarray)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__edarray)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sampler)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scorer)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "configure") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_fsarray = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[0]); - __pyx_v_edarray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)values[1]); - __pyx_v_sampler = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)values[2]); - __pyx_v_scorer = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)values[3]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_edarray), __pyx_ptype_4cdec_2sa_3_sa_DataArray, 1, "edarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sampler), __pyx_ptype_4cdec_2sa_3_sa_Sampler, 1, "sampler", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scorer), __pyx_ptype_4cdec_2sa_3_sa_Scorer, 1, "scorer", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_edarray, __pyx_v_sampler, __pyx_v_scorer); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":419 - * self.online_stats = defaultdict(OnlineStats) - * - * def configure(self, SuffixArray fsarray, DataArray edarray, # <<<<<<<<<<<<<< - * Sampler sampler, Scorer scorer): - * '''This gives the RuleFactory access to the Context object. - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray, struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_edarray, struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_sampler, struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_scorer) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("configure", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":424 - * Here we also use it to precompute the most expensive intersections - * in the corpus quickly.''' - * self.fsa = fsarray # <<<<<<<<<<<<<< - * self.fda = fsarray.darray - * self.eda = edarray - */ - __Pyx_INCREF(((PyObject *)__pyx_v_fsarray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fsarray)); - __Pyx_GOTREF(__pyx_v_self->fsa); - __Pyx_DECREF(((PyObject *)__pyx_v_self->fsa)); - __pyx_v_self->fsa = __pyx_v_fsarray; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":425 - * in the corpus quickly.''' - * self.fsa = fsarray - * self.fda = fsarray.darray # <<<<<<<<<<<<<< - * self.eda = edarray - * self.fid2symid = self.set_idmap(self.fda) - */ - __pyx_t_1 = ((PyObject *)__pyx_v_fsarray->darray); - __Pyx_INCREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->fda); - __Pyx_DECREF(((PyObject *)__pyx_v_self->fda)); - __pyx_v_self->fda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":426 - * self.fsa = fsarray - * self.fda = fsarray.darray - * self.eda = edarray # <<<<<<<<<<<<<< - * self.fid2symid = self.set_idmap(self.fda) - * self.eid2symid = self.set_idmap(self.eda) - */ - __Pyx_INCREF(((PyObject *)__pyx_v_edarray)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_edarray)); - __Pyx_GOTREF(__pyx_v_self->eda); - __Pyx_DECREF(((PyObject *)__pyx_v_self->eda)); - __pyx_v_self->eda = __pyx_v_edarray; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":427 - * self.fda = fsarray.darray - * self.eda = edarray - * self.fid2symid = self.set_idmap(self.fda) # <<<<<<<<<<<<<< - * self.eid2symid = self.set_idmap(self.eda) - * self.precompute() - */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->fda); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->fid2symid); - __Pyx_DECREF(((PyObject *)__pyx_v_self->fid2symid)); - __pyx_v_self->fid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":428 - * self.eda = edarray - * self.fid2symid = self.set_idmap(self.fda) - * self.eid2symid = self.set_idmap(self.eda) # <<<<<<<<<<<<<< - * self.precompute() - * self.sampler = sampler - */ - __pyx_t_2 = ((PyObject *)__pyx_v_self->eda); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->eid2symid); - __Pyx_DECREF(((PyObject *)__pyx_v_self->eid2symid)); - __pyx_v_self->eid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":429 - * 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 = 429; __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[8]; __pyx_lineno = 429; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":430 - * self.eid2symid = self.set_idmap(self.eda) - * self.precompute() - * self.sampler = sampler # <<<<<<<<<<<<<< - * self.scorer = scorer - * - */ - __Pyx_INCREF(((PyObject *)__pyx_v_sampler)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_sampler)); - __Pyx_GOTREF(__pyx_v_self->sampler); - __Pyx_DECREF(((PyObject *)__pyx_v_self->sampler)); - __pyx_v_self->sampler = __pyx_v_sampler; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":431 - * self.precompute() - * self.sampler = sampler - * self.scorer = scorer # <<<<<<<<<<<<<< - * - * cdef set_idmap(self, DataArray darray): - */ - __Pyx_INCREF(((PyObject *)__pyx_v_scorer)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_scorer)); - __Pyx_GOTREF(__pyx_v_self->scorer); - __Pyx_DECREF(((PyObject *)__pyx_v_self->scorer)); - __pyx_v_self->scorer = __pyx_v_scorer; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":433 - * self.scorer = scorer - * - * cdef set_idmap(self, DataArray darray): # <<<<<<<<<<<<<< - * cdef int word_id, new_word_id, N - * cdef IntList idmap - */ - -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) { - int __pyx_v_word_id; - int __pyx_v_new_word_id; - int __pyx_v_N; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_idmap = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - char *__pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("set_idmap", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":437 - * cdef IntList idmap - * - * N = len(darray.id2word) # <<<<<<<<<<<<<< - * idmap = IntList(initial_len=N) - * for word_id from 0 <= word_id < N: - */ - __pyx_t_1 = __pyx_v_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[8]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_N = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":438 - * - * N = len(darray.id2word) - * idmap = IntList(initial_len=N) # <<<<<<<<<<<<<< - * for word_id from 0 <= word_id < N: - * new_word_id = sym_fromstring(darray.id2word[word_id], True) - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_idmap = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":439 - * N = len(darray.id2word) - * idmap = IntList(initial_len=N) - * 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 - */ - __pyx_t_4 = __pyx_v_N; - for (__pyx_v_word_id = 0; __pyx_v_word_id < __pyx_t_4; __pyx_v_word_id++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":440 - * idmap = IntList(initial_len=N) - * 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 - * return idmap - */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_darray->id2word, __pyx_v_word_id, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __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 = 440; __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":441 - * 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 # <<<<<<<<<<<<<< - * return idmap - * - */ - (__pyx_v_idmap->arr[__pyx_v_word_id]) = __pyx_v_new_word_id; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":442 - * new_word_id = sym_fromstring(darray.id2word[word_id], True) - * idmap.arr[word_id] = new_word_id - * return idmap # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_idmap)); - __pyx_r = ((PyObject *)__pyx_v_idmap); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.set_idmap", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_idmap); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pattern2phrase (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phrase(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":445 - * - * - * def pattern2phrase(self, pattern): # <<<<<<<<<<<<<< - * # pattern is a tuple, which we must convert to a hiero Phrase - * result = () - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_arity = NULL; - PyObject *__pyx_v_word_id = NULL; - int __pyx_v_new_id; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - char *__pyx_t_7; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pattern2phrase", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":447 - * def pattern2phrase(self, pattern): - * # pattern is a tuple, which we must convert to a hiero Phrase - * result = () # <<<<<<<<<<<<<< - * arity = 0 - * for word_id in pattern: - */ - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - __pyx_v_result = __pyx_empty_tuple; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":448 - * # pattern is a tuple, which we must convert to a hiero Phrase - * result = () - * arity = 0 # <<<<<<<<<<<<<< - * for word_id in pattern: - * if word_id == -1: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_arity = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":449 - * 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)) { - __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 = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - for (;;) { - if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #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 = 449; __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 = 449; __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 = 449; __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 = 449; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":450 - * arity = 0 - * for word_id in pattern: - * if word_id == -1: # <<<<<<<<<<<<<< - * arity = arity + 1 - * new_id = sym_setindex(self.category, arity) - */ - __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[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":451 - * for word_id in pattern: - * if word_id == -1: - * arity = arity + 1 # <<<<<<<<<<<<<< - * new_id = sym_setindex(self.category, arity) - * else: - */ - __pyx_t_4 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_v_arity); - __pyx_v_arity = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":452 - * if word_id == -1: - * arity = arity + 1 - * new_id = sym_setindex(self.category, arity) # <<<<<<<<<<<<<< - * else: - * new_id = sym_fromstring(self.fda.id2word[word_id], True) - */ - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_arity); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_new_id = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6); - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":454 - * new_id = sym_setindex(self.category, arity) - * else: - * new_id = sym_fromstring(self.fda.id2word[word_id], True) # <<<<<<<<<<<<<< - * result = result + (new_id,) - * return Phrase(result) - */ - __pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 454; __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 = 454; __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_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":455 - * else: - * new_id = sym_fromstring(self.fda.id2word[word_id], True) - * result = result + (new_id,) # <<<<<<<<<<<<<< - * return Phrase(result) - * - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_new_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __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); - __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":456 - * new_id = sym_fromstring(self.fda.id2word[word_id], True) - * result = result + (new_id,) - * return Phrase(result) # <<<<<<<<<<<<<< - * - * def pattern2phrase_plus(self, pattern): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.pattern2phrase", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_arity); - __Pyx_XDECREF(__pyx_v_word_id); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pattern2phrase_plus (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":458 - * return Phrase(result) - * - * def pattern2phrase_plus(self, pattern): # <<<<<<<<<<<<<< - * # returns a list containing both the pattern, and pattern - * # suffixed/prefixed with the NT category. - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { - PyObject *__pyx_v_patterns = NULL; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_arity = NULL; - PyObject *__pyx_v_word_id = NULL; - int __pyx_v_new_id; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - char *__pyx_t_7; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("pattern2phrase_plus", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":461 - * # returns a list containing both the pattern, and pattern - * # suffixed/prefixed with the NT category. - * patterns = [] # <<<<<<<<<<<<<< - * result = () - * arity = 0 - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_patterns = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":462 - * # suffixed/prefixed with the NT category. - * patterns = [] - * result = () # <<<<<<<<<<<<<< - * arity = 0 - * for word_id in pattern: - */ - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - __pyx_v_result = __pyx_empty_tuple; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":463 - * patterns = [] - * result = () - * arity = 0 # <<<<<<<<<<<<<< - * for word_id in pattern: - * if word_id == -1: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_arity = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":464 - * 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)) { - __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 = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - for (;;) { - if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #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 = 464; __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 = 464; __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 = 464; __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 = 464; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_word_id); - __pyx_v_word_id = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":465 - * arity = 0 - * for word_id in pattern: - * if word_id == -1: # <<<<<<<<<<<<<< - * arity = arity + 1 - * new_id = sym_setindex(self.category, arity) - */ - __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[8]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":466 - * for word_id in pattern: - * if word_id == -1: - * arity = arity + 1 # <<<<<<<<<<<<<< - * new_id = sym_setindex(self.category, arity) - * else: - */ - __pyx_t_4 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_v_arity); - __pyx_v_arity = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":467 - * if word_id == -1: - * arity = arity + 1 - * new_id = sym_setindex(self.category, arity) # <<<<<<<<<<<<<< - * else: - * new_id = sym_fromstring(self.fda.id2word[word_id], True) - */ - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_arity); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_new_id = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6); - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":469 - * new_id = sym_setindex(self.category, arity) - * else: - * new_id = sym_fromstring(self.fda.id2word[word_id], True) # <<<<<<<<<<<<<< - * result = result + (new_id,) - * patterns.append(Phrase(result)) - */ - __pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 469; __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 = 469; __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_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":470 - * else: - * new_id = sym_fromstring(self.fda.id2word[word_id], True) - * result = result + (new_id,) # <<<<<<<<<<<<<< - * patterns.append(Phrase(result)) - * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_new_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 470; __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); - __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":471 - * new_id = sym_fromstring(self.fda.id2word[word_id], True) - * result = result + (new_id,) - * patterns.append(Phrase(result)) # <<<<<<<<<<<<<< - * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) - * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __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 = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":472 - * result = result + (new_id,) - * patterns.append(Phrase(result)) - * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) # <<<<<<<<<<<<<< - * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) - * return patterns - */ - __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __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[8]; __pyx_lineno = 472; __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 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __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 = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":473 - * patterns.append(Phrase(result)) - * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) - * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) # <<<<<<<<<<<<<< - * return patterns - * - */ - __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __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[8]; __pyx_lineno = 473; __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 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __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 = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":474 - * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) - * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) - * return patterns # <<<<<<<<<<<<<< - * - * def precompute(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_patterns)); - __pyx_r = ((PyObject *)__pyx_v_patterns); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.pattern2phrase_plus", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_patterns); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_arity); - __Pyx_XDECREF(__pyx_v_word_id); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("precompute (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":476 - * return patterns - * - * def precompute(self): # <<<<<<<<<<<<<< - * cdef Precomputation pre - * - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self) { - struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_pre = 0; - PyObject *__pyx_v_start_time = NULL; - PyObject *__pyx_v_pattern = NULL; - PyObject *__pyx_v_arr = NULL; - PyObject *__pyx_v_phrases = NULL; - PyObject *__pyx_v_phrase = NULL; - PyObject *__pyx_v_stop_time = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - 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 *); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("precompute", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":479 - * cdef Precomputation pre - * - * if self.precompute_file is not None: # <<<<<<<<<<<<<< - * start_time = monitor_cpu() - * logger.info("Reading precomputed data from file %s... ", self.precompute_file) - */ - __pyx_t_1 = (__pyx_v_self->precompute_file != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":480 - * - * 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 = 480; __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[8]; __pyx_lineno = 480; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":481 - * 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) - * # check parameters of precomputation -- some are critical and some are not - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 481; __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 = 481; __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(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_112)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_112)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112)); - __Pyx_INCREF(__pyx_v_self->precompute_file); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->precompute_file); - __Pyx_GIVEREF(__pyx_v_self->precompute_file); - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 481; __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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":482 - * 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 = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__from_binary), __pyx_v_self->precompute_file) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Precomputation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":484 - * 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: # <<<<<<<<<<<<<< - * logger.warn("Precomputation done with max nonterminals %d, decoder uses %d", pre.max_nonterminals, self.max_nonterminals) - * if pre.max_length != self.max_length: - */ - __pyx_t_2 = ((__pyx_v_pre->max_nonterminals != __pyx_v_self->max_nonterminals) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":485 - * # 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 = 485; __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 = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__pyx_v_pre->max_nonterminals); 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_t_3 = PyInt_FromLong(__pyx_v_self->max_nonterminals); 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); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_113)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_113)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_113)); - 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); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); 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); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":486 - * 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) - * if pre.train_max_initial_size != self.train_max_initial_size: - */ - __pyx_t_2 = ((__pyx_v_pre->max_length != __pyx_v_self->max_length) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":487 - * 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 = 487; __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 = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromLong(__pyx_v_pre->max_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyInt_FromLong(__pyx_v_self->max_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __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 = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_114)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_114)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114)); - 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 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":488 - * 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)) - * if pre.train_min_gap_size != self.train_min_gap_size: - */ - __pyx_t_2 = ((__pyx_v_pre->train_max_initial_size != __pyx_v_self->train_max_initial_size) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":489 - * 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)) # <<<<<<<<<<<<<< - * 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)) - */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_pre->train_max_initial_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyInt_FromLong(__pyx_v_self->train_max_initial_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __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 = 489; __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); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_5 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_115), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__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 = 489; __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_builtin_Exception, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":490 - * 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: # <<<<<<<<<<<<<< - * 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: - */ - __pyx_t_2 = ((__pyx_v_pre->train_min_gap_size != __pyx_v_self->train_min_gap_size) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":491 - * 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 = PyInt_FromLong(__pyx_v_pre->train_min_gap_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyInt_FromLong(__pyx_v_self->train_min_gap_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_116), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(((PyObject *)__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 = 491; __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 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":492 - * 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)) - * for pattern, arr in pre.precomputed_index.iteritems(): - */ - __pyx_t_2 = (__pyx_v_self->use_index != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":493 - * 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 = 493; __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 = 493; __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 = 493; __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 = 493; __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 = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_117)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_117)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_117)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":494 - * 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; - 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 = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_index, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_8), (&__pyx_t_9)); 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_XDECREF(__pyx_t_6); - __pyx_t_6 = __pyx_t_4; - __pyx_t_4 = 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 = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":495 - * 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 = 495; __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 = 495; __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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_v_phrases); - __pyx_v_phrases = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":496 - * 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; - } 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 = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; - } - 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 = 496; __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 = 496; __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 = 496; __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 = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_4 = __pyx_t_12(__pyx_t_3); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_phrase); - __pyx_v_phrase = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":497 - * phrases = self.pattern2phrase_plus(pattern) - * for phrase in phrases: - * self.precomputed_index[phrase] = arr # <<<<<<<<<<<<<< - * if self.use_collocations: - * logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations)) - */ - if (PyObject_SetItem(__pyx_v_self->precomputed_index, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":498 - * for phrase in phrases: - * 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(): - */ - __pyx_t_2 = (__pyx_v_self->use_collocations != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":499 - * 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 = 499; __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 = 499; __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 = 499; __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 = 499; __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 = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_118)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_118)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_118)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":500 - * 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; - 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 = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_collocations, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_7), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 500; __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; - 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 = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_pattern); - __pyx_v_pattern = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":501 - * 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 = 501; __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 = 501; __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 501; __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_XDECREF(__pyx_v_phrase); - __pyx_v_phrase = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":502 - * for pattern, arr in pre.precomputed_collocations.iteritems(): - * phrase = self.pattern2phrase(pattern) - * self.precomputed_collocations[phrase] = arr # <<<<<<<<<<<<<< - * stop_time = monitor_cpu() - * logger.info("Processing precomputations took %f seconds", stop_time - start_time) - */ - if (PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L13; - } - __pyx_L13:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":503 - * 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 = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 503; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":504 - * self.precomputed_collocations[phrase] = arr - * stop_time = monitor_cpu() - * logger.info("Processing precomputations took %f seconds", stop_time - start_time) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 504; __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_Subtract(__pyx_v_stop_time, __pyx_v_start_time); 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_t_4 = PyTuple_New(2); 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(((PyObject *)__pyx_kp_s_119)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_119)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_119)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__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_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - 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_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_pre); - __Pyx_XDECREF(__pyx_v_start_time); - __Pyx_XDECREF(__pyx_v_pattern); - __Pyx_XDECREF(__pyx_v_arr); - __Pyx_XDECREF(__pyx_v_phrases); - __Pyx_XDECREF(__pyx_v_phrase); - __Pyx_XDECREF(__pyx_v_stop_time); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_precomputed_collocation (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_phrase)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":507 - * - * - * def get_precomputed_collocation(self, phrase): # <<<<<<<<<<<<<< - * if phrase in self.precomputed_collocations: - * arr = self.precomputed_collocations[phrase] - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase) { - PyObject *__pyx_v_arr = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_precomputed_collocation", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":508 - * - * def get_precomputed_collocation(self, phrase): - * 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) - */ - __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_phrase, __pyx_v_self->precomputed_collocations, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":509 - * def get_precomputed_collocation(self, phrase): - * 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) - * return None - */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_arr = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":510 - * 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) # <<<<<<<<<<<<<< - * return None - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr), __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr_low), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr_high), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __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 = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __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 = 510; __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, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":511 - * arr = self.precomputed_collocations[phrase] - * return PhraseLocation(arr=arr, arr_low=0, arr_high=len(arr), num_subpatterns=phrase.arity()+1) - * return None # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_precomputed_collocation", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_arr); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":514 - * - * - * cdef int* baeza_yates_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<< - * int low2, int high2, int* arr2, int step2, - * int offset_by_one, int len_last, int num_subpatterns, int* result_len): - */ - -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) { - int __pyx_v_i1; - int __pyx_v_i2; - int __pyx_v_med1; - int __pyx_v_med2; - int __pyx_v_med1_plus; - int __pyx_v_med1_minus; - int __pyx_v_med2_minus; - int __pyx_v_med2_plus; - int __pyx_v_d_first; - int __pyx_v_qsetsize; - int __pyx_v_dsetsize; - int __pyx_v_tmp; - int __pyx_v_search_low; - int __pyx_v_search_high; - int __pyx_v_med_result_len; - int __pyx_v_low_result_len; - int __pyx_v_high_result_len; - long __pyx_v_comparison; - int *__pyx_v_result; - int *__pyx_v_low_result; - int *__pyx_v_med_result; - int *__pyx_v_high_result; - struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc1; - struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc2; - int *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":527 - * cdef Matching loc1, loc2 - * - * result = malloc(0*sizeof(int*)) # <<<<<<<<<<<<<< - * - * d_first = 0 - */ - __pyx_v_result = ((int *)malloc((0 * (sizeof(int *))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":529 - * result = malloc(0*sizeof(int*)) - * - * d_first = 0 # <<<<<<<<<<<<<< - * if high1 - low1 > high2 - low2: - * d_first = 1 - */ - __pyx_v_d_first = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":530 - * - * d_first = 0 - * if high1 - low1 > high2 - low2: # <<<<<<<<<<<<<< - * d_first = 1 - * - */ - __pyx_t_1 = (((__pyx_v_high1 - __pyx_v_low1) > (__pyx_v_high2 - __pyx_v_low2)) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":531 - * d_first = 0 - * if high1 - low1 > high2 - low2: - * d_first = 1 # <<<<<<<<<<<<<< - * - * # First, check to see if we are at any of the recursive base cases - */ - __pyx_v_d_first = 1; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":535 - * # 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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":536 - * # Case 1: one of the sets is empty - * if low1 >= high1 or low2 >= high2: - * return result # <<<<<<<<<<<<<< - * - * # Case 2: sets are non-overlapping - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":539 - * - * # 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) - * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1: - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":540 - * # 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) # <<<<<<<<<<<<<< - * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1: - * return result - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":541 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":542 - * 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 # <<<<<<<<<<<<<< - * - * assign_matching(&loc1, arr1, low1, step1, self.fda.sent_id.arr) - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":544 - * return result - * - * 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: - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":545 - * - * 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_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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":546 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":547 - * 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 # <<<<<<<<<<<<<< - * - * # Case 3: query set and data set do not meet size mismatch constraints; - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":551 - * # 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); - if (unlikely(__pyx_v_step1 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_step1 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_4))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_qsetsize = __Pyx_div_int(__pyx_t_4, __pyx_v_step1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":552 - * # 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); - if (unlikely(__pyx_v_step2 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_step2 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_4))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_dsetsize = __Pyx_div_int(__pyx_t_4, __pyx_v_step2); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":553 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":554 - * dsetsize = (high2-low2) / step2 - * if d_first: - * tmp = qsetsize # <<<<<<<<<<<<<< - * qsetsize = dsetsize - * dsetsize = tmp - */ - __pyx_v_tmp = __pyx_v_qsetsize; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":555 - * if d_first: - * tmp = qsetsize - * qsetsize = dsetsize # <<<<<<<<<<<<<< - * dsetsize = tmp - * - */ - __pyx_v_qsetsize = __pyx_v_dsetsize; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":556 - * tmp = qsetsize - * qsetsize = dsetsize - * dsetsize = tmp # <<<<<<<<<<<<<< - * - * if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize: - */ - __pyx_v_dsetsize = __pyx_v_tmp; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":558 - * 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)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = (((__pyx_t_5 / __pyx_t_6) > __pyx_v_dsetsize) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":559 - * - * 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) - * - */ - free(__pyx_v_result); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":560 - * 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) # <<<<<<<<<<<<<< - * - * # binary search. There are two flavors, depending on - */ - __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->merge_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, __pyx_v_result_len); - goto __pyx_L0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":564 - * # 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":565 - * # 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_v_med2 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_low2, __pyx_v_high2, __pyx_v_step2); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":566 - * if d_first: - * med2 = median(low2, high2, step2) - * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< - * - * search_low = low1 - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":568 - * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) - * - * search_low = low1 # <<<<<<<<<<<<<< - * search_high = high1 - * while search_low < search_high: - */ - __pyx_v_search_low = __pyx_v_low1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":569 - * - * search_low = low1 - * search_high = high1 # <<<<<<<<<<<<<< - * while search_low < search_high: - * med1 = median(search_low, search_high, step1) - */ - __pyx_v_search_high = __pyx_v_high1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":570 - * search_low = low1 - * search_high = high1 - * while search_low < search_high: # <<<<<<<<<<<<<< - * med1 = median(search_low, search_high, step1) - * 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":571 - * search_high = high1 - * while search_low < search_high: - * 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) - */ - __pyx_v_med1 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":572 - * while search_low < search_high: - * 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) - * if comparison == -1: - */ - __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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":573 - * 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) # <<<<<<<<<<<<<< - * if comparison == -1: - * search_low = med1_plus - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":576 - * if comparison == -1: - * search_low = med1_plus - * elif comparison == 1: # <<<<<<<<<<<<<< - * search_high = med1_minus - * else: - */ - switch (__pyx_v_comparison) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":574 - * 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: # <<<<<<<<<<<<<< - * search_low = med1_plus - * elif comparison == 1: - */ - case -1: - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":575 - * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) - * if comparison == -1: - * search_low = med1_plus # <<<<<<<<<<<<<< - * elif comparison == 1: - * search_high = med1_minus - */ - __pyx_v_search_low = __pyx_v_med1_plus; - break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":576 - * if comparison == -1: - * search_low = med1_plus - * elif comparison == 1: # <<<<<<<<<<<<<< - * search_high = med1_minus - * else: - */ - case 1: - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":577 - * search_low = med1_plus - * elif comparison == 1: - * search_high = med1_minus # <<<<<<<<<<<<<< - * else: - * break - */ - __pyx_v_search_high = __pyx_v_med1_minus; - break; - default: - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":579 - * search_high = med1_minus - * else: - * break # <<<<<<<<<<<<<< - * else: - * med1 = median(low1, high1, step1) - */ - goto __pyx_L11_break; - break; - } - } - __pyx_L11_break:; - goto __pyx_L9; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":581 - * break - * else: - * med1 = median(low1, high1, step1) # <<<<<<<<<<<<<< - * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) - * - */ - __pyx_v_med1 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_low1, __pyx_v_high1, __pyx_v_step1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":582 - * else: - * med1 = median(low1, high1, step1) - * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) # <<<<<<<<<<<<<< - * - * search_low = low2 - */ - __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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":584 - * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) - * - * search_low = low2 # <<<<<<<<<<<<<< - * search_high = high2 - * while search_low < search_high: - */ - __pyx_v_search_low = __pyx_v_low2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":585 - * - * search_low = low2 - * search_high = high2 # <<<<<<<<<<<<<< - * while search_low < search_high: - * med2 = median(search_low, search_high, step2) - */ - __pyx_v_search_high = __pyx_v_high2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":586 - * search_low = low2 - * search_high = high2 - * while search_low < search_high: # <<<<<<<<<<<<<< - * med2 = median(search_low, search_high, step2) - * 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":587 - * search_high = high2 - * while search_low < search_high: - * 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) - */ - __pyx_v_med2 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step2); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":588 - * while search_low < search_high: - * 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) - * if comparison == -1: - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":589 - * 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) # <<<<<<<<<<<<<< - * if comparison == -1: - * search_high = med2 - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":592 - * if comparison == -1: - * search_high = med2 - * elif comparison == 1: # <<<<<<<<<<<<<< - * search_low = med2 + step2 - * else: - */ - switch (__pyx_v_comparison) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":590 - * 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: # <<<<<<<<<<<<<< - * search_high = med2 - * elif comparison == 1: - */ - case -1: - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":591 - * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) - * if comparison == -1: - * search_high = med2 # <<<<<<<<<<<<<< - * elif comparison == 1: - * search_low = med2 + step2 - */ - __pyx_v_search_high = __pyx_v_med2; - break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":592 - * if comparison == -1: - * search_high = med2 - * elif comparison == 1: # <<<<<<<<<<<<<< - * search_low = med2 + step2 - * else: - */ - case 1: - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":593 - * search_high = med2 - * elif comparison == 1: - * search_low = med2 + step2 # <<<<<<<<<<<<<< - * else: - * break - */ - __pyx_v_search_low = (__pyx_v_med2 + __pyx_v_step2); - break; - default: - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":595 - * search_low = med2 + step2 - * else: - * break # <<<<<<<<<<<<<< - * - * med_result_len = 0 - */ - goto __pyx_L13_break; - break; - } - } - __pyx_L13_break:; - } - __pyx_L9:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":597 - * break - * - * med_result_len = 0 # <<<<<<<<<<<<<< - * med_result = malloc(0*sizeof(int*)) - * if search_high > search_low: - */ - __pyx_v_med_result_len = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":598 - * - * med_result_len = 0 - * med_result = malloc(0*sizeof(int*)) # <<<<<<<<<<<<<< - * if search_high > search_low: - * # Then there is a match for the median element of Q - */ - __pyx_v_med_result = ((int *)malloc((0 * (sizeof(int *))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":599 - * med_result_len = 0 - * med_result = 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":605 - * # want to store the bindings for all of those elements. We can - * # subsequently throw all of them away. - * med2_minus = med2 # <<<<<<<<<<<<<< - * med2_plus = med2 + step2 - * i1 = med1_minus - */ - __pyx_v_med2_minus = __pyx_v_med2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":606 - * # subsequently throw all of them away. - * med2_minus = med2 - * med2_plus = med2 + step2 # <<<<<<<<<<<<<< - * i1 = med1_minus - * while i1 < med1_plus: - */ - __pyx_v_med2_plus = (__pyx_v_med2 + __pyx_v_step2); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":607 - * med2_minus = med2 - * med2_plus = med2 + step2 - * i1 = med1_minus # <<<<<<<<<<<<<< - * while i1 < med1_plus: - * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) - */ - __pyx_v_i1 = __pyx_v_med1_minus; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":608 - * med2_plus = med2 + step2 - * i1 = med1_minus - * while i1 < med1_plus: # <<<<<<<<<<<<<< - * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) - * while med2_minus-step2 >= low2: - */ - while (1) { - __pyx_t_3 = ((__pyx_v_i1 < __pyx_v_med1_plus) != 0); - if (!__pyx_t_3) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":609 - * i1 = med1_minus - * while i1 < med1_plus: - * 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) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":610 - * while i1 < med1_plus: - * 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) - * 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":611 - * 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) # <<<<<<<<<<<<<< - * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) < 1: - * med2_minus = med2_minus - step2 - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":612 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":613 - * 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: - * break - */ - __pyx_v_med2_minus = (__pyx_v_med2_minus - __pyx_v_step2); - goto __pyx_L19; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":615 - * med2_minus = med2_minus - step2 - * else: - * break # <<<<<<<<<<<<<< - * i2 = med2_minus - * while i2 < high2: - */ - goto __pyx_L18_break; - } - __pyx_L19:; - } - __pyx_L18_break:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":616 - * else: - * break - * i2 = med2_minus # <<<<<<<<<<<<<< - * while i2 < high2: - * assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) - */ - __pyx_v_i2 = __pyx_v_med2_minus; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":617 - * break - * i2 = med2_minus - * 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) - */ - while (1) { - __pyx_t_3 = ((__pyx_v_i2 < __pyx_v_high2) != 0); - if (!__pyx_t_3) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":618 - * i2 = med2_minus - * 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) - * if comparison == 0: - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":619 - * 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) # <<<<<<<<<<<<<< - * if comparison == 0: - * pass - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":620 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":622 - * if comparison == 0: - * pass - * med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len) # <<<<<<<<<<<<<< - * if comparison == -1: - * 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; - } - __pyx_L22:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":623 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":624 - * 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; - } - __pyx_L23:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":625 - * if comparison == -1: - * break - * i2 = i2 + step2 # <<<<<<<<<<<<<< - * if i2 > med2_plus: - * med2_plus = i2 - */ - __pyx_v_i2 = (__pyx_v_i2 + __pyx_v_step2); - } - __pyx_L21_break:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":626 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":627 - * i2 = i2 + step2 - * if i2 > med2_plus: - * med2_plus = i2 # <<<<<<<<<<<<<< - * i1 = i1 + step1 - * - */ - __pyx_v_med2_plus = __pyx_v_i2; - goto __pyx_L24; - } - __pyx_L24:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":628 - * if i2 > med2_plus: - * med2_plus = i2 - * i1 = i1 + step1 # <<<<<<<<<<<<<< - * - * tmp = med1_minus - */ - __pyx_v_i1 = (__pyx_v_i1 + __pyx_v_step1); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":630 - * i1 = i1 + step1 - * - * tmp = med1_minus # <<<<<<<<<<<<<< - * med1_minus = med1_plus - * med1_plus = tmp - */ - __pyx_v_tmp = __pyx_v_med1_minus; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":631 - * - * tmp = med1_minus - * med1_minus = med1_plus # <<<<<<<<<<<<<< - * med1_plus = tmp - * else: - */ - __pyx_v_med1_minus = __pyx_v_med1_plus; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":632 - * tmp = med1_minus - * med1_minus = med1_plus - * med1_plus = tmp # <<<<<<<<<<<<<< - * else: - * # No match; need to figure out the point of division in D and Q - */ - __pyx_v_med1_plus = __pyx_v_tmp; - goto __pyx_L14; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":635 - * else: - * # No match; need to figure out the point of division in D and Q - * med2_minus = med2 # <<<<<<<<<<<<<< - * med2_plus = med2 - * if d_first: - */ - __pyx_v_med2_minus = __pyx_v_med2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":636 - * # No match; need to figure out the point of division in D and Q - * med2_minus = med2 - * med2_plus = med2 # <<<<<<<<<<<<<< - * if d_first: - * med2_minus = med2_minus + step2 - */ - __pyx_v_med2_plus = __pyx_v_med2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":637 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":638 - * med2_plus = med2 - * if d_first: - * med2_minus = med2_minus + step2 # <<<<<<<<<<<<<< - * if comparison == -1: - * med1_minus = med1_plus - */ - __pyx_v_med2_minus = (__pyx_v_med2_minus + __pyx_v_step2); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":639 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":640 - * med2_minus = med2_minus + step2 - * if comparison == -1: - * med1_minus = med1_plus # <<<<<<<<<<<<<< - * if comparison == 1: - * med1_plus = med1_minus - */ - __pyx_v_med1_minus = __pyx_v_med1_plus; - goto __pyx_L26; - } - __pyx_L26:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":641 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":642 - * med1_minus = med1_plus - * if comparison == 1: - * med1_plus = med1_minus # <<<<<<<<<<<<<< - * else: - * tmp = med1_minus - */ - __pyx_v_med1_plus = __pyx_v_med1_minus; - goto __pyx_L27; - } - __pyx_L27:; - goto __pyx_L25; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":644 - * med1_plus = med1_minus - * else: - * tmp = med1_minus # <<<<<<<<<<<<<< - * med1_minus = med1_plus - * med1_plus = tmp - */ - __pyx_v_tmp = __pyx_v_med1_minus; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":645 - * else: - * tmp = med1_minus - * med1_minus = med1_plus # <<<<<<<<<<<<<< - * med1_plus = tmp - * if comparison == 1: - */ - __pyx_v_med1_minus = __pyx_v_med1_plus; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":646 - * tmp = med1_minus - * med1_minus = med1_plus - * med1_plus = tmp # <<<<<<<<<<<<<< - * if comparison == 1: - * med2_minus = med2_minus + step2 - */ - __pyx_v_med1_plus = __pyx_v_tmp; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":647 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":648 - * med1_plus = tmp - * if comparison == 1: - * med2_minus = med2_minus + step2 # <<<<<<<<<<<<<< - * med2_plus = med2_plus + step2 - * - */ - __pyx_v_med2_minus = (__pyx_v_med2_minus + __pyx_v_step2); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":649 - * if comparison == 1: - * med2_minus = med2_minus + step2 - * med2_plus = med2_plus + step2 # <<<<<<<<<<<<<< - * - * low_result_len = 0 - */ - __pyx_v_med2_plus = (__pyx_v_med2_plus + __pyx_v_step2); - goto __pyx_L28; - } - __pyx_L28:; - } - __pyx_L25:; - } - __pyx_L14:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":651 - * med2_plus = med2_plus + step2 - * - * 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 - */ - __pyx_v_low_result_len = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":652 - * - * 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 - * 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) - */ - __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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":653 - * 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 # <<<<<<<<<<<<<< - * 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) - * - */ - __pyx_v_high_result_len = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":654 - * 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) # <<<<<<<<<<<<<< - * - * result = extend_arr(result, result_len, low_result, low_result_len) - */ - __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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":656 - * 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) # <<<<<<<<<<<<<< - * result = extend_arr(result, result_len, med_result, med_result_len) - * result = extend_arr(result, result_len, high_result, high_result_len) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":657 - * - * 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) - * free(low_result) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":658 - * 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) # <<<<<<<<<<<<<< - * free(low_result) - * free(med_result) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":659 - * 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) # <<<<<<<<<<<<<< - * free(med_result) - * free(high_result) - */ - free(__pyx_v_low_result); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":660 - * result = extend_arr(result, result_len, high_result, high_result_len) - * free(low_result) - * free(med_result) # <<<<<<<<<<<<<< - * free(high_result) - * - */ - free(__pyx_v_med_result); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":661 - * free(low_result) - * free(med_result) - * free(high_result) # <<<<<<<<<<<<<< - * - * return result - */ - free(__pyx_v_high_result); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":663 - * free(high_result) - * - * return result # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_WriteUnraisable("cdec.sa._sa.HieroCachingRuleFactory.baeza_yates_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":667 - * - * - * cdef long compare_matchings_set(self, int i1_minus, int i1_plus, int* arr1, int step1, # <<<<<<<<<<<<<< - * Matching* loc2, int offset_by_one, int len_last): - * """ - */ - -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) { - int __pyx_v_i1; - int __pyx_v_comparison; - int __pyx_v_prev_comparison; - struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_l1_stack; - struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc1; - long __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("compare_matchings_set", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":678 - * cdef Matching* loc1 - * - * loc1 = &l1_stack # <<<<<<<<<<<<<< - * - * i1 = i1_minus - */ - __pyx_v_loc1 = (&__pyx_v_l1_stack); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":680 - * loc1 = &l1_stack - * - * i1 = i1_minus # <<<<<<<<<<<<<< - * while i1 < i1_plus: - * assign_matching(loc1, arr1, i1, step1, self.fda.sent_id.arr) - */ - __pyx_v_i1 = __pyx_v_i1_minus; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":681 - * - * i1 = i1_minus - * 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) - */ - while (1) { - __pyx_t_1 = ((__pyx_v_i1 < __pyx_v_i1_plus) != 0); - if (!__pyx_t_1) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":682 - * i1 = i1_minus - * 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) - * if comparison == 0: - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":683 - * 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) # <<<<<<<<<<<<<< - * if comparison == 0: - * prev_comparison = 0 - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":684 - * 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: # <<<<<<<<<<<<<< - * prev_comparison = 0 - * break - */ - __pyx_t_1 = ((__pyx_v_comparison == 0) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":685 - * comparison = self.compare_matchings(loc1, loc2, offset_by_one, len_last) - * if comparison == 0: - * prev_comparison = 0 # <<<<<<<<<<<<<< - * break - * elif i1 == i1_minus: - */ - __pyx_v_prev_comparison = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":686 - * if comparison == 0: - * prev_comparison = 0 - * break # <<<<<<<<<<<<<< - * elif i1 == i1_minus: - * prev_comparison = comparison - */ - goto __pyx_L4_break; - goto __pyx_L5; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":687 - * prev_comparison = 0 - * break - * elif i1 == i1_minus: # <<<<<<<<<<<<<< - * prev_comparison = comparison - * else: - */ - __pyx_t_1 = ((__pyx_v_i1 == __pyx_v_i1_minus) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":688 - * break - * elif i1 == i1_minus: - * prev_comparison = comparison # <<<<<<<<<<<<<< - * else: - * if comparison != prev_comparison: - */ - __pyx_v_prev_comparison = __pyx_v_comparison; - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":690 - * prev_comparison = comparison - * else: - * if comparison != prev_comparison: # <<<<<<<<<<<<<< - * prev_comparison = 0 - * break - */ - __pyx_t_1 = ((__pyx_v_comparison != __pyx_v_prev_comparison) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":691 - * else: - * if comparison != prev_comparison: - * prev_comparison = 0 # <<<<<<<<<<<<<< - * break - * i1 = i1 + step1 - */ - __pyx_v_prev_comparison = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":692 - * if comparison != prev_comparison: - * prev_comparison = 0 - * break # <<<<<<<<<<<<<< - * i1 = i1 + step1 - * return prev_comparison - */ - goto __pyx_L4_break; - goto __pyx_L6; - } - __pyx_L6:; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":693 - * prev_comparison = 0 - * break - * i1 = i1 + step1 # <<<<<<<<<<<<<< - * return prev_comparison - * - */ - __pyx_v_i1 = (__pyx_v_i1 + __pyx_v_step1); - } - __pyx_L4_break:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":694 - * break - * i1 = i1 + step1 - * return prev_comparison # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_prev_comparison; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":697 - * - * - * cdef long compare_matchings(self, Matching* loc1, Matching* loc2, int offset_by_one, int len_last): # <<<<<<<<<<<<<< - * cdef int i - * - */ - -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) { - int __pyx_v_i; - long __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("compare_matchings", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":700 - * cdef int i - * - * if loc1.sent_id > loc2.sent_id: # <<<<<<<<<<<<<< - * return 1 - * if loc2.sent_id > loc1.sent_id: - */ - __pyx_t_1 = ((__pyx_v_loc1->sent_id > __pyx_v_loc2->sent_id) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":701 - * - * if loc1.sent_id > loc2.sent_id: - * return 1 # <<<<<<<<<<<<<< - * if loc2.sent_id > loc1.sent_id: - * return -1 - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":702 - * if loc1.sent_id > loc2.sent_id: - * return 1 - * if loc2.sent_id > loc1.sent_id: # <<<<<<<<<<<<<< - * return -1 - * - */ - __pyx_t_1 = ((__pyx_v_loc2->sent_id > __pyx_v_loc1->sent_id) != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":703 - * return 1 - * if loc2.sent_id > loc1.sent_id: - * return -1 # <<<<<<<<<<<<<< - * - * if loc1.size == 1 and loc2.size == 1: - */ - __pyx_r = -1; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":705 - * 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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":706 - * - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":707 - * if loc1.size == 1 and loc2.size == 1: - * if loc2.arr[loc2.start] - loc1.arr[loc1.start] <= self.train_min_gap_size: - * return 1 # <<<<<<<<<<<<<< - * - * elif offset_by_one: - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - goto __pyx_L5; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":709 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":710 - * - * 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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":711 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":712 - * 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]: - * return -1 - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":713 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":714 - * return 1 - * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i-1]: - * return -1 # <<<<<<<<<<<<<< - * - * else: - */ - __pyx_r = -1; - goto __pyx_L0; - goto __pyx_L10; - } - __pyx_L10:; - } - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":717 - * - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":718 - * else: - * 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_r = 1; - goto __pyx_L0; - goto __pyx_L11; - } - __pyx_L11:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":719 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":720 - * return 1 - * if loc1.arr[loc1.start]+1 < loc2.arr[loc2.start]: - * return -1 # <<<<<<<<<<<<<< - * - * for i from 1 <= i < loc1.size: - */ - __pyx_r = -1; - goto __pyx_L0; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":722 - * 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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":723 - * - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":724 - * 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]: - * return -1 - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L15; - } - __pyx_L15:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":725 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":726 - * return 1 - * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i]: - * return -1 # <<<<<<<<<<<<<< - * - * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: - */ - __pyx_r = -1; - goto __pyx_L0; - goto __pyx_L16; - } - __pyx_L16:; - } - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":728 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":729 - * - * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: - * return -1 # <<<<<<<<<<<<<< - * return 0 - * - */ - __pyx_r = -1; - goto __pyx_L0; - goto __pyx_L17; - } - __pyx_L17:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":730 - * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: - * return -1 - * return 0 # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = 0; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":733 - * - * - * cdef int* merge_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<< - * int low2, int high2, int* arr2, int step2, - * int offset_by_one, int len_last, int num_subpatterns, int* result_len): - */ - -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) { - int __pyx_v_i1; - int __pyx_v_i2; - int __pyx_v_j1; - int __pyx_v_j2; - long __pyx_v_comparison; - int *__pyx_v_result; - struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc1; - struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc2; - int *__pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("merge_helper", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":741 - * cdef Matching loc1, loc2 - * - * result_len[0] = 0 # <<<<<<<<<<<<<< - * result = malloc(0*sizeof(int)) - * - */ - (__pyx_v_result_len[0]) = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":742 - * - * result_len[0] = 0 - * result = malloc(0*sizeof(int)) # <<<<<<<<<<<<<< - * - * i1 = low1 - */ - __pyx_v_result = ((int *)malloc((0 * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":744 - * result = malloc(0*sizeof(int)) - * - * i1 = low1 # <<<<<<<<<<<<<< - * i2 = low2 - * while i1 < high1 and i2 < high2: - */ - __pyx_v_i1 = __pyx_v_low1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":745 - * - * i1 = low1 - * i2 = low2 # <<<<<<<<<<<<<< - * while i1 < high1 and i2 < high2: - * - */ - __pyx_v_i2 = __pyx_v_low2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":746 - * i1 = low1 - * i2 = low2 - * while i1 < high1 and i2 < high2: # <<<<<<<<<<<<<< - * - * # 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; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (!__pyx_t_3) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":749 - * - * # First, pop all unneeded loc2's off the stack - * 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) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":750 - * # First, pop all unneeded loc2's off the stack - * 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) - * 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":751 - * 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) # <<<<<<<<<<<<<< - * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: - * i2 = i2 + step2 - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":752 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":753 - * 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: - * break - */ - __pyx_v_i2 = (__pyx_v_i2 + __pyx_v_step2); - goto __pyx_L7; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":755 - * i2 = i2 + step2 - * else: - * break # <<<<<<<<<<<<<< - * - * # Next: process all loc1's with the same starting val - */ - goto __pyx_L6_break; - } - __pyx_L7:; - } - __pyx_L6_break:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":758 - * - * # Next: process all loc1's with the same starting val - * j1 = i1 # <<<<<<<<<<<<<< - * while i1 < high1 and arr1[j1] == arr1[i1]: - * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) - */ - __pyx_v_j1 = __pyx_v_i1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":759 - * # Next: process all loc1's with the same starting val - * j1 = i1 - * while i1 < high1 and arr1[j1] == arr1[i1]: # <<<<<<<<<<<<<< - * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) - * 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; - } else { - __pyx_t_2 = __pyx_t_3; - } - if (!__pyx_t_2) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":760 - * j1 = i1 - * while i1 < high1 and arr1[j1] == arr1[i1]: - * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<< - * j2 = i2 - * while j2 < high2: - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":761 - * while i1 < high1 and arr1[j1] == arr1[i1]: - * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) - * j2 = i2 # <<<<<<<<<<<<<< - * while j2 < high2: - * assign_matching(&loc2, arr2, j2, step2, self.fda.sent_id.arr) - */ - __pyx_v_j2 = __pyx_v_i2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":762 - * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) - * j2 = i2 - * 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) - */ - while (1) { - __pyx_t_2 = ((__pyx_v_j2 < __pyx_v_high2) != 0); - if (!__pyx_t_2) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":763 - * j2 = i2 - * 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) - * if comparison == 0: - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":764 - * 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) # <<<<<<<<<<<<<< - * if comparison == 0: - * result = append_combined_matching(result, &loc1, &loc2, offset_by_one, num_subpatterns, result_len) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":765 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":766 - * 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: - * 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; - } - __pyx_L12:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":767 - * 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_L13:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":769 - * if comparison == 1: - * pass - * if comparison == -1: # <<<<<<<<<<<<<< - * break - * else: - */ - __pyx_t_2 = ((__pyx_v_comparison == -1) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":770 - * pass - * if comparison == -1: - * break # <<<<<<<<<<<<<< - * else: - * j2 = j2 + step2 - */ - goto __pyx_L11_break; - goto __pyx_L14; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":772 - * break - * else: - * j2 = j2 + step2 # <<<<<<<<<<<<<< - * i1 = i1 + step1 - * return result - */ - __pyx_v_j2 = (__pyx_v_j2 + __pyx_v_step2); - } - __pyx_L14:; - } - __pyx_L11_break:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":773 - * else: - * j2 = j2 + step2 - * i1 = i1 + step1 # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_v_i1 = (__pyx_v_i1 + __pyx_v_step1); - } - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":774 - * j2 = j2 + step2 - * i1 = i1 + step1 - * return result # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":777 - * - * - * cdef void sort_phrase_loc(self, IntList arr, PhraseLocation loc, Phrase phrase): # <<<<<<<<<<<<<< - * cdef int i, j - * cdef VEB veb - */ - -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) { - int __pyx_v_i; - int __pyx_v_j; - struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_veb = 0; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("sort_phrase_loc", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":782 - * cdef IntList result - * - * if phrase in self.precomputed_index: # <<<<<<<<<<<<<< - * loc.arr = self.precomputed_index[phrase] - * else: - */ - __pyx_t_1 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_phrase), __pyx_v_self->precomputed_index, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":783 - * - * if phrase in self.precomputed_index: - * loc.arr = self.precomputed_index[phrase] # <<<<<<<<<<<<<< - * else: - * loc.arr = IntList(initial_len=loc.sa_high-loc.sa_low) - */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_self->precomputed_index, ((PyObject *)__pyx_v_phrase)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 783; __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_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_loc->arr); - __Pyx_DECREF(((PyObject *)__pyx_v_loc->arr)); - __pyx_v_loc->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":785 - * loc.arr = self.precomputed_index[phrase] - * else: - * 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: - */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = PyInt_FromLong((__pyx_v_loc->sa_high - __pyx_v_loc->sa_low)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_v_loc->arr); - __Pyx_DECREF(((PyObject *)__pyx_v_loc->arr)); - __pyx_v_loc->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":786 - * else: - * 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: - * veb._insert(arr.arr[i]) - */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_arr->len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 786; __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[8]; __pyx_lineno = 786; __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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_VEB)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":787 - * 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: # <<<<<<<<<<<<<< - * veb._insert(arr.arr[i]) - * i = veb.veb.min_val - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":788 - * veb = VEB(arr.len) - * for i from loc.sa_low <= i < loc.sa_high: - * veb._insert(arr.arr[i]) # <<<<<<<<<<<<<< - * i = veb.veb.min_val - * for j from 0 <= j < loc.sa_high-loc.sa_low: - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_insert(__pyx_v_veb, (__pyx_v_arr->arr[__pyx_v_i])); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":789 - * for i from loc.sa_low <= i < loc.sa_high: - * veb._insert(arr.arr[i]) - * i = veb.veb.min_val # <<<<<<<<<<<<<< - * for j from 0 <= j < loc.sa_high-loc.sa_low: - * loc.arr.arr[j] = i - */ - __pyx_t_5 = __pyx_v_veb->veb->min_val; - __pyx_v_i = __pyx_t_5; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":790 - * veb._insert(arr.arr[i]) - * i = veb.veb.min_val - * for j from 0 <= j < loc.sa_high-loc.sa_low: # <<<<<<<<<<<<<< - * loc.arr.arr[j] = i - * i = veb._findsucc(i) - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":791 - * i = veb.veb.min_val - * for j from 0 <= j < loc.sa_high-loc.sa_low: - * loc.arr.arr[j] = i # <<<<<<<<<<<<<< - * i = veb._findsucc(i) - * loc.arr_low = 0 - */ - (__pyx_v_loc->arr->arr[__pyx_v_j]) = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":792 - * for j from 0 <= j < loc.sa_high-loc.sa_low: - * loc.arr.arr[j] = i - * i = veb._findsucc(i) # <<<<<<<<<<<<<< - * loc.arr_low = 0 - * loc.arr_high = loc.arr.len - */ - __pyx_v_i = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_findsucc(__pyx_v_veb, __pyx_v_i); - } - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":793 - * loc.arr.arr[j] = i - * i = veb._findsucc(i) - * loc.arr_low = 0 # <<<<<<<<<<<<<< - * loc.arr_high = loc.arr.len - * - */ - __pyx_v_loc->arr_low = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":794 - * i = veb._findsucc(i) - * loc.arr_low = 0 - * loc.arr_high = loc.arr.len # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = __pyx_v_loc->arr->len; - __pyx_v_loc->arr_high = __pyx_t_5; - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("cdec.sa._sa.HieroCachingRuleFactory.sort_phrase_loc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_veb); - __Pyx_RefNannyFinishContext(); -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":797 - * - * - * cdef intersect_helper(self, Phrase prefix, Phrase suffix, # <<<<<<<<<<<<<< - * PhraseLocation prefix_loc, PhraseLocation suffix_loc, int algorithm): - * - */ - -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) { - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr1 = 0; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr2 = 0; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_result = 0; - int __pyx_v_low1; - int __pyx_v_high1; - int __pyx_v_step1; - int __pyx_v_low2; - int __pyx_v_high2; - 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; - int *__pyx_v_result_ptr; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("intersect_helper", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":804 - * cdef int* result_ptr - * - * result_len = 0 # <<<<<<<<<<<<<< - * - * if sym_isvar(suffix[0]): - */ - __pyx_v_result_len = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":806 - * result_len = 0 - * - * if sym_isvar(suffix[0]): # <<<<<<<<<<<<<< - * offset_by_one = 1 - * else: - */ - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_suffix), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_2) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":807 - * - * if sym_isvar(suffix[0]): - * offset_by_one = 1 # <<<<<<<<<<<<<< - * else: - * offset_by_one = 0 - */ - __pyx_v_offset_by_one = 1; - goto __pyx_L3; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":809 - * offset_by_one = 1 - * else: - * offset_by_one = 0 # <<<<<<<<<<<<<< - * - * len_last = len(suffix.getchunk(suffix.arity())) - */ - __pyx_v_offset_by_one = 0; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":811 - * 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 = 811; __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 = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __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(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __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_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__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 = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_len_last = __pyx_t_6; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":813 - * len_last = len(suffix.getchunk(suffix.arity())) - * - * if prefix_loc.arr is None: # <<<<<<<<<<<<<< - * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":814 - * - * 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; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":815 - * 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":816 - * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) - * arr1 = prefix_loc.arr - * low1 = prefix_loc.arr_low # <<<<<<<<<<<<<< - * high1 = prefix_loc.arr_high - * step1 = prefix_loc.num_subpatterns - */ - __pyx_t_2 = __pyx_v_prefix_loc->arr_low; - __pyx_v_low1 = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":817 - * arr1 = prefix_loc.arr - * low1 = prefix_loc.arr_low - * high1 = prefix_loc.arr_high # <<<<<<<<<<<<<< - * step1 = prefix_loc.num_subpatterns - * - */ - __pyx_t_2 = __pyx_v_prefix_loc->arr_high; - __pyx_v_high1 = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":818 - * low1 = prefix_loc.arr_low - * high1 = prefix_loc.arr_high - * step1 = prefix_loc.num_subpatterns # <<<<<<<<<<<<<< - * - * if suffix_loc.arr is None: - */ - __pyx_t_2 = __pyx_v_prefix_loc->num_subpatterns; - __pyx_v_step1 = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":820 - * 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); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":821 - * - * 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; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":822 - * 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":823 - * self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix) - * arr2 = suffix_loc.arr - * low2 = suffix_loc.arr_low # <<<<<<<<<<<<<< - * high2 = suffix_loc.arr_high - * step2 = suffix_loc.num_subpatterns - */ - __pyx_t_2 = __pyx_v_suffix_loc->arr_low; - __pyx_v_low2 = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":824 - * arr2 = suffix_loc.arr - * low2 = suffix_loc.arr_low - * high2 = suffix_loc.arr_high # <<<<<<<<<<<<<< - * step2 = suffix_loc.num_subpatterns - * - */ - __pyx_t_2 = __pyx_v_suffix_loc->arr_high; - __pyx_v_high2 = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":825 - * low2 = suffix_loc.arr_low - * high2 = suffix_loc.arr_high - * step2 = suffix_loc.num_subpatterns # <<<<<<<<<<<<<< - * - * num_subpatterns = prefix.arity()+1 - */ - __pyx_t_2 = __pyx_v_suffix_loc->num_subpatterns; - __pyx_v_step2 = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":827 - * 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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 827; __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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_num_subpatterns = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":829 - * num_subpatterns = prefix.arity()+1 - * - * if algorithm == MERGE: # <<<<<<<<<<<<<< - * result_ptr = self.merge_helper(low1, high1, arr1.arr, step1, - * low2, high2, arr2.arr, step2, - */ - __pyx_t_3 = ((__pyx_v_algorithm == __pyx_v_4cdec_2sa_3_sa_MERGE) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":832 - * result_ptr = self.merge_helper(low1, high1, arr1.arr, step1, - * low2, high2, arr2.arr, step2, - * offset_by_one, len_last, num_subpatterns, &result_len) # <<<<<<<<<<<<<< - * else: - * result_ptr = self.baeza_yates_helper(low1, high1, arr1.arr, step1, - */ - __pyx_v_result_ptr = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->merge_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1->arr, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2->arr, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_result_len)); - goto __pyx_L6; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":836 - * result_ptr = self.baeza_yates_helper(low1, high1, arr1.arr, step1, - * low2, high2, arr2.arr, step2, - * offset_by_one, len_last, num_subpatterns, &result_len) # <<<<<<<<<<<<<< - * - * if result_len == 0: - */ - __pyx_v_result_ptr = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->baeza_yates_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1->arr, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2->arr, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_result_len)); - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":838 - * offset_by_one, len_last, num_subpatterns, &result_len) - * - * if result_len == 0: # <<<<<<<<<<<<<< - * free(result_ptr) - * return None - */ - __pyx_t_3 = ((__pyx_v_result_len == 0) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":839 - * - * if result_len == 0: - * free(result_ptr) # <<<<<<<<<<<<<< - * return None - * else: - */ - free(__pyx_v_result_ptr); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":840 - * if result_len == 0: - * free(result_ptr) - * return None # <<<<<<<<<<<<<< - * else: - * result = IntList() - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - goto __pyx_L7; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":842 - * return None - * else: - * result = IntList() # <<<<<<<<<<<<<< - * free(result.arr) - * result.arr = result_ptr - */ - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":843 - * else: - * result = IntList() - * free(result.arr) # <<<<<<<<<<<<<< - * result.arr = result_ptr - * result.len = result_len - */ - free(__pyx_v_result->arr); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":844 - * result = IntList() - * free(result.arr) - * result.arr = result_ptr # <<<<<<<<<<<<<< - * result.len = result_len - * result.size = result_len - */ - __pyx_v_result->arr = __pyx_v_result_ptr; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":845 - * free(result.arr) - * result.arr = result_ptr - * result.len = result_len # <<<<<<<<<<<<<< - * result.size = result_len - * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) - */ - __pyx_v_result->len = __pyx_v_result_len; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":846 - * result.arr = result_ptr - * result.len = result_len - * result.size = result_len # <<<<<<<<<<<<<< - * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) - * - */ - __pyx_v_result->size = __pyx_v_result_len; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":847 - * result.len = result_len - * result.size = result_len - * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) # <<<<<<<<<<<<<< - * - * 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 = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr_low), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_v_result_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr_high), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr), ((PyObject *)__pyx_v_result)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong(__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - } - __pyx_L7:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.intersect_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_arr1); - __Pyx_XDECREF((PyObject *)__pyx_v_arr2); - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":849 - * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) - * - * cdef loc2str(self, PhraseLocation loc): # <<<<<<<<<<<<<< - * cdef int i, j - * result = "{" - */ - -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) { - int __pyx_v_i; - int __pyx_v_j; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loc2str", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":851 - * cdef loc2str(self, PhraseLocation loc): - * cdef int i, j - * result = "{" # <<<<<<<<<<<<<< - * i = 0 - * while i < loc.arr_high: - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_120)); - __pyx_v_result = ((PyObject *)__pyx_kp_s_120); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":852 - * cdef int i, j - * result = "{" - * i = 0 # <<<<<<<<<<<<<< - * while i < loc.arr_high: - * result = result + "(" - */ - __pyx_v_i = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":853 - * result = "{" - * i = 0 - * while i < loc.arr_high: # <<<<<<<<<<<<<< - * result = result + "(" - * for j from i <= j < i + loc.num_subpatterns: - */ - while (1) { - __pyx_t_1 = ((__pyx_v_i < __pyx_v_loc->arr_high) != 0); - if (!__pyx_t_1) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":854 - * i = 0 - * while i < loc.arr_high: - * result = result + "(" # <<<<<<<<<<<<<< - * for j from i <= j < i + loc.num_subpatterns: - * result = result + ("%d " %loc.arr[j]) - */ - __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_121)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":855 - * while i < loc.arr_high: - * result = result + "(" - * for j from i <= j < i + loc.num_subpatterns: # <<<<<<<<<<<<<< - * result = result + ("%d " %loc.arr[j]) - * result = result + ")" - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":856 - * result = result + "(" - * for j from i <= j < i + loc.num_subpatterns: - * result = result + ("%d " %loc.arr[j]) # <<<<<<<<<<<<<< - * result = result + ")" - * i = i + loc.num_subpatterns - */ - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_loc->arr), __pyx_v_j, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_2; - __pyx_t_2 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":857 - * for j from i <= j < i + loc.num_subpatterns: - * result = result + ("%d " %loc.arr[j]) - * result = result + ")" # <<<<<<<<<<<<<< - * i = i + loc.num_subpatterns - * result = result + "}" - */ - __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":858 - * result = result + ("%d " %loc.arr[j]) - * result = result + ")" - * i = i + loc.num_subpatterns # <<<<<<<<<<<<<< - * result = result + "}" - * return result - */ - __pyx_v_i = (__pyx_v_i + __pyx_v_loc->num_subpatterns); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":859 - * result = result + ")" - * i = i + loc.num_subpatterns - * result = result + "}" # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_122)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":860 - * i = i + loc.num_subpatterns - * result = result + "}" - * return result # <<<<<<<<<<<<<< - * - * cdef PhraseLocation intersect(self, prefix_node, suffix_node, Phrase phrase): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.loc2str", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":862 - * return result - * - * cdef PhraseLocation intersect(self, prefix_node, suffix_node, Phrase phrase): # <<<<<<<<<<<<<< - * cdef Phrase prefix, suffix - * cdef PhraseLocation prefix_loc, suffix_loc, result - */ - -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) { - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_prefix = 0; - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_suffix = 0; - struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_prefix_loc = 0; - struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_suffix_loc = 0; - struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_result = 0; - CYTHON_UNUSED PyObject *__pyx_v_intersect_method = NULL; - struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("intersect", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":866 - * cdef PhraseLocation prefix_loc, suffix_loc, result - * - * prefix = prefix_node.phrase # <<<<<<<<<<<<<< - * suffix = suffix_node.phrase - * prefix_loc = prefix_node.phrase_location - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix_node, __pyx_n_s__phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __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_Phrase))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_prefix = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":867 - * - * prefix = prefix_node.phrase - * suffix = suffix_node.phrase # <<<<<<<<<<<<<< - * prefix_loc = prefix_node.phrase_location - * suffix_loc = suffix_node.phrase_location - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_suffix_node, __pyx_n_s__phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 867; __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_Phrase))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_suffix = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":868 - * prefix = prefix_node.phrase - * suffix = suffix_node.phrase - * prefix_loc = prefix_node.phrase_location # <<<<<<<<<<<<<< - * suffix_loc = suffix_node.phrase_location - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 868; __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 = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_prefix_loc = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":869 - * suffix = suffix_node.phrase - * prefix_loc = prefix_node.phrase_location - * suffix_loc = suffix_node.phrase_location # <<<<<<<<<<<<<< - * - * result = self.get_precomputed_collocation(phrase) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_suffix_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 869; __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 = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_suffix_loc = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":871 - * 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_123); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __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 = 871; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __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 (!(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 = 871; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":872 - * - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":873 - * result = self.get_precomputed_collocation(phrase) - * if result is not None: - * intersect_method = "precomputed" # <<<<<<<<<<<<<< - * - * if result is None: - */ - __Pyx_INCREF(((PyObject *)__pyx_n_s__precomputed)); - __pyx_v_intersect_method = ((PyObject *)__pyx_n_s__precomputed); - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":875 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":876 - * - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":877 - * 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 = 877; __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 = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":878 - * if self.use_baeza_yates: - * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, BAEZA_YATES) - * intersect_method="double binary" # <<<<<<<<<<<<<< - * else: - * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_124)); - __Pyx_XDECREF(__pyx_v_intersect_method); - __pyx_v_intersect_method = ((PyObject *)__pyx_kp_s_124); - goto __pyx_L5; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":880 - * 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 = 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(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":881 - * else: - * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) - * intersect_method="merge" # <<<<<<<<<<<<<< - * return result - * - */ - __Pyx_INCREF(((PyObject *)__pyx_n_s__merge)); - __Pyx_XDECREF(__pyx_v_intersect_method); - __pyx_v_intersect_method = ((PyObject *)__pyx_n_s__merge); - } - __pyx_L5:; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":882 - * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) - * intersect_method="merge" - * return result # <<<<<<<<<<<<<< - * - * def advance(self, frontier, res, fwords): - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - __pyx_r = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_prefix); - __Pyx_XDECREF((PyObject *)__pyx_v_suffix); - __Pyx_XDECREF((PyObject *)__pyx_v_prefix_loc); - __Pyx_XDECREF((PyObject *)__pyx_v_suffix_loc); - __Pyx_XDECREF((PyObject *)__pyx_v_result); - __Pyx_XDECREF(__pyx_v_intersect_method); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_frontier = 0; - PyObject *__pyx_v_res = 0; - PyObject *__pyx_v_fwords = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("advance (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__frontier,&__pyx_n_s__res,&__pyx_n_s__fwords,0}; - PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__frontier)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "advance") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_frontier = values[0]; - __pyx_v_res = values[1]; - __pyx_v_fwords = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_frontier, __pyx_v_res, __pyx_v_fwords); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":884 - * return result - * - * def advance(self, frontier, res, fwords): # <<<<<<<<<<<<<< - * cdef unsigned na - * nf = [] - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_frontier, PyObject *__pyx_v_res, PyObject *__pyx_v_fwords) { - unsigned int __pyx_v_na; - PyObject *__pyx_v_nf = NULL; - PyObject *__pyx_v_toskip = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_alt = NULL; - PyObject *__pyx_v_pathlen = NULL; - PyObject *__pyx_v_spanlen = NULL; - PyObject *__pyx_v_ni = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - 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; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - Py_ssize_t __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - unsigned int __pyx_t_16; - int __pyx_t_17; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("advance", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":886 - * def advance(self, frontier, res, fwords): - * cdef unsigned na - * nf = [] # <<<<<<<<<<<<<< - * for toskip, (i, alt, pathlen) in frontier: - * spanlen = fwords[i][alt][2] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_nf = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":887 - * 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)) { - __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 = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - for (;;) { - if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #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 = 887; __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 = 887; __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 = 887; __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 = 887; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 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[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = NULL; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L6_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_toskip); - __pyx_v_toskip = __pyx_t_5; - __pyx_t_5 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { - PyObject* sequence = __pyx_t_6; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_7 = PyList_GET_ITEM(sequence, 0); - __pyx_t_9 = PyList_GET_ITEM(sequence, 1); - __pyx_t_10 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - #else - __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - #endif - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_8 = Py_TYPE(__pyx_t_11)->tp_iternext; - index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - index = 2; __pyx_t_10 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L7_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L8_unpacking_done; - __pyx_L7_unpacking_failed:; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_8 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L8_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_7; - __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_v_alt); - __pyx_v_alt = __pyx_t_9; - __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_v_pathlen); - __pyx_v_pathlen = __pyx_t_10; - __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":888 - * nf = [] - * for toskip, (i, alt, pathlen) in frontier: - * spanlen = fwords[i][alt][2] # <<<<<<<<<<<<<< - * if toskip == 0: - * res.append((i, alt, pathlen)) - */ - __pyx_t_4 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_v_alt); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __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_GetItemInt(__pyx_t_6, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_v_spanlen); - __pyx_v_spanlen = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":889 - * for toskip, (i, alt, pathlen) in frontier: - * spanlen = fwords[i][alt][2] - * if toskip == 0: # <<<<<<<<<<<<<< - * res.append((i, alt, pathlen)) - * ni = i + spanlen - */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_toskip, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_12) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":890 - * spanlen = fwords[i][alt][2] - * if toskip == 0: - * res.append((i, alt, pathlen)) # <<<<<<<<<<<<<< - * ni = i + spanlen - * if ni < len(fwords) and pathlen + 1 < self.max_initial_size: - */ - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - __Pyx_INCREF(__pyx_v_alt); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_alt); - __Pyx_GIVEREF(__pyx_v_alt); - __Pyx_INCREF(__pyx_v_pathlen); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_pathlen); - __Pyx_GIVEREF(__pyx_v_pathlen); - __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_res, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":891 - * if toskip == 0: - * res.append((i, alt, pathlen)) - * ni = i + spanlen # <<<<<<<<<<<<<< - * if ni < len(fwords) and pathlen + 1 < self.max_initial_size: - * for na in range(len(fwords[ni])): - */ - __pyx_t_6 = PyNumber_Add(__pyx_v_i, __pyx_v_spanlen); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_v_ni); - __pyx_v_ni = __pyx_t_6; - __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":892 - * res.append((i, alt, pathlen)) - * ni = i + spanlen - * 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))) - */ - __pyx_t_13 = PyObject_Length(__pyx_v_fwords); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_ni, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_12) { - __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_15 = __pyx_t_14; - } else { - __pyx_t_15 = __pyx_t_12; - } - if (__pyx_t_15) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":893 - * ni = i + spanlen - * 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))) - * if len(nf) > 0: - */ - __pyx_t_5 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ni); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_13 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_13; __pyx_t_16+=1) { - __pyx_v_na = __pyx_t_16; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":894 - * 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))) # <<<<<<<<<<<<<< - * if len(nf) > 0: - * return self.advance(nf, res, fwords) - */ - __pyx_t_5 = PyNumber_Subtract(__pyx_v_toskip, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_na); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __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 = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_v_ni); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ni); - __Pyx_GIVEREF(__pyx_v_ni); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_6 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __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); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); - __pyx_t_5 = 0; - __pyx_t_10 = 0; - __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_nf, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - } - goto __pyx_L10; - } - __pyx_L10:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":895 - * for na in range(len(fwords[ni])): - * nf.append((toskip - 1, (ni, na, pathlen + 1))) - * if len(nf) > 0: # <<<<<<<<<<<<<< - * return self.advance(nf, res, fwords) - * else: - */ - __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_nf)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_15 = ((__pyx_t_2 > 0) != 0); - if (__pyx_t_15) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":896 - * nf.append((toskip - 1, (ni, na, pathlen + 1))) - * if len(nf) > 0: - * return self.advance(nf, res, fwords) # <<<<<<<<<<<<<< - * else: - * 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 = 896; __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 = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_v_nf)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_nf)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_nf)); - __Pyx_INCREF(__pyx_v_res); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_res); - __Pyx_GIVEREF(__pyx_v_res); - __Pyx_INCREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_fwords); - __Pyx_GIVEREF(__pyx_v_fwords); - __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = __pyx_t_10; - __pyx_t_10 = 0; - goto __pyx_L0; - goto __pyx_L13; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":898 - * return self.advance(nf, res, fwords) - * else: - * return res # <<<<<<<<<<<<<< - * - * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_res); - __pyx_r = __pyx_v_res; - goto __pyx_L0; - } - __pyx_L13:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_nf); - __Pyx_XDECREF(__pyx_v_toskip); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_alt); - __Pyx_XDECREF(__pyx_v_pathlen); - __Pyx_XDECREF(__pyx_v_spanlen); - __Pyx_XDECREF(__pyx_v_ni); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_skip = 0; - PyObject *__pyx_v_i = 0; - PyObject *__pyx_v_spanlen = 0; - PyObject *__pyx_v_pathlen = 0; - PyObject *__pyx_v_fwords = 0; - PyObject *__pyx_v_next_states = 0; - PyObject *__pyx_v_reachable_buffer = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_all_nodes_isteps_away (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__skip,&__pyx_n_s__i,&__pyx_n_s__spanlen,&__pyx_n_s__pathlen,&__pyx_n_s__fwords,&__pyx_n_s__next_states,&__pyx_n_s__reachable_buffer,0}; - PyObject* values[7] = {0,0,0,0,0,0,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 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__skip)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__spanlen)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pathlen)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__next_states)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 6: - if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reachable_buffer)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __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_all_nodes_isteps_away") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - } - __pyx_v_skip = values[0]; - __pyx_v_i = values[1]; - __pyx_v_spanlen = values[2]; - __pyx_v_pathlen = values[3]; - __pyx_v_fwords = values[4]; - __pyx_v_next_states = values[5]; - __pyx_v_reachable_buffer = values[6]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_skip, __pyx_v_i, __pyx_v_spanlen, __pyx_v_pathlen, __pyx_v_fwords, __pyx_v_next_states, __pyx_v_reachable_buffer); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":900 - * return res - * - * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): # <<<<<<<<<<<<<< - * cdef unsigned alt_it - * frontier = [] - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_skip, PyObject *__pyx_v_i, PyObject *__pyx_v_spanlen, PyObject *__pyx_v_pathlen, PyObject *__pyx_v_fwords, PyObject *__pyx_v_next_states, PyObject *__pyx_v_reachable_buffer) { - PyObject *__pyx_v_frontier = NULL; - PyObject *__pyx_v_key = NULL; - PyObject *__pyx_v_reachable = NULL; - PyObject *__pyx_v_nextreachable = NULL; - PyObject *__pyx_v_next_id = NULL; - PyObject *__pyx_v_jump = NULL; - PyObject *__pyx_v_alt_id = NULL; - PyObject *__pyx_v_newel = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - 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_11 = NULL; - Py_ssize_t __pyx_t_12; - PyObject *(*__pyx_t_13)(PyObject *); - PyObject *__pyx_t_14 = NULL; - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":902 - * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): - * cdef unsigned alt_it - * frontier = [] # <<<<<<<<<<<<<< - * if i+spanlen+skip >= len(next_states): - * return frontier - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_frontier = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":903 - * cdef unsigned alt_it - * frontier = [] - * if i+spanlen+skip >= len(next_states): # <<<<<<<<<<<<<< - * return frontier - * key = tuple([i,spanlen]) - */ - __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_Length(__pyx_v_next_states); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __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_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":904 - * frontier = [] - * if i+spanlen+skip >= len(next_states): - * return frontier # <<<<<<<<<<<<<< - * key = tuple([i,spanlen]) - * reachable = [] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_frontier)); - __pyx_r = ((PyObject *)__pyx_v_frontier); - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":905 - * if i+spanlen+skip >= len(next_states): - * return frontier - * key = tuple([i,spanlen]) # <<<<<<<<<<<<<< - * reachable = [] - * if key in reachable_buffer: - */ - __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_i); - PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - __Pyx_INCREF(__pyx_v_spanlen); - PyList_SET_ITEM(__pyx_t_4, 1, __pyx_v_spanlen); - __Pyx_GIVEREF(__pyx_v_spanlen); - __pyx_t_1 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_4))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_v_key = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":906 - * return frontier - * key = tuple([i,spanlen]) - * reachable = [] # <<<<<<<<<<<<<< - * if key in reachable_buffer: - * reachable = reachable_buffer[key] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_reachable = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":907 - * key = tuple([i,spanlen]) - * reachable = [] - * if key in reachable_buffer: # <<<<<<<<<<<<<< - * reachable = reachable_buffer[key] - * else: - */ - __pyx_t_5 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_key), __pyx_v_reachable_buffer, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = (__pyx_t_5 != 0); - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":908 - * reachable = [] - * if key in reachable_buffer: - * reachable = reachable_buffer[key] # <<<<<<<<<<<<<< - * else: - * reachable = self.reachable(fwords, i, spanlen) - */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_reachable); - __pyx_v_reachable = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L4; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":910 - * 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 = 910; __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 = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fwords); - __Pyx_GIVEREF(__pyx_v_fwords); - __Pyx_INCREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - __Pyx_INCREF(__pyx_v_spanlen); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_spanlen); - __Pyx_GIVEREF(__pyx_v_spanlen); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 910; __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_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_reachable); - __pyx_v_reachable = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":911 - * else: - * reachable = self.reachable(fwords, i, spanlen) - * reachable_buffer[key] = reachable # <<<<<<<<<<<<<< - * for nextreachable in reachable: - * for next_id in next_states[nextreachable]: - */ - if (PyObject_SetItem(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key), __pyx_v_reachable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":912 - * 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; - } 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 = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; - } - 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 = 912; __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 = 912; __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 = 912; __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 = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_4 = __pyx_t_7(__pyx_t_2); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_nextreachable); - __pyx_v_nextreachable = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":913 - * 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_t_4 = PyObject_GetItem(__pyx_v_next_states, __pyx_v_nextreachable); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __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; - } 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 = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - __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 = 913; __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 = 913; __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 = 913; __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 = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_4 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_next_id); - __pyx_v_next_id = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":914 - * 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 = 914; __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 = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_fwords); - __Pyx_GIVEREF(__pyx_v_fwords); - __Pyx_INCREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_10, 1, __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); - __Pyx_GIVEREF(__pyx_v_next_id); - __pyx_t_11 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_v_jump); - __pyx_v_jump = __pyx_t_11; - __pyx_t_11 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":915 - * 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 = 915; __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 = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":916 - * jump = self.shortest(fwords,i,next_id) - * if jump < skip: - * continue # <<<<<<<<<<<<<< - * if pathlen+jump <= self.max_initial_size: - * for alt_id in range(len(fwords[next_id])): - */ - goto __pyx_L7_continue; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":917 - * 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 = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = PyInt_FromLong(__pyx_v_self->max_initial_size); 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_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 = 917; __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 = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":918 - * 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 (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __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 = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_10 = __pyx_t_4; __Pyx_INCREF(__pyx_t_10); __pyx_t_12 = 0; - __pyx_t_13 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = Py_TYPE(__pyx_t_10)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_10)) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_10, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_10)) { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_10, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_4 = __pyx_t_13(__pyx_t_10); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_alt_id); - __pyx_v_alt_id = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":919 - * 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 (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyObject_GetItem(__pyx_t_4, __pyx_v_alt_id); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_11, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_14 = PyObject_RichCompare(__pyx_t_4, __pyx_t_11, Py_NE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":920 - * 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_14 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_11 = PyTuple_New(3); 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_INCREF(__pyx_v_next_id); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_next_id); - __Pyx_GIVEREF(__pyx_v_next_id); - __Pyx_INCREF(__pyx_v_alt_id); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_alt_id); - __Pyx_GIVEREF(__pyx_v_alt_id); - PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_14); - __Pyx_GIVEREF(__pyx_t_14); - __pyx_t_14 = 0; - __Pyx_XDECREF(((PyObject *)__pyx_v_newel)); - __pyx_v_newel = ((PyObject*)__pyx_t_11); - __pyx_t_11 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":921 - * 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)) - * return frontier - */ - __pyx_t_6 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_newel), ((PyObject *)__pyx_v_frontier), Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = (__pyx_t_6 != 0); - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":922 - * newel = (next_id,alt_id,pathlen+jump) - * if newel not in frontier: - * frontier.append((next_id,alt_id,pathlen+jump)) # <<<<<<<<<<<<<< - * return frontier - * - */ - __pyx_t_11 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_INCREF(__pyx_v_next_id); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_next_id); - __Pyx_GIVEREF(__pyx_v_next_id); - __Pyx_INCREF(__pyx_v_alt_id); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_alt_id); - __Pyx_GIVEREF(__pyx_v_alt_id); - PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; - __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_frontier, ((PyObject *)__pyx_t_14)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; - goto __pyx_L14; - } - __pyx_L14:; - goto __pyx_L13; - } - __pyx_L13:; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L10; - } - __pyx_L10:; - __pyx_L7_continue:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":923 - * if newel not in frontier: - * frontier.append((next_id,alt_id,pathlen+jump)) - * return frontier # <<<<<<<<<<<<<< - * - * def reachable(self, fwords, ifrom, dist): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_frontier)); - __pyx_r = ((PyObject *)__pyx_v_frontier); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_frontier); - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_reachable); - __Pyx_XDECREF(__pyx_v_nextreachable); - __Pyx_XDECREF(__pyx_v_next_id); - __Pyx_XDECREF(__pyx_v_jump); - __Pyx_XDECREF(__pyx_v_alt_id); - __Pyx_XDECREF(__pyx_v_newel); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fwords = 0; - PyObject *__pyx_v_ifrom = 0; - PyObject *__pyx_v_dist = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reachable (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__ifrom,&__pyx_n_s__dist,0}; - PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__fwords)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dist)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reachable") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_fwords = values[0]; - __pyx_v_ifrom = values[1]; - __pyx_v_dist = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_dist); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":925 - * return frontier - * - * def reachable(self, fwords, ifrom, dist): # <<<<<<<<<<<<<< - * ret = [] - * if ifrom >= len(fwords): - */ - -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) { - PyObject *__pyx_v_ret = NULL; - PyObject *__pyx_v_alt_id = NULL; - PyObject *__pyx_v_ifromchild = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("reachable", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":926 - * - * def reachable(self, fwords, ifrom, dist): - * ret = [] # <<<<<<<<<<<<<< - * if ifrom >= len(fwords): - * return ret - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_ret = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":927 - * def reachable(self, fwords, ifrom, dist): - * ret = [] - * if ifrom >= len(fwords): # <<<<<<<<<<<<<< - * return ret - * for alt_id in range(len(fwords[ifrom])): - */ - __pyx_t_2 = PyObject_Length(__pyx_v_fwords); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 927; __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 = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":928 - * ret = [] - * if ifrom >= len(fwords): - * return ret # <<<<<<<<<<<<<< - * for alt_id in range(len(fwords[ifrom])): - * if fwords[ifrom][alt_id][0] == EPSILON: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_ret)); - __pyx_r = ((PyObject *)__pyx_v_ret); - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":929 - * if ifrom >= len(fwords): - * return ret - * 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)) - */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __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[8]; __pyx_lineno = 929; __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 = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - 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 = 929; __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 = 929; __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 = 929; __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 = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_3 = __pyx_t_5(__pyx_t_1); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF(__pyx_v_alt_id); - __pyx_v_alt_id = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":930 - * return ret - * 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: - */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __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_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __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 = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":931 - * 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_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ret), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __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 = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fwords); - __Pyx_GIVEREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_dist); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_dist); - __Pyx_GIVEREF(__pyx_v_dist); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __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[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L6; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":933 - * 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_8 = PyObject_RichCompare(__pyx_v_dist, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __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 = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":934 - * else: - * if dist == 0: - * if ifrom not in ret: # <<<<<<<<<<<<<< - * ret.append(ifrom) - * else: - */ - __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_ifrom, ((PyObject *)__pyx_v_ret), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = (__pyx_t_4 != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":935 - * 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_10 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_ifrom); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; - } - __pyx_L8:; - goto __pyx_L7; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":937 - * 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_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__reachable); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __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_GetItemInt(__pyx_t_7, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __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 = 937; __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_Subtract(__pyx_v_dist, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __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 = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fwords); - __Pyx_GIVEREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_7 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_6 = __pyx_t_3; __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_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_6)) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_6)) { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_3 = __pyx_t_12(__pyx_t_6); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF(__pyx_v_ifromchild); - __pyx_v_ifromchild = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":938 - * 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_9 = (__Pyx_PySequence_Contains(__pyx_v_ifromchild, ((PyObject *)__pyx_v_ret), Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = (__pyx_t_9 != 0); - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":939 - * 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_10 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_ifromchild); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L11; - } - __pyx_L11:; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __pyx_L7:; - } - __pyx_L6:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":941 - * ret.append(ifromchild) - * - * return ret # <<<<<<<<<<<<<< - * - * def shortest(self, fwords, ifrom, ito): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_ret)); - __pyx_r = ((PyObject *)__pyx_v_ret); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_ret); - __Pyx_XDECREF(__pyx_v_alt_id); - __Pyx_XDECREF(__pyx_v_ifromchild); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fwords = 0; - PyObject *__pyx_v_ifrom = 0; - PyObject *__pyx_v_ito = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("shortest (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__ifrom,&__pyx_n_s__ito,0}; - PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__fwords)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ito)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shortest") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_fwords = values[0]; - __pyx_v_ifrom = values[1]; - __pyx_v_ito = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_ito); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":943 - * return ret - * - * def shortest(self, fwords, ifrom, ito): # <<<<<<<<<<<<<< - * cdef unsigned alt_id - * min = 1000 - */ - -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) { - unsigned int __pyx_v_alt_id; - PyObject *__pyx_v_min = NULL; - PyObject *__pyx_v_currmin = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; - unsigned int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("shortest", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":945 - * def shortest(self, fwords, ifrom, ito): - * cdef unsigned alt_id - * min = 1000 # <<<<<<<<<<<<<< - * if ifrom > ito: - * return min - */ - __Pyx_INCREF(__pyx_int_1000); - __pyx_v_min = __pyx_int_1000; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":946 - * cdef unsigned alt_id - * min = 1000 - * if ifrom > ito: # <<<<<<<<<<<<<< - * return min - * if ifrom == ito: - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 946; __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 = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":947 - * min = 1000 - * if ifrom > ito: - * return min # <<<<<<<<<<<<<< - * if ifrom == ito: - * return 0 - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_min); - __pyx_r = __pyx_v_min; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":948 - * if ifrom > ito: - * return min - * if ifrom == ito: # <<<<<<<<<<<<<< - * return 0 - * for alt_id in range(len(fwords[ifrom])): - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 948; __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 = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":949 - * return min - * if ifrom == ito: - * return 0 # <<<<<<<<<<<<<< - * for alt_id in range(len(fwords[ifrom])): - * currmin = self.shortest(fwords,ifrom+fwords[ifrom][alt_id][2],ito) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_0); - __pyx_r = __pyx_int_0; - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":950 - * if ifrom == ito: - * 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: - */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_alt_id = __pyx_t_4; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":951 - * 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 = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_alt_id, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __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 = 951; __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 = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_fwords); - __Pyx_GIVEREF(__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_ito); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_ito); - __Pyx_GIVEREF(__pyx_v_ito); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_v_currmin); - __pyx_v_currmin = __pyx_t_6; - __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":952 - * 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 (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_alt_id, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __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 = 952; __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 = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":953 - * 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 = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_currmin); - __pyx_v_currmin = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L7; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":954 - * 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 = 954; __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 = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":955 - * currmin += 1 - * if currmin < min: - * min = currmin # <<<<<<<<<<<<<< - * return min - * - */ - __Pyx_INCREF(__pyx_v_currmin); - __Pyx_DECREF(__pyx_v_min); - __pyx_v_min = __pyx_v_currmin; - goto __pyx_L8; - } - __pyx_L8:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":956 - * if currmin < min: - * min = currmin - * return min # <<<<<<<<<<<<<< - * - * def get_next_states(self, _columns, curr_idx, min_dist=2): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_min); - __pyx_r = __pyx_v_min; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_min); - __Pyx_XDECREF(__pyx_v_currmin); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v__columns = 0; - PyObject *__pyx_v_curr_idx = 0; - PyObject *__pyx_v_min_dist = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_next_states (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___columns,&__pyx_n_s__curr_idx,&__pyx_n_s__min_dist,0}; - PyObject* values[3] = {0,0,0}; - values[2] = ((PyObject *)__pyx_int_2); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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___columns)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__curr_idx)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_next_states", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_dist); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_next_states") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v__columns = values[0]; - __pyx_v_curr_idx = values[1]; - __pyx_v_min_dist = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_next_states", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_states(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v__columns, __pyx_v_curr_idx, __pyx_v_min_dist); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":958 - * return min - * - * def get_next_states(self, _columns, curr_idx, min_dist=2): # <<<<<<<<<<<<<< - * result = [] - * candidate = [[curr_idx,0]] - */ - -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) { - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_candidate = NULL; - PyObject *__pyx_v_curr = NULL; - PyObject *__pyx_v_curr_col = NULL; - PyObject *__pyx_v_alt = NULL; - PyObject *__pyx_v_next_id = NULL; - PyObject *__pyx_v_jump = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - PyObject *__pyx_t_10 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_next_states", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":959 - * - * def get_next_states(self, _columns, curr_idx, min_dist=2): - * result = [] # <<<<<<<<<<<<<< - * candidate = [[curr_idx,0]] - * - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_result = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":960 - * def get_next_states(self, _columns, curr_idx, min_dist=2): - * result = [] - * candidate = [[curr_idx,0]] # <<<<<<<<<<<<<< - * - * while len(candidate) > 0: - */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_curr_idx); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_curr_idx); - __Pyx_GIVEREF(__pyx_v_curr_idx); - __Pyx_INCREF(__pyx_int_0); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_v_candidate = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":962 - * candidate = [[curr_idx,0]] - * - * while len(candidate) > 0: # <<<<<<<<<<<<<< - * curr = candidate.pop() - * if curr[0] >= len(_columns): - */ - while (1) { - __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_candidate)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = ((__pyx_t_3 > 0) != 0); - if (!__pyx_t_4) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":963 - * - * while len(candidate) > 0: - * curr = candidate.pop() # <<<<<<<<<<<<<< - * if curr[0] >= len(_columns): - * continue - */ - __pyx_t_2 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_candidate)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_curr); - __pyx_v_curr = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":964 - * while len(candidate) > 0: - * curr = candidate.pop() - * if curr[0] >= len(_columns): # <<<<<<<<<<<<<< - * continue - * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: - */ - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Length(__pyx_v__columns); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __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_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":965 - * curr = candidate.pop() - * if curr[0] >= len(_columns): - * continue # <<<<<<<<<<<<<< - * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: - * result.append(curr[0]); - */ - goto __pyx_L3_continue; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":966 - * if curr[0] >= len(_columns): - * continue - * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: # <<<<<<<<<<<<<< - * result.append(curr[0]); - * curr_col = _columns[curr[0]] - */ - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_5, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __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 = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { - __Pyx_DECREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __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 = 966; __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 = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_t_6; - } else { - __pyx_t_7 = __pyx_t_4; - } - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":967 - * continue - * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: - * result.append(curr[0]); # <<<<<<<<<<<<<< - * curr_col = _columns[curr[0]] - * for alt in curr_col: - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":968 - * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: - * result.append(curr[0]); - * curr_col = _columns[curr[0]] # <<<<<<<<<<<<<< - * for alt in curr_col: - * next_id = curr[0]+alt[2] - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetItem(__pyx_v__columns, __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_v_curr_col); - __pyx_v_curr_col = __pyx_t_5; - __pyx_t_5 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":969 - * 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)) { - __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 = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; - } - 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 = 969; __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 = 969; __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 = 969; __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 = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_1 = __pyx_t_9(__pyx_t_5); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_alt); - __pyx_v_alt = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":970 - * curr_col = _columns[curr[0]] - * for alt in curr_col: - * next_id = curr[0]+alt[2] # <<<<<<<<<<<<<< - * jump = 1 - * if alt[0] == EPSILON: - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_alt, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_v_next_id); - __pyx_v_next_id = __pyx_t_10; - __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":971 - * for alt in curr_col: - * next_id = curr[0]+alt[2] - * jump = 1 # <<<<<<<<<<<<<< - * if alt[0] == EPSILON: - * jump = 0 - */ - __Pyx_INCREF(__pyx_int_1); - __Pyx_XDECREF(__pyx_v_jump); - __pyx_v_jump = __pyx_int_1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":972 - * next_id = curr[0]+alt[2] - * jump = 1 - * if alt[0] == EPSILON: # <<<<<<<<<<<<<< - * jump = 0 - * if next_id not in result and min_dist <= curr[1]+jump <= self.max_initial_size+1: - */ - __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_alt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __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 = 972; __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 = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":973 - * jump = 1 - * if alt[0] == EPSILON: - * 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]) - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF(__pyx_v_jump); - __pyx_v_jump = __pyx_int_0; - goto __pyx_L9; - } - __pyx_L9:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":974 - * if alt[0] == EPSILON: - * 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]) - * return sorted(result); - */ - __pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_next_id, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_7) { - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __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 = 974; __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 = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { - __Pyx_DECREF(__pyx_t_1); - __pyx_t_10 = PyInt_FromLong((__pyx_v_self->max_initial_size + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __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 = 974; __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 = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __pyx_t_4; - } else { - __pyx_t_6 = __pyx_t_7; - } - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":975 - * 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]) # <<<<<<<<<<<<<< - * return sorted(result); - * - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __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 = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_next_id); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_next_id); - __Pyx_GIVEREF(__pyx_v_next_id); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_candidate, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - goto __pyx_L10; - } - __pyx_L10:; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_L3_continue:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":976 - * 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); # <<<<<<<<<<<<<< - * - * def input(self, fwords, meta, ctx_name=None): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_v_result)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_result)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); - __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_candidate); - __Pyx_XDECREF(__pyx_v_curr); - __Pyx_XDECREF(__pyx_v_curr_col); - __Pyx_XDECREF(__pyx_v_alt); - __Pyx_XDECREF(__pyx_v_next_id); - __Pyx_XDECREF(__pyx_v_jump); - __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); /* proto */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input[] = "When this function is called on the RuleFactory,\n it looks up all of the rules that can be used to translate\n the input sentence"; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fwords = 0; - PyObject *__pyx_v_meta = 0; - PyObject *__pyx_v_ctx_name = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("input (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__meta,&__pyx_n_s__ctx_name,0}; - PyObject* values[3] = {0,0,0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":978 - * 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 - */ - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__fwords)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__meta)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("input", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx_name); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "input") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_fwords = values[0]; - __pyx_v_meta = values[1]; - __pyx_v_ctx_name = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("input", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_meta, __pyx_v_ctx_name); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4 = {__Pyx_NAMESTR("lambda4"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4(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_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5 = {__Pyx_NAMESTR("lambda5"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5, METH_NOARGS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda5 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda5(__pyx_self); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1147 - * if len(extracts) > 0: - * fcount = Counter() - * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) # <<<<<<<<<<<<<< - * for (f, e, count, als), loc in extracts: - * fcount[f] += count - */ - -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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 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 = 1147; __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 = 1147; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __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; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda4.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 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 = 1147; __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_7lambda4_lambda5, 0, __pyx_n_s_125, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __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 = 1147; __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[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ -static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6 = {__Pyx_NAMESTR("lambda6"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6(PyObject *__pyx_self, PyObject *__pyx_v_x) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda6 (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda6(__pyx_self, ((PyObject *)__pyx_v_x)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1153 - * 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) - */ - -static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("lambda6", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda6", __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 */ - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1193 - * 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 - */ - -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; - 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); - 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_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 = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __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 = 1193; __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)) { - __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 = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - for (;;) { - if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #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 = 1193; __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 = 1193; __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 = 1193; __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 = 1193; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_word = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_word, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("genexpr", __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; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":978 - * 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 - */ - -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; - 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); - 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_fwords = __pyx_v_fwords; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords); - __pyx_cur_scope->__pyx_v_meta = __pyx_v_meta; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_meta); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_meta); - __pyx_cur_scope->__pyx_v_ctx_name = __pyx_v_ctx_name; - __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 = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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); - 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; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - PyObject *(*__pyx_t_20)(PyObject *); - int __pyx_t_21; - PyObject *(*__pyx_t_22)(PyObject *); - Py_ssize_t __pyx_t_23; - 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 *); - 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_L61_resume_from_yield; - case 2: goto __pyx_L82_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[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":989 - * cdef Phrase hiero_phrase - * - * flen = len(fwords) # <<<<<<<<<<<<<< - * start_time = monitor_cpu() - * self.extract_time = 0.0 - */ - __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 = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_cur_scope->__pyx_v_flen = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":990 - * - * 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 = 990; __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[8]; __pyx_lineno = 990; __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 = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_cur_scope->__pyx_v_start_time = __pyx_t_4; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":991 - * flen = len(fwords) - * start_time = monitor_cpu() - * self.extract_time = 0.0 # <<<<<<<<<<<<<< - * self.intersect_time = 0.0 - * nodes_isteps_away_buffer = {} - */ - __pyx_cur_scope->__pyx_v_self->extract_time = 0.0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":992 - * start_time = monitor_cpu() - * self.extract_time = 0.0 - * self.intersect_time = 0.0 # <<<<<<<<<<<<<< - * nodes_isteps_away_buffer = {} - * hit = 0 - */ - __pyx_cur_scope->__pyx_v_self->intersect_time = 0.0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":993 - * 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 = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":994 - * self.intersect_time = 0.0 - * nodes_isteps_away_buffer = {} - * hit = 0 # <<<<<<<<<<<<<< - * reachable_buffer = {} - * - */ - __pyx_cur_scope->__pyx_v_hit = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":995 - * 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 = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_cur_scope->__pyx_v_reachable_buffer = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1000 - * # 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 = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_cur_scope->__pyx_v_seen_phrases = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1003 - * - * # 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 = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); 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); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1005 - * 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 = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_cur_scope->__pyx_v_frontier = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1006 - * - * 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 = 1006; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1007 - * 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, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1007; __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 = 1007; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1008 - * 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, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __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, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); 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_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 = 1008; __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_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1009 - * 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 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __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 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PyTuple_New(8); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); - PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->rules->root); - PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_cur_scope->__pyx_v_self->rules->root); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->rules->root); - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - PyTuple_SET_ITEM(__pyx_t_12, 6, ((PyObject *)__pyx_empty_tuple)); - __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); - PyTuple_SET_ITEM(__pyx_t_12, 7, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_8 = 0; - __pyx_t_3 = 0; - __pyx_t_10 = 0; - __pyx_t_1 = 0; - __pyx_t_11 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_12)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - goto __pyx_L8; - } - __pyx_L8:; - } - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1011 - * frontier.append((i, i, (i,), alt, 0, self.rules.root, (), False)) - * - * xroot = None # <<<<<<<<<<<<<< - * x1 = sym_setindex(self.category, 1) - * if x1 in self.rules.root.children: - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __pyx_cur_scope->__pyx_v_xroot = Py_None; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1012 - * - * xroot = None - * x1 = sym_setindex(self.category, 1) # <<<<<<<<<<<<<< - * if x1 in self.rules.root.children: - * xroot = self.rules.root.children[x1] - */ - __pyx_cur_scope->__pyx_v_x1 = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1013 - * xroot = None - * x1 = sym_setindex(self.category, 1) - * if x1 in self.rules.root.children: # <<<<<<<<<<<<<< - * xroot = self.rules.root.children[x1] - * else: - */ - __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_t_12, __pyx_t_11, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_14 = (__pyx_t_9 != 0); - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1014 - * 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_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_x1, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_xroot); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_xroot = __pyx_t_12; - __pyx_t_12 = 0; - goto __pyx_L9; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1016 - * xroot = self.rules.root.children[x1] - * else: - * xroot = ExtendedTrieNode(suffix_link=self.rules.root, phrase_location=PhraseLocation()) # <<<<<<<<<<<<<< - * self.rules.root.children[x1] = xroot - * - */ - __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_self->rules->root) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); 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); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_11) < 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_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); 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_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_xroot); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_cur_scope->__pyx_v_xroot = __pyx_t_11; - __pyx_t_11 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1017 - * 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_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - if (__Pyx_SetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_xroot, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __pyx_L9:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1019 - * 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_11 = __pyx_cur_scope->__pyx_v_fwords; - __Pyx_INCREF(__pyx_t_11); - __pyx_t_2 = PyObject_Length(__pyx_t_11); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1020 - * - * 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_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_6 = PyObject_Length(__pyx_t_11); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1021 - * 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_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_12, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_11, __pyx_t_12, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1022 - * 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)) # <<<<<<<<<<<<<< - * - * next_states = [] - */ - __pyx_t_1 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_i - __pyx_cur_scope->__pyx_v_self->min_gap_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; - __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_16 = PyTuple_New(8); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_16, 2, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); - PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_16, 4, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_xroot); - PyTuple_SET_ITEM(__pyx_t_16, 5, __pyx_cur_scope->__pyx_v_xroot); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xroot); - PyTuple_SET_ITEM(__pyx_t_16, 6, ((PyObject *)__pyx_t_15)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_15)); - PyTuple_SET_ITEM(__pyx_t_16, 7, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_1 = 0; - __pyx_t_12 = 0; - __pyx_t_10 = 0; - __pyx_t_11 = 0; - __pyx_t_3 = 0; - __pyx_t_15 = 0; - __pyx_t_8 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_16)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; - goto __pyx_L14; - } - __pyx_L14:; - } - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1024 - * frontier.append((i-self.min_gap_size, i, (i,), alt, self.min_gap_size, xroot, (x1,), True)) - * - * next_states = [] # <<<<<<<<<<<<<< - * for i in range(len(fwords)): - * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) - */ - __pyx_t_16 = PyList_New(0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_GIVEREF(((PyObject *)__pyx_t_16)); - __pyx_cur_scope->__pyx_v_next_states = ((PyObject*)__pyx_t_16); - __pyx_t_16 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1025 - * - * next_states = [] - * for i in range(len(fwords)): # <<<<<<<<<<<<<< - * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) - * - */ - __pyx_t_16 = __pyx_cur_scope->__pyx_v_fwords; - __Pyx_INCREF(__pyx_t_16); - __pyx_t_2 = PyObject_Length(__pyx_t_16); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1026 - * 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_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__get_next_states); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_fwords); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_t_8 = 0; - __pyx_t_15 = 0; - __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_next_states, __pyx_t_15); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1028 - * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) - * - * while len(frontier) > 0: # <<<<<<<<<<<<<< - * new_frontier = [] - * for k, i, input_match, alt, pathlen, node, prefix, is_shadow_path in frontier: - */ - while (1) { - __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = ((__pyx_t_2 > 0) != 0); - if (!__pyx_t_14) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1029 - * - * 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_15 = PyList_New(0); 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_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_15)); - __pyx_cur_scope->__pyx_v_new_frontier = ((PyObject*)__pyx_t_15); - __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1030 - * 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_15 = ((PyObject *)__pyx_cur_scope->__pyx_v_frontier); __Pyx_INCREF(__pyx_t_15); __pyx_t_2 = 0; - for (;;) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_15)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_15, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __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; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 8)) { - if (size > 8) __Pyx_RaiseTooManyValuesError(8); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); - __pyx_t_12 = PyTuple_GET_ITEM(sequence, 4); - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 5); - __pyx_t_17 = PyTuple_GET_ITEM(sequence, 6); - __pyx_t_18 = PyTuple_GET_ITEM(sequence, 7); - } else { - __pyx_t_16 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); - __pyx_t_11 = PyList_GET_ITEM(sequence, 2); - __pyx_t_10 = PyList_GET_ITEM(sequence, 3); - __pyx_t_12 = PyList_GET_ITEM(sequence, 4); - __pyx_t_1 = 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_16); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(__pyx_t_18); - #else - Py_ssize_t i; - PyObject** temps[8] = {&__pyx_t_16,&__pyx_t_8,&__pyx_t_11,&__pyx_t_10,&__pyx_t_12,&__pyx_t_1,&__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 = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(item); - *(temps[i]) = item; - } - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - { - Py_ssize_t index = -1; - PyObject** temps[8] = {&__pyx_t_16,&__pyx_t_8,&__pyx_t_11,&__pyx_t_10,&__pyx_t_12,&__pyx_t_1,&__pyx_t_17,&__pyx_t_18}; - __pyx_t_19 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; - __Pyx_GOTREF(item); - *(temps[index]) = item; - } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_19), 8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_20 = NULL; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - goto __pyx_L22_unpacking_done; - __pyx_L21_unpacking_failed:; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_20 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L22_unpacking_done:; - } - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_16); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_cur_scope->__pyx_v_k = __pyx_t_5; - __pyx_cur_scope->__pyx_v_i = __pyx_t_7; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_input_match); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_input_match); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_cur_scope->__pyx_v_input_match = __pyx_t_11; - __pyx_t_11 = 0; - __pyx_cur_scope->__pyx_v_alt = __pyx_t_21; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pathlen); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_pathlen); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_12; - __pyx_t_12 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_node); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_node); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_node = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_prefix); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_prefix); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_cur_scope->__pyx_v_prefix = __pyx_t_17; - __pyx_t_17 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_is_shadow_path); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_is_shadow_path); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_is_shadow_path = __pyx_t_18; - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1031 - * 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_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_18, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word_id); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word_id); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_word_id = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1032 - * 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_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_18, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_spanlen); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_spanlen); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1034 - * 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_3 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_18); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1036 - * if word_id == EPSILON: - * # skipping because word_id is epsilon - * if i+spanlen >= len(fwords): # <<<<<<<<<<<<<< - * continue - * for nualt in range(0,len(fwords[i+spanlen])): - */ - __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __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 = 1036; __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_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 = 1036; __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 = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = PyObject_RichCompare(__pyx_t_3, __pyx_t_18, Py_GE); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __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_14 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1037 - * # skipping because word_id is epsilon - * if i+spanlen >= len(fwords): - * continue # <<<<<<<<<<<<<< - * for nualt in range(0,len(fwords[i+spanlen])): - * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) - */ - goto __pyx_L19_continue; - goto __pyx_L24; - } - __pyx_L24:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1038 - * if i+spanlen >= len(fwords): - * continue - * for nualt in range(0,len(fwords[i+spanlen])): # <<<<<<<<<<<<<< - * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) - * continue - */ - __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyNumber_Add(__pyx_t_17, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_18); if (!__pyx_t_17) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __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 = 1038; __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) { - __pyx_cur_scope->__pyx_v_nualt = __pyx_t_21; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1039 - * continue - * for nualt in range(0,len(fwords[i+spanlen])): - * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyInt_FromLong(__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_3 = PyNumber_Add(__pyx_t_18, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_nualt); 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 = PyTuple_New(8); 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); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_input_match); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_cur_scope->__pyx_v_input_match); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_input_match); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); - PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_cur_scope->__pyx_v_pathlen); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pathlen); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_node); - PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_cur_scope->__pyx_v_node); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_node); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_prefix); - PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_cur_scope->__pyx_v_prefix); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_prefix); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_shadow_path); - PyTuple_SET_ITEM(__pyx_t_1, 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_3 = 0; - __pyx_t_18 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1040 - * for nualt in range(0,len(fwords[i+spanlen])): - * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) - * continue # <<<<<<<<<<<<<< - * - * phrase = prefix + (word_id,) - */ - goto __pyx_L19_continue; - goto __pyx_L23; - } - __pyx_L23:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1042 - * continue - * - * phrase = prefix + (word_id,) # <<<<<<<<<<<<<< - * hiero_phrase = Phrase(phrase) - * arity = hiero_phrase.arity() - */ - __pyx_t_1 = PyTuple_New(1); 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_INCREF(__pyx_cur_scope->__pyx_v_word_id); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_word_id); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_word_id); - __pyx_t_18 = PyNumber_Add(__pyx_cur_scope->__pyx_v_prefix, ((PyObject *)__pyx_t_1)); 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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_phrase); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_phrase); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_phrase = __pyx_t_18; - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1043 - * - * phrase = prefix + (word_id,) - * hiero_phrase = Phrase(phrase) # <<<<<<<<<<<<<< - * arity = hiero_phrase.arity() - * - */ - __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_cur_scope->__pyx_v_phrase); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_hiero_phrase = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1044 - * phrase = prefix + (word_id,) - * hiero_phrase = Phrase(phrase) - * arity = hiero_phrase.arity() # <<<<<<<<<<<<<< - * - * lookup_required = False - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase), __pyx_n_s__arity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_18 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_cur_scope->__pyx_v_arity = __pyx_t_21; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1046 - * arity = hiero_phrase.arity() - * - * lookup_required = False # <<<<<<<<<<<<<< - * if word_id in node.children: - * if node.children[word_id] is None: - */ - __pyx_cur_scope->__pyx_v_lookup_required = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1047 - * - * 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 = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_14 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_18, Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_9 = (__pyx_t_14 != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1048 - * 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 = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_1 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_9 = (__pyx_t_1 == Py_None); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_14 = (__pyx_t_9 != 0); - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1050 - * if node.children[word_id] is None: - * # Path dead-ends at this node - * continue # <<<<<<<<<<<<<< - * else: - * # Path continues at this node - */ - goto __pyx_L19_continue; - goto __pyx_L28; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1053 - * else: - * # Path continues at this node - * node = node.children[word_id] # <<<<<<<<<<<<<< - * else: - * if node.suffix_link is None: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_18 = PyObject_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_node); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_node = __pyx_t_18; - __pyx_t_18 = 0; - } - __pyx_L28:; - goto __pyx_L27; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1055 - * 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 = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_14 = (__pyx_t_18 == Py_None); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_9 = (__pyx_t_14 != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1057 - * if node.suffix_link is None: - * # Current node is root; lookup required - * lookup_required = True # <<<<<<<<<<<<<< - * else: - * if word_id in node.suffix_link.children: - */ - __pyx_cur_scope->__pyx_v_lookup_required = 1; - goto __pyx_L29; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1059 - * 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 = 1059; __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 = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_14 = (__pyx_t_9 != 0); - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1060 - * 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_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 = 1060; __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 = 1060; __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 (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_14 = (__pyx_t_1 == Py_None); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_9 = (__pyx_t_14 != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1062 - * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1063 - * # Suffix link reports path is dead end - * node.children[word_id] = None - * continue # <<<<<<<<<<<<<< - * else: - * # Suffix link indicates lookup is reqired - */ - goto __pyx_L19_continue; - goto __pyx_L31; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1066 - * else: - * # Suffix link indicates lookup is reqired - * lookup_required = True # <<<<<<<<<<<<<< - * else: - * #ERROR: We never get here - */ - __pyx_cur_scope->__pyx_v_lookup_required = 1; - } - __pyx_L31:; - goto __pyx_L30; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1069 - * else: - * #ERROR: We never get here - * raise Exception("Keyword trie error") # <<<<<<<<<<<<<< - * # checking whether lookup_required - * if lookup_required: - */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __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[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L30:; - } - __pyx_L29:; - } - __pyx_L27:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1071 - * raise Exception("Keyword trie error") - * # checking whether lookup_required - * if lookup_required: # <<<<<<<<<<<<<< - * new_node = None - * if is_shadow_path: - */ - __pyx_t_9 = (__pyx_cur_scope->__pyx_v_lookup_required != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1072 - * # checking whether lookup_required - * if lookup_required: - * new_node = None # <<<<<<<<<<<<<< - * if is_shadow_path: - * # Extending shadow path - */ - __Pyx_INCREF(Py_None); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_new_node); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_new_node); - __Pyx_GIVEREF(Py_None); - __pyx_cur_scope->__pyx_v_new_node = Py_None; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1073 - * if lookup_required: - * new_node = None - * if is_shadow_path: # <<<<<<<<<<<<<< - * # Extending shadow path - * # on the shadow path we don't do any search, we just use info from suffix link - */ - __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 = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1076 - * # 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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __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 = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyObject_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1077 - * # 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_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1078 - * 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_1, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_new_node); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_new_node = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L33; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1080 - * phrase=hiero_phrase) - * else: - * if arity > 0: # <<<<<<<<<<<<<< - * # Intersecting because of arity > 0 - * intersect_start_time = monitor_cpu() - */ - __pyx_t_9 = ((__pyx_cur_scope->__pyx_v_arity > 0) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1082 - * 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_intersect_start_time); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_intersect_start_time); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_intersect_start_time = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1083 - * # 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_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 = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __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_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __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 *)((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_1, __pyx_cur_scope->__pyx_v_hiero_phrase)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1084 - * 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_intersect_stop_time); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_intersect_stop_time); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_intersect_stop_time = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1085 - * 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_1 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); 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_3 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_intersect_stop_time, __pyx_cur_scope->__pyx_v_intersect_start_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_3); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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 = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_cur_scope->__pyx_v_self->intersect_time = __pyx_t_4; - goto __pyx_L34; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1088 - * 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 = 1088; __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 = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_18); - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1089 - * # 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 = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_phrase, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_21)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_6 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_6 - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_low); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_high); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_17 = 0; - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sa_range); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sa_range); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_sa_range = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1090 - * 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]) - * else: - */ - __pyx_t_9 = (__pyx_cur_scope->__pyx_v_sa_range != Py_None); - __pyx_t_14 = (__pyx_t_9 != 0); - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1091 - * 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __pyx_t_10 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__sa_low), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__sa_high), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_10); - __pyx_t_10 = 0; - goto __pyx_L35; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1093 - * phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1]) - * else: - * phrase_location = None # <<<<<<<<<<<<<< - * - * if phrase_location is None: - */ - __Pyx_INCREF(Py_None); - __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); - __Pyx_GIVEREF(Py_None); - __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None); - } - __pyx_L35:; - } - __pyx_L34:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1095 - * phrase_location = None - * - * if phrase_location is None: # <<<<<<<<<<<<<< - * node.children[word_id] = None - * # Search failed - */ - __pyx_t_14 = (((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location) == Py_None); - __pyx_t_9 = (__pyx_t_14 != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1096 - * - * if phrase_location is None: - * node.children[word_id] = None # <<<<<<<<<<<<<< - * # Search failed - * continue - */ - __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 = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - if (PyObject_SetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1098 - * node.children[word_id] = None - * # Search failed - * continue # <<<<<<<<<<<<<< - * # Search succeeded - * suffix_link = self.rules.root - */ - goto __pyx_L19_continue; - goto __pyx_L36; - } - __pyx_L36:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1100 - * 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_10 = __pyx_cur_scope->__pyx_v_self->rules->root; - __Pyx_INCREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_suffix_link); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_suffix_link); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_v_suffix_link = __pyx_t_10; - __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1101 - * # 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_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = (__pyx_t_10 != Py_None); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_14 = (__pyx_t_9 != 0); - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1102 - * 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_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_GetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_suffix_link); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_v_suffix_link = __pyx_t_10; - __pyx_t_10 = 0; - goto __pyx_L37; - } - __pyx_L37:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1103 - * 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 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase_location), ((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1104 - * 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_10, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_suffix_link) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1105 - * 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_10, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_new_node); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_new_node = __pyx_t_12; - __pyx_t_12 = 0; - } - __pyx_L33:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1106 - * suffix_link=suffix_link, - * phrase=hiero_phrase) - * node.children[word_id] = new_node # <<<<<<<<<<<<<< - * node = new_node - * - */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - if (PyObject_SetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_word_id, __pyx_cur_scope->__pyx_v_new_node) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1107 - * phrase=hiero_phrase) - * node.children[word_id] = new_node - * node = new_node # <<<<<<<<<<<<<< - * - * '''Automatically add a trailing X node, if allowed -- - */ - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new_node); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_node); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_node); - __pyx_cur_scope->__pyx_v_node = __pyx_cur_scope->__pyx_v_new_node; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1112 - * This should happen before we get to extraction (so that - * the node will exist if needed)''' - * if arity < self.max_nonterminals: # <<<<<<<<<<<<<< - * xcat_index = arity+1 - * xcat = sym_setindex(self.category, xcat_index) - */ - __pyx_t_14 = ((__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals) != 0); - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1113 - * 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_12 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_arity + 1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xcat_index); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_xcat_index); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_xcat_index = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1114 - * if arity < self.max_nonterminals: - * xcat_index = arity+1 - * xcat = sym_setindex(self.category, xcat_index) # <<<<<<<<<<<<<< - * suffix_link_xcat_index = xcat_index - * if is_shadow_path: - */ - __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_xcat_index); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1115 - * xcat_index = arity+1 - * xcat = sym_setindex(self.category, xcat_index) - * suffix_link_xcat_index = xcat_index # <<<<<<<<<<<<<< - * if is_shadow_path: - * suffix_link_xcat_index = xcat_index-1 - */ - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_xcat_index); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xcat_index); - __pyx_cur_scope->__pyx_v_suffix_link_xcat_index = __pyx_cur_scope->__pyx_v_xcat_index; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1116 - * xcat = sym_setindex(self.category, xcat_index) - * 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) - */ - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1117 - * 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_12 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_suffix_link_xcat_index = __pyx_t_12; - __pyx_t_12 = 0; - goto __pyx_L39; - } - __pyx_L39:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1118 - * 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, - * suffix_link=node.suffix_link.children[suffix_link_xcat], - */ - __pyx_t_21 = __Pyx_PyInt_AsInt(__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 = 1118; __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1119 - * 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __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 = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1120 - * 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 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); 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_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_18, __pyx_cur_scope->__pyx_v_suffix_link_xcat, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1121 - * 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_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __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 = 1121; __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 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__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 = 1121; __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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1119 - * 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_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - if (__Pyx_SetItemInt(__pyx_t_12, __pyx_cur_scope->__pyx_v_xcat, __pyx_t_10, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L38; - } - __pyx_L38:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1124 - * - * # sample from range - * if not is_shadow_path: # <<<<<<<<<<<<<< - * sample = self.sampler.sample(node.phrase_location) - * num_subpatterns = ( node.phrase_location).num_subpatterns - */ - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = ((!__pyx_t_14) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1125 - * # sample from range - * if not is_shadow_path: - * sample = self.sampler.sample(node.phrase_location) # <<<<<<<<<<<<<< - * num_subpatterns = ( node.phrase_location).num_subpatterns - * chunklen = IntList(initial_len=num_subpatterns) - */ - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->sampler), __pyx_n_s__sample); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_sample)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_sample)); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12); - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1126 - * if not is_shadow_path: - * sample = self.sampler.sample(node.phrase_location) - * num_subpatterns = ( node.phrase_location).num_subpatterns # <<<<<<<<<<<<<< - * chunklen = IntList(initial_len=num_subpatterns) - * for j from 0 <= j < num_subpatterns: - */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_21 = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_12)->num_subpatterns; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_cur_scope->__pyx_v_num_subpatterns = __pyx_t_21; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1127 - * sample = self.sampler.sample(node.phrase_location) - * num_subpatterns = ( 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_18) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen)); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_chunklen = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_18); - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1128 - * num_subpatterns = ( 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) - * extracts = [] - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1129 - * chunklen = IntList(initial_len=num_subpatterns) - * for j from 0 <= j < num_subpatterns: - * chunklen.arr[j] = hiero_phrase.chunklen(j) # <<<<<<<<<<<<<< - * extracts = [] - * j = 0 - */ - (__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); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1130 - * 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 = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); - __pyx_cur_scope->__pyx_v_extracts = ((PyObject*)__pyx_t_18); - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1131 - * chunklen.arr[j] = hiero_phrase.chunklen(j) - * extracts = [] - * j = 0 # <<<<<<<<<<<<<< - * extract_start = monitor_cpu() - * while j < sample.len: - */ - __pyx_cur_scope->__pyx_v_j = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1132 - * 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 = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_12 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_start); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract_start); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_extract_start = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1133 - * j = 0 - * extract_start = monitor_cpu() - * while j < sample.len: # <<<<<<<<<<<<<< - * extract = [] - * - */ - while (1) { - __pyx_t_9 = ((__pyx_cur_scope->__pyx_v_j < __pyx_cur_scope->__pyx_v_sample->len) != 0); - if (!__pyx_t_9) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1134 - * extract_start = monitor_cpu() - * while j < sample.len: - * extract = [] # <<<<<<<<<<<<<< - * - * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) - */ - __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract); - __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); - __pyx_cur_scope->__pyx_v_extract = ((PyObject *)__pyx_t_12); - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1136 - * extract = [] - * - * 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) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1137 - * - * 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_12 = __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_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_loc); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_loc); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_loc = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1138 - * 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_12 = ((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_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_extract); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_extract); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_extract = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1139 - * 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_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_extracts), __pyx_n_s__extend); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_extract) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_extract)) { - __pyx_t_10 = __pyx_cur_scope->__pyx_v_extract; __Pyx_INCREF(__pyx_t_10); __pyx_t_6 = 0; - __pyx_t_22 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_extract); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_22 = Py_TYPE(__pyx_t_10)->tp_iternext; - } - for (;;) { - if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_10)) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_17 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_17); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_17 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_10)) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_17); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_17 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_17 = __pyx_t_22(__pyx_t_10); - if (unlikely(!__pyx_t_17)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_17); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_cur_scope->__pyx_v_e = __pyx_t_17; - __pyx_t_17 = 0; - __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e); - PyTuple_SET_ITEM(__pyx_t_17, 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_17, 1, __pyx_cur_scope->__pyx_v_loc); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_loc); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_18, (PyObject*)__pyx_t_17))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_18)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); - __pyx_t_18 = 0; - __pyx_t_18 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1140 - * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) - * extracts.extend([(e, loc) for e in extract]) - * j = j + num_subpatterns # <<<<<<<<<<<<<< - * - * num_samples = sample.len/num_subpatterns - */ - __pyx_cur_scope->__pyx_v_j = (__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_num_subpatterns); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1142 - * j = j + num_subpatterns - * - * num_samples = sample.len/num_subpatterns # <<<<<<<<<<<<<< - * extract_stop = monitor_cpu() - * self.extract_time = self.extract_time + extract_stop - extract_start - */ - if (unlikely(__pyx_cur_scope->__pyx_v_num_subpatterns == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - else if (sizeof(int) == sizeof(long) && unlikely(__pyx_cur_scope->__pyx_v_num_subpatterns == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_cur_scope->__pyx_v_sample->len))) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_cur_scope->__pyx_v_num_samples = __Pyx_div_int(__pyx_cur_scope->__pyx_v_sample->len, __pyx_cur_scope->__pyx_v_num_subpatterns); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1143 - * - * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_stop); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract_stop); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_v_extract_stop = __pyx_t_10; - __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1144 - * 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_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __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_extract_stop); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyNumber_Subtract(__pyx_t_18, __pyx_cur_scope->__pyx_v_extract_start); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_10); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_cur_scope->__pyx_v_self->extract_time = __pyx_t_4; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1145 - * 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(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = ((__pyx_t_6 > 0) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1146 - * 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_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__Counter); 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 = PyObject_Call(__pyx_t_10, ((PyObject *)__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_XGOTREF(__pyx_cur_scope->__pyx_v_fcount); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_fcount); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_fcount = __pyx_t_18; - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1147 - * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); 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 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4, 0, __pyx_n_s_128, NULL, __pyx_n_s_102, NULL); 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_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_12), NULL); 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_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_fphrases); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_fphrases); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_v_fphrases = __pyx_t_10; - __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1148 - * 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_10 = ((PyObject *)__pyx_cur_scope->__pyx_v_extracts); __Pyx_INCREF(__pyx_t_10); __pyx_t_6 = 0; - for (;;) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_10)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_12 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_12); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_18 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_18 = PyList_GET_ITEM(sequence, 0); - __pyx_t_17 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_18); - __Pyx_INCREF(__pyx_t_17); - #else - __pyx_t_18 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - #endif - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_1 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_20 = Py_TYPE(__pyx_t_1)->tp_iternext; - index = 0; __pyx_t_18 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_18)) goto __pyx_L50_unpacking_failed; - __Pyx_GOTREF(__pyx_t_18); - index = 1; __pyx_t_17 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_17)) goto __pyx_L50_unpacking_failed; - __Pyx_GOTREF(__pyx_t_17); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_20 = NULL; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L51_unpacking_done; - __pyx_L50_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 = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L51_unpacking_done:; - } - if ((likely(PyTuple_CheckExact(__pyx_t_18))) || (PyList_CheckExact(__pyx_t_18))) { - PyObject* sequence = __pyx_t_18; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 4)) { - if (size > 4) __Pyx_RaiseTooManyValuesError(4); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); - } else { - __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_t_8 = PyList_GET_ITEM(sequence, 3); - } - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(__pyx_t_8); - #else - Py_ssize_t i; - PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_11,&__pyx_t_8}; - for (i=0; i < 4; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(item); - *(temps[i]) = item; - } - #endif - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - { - Py_ssize_t index = -1; - PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_11,&__pyx_t_8}; - __pyx_t_16 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_20 = Py_TYPE(__pyx_t_16)->tp_iternext; - for (index=0; index < 4; index++) { - PyObject* item = __pyx_t_20(__pyx_t_16); if (unlikely(!item)) goto __pyx_L52_unpacking_failed; - __Pyx_GOTREF(item); - *(temps[index]) = item; - } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_16), 4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_20 = NULL; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - goto __pyx_L53_unpacking_done; - __pyx_L52_unpacking_failed:; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_20 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L53_unpacking_done:; - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_f = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_e = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_count); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_cur_scope->__pyx_v_count = __pyx_t_11; - __pyx_t_11 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_als); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_als); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_cur_scope->__pyx_v_als = __pyx_t_8; - __pyx_t_8 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_loc); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_loc); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_cur_scope->__pyx_v_loc = __pyx_t_17; - __pyx_t_17 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1149 - * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) - * for (f, e, count, als), loc in extracts: - * fcount[f] += count # <<<<<<<<<<<<<< - * fphrases[f][e][als].append(loc) - * for f, elist in fphrases.iteritems(): - */ - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); - __pyx_t_12 = __pyx_cur_scope->__pyx_v_f; - __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_12); if (!__pyx_t_17) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_17, __pyx_cur_scope->__pyx_v_count); 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_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (PyObject_SetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_12, __pyx_t_18) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1150 - * 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_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fphrases, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_18 = PyObject_GetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_e); if (!__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_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_als); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_cur_scope->__pyx_v_loc); 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_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1151 - * 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; - 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 = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_18 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_fphrases, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_23), (&__pyx_t_21)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_10); - __pyx_t_10 = __pyx_t_18; - __pyx_t_18 = 0; - while (1) { - __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_10, __pyx_t_23, &__pyx_t_6, &__pyx_t_18, &__pyx_t_12, NULL, __pyx_t_21); - if (unlikely(__pyx_t_7 == 0)) break; - if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_GOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_f = __pyx_t_18; - __pyx_t_18 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elist); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_elist); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_elist = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1152 - * 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])) - * locs = tuple(itertools.chain.from_iterable(alslist.itervalues())) - */ - __pyx_t_24 = 0; - if (unlikely(__pyx_cur_scope->__pyx_v_elist == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_18 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_elist, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_25), (&__pyx_t_7)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_12); - __pyx_t_12 = __pyx_t_18; - __pyx_t_18 = 0; - while (1) { - __pyx_t_5 = __Pyx_dict_iter_next(__pyx_t_12, __pyx_t_25, &__pyx_t_24, &__pyx_t_18, &__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 = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_GOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_e = __pyx_t_18; - __pyx_t_18 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alslist); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alslist); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_cur_scope->__pyx_v_alslist = __pyx_t_17; - __pyx_t_17 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1153 - * 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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __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 = 1153; __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 = 0; - __pyx_t_18 = PyDict_New(); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_18)); - __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6, 0, __pyx_n_s_128, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_18, ((PyObject *)__pyx_n_s__key), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_17), ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) { - PyObject* sequence = __pyx_t_8; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_18 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_18 = PyList_GET_ITEM(sequence, 0); - __pyx_t_17 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_18); - __Pyx_INCREF(__pyx_t_17); - #else - __pyx_t_18 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - #endif - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_11 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_20 = Py_TYPE(__pyx_t_11)->tp_iternext; - index = 0; __pyx_t_18 = __pyx_t_20(__pyx_t_11); if (unlikely(!__pyx_t_18)) goto __pyx_L58_unpacking_failed; - __Pyx_GOTREF(__pyx_t_18); - index = 1; __pyx_t_17 = __pyx_t_20(__pyx_t_11); if (unlikely(!__pyx_t_17)) goto __pyx_L58_unpacking_failed; - __Pyx_GOTREF(__pyx_t_17); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_20 = NULL; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L59_unpacking_done; - __pyx_L58_unpacking_failed:; - __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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L59_unpacking_done:; - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alignment); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_alignment = __pyx_t_18; - __pyx_t_18 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_max_locs); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_max_locs); - __Pyx_GIVEREF(__pyx_t_17); - __pyx_cur_scope->__pyx_v_max_locs = __pyx_t_17; - __pyx_t_17 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1154 - * 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) - * scores = self.scorer.score(FeatureContext( - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__itertools); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__chain); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s__from_iterable); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __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 = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __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 = 1154; __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 = 0; - __pyx_t_18 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__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 = 1154; __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 = 0; - __pyx_t_18 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_locs = ((PyObject*)__pyx_t_18); - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1155 - * alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) - * locs = tuple(itertools.chain.from_iterable(alslist.itervalues())) - * count = len(locs) # <<<<<<<<<<<<<< - * scores = self.scorer.score(FeatureContext( - * f, e, count, fcount[f], num_samples, - */ - __pyx_t_26 = PyTuple_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); if (unlikely(__pyx_t_26 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_26); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_count); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_count = __pyx_t_18; - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1156 - * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__FeatureContext); 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1157 - * count = len(locs) - * scores = self.scorer.score(FeatureContext( - * f, e, count, fcount[f], num_samples, # <<<<<<<<<<<<<< - * (k,i+spanlen), locs, input_match, - * fwords, self.fda, self.eda, - */ - __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_cur_scope->__pyx_v_f); if (!__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_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_samples); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1158 - * 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_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); 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_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __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 = 1158; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1162 - * meta, - * # Include online stats. None if none. - * self.online_ctx_lookup(f, e, ctx_name))) # <<<<<<<<<<<<<< - * # Phrase pair processed - * if self.online: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__online_ctx_lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1162; __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_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_11, 1, __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_11, 2, __pyx_cur_scope->__pyx_v_ctx_name); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ctx_name); - __pyx_t_16 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(13); 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_INCREF(__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_11, 1, __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_11, 2, __pyx_cur_scope->__pyx_v_count); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_count); - PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_11, 5, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); - PyTuple_SET_ITEM(__pyx_t_11, 6, ((PyObject *)__pyx_cur_scope->__pyx_v_locs)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_input_match); - PyTuple_SET_ITEM(__pyx_t_11, 7, __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_11, 8, __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_11, 9, ((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_11, 10, ((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_11, 11, __pyx_cur_scope->__pyx_v_meta); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_meta); - PyTuple_SET_ITEM(__pyx_t_11, 12, __pyx_t_16); - __Pyx_GIVEREF(__pyx_t_16); - __pyx_t_17 = 0; - __pyx_t_8 = 0; - __pyx_t_3 = 0; - __pyx_t_16 = 0; - __pyx_t_16 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = ((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_16)); 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_16); __pyx_t_16 = 0; - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_11); - __pyx_t_11 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1164 - * self.online_ctx_lookup(f, e, ctx_name))) - * # Phrase pair processed - * if self.online: # <<<<<<<<<<<<<< - * seen_phrases.add((f, e)) - * yield Rule(self.category, f, e, scores, alignment) - */ - __pyx_t_9 = (__pyx_cur_scope->__pyx_v_self->online != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1165 - * # Phrase pair processed - * if self.online: - * seen_phrases.add((f, e)) # <<<<<<<<<<<<<< - * yield Rule(self.category, f, e, scores, alignment) - * - */ - __pyx_t_11 = PyTuple_New(2); 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_INCREF(__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_11, 1, __pyx_cur_scope->__pyx_v_e); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); - __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, ((PyObject *)__pyx_t_11)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - goto __pyx_L60; - } - __pyx_L60:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1166 - * 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_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_16 = PyTuple_New(5); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_16, 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_16, 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_16, 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_16, 4, __pyx_cur_scope->__pyx_v_alignment); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignment); - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)), ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; - __pyx_r = __pyx_t_11; - __pyx_t_11 = 0; - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_6; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_7; - __Pyx_XGIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_t_3 = __pyx_t_10; - __Pyx_XGIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_t_4 = __pyx_t_12; - __Pyx_XGIVEREF(__pyx_t_15); - __pyx_cur_scope->__pyx_t_5 = __pyx_t_15; - __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; - __pyx_cur_scope->__pyx_t_9 = __pyx_t_25; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __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_7 = __pyx_cur_scope->__pyx_t_2; - __pyx_t_10 = __pyx_cur_scope->__pyx_t_3; - __pyx_cur_scope->__pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_t_10); - __pyx_t_12 = __pyx_cur_scope->__pyx_t_4; - __pyx_cur_scope->__pyx_t_4 = 0; - __Pyx_XGOTREF(__pyx_t_12); - __pyx_t_15 = __pyx_cur_scope->__pyx_t_5; - __pyx_cur_scope->__pyx_t_5 = 0; - __Pyx_XGOTREF(__pyx_t_15); - __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 = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L47; - } - __pyx_L47:; - goto __pyx_L40; - } - __pyx_L40:; - goto __pyx_L32; - } - __pyx_L32:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1168 - * 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: # <<<<<<<<<<<<<< - * 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)) - */ - __pyx_t_23 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __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_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __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_cur_scope->__pyx_v_fwords; - __Pyx_INCREF(__pyx_t_10); - __pyx_t_23 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_23); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (__pyx_t_14) { - __pyx_t_11 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, __pyx_t_10, Py_LE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __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_27 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_27 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_28 = __pyx_t_27; - } else { - __pyx_t_28 = __pyx_t_14; - } - __pyx_t_14 = __pyx_t_28; - } else { - __pyx_t_14 = __pyx_t_9; - } - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1169 - * - * 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_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_10 = PyNumber_Add(__pyx_t_12, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_10); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_23 = PyObject_Length(__pyx_t_12); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1170 - * 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_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt_id); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_16 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_18 = PyTuple_New(8); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_input_match); - PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_cur_scope->__pyx_v_input_match); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_input_match); - PyTuple_SET_ITEM(__pyx_t_18, 3, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_18, 4, __pyx_t_16); - __Pyx_GIVEREF(__pyx_t_16); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_node); - PyTuple_SET_ITEM(__pyx_t_18, 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_18, 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_18, 7, __pyx_cur_scope->__pyx_v_is_shadow_path); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path); - __pyx_t_12 = 0; - __pyx_t_11 = 0; - __pyx_t_10 = 0; - __pyx_t_16 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_18)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1171 - * 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: - * num_subpatterns = num_subpatterns + 1 - */ - __pyx_cur_scope->__pyx_v_num_subpatterns = __pyx_cur_scope->__pyx_v_arity; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1172 - * 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_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = ((!__pyx_t_14) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1173 - * 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: - * 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; - } - __pyx_L65:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1174 - * 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: # <<<<<<<<<<<<<< - * xcat = sym_setindex(self.category, arity+1) - * xnode = node.children[xcat] - */ - __pyx_t_23 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1174; __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_14 = ((__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals) != 0); - if (__pyx_t_14) { - __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_14; - } - __pyx_t_14 = __pyx_t_27; - } else { - __pyx_t_14 = __pyx_t_9; - } - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1175 - * 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) # <<<<<<<<<<<<<< - * xnode = node.children[xcat] - * # I put spanlen=1 below - */ - __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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1176 - * 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_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 = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_18, __pyx_cur_scope->__pyx_v_xcat, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_16) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xnode); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_xnode); - __Pyx_GIVEREF(__pyx_t_16); - __pyx_cur_scope->__pyx_v_xnode = __pyx_t_16; - __pyx_t_16 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1178 - * 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_16 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_10 = PyList_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_16); - __Pyx_GIVEREF(__pyx_t_16); - PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - __Pyx_INCREF(__pyx_int_1); - PyList_SET_ITEM(__pyx_t_10, 2, __pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); - PyList_SET_ITEM(__pyx_t_10, 3, __pyx_cur_scope->__pyx_v_pathlen); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pathlen); - __pyx_t_16 = 0; - __pyx_t_18 = 0; - __pyx_t_18 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_10))); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_18)); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_key)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_key)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); - __pyx_cur_scope->__pyx_v_key = ((PyObject*)__pyx_t_18); - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1179 - * # 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_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); - __pyx_cur_scope->__pyx_v_frontier_nodes = ((PyObject *)__pyx_t_18); - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1180 - * 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] - * else: - */ - __pyx_t_14 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_cur_scope->__pyx_v_key), ((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = (__pyx_t_14 != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1181 - * 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_18 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_18; - __pyx_t_18 = 0; - goto __pyx_L67; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1183 - * 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_18 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_129); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_16 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_11 = PyTuple_New(7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __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_16); - __Pyx_GIVEREF(__pyx_t_16); - __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); - PyTuple_SET_ITEM(__pyx_t_11, 3, __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_11, 4, __pyx_cur_scope->__pyx_v_fwords); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_next_states)); - PyTuple_SET_ITEM(__pyx_t_11, 5, ((PyObject *)__pyx_cur_scope->__pyx_v_next_states)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_next_states)); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); - PyTuple_SET_ITEM(__pyx_t_11, 6, ((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); - __pyx_t_10 = 0; - __pyx_t_16 = 0; - __pyx_t_16 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); - __Pyx_GIVEREF(__pyx_t_16); - __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_16; - __pyx_t_16 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1184 - * 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 # <<<<<<<<<<<<<< - * - * for i, alt, pathlen in frontier_nodes: - */ - if (PyDict_SetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key), __pyx_cur_scope->__pyx_v_frontier_nodes) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_L67:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1186 - * 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_16 = __pyx_cur_scope->__pyx_v_frontier_nodes; __Pyx_INCREF(__pyx_t_16); __pyx_t_23 = 0; - __pyx_t_22 = NULL; - } else { - __pyx_t_23 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_frontier_nodes); 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_22 = Py_TYPE(__pyx_t_16)->tp_iternext; - } - for (;;) { - if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_16)) { - if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_16)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_11 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_23); __Pyx_INCREF(__pyx_t_11); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_11 = PySequence_ITEM(__pyx_t_16, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_16)) { - if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_16)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_23); __Pyx_INCREF(__pyx_t_11); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_11 = PySequence_ITEM(__pyx_t_16, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_11 = __pyx_t_22(__pyx_t_16); - if (unlikely(!__pyx_t_11)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_11); - } - if ((likely(PyTuple_CheckExact(__pyx_t_11))) || (PyList_CheckExact(__pyx_t_11))) { - PyObject* sequence = __pyx_t_11; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_18 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_18 = PyList_GET_ITEM(sequence, 0); - __pyx_t_10 = PyList_GET_ITEM(sequence, 1); - __pyx_t_12 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_18); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(__pyx_t_12); - #else - __pyx_t_18 = PySequence_ITEM(sequence, 0); 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_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - #endif - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_11); 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); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_20 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_18 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_18)) goto __pyx_L70_unpacking_failed; - __Pyx_GOTREF(__pyx_t_18); - index = 1; __pyx_t_10 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_10)) goto __pyx_L70_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - index = 2; __pyx_t_12 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_12)) goto __pyx_L70_unpacking_failed; - __Pyx_GOTREF(__pyx_t_12); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_20 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L71_unpacking_done; - __pyx_L70_unpacking_failed:; - __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 = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L71_unpacking_done:; - } - __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_cur_scope->__pyx_v_i = __pyx_t_21; - __pyx_cur_scope->__pyx_v_alt = __pyx_t_7; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_pathlen); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_pathlen); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1187 - * - * 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_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __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 = 1187; __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 = PyNumber_Add(__pyx_cur_scope->__pyx_v_input_match, ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); - PyTuple_SET_ITEM(__pyx_t_8, 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_8, 5, __pyx_cur_scope->__pyx_v_xnode); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xnode); - PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_shadow_path); - PyTuple_SET_ITEM(__pyx_t_8, 7, __pyx_cur_scope->__pyx_v_is_shadow_path); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path); - __pyx_t_11 = 0; - __pyx_t_12 = 0; - __pyx_t_10 = 0; - __pyx_t_18 = 0; - __pyx_t_3 = 0; - __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - goto __pyx_L66; - } - __pyx_L66:; - goto __pyx_L62; - } - __pyx_L62:; - __pyx_L19_continue:; - } - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1188 - * 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 # <<<<<<<<<<<<<< - * - * # Online rule extraction and scoring - */ - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); - __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); - __pyx_cur_scope->__pyx_v_frontier = __pyx_cur_scope->__pyx_v_new_frontier; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1191 - * - * # Online rule extraction and scoring - * if self.online: # <<<<<<<<<<<<<< - * stats = self.online_stats[ctx_name] - * f_syms = tuple(word[0][0] for word in fwords) - */ - __pyx_t_9 = (__pyx_cur_scope->__pyx_v_self->online != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1192 - * # 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_15 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->online_stats, __pyx_cur_scope->__pyx_v_ctx_name); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_cur_scope->__pyx_v_stats = __pyx_t_15; - __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1193 - * 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_15 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_t_15 = 0; - __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; - __Pyx_GIVEREF(__pyx_t_15); - __pyx_cur_scope->__pyx_v_f_syms = ((PyObject*)__pyx_t_15); - __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1194 - * 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_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__get_f_phrases); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_syms)); - PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_f_syms)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_syms)); - __pyx_t_8 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; - if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) { - __pyx_t_16 = __pyx_t_8; __Pyx_INCREF(__pyx_t_16); __pyx_t_2 = 0; - __pyx_t_22 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_22 = Py_TYPE(__pyx_t_16)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - for (;;) { - if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_16)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_16)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_16, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_16)) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_16)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_16, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_8 = __pyx_t_22(__pyx_t_16); - if (unlikely(!__pyx_t_8)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) { - PyObject* sequence = __pyx_t_8; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __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_3 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_18 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_15 = PyList_GET_ITEM(sequence, 0); - __pyx_t_3 = PyList_GET_ITEM(sequence, 1); - __pyx_t_18 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_18); - #else - __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_18 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - #endif - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_20 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_15 = __pyx_t_20(__pyx_t_10); if (unlikely(!__pyx_t_15)) goto __pyx_L75_unpacking_failed; - __Pyx_GOTREF(__pyx_t_15); - index = 1; __pyx_t_3 = __pyx_t_20(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L75_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 2; __pyx_t_18 = __pyx_t_20(__pyx_t_10); if (unlikely(!__pyx_t_18)) goto __pyx_L75_unpacking_failed; - __Pyx_GOTREF(__pyx_t_18); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_20 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L76_unpacking_done; - __pyx_L75_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_20 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L76_unpacking_done:; - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_cur_scope->__pyx_v_f = __pyx_t_15; - __pyx_t_15 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_lex_i); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_lex_i); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_lex_i = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_lex_j); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_lex_j); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_lex_j = __pyx_t_18; - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1195 - * 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_8 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_lex_j, __pyx_cur_scope->__pyx_v_lex_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_18 = PyNumber_Add(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_spanlen); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_spanlen); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_18; - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1196 - * 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 - * if not sym_isvar(f[1]): - */ - __pyx_t_18 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_f, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_7) != 0)) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1197 - * spanlen = (lex_j - lex_i) + 1 - * if not sym_isvar(f[0]): - * spanlen += 1 # <<<<<<<<<<<<<< - * if not sym_isvar(f[1]): - * spanlen += 1 - */ - __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_spanlen, __pyx_int_1); 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_GOTREF(__pyx_cur_scope->__pyx_v_spanlen); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_spanlen); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_18; - __pyx_t_18 = 0; - goto __pyx_L77; - } - __pyx_L77:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1198 - * if not sym_isvar(f[0]): - * spanlen += 1 - * if not sym_isvar(f[1]): # <<<<<<<<<<<<<< - * spanlen += 1 - * for e in stats.phrases_fe.get(f, ()): - */ - __pyx_t_18 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_f, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_7) != 0)) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1199 - * spanlen += 1 - * if not sym_isvar(f[1]): - * spanlen += 1 # <<<<<<<<<<<<<< - * for e in stats.phrases_fe.get(f, ()): - * if (f, e) not in seen_phrases: - */ - __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_spanlen, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_spanlen); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_spanlen); - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_18; - __pyx_t_18 = 0; - goto __pyx_L78; - } - __pyx_L78:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1200 - * 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_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_stats, __pyx_n_s__phrases_fe); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__get); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_cur_scope->__pyx_v_f); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f); - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - PyTuple_SET_ITEM(__pyx_t_18, 1, ((PyObject *)__pyx_empty_tuple)); - __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); - __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_18 = __pyx_t_3; __Pyx_INCREF(__pyx_t_18); __pyx_t_23 = 0; - __pyx_t_29 = NULL; - } else { - __pyx_t_23 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_29 = Py_TYPE(__pyx_t_18)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (!__pyx_t_29 && PyList_CheckExact(__pyx_t_18)) { - if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_18)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_18, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_29 && PyTuple_CheckExact(__pyx_t_18)) { - if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_18)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_18, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_3 = __pyx_t_29(__pyx_t_18); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_e = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1201 - * 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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_3, 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); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); - __pyx_t_9 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_cur_scope->__pyx_v_seen_phrases), Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_14 = (__pyx_t_9 != 0); - if (__pyx_t_14) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1203 - * 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_3 = PyTuple_New(2); 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_INCREF(__pyx_cur_scope->__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_3, 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); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); - __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1204 - * # 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__FeatureContext); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1209 - * fwords, self.fda, self.eda, - * 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(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__online_ctx_lookup); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __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_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_15, 1, __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_15, 2, __pyx_cur_scope->__pyx_v_ctx_name); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ctx_name); - __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __pyx_t_15 = PyTuple_New(13); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __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_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_15, 1, __pyx_cur_scope->__pyx_v_e); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_spanlen); - PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_cur_scope->__pyx_v_spanlen); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_spanlen); - __Pyx_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_15, 6, Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_15, 7, Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords); - PyTuple_SET_ITEM(__pyx_t_15, 8, __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_15, 9, ((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_15, 10, ((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_15, 11, __pyx_cur_scope->__pyx_v_meta); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_meta); - PyTuple_SET_ITEM(__pyx_t_15, 12, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __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_10)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); - __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_15); - __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1210 - * 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_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_stats, __pyx_n_s__phrases_al); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyObject_GetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_e); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alignment); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_cur_scope->__pyx_v_alignment = __pyx_t_15; - __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1211 - * 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_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_10 = PyTuple_New(5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_10, 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_10, 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_10, 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_10, 4, __pyx_cur_scope->__pyx_v_alignment); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignment); - __pyx_t_15 = 0; - __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_r = __pyx_t_15; - __pyx_t_15 = 0; - __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; - __Pyx_XGIVEREF(__pyx_t_16); - __pyx_cur_scope->__pyx_t_3 = __pyx_t_16; - __Pyx_XGIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_t_4 = __pyx_t_18; - __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_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_16 = __pyx_cur_scope->__pyx_t_3; - __pyx_cur_scope->__pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_t_16); - __pyx_t_18 = __pyx_cur_scope->__pyx_t_4; - __pyx_cur_scope->__pyx_t_4 = 0; - __Pyx_XGOTREF(__pyx_t_18); - __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; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L81; - } - __pyx_L81:; - } - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - goto __pyx_L72; - } - __pyx_L72:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1213 - * 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_16 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_18 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_GIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_v_stop_time = __pyx_t_18; - __pyx_t_18 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1214 - * - * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__info); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_start_time); 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); - __pyx_t_15 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_stop_time, __pyx_t_18); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyTuple_New(2); 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); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_130)); - PyTuple_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_kp_s_130)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_130)); - PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_t_15 = 0; - __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1215 - * 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_15 = __Pyx_GetModuleGlobalName(__pyx_n_s__gc); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s__collect); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1215; __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_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1216 - * 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_15 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s__info); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_131)); - PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_kp_s_131)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_131)); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_t_15 = 0; - __pyx_t_15 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1217 - * gc.collect() - * logger.info(" Extract time = %f seconds", self.extract_time) - * logger.info(" Intersect time = %f seconds", self.intersect_time) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s__info); 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); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_18); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_132)); - PyTuple_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_kp_s_132)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_132)); - PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_t_15 = 0; - __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_19); - __Pyx_AddTraceback("input", __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; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1220 - * - * - * cdef int find_fixpoint(self, # <<<<<<<<<<<<<< - * int f_low, f_high, - * int* f_links_low, int* f_links_high, - */ - -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) { - int __pyx_v_e_low_prev; - int __pyx_v_e_high_prev; - int __pyx_v_f_low_prev; - int __pyx_v_f_high_prev; - int __pyx_v_new_x; - int __pyx_v_new_low_x; - int __pyx_v_new_high_x; - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - 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("find_fixpoint", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1235 - * 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 # <<<<<<<<<<<<<< - * e_high[0] = e_in_high - * self.find_projection(f_low, f_high, f_links_low, f_links_high, e_low, e_high) - */ - (__pyx_v_e_low[0]) = __pyx_v_e_in_low; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1236 - * - * 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) - * if e_low[0] == -1: - */ - (__pyx_v_e_high[0]) = __pyx_v_e_in_high; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1237 - * 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) # <<<<<<<<<<<<<< - * if e_low[0] == -1: - * # low-priority corner case: if phrase w is unaligned, - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, __pyx_v_f_low, __pyx_t_1, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_low, __pyx_v_e_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1238 - * 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: # <<<<<<<<<<<<<< - * # low-priority corner case: if phrase w is unaligned, - * # but we don't require aligned terminals, then returning - */ - __pyx_t_3 = (((__pyx_v_e_low[0]) == -1) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1244 - * # rule X -> X_1 w X_2 / X_1 X_2. This is probably - * # 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: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L3; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1245 - * # 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; - } else { - __pyx_t_5 = __pyx_t_3; - } - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1246 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1247 - * 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: - * return 0 - */ - (__pyx_v_e_low[0]) = (__pyx_v_e_in_low - __pyx_v_min_ex_size); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1248 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1249 - * e_low[0] = e_in_low - min_ex_size - * if e_low[0] < 0: - * return 0 # <<<<<<<<<<<<<< - * - * if e_high[0] - e_low[0] > max_e_len: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - goto __pyx_L4; - } - __pyx_L4:; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1251 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1252 - * - * 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: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L6; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1253 - * 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; - } else { - __pyx_t_4 = __pyx_t_5; - } - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1254 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1255 - * 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: - * return 0 - */ - (__pyx_v_e_high[0]) = (__pyx_v_e_in_high + __pyx_v_min_ex_size); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1256 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1257 - * e_high[0] = e_in_high + min_ex_size - * if e_high[0] > e_sent_len: - * return 0 # <<<<<<<<<<<<<< - * - * f_back_low[0] = -1 - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L8; - } - __pyx_L8:; - goto __pyx_L7; - } - __pyx_L7:; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1259 - * return 0 - * - * f_back_low[0] = -1 # <<<<<<<<<<<<<< - * f_back_high[0] = -1 - * f_low_prev = f_low - */ - (__pyx_v_f_back_low[0]) = -1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1260 - * - * f_back_low[0] = -1 - * f_back_high[0] = -1 # <<<<<<<<<<<<<< - * f_low_prev = f_low - * f_high_prev = f_high - */ - (__pyx_v_f_back_high[0]) = -1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1261 - * f_back_low[0] = -1 - * f_back_high[0] = -1 - * f_low_prev = f_low # <<<<<<<<<<<<<< - * f_high_prev = f_high - * new_x = 0 - */ - __pyx_v_f_low_prev = __pyx_v_f_low; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1262 - * f_back_high[0] = -1 - * f_low_prev = f_low - * f_high_prev = f_high # <<<<<<<<<<<<<< - * new_x = 0 - * new_low_x = 0 - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f_high_prev = __pyx_t_1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1263 - * f_low_prev = f_low - * f_high_prev = f_high - * new_x = 0 # <<<<<<<<<<<<<< - * new_low_x = 0 - * new_high_x = 0 - */ - __pyx_v_new_x = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1264 - * f_high_prev = f_high - * new_x = 0 - * new_low_x = 0 # <<<<<<<<<<<<<< - * new_high_x = 0 - * - */ - __pyx_v_new_low_x = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1265 - * new_x = 0 - * new_low_x = 0 - * new_high_x = 0 # <<<<<<<<<<<<<< - * - * while True: - */ - __pyx_v_new_high_x = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1267 - * new_high_x = 0 - * - * while True: # <<<<<<<<<<<<<< - * - * if f_back_low[0] == -1: - */ - while (1) { - if (!1) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1269 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1270 - * - * 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: - * self.find_projection(e_low[0], e_low_prev, e_links_low, e_links_high, f_back_low, f_back_high) - */ - __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 = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L11; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1272 - * 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) # <<<<<<<<<<<<<< - * self.find_projection(e_high_prev, e_high[0], e_links_low, e_links_high, f_back_low, f_back_high) - * - */ - __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_low_prev, __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 = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1273 - * 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) # <<<<<<<<<<<<<< - * - * if f_back_low[0] > f_low: - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, __pyx_v_e_high_prev, (__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; - } - __pyx_L11:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1275 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1276 - * - * if f_back_low[0] > f_low: - * f_back_low[0] = f_low # <<<<<<<<<<<<<< - * - * if f_back_high[0] < f_high: - */ - (__pyx_v_f_back_low[0]) = __pyx_v_f_low; - goto __pyx_L12; - } - __pyx_L12:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1278 - * f_back_low[0] = f_low - * - * if f_back_high[0] < f_high: # <<<<<<<<<<<<<< - * f_back_high[0] = f_high - * - */ - __pyx_t_2 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1278; __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 = 1278; __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 = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1279 - * - * if f_back_high[0] < f_high: - * f_back_high[0] = f_high # <<<<<<<<<<<<<< - * - * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: - */ - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (__pyx_v_f_back_high[0]) = __pyx_t_1; - goto __pyx_L13; - } - __pyx_L13:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1281 - * f_back_high[0] = f_high - * - * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: # <<<<<<<<<<<<<< - * return 1 - * - */ - __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; - } else { - __pyx_t_3 = __pyx_t_4; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1282 - * - * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: - * return 1 # <<<<<<<<<<<<<< - * - * if allow_low_x == 0 and f_back_low[0] < f_low: - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L14; - } - __pyx_L14:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1284 - * 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; - } else { - __pyx_t_5 = __pyx_t_3; - } - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1286 - * if allow_low_x == 0 and f_back_low[0] < f_low: - * # FAIL: f phrase is not tight - * return 0 # <<<<<<<<<<<<<< - * - * if f_back_high[0] - f_back_low[0] > max_f_len: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L15; - } - __pyx_L15:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1288 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1290 - * if f_back_high[0] - f_back_low[0] > max_f_len: - * # FAIL: f back projection is too wide - * return 0 # <<<<<<<<<<<<<< - * - * if allow_high_x == 0 and f_back_high[0] > f_high: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L16; - } - __pyx_L16:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1292 - * 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 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1292; __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 = 1292; __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 = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_t_3; - } else { - __pyx_t_4 = __pyx_t_5; - } - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1294 - * if allow_high_x == 0 and f_back_high[0] > f_high: - * # FAIL: extension on high side not allowed - * return 0 # <<<<<<<<<<<<<< - * - * if f_low != f_back_low[0]: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L17; - } - __pyx_L17:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1296 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1297 - * - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1298 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1300 - * if new_x >= max_new_x: - * # FAIL: extension required on low side violates max # of gaps - * return 0 # <<<<<<<<<<<<<< - * else: - * new_x = new_x + 1 - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L20; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1302 - * return 0 - * else: - * new_x = new_x + 1 # <<<<<<<<<<<<<< - * new_low_x = 1 - * if f_low - f_back_low[0] < min_fx_size: - */ - __pyx_v_new_x = (__pyx_v_new_x + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1303 - * else: - * 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 - */ - __pyx_v_new_low_x = 1; - } - __pyx_L20:; - goto __pyx_L19; - } - __pyx_L19:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1304 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1305 - * 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: - * # FAIL: extension required on low side violates max initial length - */ - (__pyx_v_f_back_low[0]) = (__pyx_v_f_low - __pyx_v_min_fx_size); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1306 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1308 - * if f_back_high[0] - f_back_low[0] > max_f_len: - * # 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 - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L22; - } - __pyx_L22:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1309 - * # 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1311 - * if f_back_low[0] < 0: - * # FAIL: extension required on low side violates sentence boundary - * return 0 # <<<<<<<<<<<<<< - * - * if f_high != f_back_high[0]: - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L23; - } - __pyx_L23:; - goto __pyx_L21; - } - __pyx_L21:; - goto __pyx_L18; - } - __pyx_L18:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1313 - * return 0 - * - * if f_high != f_back_high[0]: # <<<<<<<<<<<<<< - * if new_high_x == 0: - * if new_x >= max_new_x: - */ - __pyx_t_2 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1313; __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 = 1313; __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 = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1314 - * - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1315 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1317 - * if new_x >= max_new_x: - * # FAIL: extension required on high side violates max # of gaps - * return 0 # <<<<<<<<<<<<<< - * else: - * new_x = new_x + 1 - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L26; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1319 - * return 0 - * else: - * new_x = new_x + 1 # <<<<<<<<<<<<<< - * new_high_x = 1 - * if f_back_high[0] - f_high < min_fx_size: - */ - __pyx_v_new_x = (__pyx_v_new_x + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1320 - * else: - * 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 - */ - __pyx_v_new_high_x = 1; - } - __pyx_L26:; - goto __pyx_L25; - } - __pyx_L25:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1321 - * 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 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1321; __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 = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromLong(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1321; __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 = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __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 = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1322 - * 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 = PyInt_FromLong(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1322; __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 = 1322; __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_AsInt(__pyx_t_6); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - (__pyx_v_f_back_high[0]) = __pyx_t_1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1323 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1325 - * if f_back_high[0] - f_back_low[0] > max_f_len: - * # 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 - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L28; - } - __pyx_L28:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1326 - * # 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1328 - * if f_back_high[0] > f_sent_len: - * # FAIL: extension required on high side violates sentence boundary - * return 0 # <<<<<<<<<<<<<< - * - * e_low_prev = e_low[0] - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L29; - } - __pyx_L29:; - goto __pyx_L27; - } - __pyx_L27:; - goto __pyx_L24; - } - __pyx_L24:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1330 - * return 0 - * - * e_low_prev = e_low[0] # <<<<<<<<<<<<<< - * e_high_prev = e_high[0] - * - */ - __pyx_v_e_low_prev = (__pyx_v_e_low[0]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1331 - * - * e_low_prev = e_low[0] - * 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) - */ - __pyx_v_e_high_prev = (__pyx_v_e_high[0]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1333 - * 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 = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1334 - * - * 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 = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1335 - * 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 - * if allow_arbitrary_x == 0: - */ - __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; - } else { - __pyx_t_3 = __pyx_t_4; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1336 - * 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 # <<<<<<<<<<<<<< - * if allow_arbitrary_x == 0: - * # FAIL: arbitrary expansion not permitted - */ - __pyx_r = 1; - goto __pyx_L0; - goto __pyx_L30; - } - __pyx_L30:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1337 - * if e_low[0] == e_low_prev and e_high[0] == e_high_prev: - * return 1 - * if allow_arbitrary_x == 0: # <<<<<<<<<<<<<< - * # FAIL: arbitrary expansion not permitted - * return 0 - */ - __pyx_t_3 = ((__pyx_v_allow_arbitrary_x == 0) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1339 - * if allow_arbitrary_x == 0: - * # FAIL: arbitrary expansion not permitted - * return 0 # <<<<<<<<<<<<<< - * if e_high[0] - e_low[0] > max_e_len: - * # FAIL: re-projection violates sentence max phrase length - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L31; - } - __pyx_L31:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1340 - * # FAIL: arbitrary expansion not permitted - * return 0 - * if e_high[0] - e_low[0] > max_e_len: # <<<<<<<<<<<<<< - * # FAIL: re-projection violates sentence max phrase length - * return 0 - */ - __pyx_t_3 = ((((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1342 - * if e_high[0] - e_low[0] > max_e_len: - * # FAIL: re-projection violates sentence max phrase length - * return 0 # <<<<<<<<<<<<<< - * f_low_prev = f_back_low[0] - * f_high_prev = f_back_high[0] - */ - __pyx_r = 0; - goto __pyx_L0; - goto __pyx_L32; - } - __pyx_L32:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1343 - * # FAIL: re-projection violates sentence max phrase length - * return 0 - * f_low_prev = f_back_low[0] # <<<<<<<<<<<<<< - * f_high_prev = f_back_high[0] - * - */ - __pyx_v_f_low_prev = (__pyx_v_f_back_low[0]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1344 - * return 0 - * f_low_prev = f_back_low[0] - * f_high_prev = f_back_high[0] # <<<<<<<<<<<<<< - * - * - */ - __pyx_v_f_high_prev = (__pyx_v_f_back_high[0]); - } - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_WriteUnraisable("cdec.sa._sa.HieroCachingRuleFactory.find_fixpoint", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1347 - * - * - * cdef find_projection(self, int in_low, int in_high, int* in_links_low, int* in_links_high, # <<<<<<<<<<<<<< - * int* out_low, int* out_high): - * cdef int i - */ - -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) { - int __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("find_projection", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1350 - * int* out_low, int* out_high): - * cdef int i - * 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]: - */ - __pyx_t_1 = __pyx_v_in_high; - for (__pyx_v_i = __pyx_v_in_low; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1351 - * cdef int i - * 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] - */ - __pyx_t_2 = (((__pyx_v_in_links_low[__pyx_v_i]) != -1) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1352 - * 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; - } else { - __pyx_t_4 = __pyx_t_2; - } - if (__pyx_t_4) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1353 - * 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]: - * out_high[0] = in_links_high[i] - */ - (__pyx_v_out_low[0]) = (__pyx_v_in_links_low[__pyx_v_i]); - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1354 - * 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; - } else { - __pyx_t_3 = __pyx_t_4; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1355 - * 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_v_out_high[0]) = (__pyx_v_in_links_high[__pyx_v_i]); - goto __pyx_L7; - } - __pyx_L7:; - goto __pyx_L5; - } - __pyx_L5:; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1358 - * - * - * 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 - */ - -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) { - int __pyx_v_new_len; - int *__pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("int_arr_extend", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1360 - * 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 # <<<<<<<<<<<<<< - * arr = realloc(arr, new_len*sizeof(int)) - * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) - */ - __pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_data_len); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1361 - * cdef int new_len - * new_len = arr_len[0] + data_len - * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< - * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) - * arr_len[0] = new_len - */ - __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1362 - * new_len = arr_len[0] + data_len - * arr = realloc(arr, new_len*sizeof(int)) - * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) # <<<<<<<<<<<<<< - * arr_len[0] = new_len - * return arr - */ - memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_data, (__pyx_v_data_len * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1363 - * arr = realloc(arr, new_len*sizeof(int)) - * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) - * arr_len[0] = new_len # <<<<<<<<<<<<<< - * return arr - * - */ - (__pyx_v_arr_len[0]) = __pyx_v_new_len; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1364 - * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) - * arr_len[0] = new_len - * return arr # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_arr; - goto __pyx_L0; - - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1367 - * - * - * 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): - */ - -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) { - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_k; - int __pyx_v_m; - int __pyx_v_n; - int *__pyx_v_e_gap_order; - int __pyx_v_e_x_low; - int __pyx_v_e_x_high; - int __pyx_v_e_x_gap_low; - int __pyx_v_e_x_gap_high; - int *__pyx_v_e_gaps1; - int *__pyx_v_e_gaps2; - int __pyx_v_len1; - int __pyx_v_len2; - int __pyx_v_step; - int __pyx_v_num_chunks; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_ephr_arr = 0; - PyObject *__pyx_v_result = 0; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_indexes = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - 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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("extract_phrases", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1375 - * cdef result - * - * result = [] # <<<<<<<<<<<<<< - * len1 = 0 - * e_gaps1 = malloc(0) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_result = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1376 - * - * result = [] - * len1 = 0 # <<<<<<<<<<<<<< - * e_gaps1 = malloc(0) - * ephr_arr = IntList() - */ - __pyx_v_len1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1377 - * result = [] - * len1 = 0 - * e_gaps1 = malloc(0) # <<<<<<<<<<<<<< - * ephr_arr = IntList() - * - */ - __pyx_v_e_gaps1 = ((int *)malloc(0)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1378 - * len1 = 0 - * e_gaps1 = malloc(0) - * ephr_arr = IntList() # <<<<<<<<<<<<<< - * - * e_gap_order = malloc(num_gaps*sizeof(int)) - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1378; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1380 - * ephr_arr = IntList() - * - * e_gap_order = malloc(num_gaps*sizeof(int)) # <<<<<<<<<<<<<< - * if num_gaps > 0: - * e_gap_order[0] = 0 - */ - __pyx_v_e_gap_order = ((int *)malloc((__pyx_v_num_gaps * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1381 - * - * e_gap_order = malloc(num_gaps*sizeof(int)) - * if num_gaps > 0: # <<<<<<<<<<<<<< - * e_gap_order[0] = 0 - * for i from 1 <= i < num_gaps: - */ - __pyx_t_2 = ((__pyx_v_num_gaps > 0) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1382 - * e_gap_order = malloc(num_gaps*sizeof(int)) - * if num_gaps > 0: - * e_gap_order[0] = 0 # <<<<<<<<<<<<<< - * for i from 1 <= i < num_gaps: - * for j from 0 <= j < i: - */ - (__pyx_v_e_gap_order[0]) = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1383 - * if num_gaps > 0: - * e_gap_order[0] = 0 - * for i from 1 <= i < num_gaps: # <<<<<<<<<<<<<< - * for j from 0 <= j < i: - * if e_gap_low[i] < e_gap_low[j]: - */ - __pyx_t_3 = __pyx_v_num_gaps; - for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1384 - * e_gap_order[0] = 0 - * for i from 1 <= i < num_gaps: - * for j from 0 <= j < i: # <<<<<<<<<<<<<< - * if e_gap_low[i] < e_gap_low[j]: - * for k from j <= k < i: - */ - __pyx_t_4 = __pyx_v_i; - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1385 - * for i from 1 <= i < num_gaps: - * for j from 0 <= j < i: - * if e_gap_low[i] < e_gap_low[j]: # <<<<<<<<<<<<<< - * for k from j <= k < i: - * e_gap_order[k+1] = e_gap_order[k] - */ - __pyx_t_2 = (((__pyx_v_e_gap_low[__pyx_v_i]) < (__pyx_v_e_gap_low[__pyx_v_j])) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1386 - * for j from 0 <= j < i: - * if e_gap_low[i] < e_gap_low[j]: - * for k from j <= k < i: # <<<<<<<<<<<<<< - * e_gap_order[k+1] = e_gap_order[k] - * e_gap_order[j] = i - */ - __pyx_t_5 = __pyx_v_i; - for (__pyx_v_k = __pyx_v_j; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1387 - * if e_gap_low[i] < e_gap_low[j]: - * for k from j <= k < i: - * e_gap_order[k+1] = e_gap_order[k] # <<<<<<<<<<<<<< - * e_gap_order[j] = i - * break - */ - (__pyx_v_e_gap_order[(__pyx_v_k + 1)]) = (__pyx_v_e_gap_order[__pyx_v_k]); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1388 - * for k from j <= k < i: - * e_gap_order[k+1] = e_gap_order[k] - * e_gap_order[j] = i # <<<<<<<<<<<<<< - * break - * else: - */ - (__pyx_v_e_gap_order[__pyx_v_j]) = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1389 - * e_gap_order[k+1] = e_gap_order[k] - * e_gap_order[j] = i - * break # <<<<<<<<<<<<<< - * else: - * e_gap_order[i] = i - */ - goto __pyx_L7_break; - goto __pyx_L8; - } - __pyx_L8:; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1391 - * break - * else: - * e_gap_order[i] = i # <<<<<<<<<<<<<< - * - * e_x_low = e_low - */ - (__pyx_v_e_gap_order[__pyx_v_i]) = __pyx_v_i; - } - __pyx_L7_break:; - } - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1393 - * e_gap_order[i] = i - * - * e_x_low = e_low # <<<<<<<<<<<<<< - * e_x_high = e_high - * if not self.tight_phrases: - */ - __pyx_v_e_x_low = __pyx_v_e_low; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1394 - * - * e_x_low = e_low - * 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: - */ - __pyx_v_e_x_high = __pyx_v_e_high; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1395 - * e_x_low = e_low - * 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: - * e_x_low = e_x_low - 1 - */ - __pyx_t_2 = ((!(__pyx_v_self->tight_phrases != 0)) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1396 - * 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: # <<<<<<<<<<<<<< - * 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: - */ - 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; - } else { - __pyx_t_6 = __pyx_t_2; - } - if (!__pyx_t_6) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1397 - * 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 # <<<<<<<<<<<<<< - * 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 - */ - __pyx_v_e_x_low = (__pyx_v_e_x_low - 1); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1398 - * 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: # <<<<<<<<<<<<<< - * e_x_high = e_x_high + 1 - * - */ - 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; - } else { - __pyx_t_2 = __pyx_t_6; - } - if (!__pyx_t_2) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1399 - * 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 # <<<<<<<<<<<<<< - * - * for i from e_x_low <= i <= e_low: - */ - __pyx_v_e_x_high = (__pyx_v_e_x_high + 1); - } - goto __pyx_L11; - } - __pyx_L11:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1401 - * e_x_high = e_x_high + 1 - * - * for i from e_x_low <= i <= e_low: # <<<<<<<<<<<<<< - * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) - * - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1402 - * - * for i from e_x_low <= i <= e_low: - * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) # <<<<<<<<<<<<<< - * - * for i from 0 <= i < num_gaps: - */ - __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); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1404 - * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) - * - * for i from 0 <= i < num_gaps: # <<<<<<<<<<<<<< - * e_gaps2 = malloc(0) - * len2 = 0 - */ - __pyx_t_3 = __pyx_v_num_gaps; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1405 - * - * for i from 0 <= i < num_gaps: - * e_gaps2 = malloc(0) # <<<<<<<<<<<<<< - * len2 = 0 - * - */ - __pyx_v_e_gaps2 = ((int *)malloc(0)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1406 - * for i from 0 <= i < num_gaps: - * e_gaps2 = malloc(0) - * len2 = 0 # <<<<<<<<<<<<<< - * - * j = e_gap_order[i] - */ - __pyx_v_len2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1408 - * len2 = 0 - * - * j = e_gap_order[i] # <<<<<<<<<<<<<< - * e_x_gap_low = e_gap_low[j] - * e_x_gap_high = e_gap_high[j] - */ - __pyx_v_j = (__pyx_v_e_gap_order[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1409 - * - * j = e_gap_order[i] - * e_x_gap_low = e_gap_low[j] # <<<<<<<<<<<<<< - * e_x_gap_high = e_gap_high[j] - * if not self.tight_phrases: - */ - __pyx_v_e_x_gap_low = (__pyx_v_e_gap_low[__pyx_v_j]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1410 - * j = e_gap_order[i] - * e_x_gap_low = e_gap_low[j] - * 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: - */ - __pyx_v_e_x_gap_high = (__pyx_v_e_gap_high[__pyx_v_j]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1411 - * e_x_gap_low = e_gap_low[j] - * 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: - * e_x_gap_low = e_x_gap_low - 1 - */ - __pyx_t_2 = ((!(__pyx_v_self->tight_phrases != 0)) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1412 - * 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: # <<<<<<<<<<<<<< - * 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: - */ - 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; - } else { - __pyx_t_7 = __pyx_t_2; - } - if (!__pyx_t_7) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1413 - * 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 # <<<<<<<<<<<<<< - * 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 - */ - __pyx_v_e_x_gap_low = (__pyx_v_e_x_gap_low - 1); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1414 - * 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: # <<<<<<<<<<<<<< - * e_x_gap_high = e_x_gap_high + 1 - * - */ - 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; - } else { - __pyx_t_6 = __pyx_t_7; - } - if (!__pyx_t_6) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1415 - * 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 # <<<<<<<<<<<<<< - * - * k = 0 - */ - __pyx_v_e_x_gap_high = (__pyx_v_e_x_gap_high + 1); - } - goto __pyx_L20; - } - __pyx_L20:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1417 - * e_x_gap_high = e_x_gap_high + 1 - * - * k = 0 # <<<<<<<<<<<<<< - * step = 1+(i*2) - * while k < len1: - */ - __pyx_v_k = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1418 - * - * k = 0 - * step = 1+(i*2) # <<<<<<<<<<<<<< - * while k < len1: - * for m from e_x_gap_low <= m <= e_gap_low[j]: - */ - __pyx_v_step = (1 + (__pyx_v_i * 2)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1419 - * k = 0 - * step = 1+(i*2) - * while k < len1: # <<<<<<<<<<<<<< - * for m from e_x_gap_low <= m <= e_gap_low[j]: - * if m >= e_gaps1[k+step-1]: - */ - while (1) { - __pyx_t_6 = ((__pyx_v_k < __pyx_v_len1) != 0); - if (!__pyx_t_6) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1420 - * step = 1+(i*2) - * 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: - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1421 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1422 - * 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 - * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+k, step) - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1423 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1424 - * 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) - * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1425 - * 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) # <<<<<<<<<<<<<< - * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) - * k = k + step - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1426 - * 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) # <<<<<<<<<<<<<< - * k = k + step - * 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; - } - __pyx_L32:; - } - goto __pyx_L29; - } - __pyx_L29:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1427 - * 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 # <<<<<<<<<<<<<< - * free(e_gaps1) - * e_gaps1 = e_gaps2 - */ - __pyx_v_k = (__pyx_v_k + __pyx_v_step); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1428 - * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) - * k = k + step - * free(e_gaps1) # <<<<<<<<<<<<<< - * e_gaps1 = e_gaps2 - * len1 = len2 - */ - free(__pyx_v_e_gaps1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1429 - * k = k + step - * free(e_gaps1) - * e_gaps1 = e_gaps2 # <<<<<<<<<<<<<< - * len1 = len2 - * - */ - __pyx_v_e_gaps1 = __pyx_v_e_gaps2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1430 - * free(e_gaps1) - * e_gaps1 = e_gaps2 - * len1 = len2 # <<<<<<<<<<<<<< - * - * step = 1+(num_gaps*2) - */ - __pyx_v_len1 = __pyx_v_len2; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1432 - * len1 = len2 - * - * step = 1+(num_gaps*2) # <<<<<<<<<<<<<< - * e_gaps2 = malloc(0) - * len2 = 0 - */ - __pyx_v_step = (1 + (__pyx_v_num_gaps * 2)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1433 - * - * step = 1+(num_gaps*2) - * e_gaps2 = malloc(0) # <<<<<<<<<<<<<< - * len2 = 0 - * for i from e_high <= i <= e_x_high: - */ - __pyx_v_e_gaps2 = ((int *)malloc(0)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1434 - * step = 1+(num_gaps*2) - * e_gaps2 = malloc(0) - * len2 = 0 # <<<<<<<<<<<<<< - * for i from e_high <= i <= e_x_high: - * j = 0 - */ - __pyx_v_len2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1435 - * e_gaps2 = malloc(0) - * len2 = 0 - * for i from e_high <= i <= e_x_high: # <<<<<<<<<<<<<< - * j = 0 - * while j < len1: - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1436 - * len2 = 0 - * for i from e_high <= i <= e_x_high: - * j = 0 # <<<<<<<<<<<<<< - * while j < len1: - * if i - e_gaps1[j] <= self.train_max_initial_size and i >= e_gaps1[j+step-1]: - */ - __pyx_v_j = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1437 - * for i from e_high <= i <= e_x_high: - * j = 0 - * 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) - */ - while (1) { - __pyx_t_6 = ((__pyx_v_j < __pyx_v_len1) != 0); - if (!__pyx_t_6) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1438 - * j = 0 - * 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) - * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) - */ - __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; - } else { - __pyx_t_2 = __pyx_t_6; - } - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1439 - * 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) # <<<<<<<<<<<<<< - * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) - * j = j + step - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1440 - * 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) # <<<<<<<<<<<<<< - * j = j + step - * 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; - } - __pyx_L37:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1441 - * 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 # <<<<<<<<<<<<<< - * free(e_gaps1) - * e_gaps1 = e_gaps2 - */ - __pyx_v_j = (__pyx_v_j + __pyx_v_step); - } - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1442 - * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) - * j = j + step - * free(e_gaps1) # <<<<<<<<<<<<<< - * e_gaps1 = e_gaps2 - * len1 = len2 - */ - free(__pyx_v_e_gaps1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1443 - * j = j + step - * free(e_gaps1) - * e_gaps1 = e_gaps2 # <<<<<<<<<<<<<< - * len1 = len2 - * - */ - __pyx_v_e_gaps1 = __pyx_v_e_gaps2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1444 - * free(e_gaps1) - * e_gaps1 = e_gaps2 - * len1 = len2 # <<<<<<<<<<<<<< - * - * step = (num_gaps+1)*2 - */ - __pyx_v_len1 = __pyx_v_len2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1446 - * len1 = len2 - * - * step = (num_gaps+1)*2 # <<<<<<<<<<<<<< - * i = 0 - * - */ - __pyx_v_step = ((__pyx_v_num_gaps + 1) * 2); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1447 - * - * step = (num_gaps+1)*2 - * i = 0 # <<<<<<<<<<<<<< - * - * cdef IntList indexes - */ - __pyx_v_i = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1450 - * - * cdef IntList indexes - * while i < len1: # <<<<<<<<<<<<<< - * ephr_arr._clear() - * num_chunks = 0 - */ - while (1) { - __pyx_t_2 = ((__pyx_v_i < __pyx_v_len1) != 0); - if (!__pyx_t_2) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1451 - * cdef IntList indexes - * while i < len1: - * ephr_arr._clear() # <<<<<<<<<<<<<< - * num_chunks = 0 - * indexes = IntList() - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_clear(__pyx_v_ephr_arr); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1452 - * while i < len1: - * ephr_arr._clear() - * num_chunks = 0 # <<<<<<<<<<<<<< - * indexes = IntList() - * for j from 0 <= j < num_gaps+1: - */ - __pyx_v_num_chunks = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1453 - * 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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(((PyObject *)__pyx_v_indexes)); - __pyx_v_indexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1454 - * 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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1455 - * 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 - * for k from e_gaps1[i+2*j] <= k < e_gaps1[i+(2*j)+1]: - */ - __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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1456 - * 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 # <<<<<<<<<<<<<< - * for k from e_gaps1[i+2*j] <= k < e_gaps1[i+(2*j)+1]: - * indexes.append(k) - */ - __pyx_v_num_chunks = (__pyx_v_num_chunks + 1); - goto __pyx_L42; - } - __pyx_L42:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1457 - * 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]: # <<<<<<<<<<<<<< - * indexes.append(k) - * ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]]) - */ - __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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1458 - * 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 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1458; __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)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1459 - * 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: - * 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_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->eid2symid), __pyx_t_4, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_append(__pyx_v_ephr_arr, __pyx_t_4); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1460 - * indexes.append(k) - * 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)) - */ - __pyx_t_2 = ((__pyx_v_j < __pyx_v_num_gaps) != 0); - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1461 - * 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_10 = PyInt_FromLong(__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_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_indexes), __pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1461; __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_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1462 - * 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 - * 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; - } - __pyx_L45:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1463 - * 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 # <<<<<<<<<<<<<< - * if ephr_arr.len <= self.max_target_length and num_chunks <= self.max_target_chunks: - * result.append((Phrase(ephr_arr),indexes)) - */ - __pyx_v_i = (__pyx_v_i + __pyx_v_step); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1464 - * 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; - } else { - __pyx_t_7 = __pyx_t_2; - } - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1465 - * 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 = 1465; __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_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__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 = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __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_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L46; - } - __pyx_L46:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1467 - * result.append((Phrase(ephr_arr),indexes)) - * - * free(e_gaps1) # <<<<<<<<<<<<<< - * free(e_gap_order) - * return result - */ - free(__pyx_v_e_gaps1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1468 - * - * free(e_gaps1) - * free(e_gap_order) # <<<<<<<<<<<<<< - * return result - * - */ - free(__pyx_v_e_gap_order); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1469 - * free(e_gaps1) - * free(e_gap_order) - * return result # <<<<<<<<<<<<<< - * - * cdef IntList create_alignments(self, int* sent_links, int num_links, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.extract_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_ephr_arr); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF((PyObject *)__pyx_v_indexes); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1471 - * return result - * - * cdef IntList create_alignments(self, int* sent_links, int num_links, # <<<<<<<<<<<<<< - * IntList findexes, IntList eindexes): - * cdef unsigned i - */ - -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) { - unsigned int __pyx_v_i; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_ret = 0; - int __pyx_v_s; - PyObject *__pyx_v_idx = NULL; - PyObject *__pyx_v_j = NULL; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - unsigned int __pyx_t_3; - int __pyx_t_4; - 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("create_alignments", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1474 - * IntList findexes, IntList eindexes): - * cdef unsigned i - * cdef IntList ret = IntList() # <<<<<<<<<<<<<< - * for i in range(findexes.len): - * s = findexes.arr[i] - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1474; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1475 - * cdef unsigned i - * cdef IntList ret = IntList() - * for i in range(findexes.len): # <<<<<<<<<<<<<< - * s = findexes.arr[i] - * if s < 0: continue - */ - __pyx_t_2 = __pyx_v_findexes->len; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1476 - * cdef IntList ret = IntList() - * for i in range(findexes.len): - * s = findexes.arr[i] # <<<<<<<<<<<<<< - * if s < 0: continue - * idx = 0 - */ - __pyx_v_s = (__pyx_v_findexes->arr[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1477 - * for i in range(findexes.len): - * s = findexes.arr[i] - * if s < 0: continue # <<<<<<<<<<<<<< - * idx = 0 - * while idx < num_links * 2: - */ - __pyx_t_4 = ((__pyx_v_s < 0) != 0); - if (__pyx_t_4) { - goto __pyx_L3_continue; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1478 - * s = findexes.arr[i] - * if s < 0: continue - * idx = 0 # <<<<<<<<<<<<<< - * while idx < num_links * 2: - * if sent_links[idx] == s: - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_XDECREF(__pyx_v_idx); - __pyx_v_idx = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1479 - * if s < 0: continue - * idx = 0 - * while idx < num_links * 2: # <<<<<<<<<<<<<< - * if sent_links[idx] == s: - * j = eindexes.index(sent_links[idx+1]) - */ - while (1) { - __pyx_t_1 = PyInt_FromLong((__pyx_v_num_links * 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1479; __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 = 1479; __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 = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!__pyx_t_4) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1480 - * 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 = 1480; __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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1481 - * 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 = 1481; __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 = 1481; __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 = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong((__pyx_v_sent_links[__pyx_t_6])); 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_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1481; __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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1482 - * 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 = PyLong_FromUnsignedLong((__pyx_v_i * __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __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 = 1482; __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_PyObject_Append(((PyObject *)__pyx_v_ret), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __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_1); __pyx_t_1 = 0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1483 - * j = eindexes.index(sent_links[idx+1]) - * ret.append(i * ALIGNMENT_CODE + j) - * idx += 2 # <<<<<<<<<<<<<< - * return ret - * - */ - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_idx); - __pyx_v_idx = __pyx_t_1; - __pyx_t_1 = 0; - } - __pyx_L3_continue:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1484 - * ret.append(i * ALIGNMENT_CODE + j) - * idx += 2 - * return ret # <<<<<<<<<<<<<< - * - * cdef extract(self, Phrase phrase, Matching* matching, int* chunklen, int num_chunks): - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_ret)); - __pyx_r = __pyx_v_ret; - goto __pyx_L0; - - __pyx_r = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.create_alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_ret); - __Pyx_XDECREF(__pyx_v_idx); - __Pyx_XDECREF(__pyx_v_j); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1486 - * 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 - */ - -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) { - int *__pyx_v_sent_links; - int *__pyx_v_e_links_low; - int *__pyx_v_e_links_high; - int *__pyx_v_f_links_low; - int *__pyx_v_f_links_high; - int *__pyx_v_f_gap_low; - int *__pyx_v_f_gap_high; - int *__pyx_v_e_gap_low; - int *__pyx_v_e_gap_high; - int __pyx_v_num_gaps; - int __pyx_v_gap_start; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_e_i; - int __pyx_v_f_i; - int __pyx_v_num_links; - int __pyx_v_num_aligned_chunks; - int __pyx_v_met_constraints; - int __pyx_v_x; - int __pyx_v_f_low; - int __pyx_v_f_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_e_sent_start; - int __pyx_v_e_sent_end; - int __pyx_v_f_sent_start; - int __pyx_v_f_sent_end; - int __pyx_v_e_sent_len; - int __pyx_v_f_sent_len; - CYTHON_UNUSED int __pyx_v_e_word_count; - int __pyx_v_f_x_low; - int __pyx_v_f_x_high; - int __pyx_v_e_x_low; - int __pyx_v_e_x_high; - int __pyx_v_phrase_len; - float __pyx_v_pair_count; - PyObject *__pyx_v_extracts = 0; - PyObject *__pyx_v_phrase_list = 0; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_fphr_arr = 0; - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_fphr = 0; - CYTHON_UNUSED PyObject *__pyx_v_reason_for_failure = 0; - PyObject *__pyx_v_sofar = NULL; - PyObject *__pyx_v_als = NULL; - PyObject *__pyx_v_al = NULL; - long __pyx_v_gap_error; - PyObject *__pyx_v_phrase2 = NULL; - PyObject *__pyx_v_eindexes = NULL; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als1 = NULL; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als2 = NULL; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als3 = NULL; - struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als4 = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - long __pyx_t_12; - Py_ssize_t __pyx_t_13; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1499 - * cdef reason_for_failure - * - * fphr_arr = IntList() # <<<<<<<<<<<<<< - * phrase_len = phrase.n - * extracts = [] - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1499; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1500 - * - * fphr_arr = IntList() - * phrase_len = phrase.n # <<<<<<<<<<<<<< - * extracts = [] - * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) - */ - __pyx_t_2 = __pyx_v_phrase->n; - __pyx_v_phrase_len = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1501 - * 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 = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_extracts = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1502 - * phrase_len = phrase.n - * extracts = [] - * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) # <<<<<<<<<<<<<< - * - * e_sent_start = self.eda.sent_index.arr[matching.sent_id] - */ - __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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1504 - * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) - * - * 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 - */ - __pyx_v_e_sent_start = (__pyx_v_self->eda->sent_index->arr[__pyx_v_matching->sent_id]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1505 - * - * 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 - * f_sent_start = self.fda.sent_index.arr[matching.sent_id] - */ - __pyx_v_e_sent_end = (__pyx_v_self->eda->sent_index->arr[(__pyx_v_matching->sent_id + 1)]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1506 - * 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 # <<<<<<<<<<<<<< - * f_sent_start = self.fda.sent_index.arr[matching.sent_id] - * f_sent_end = self.fda.sent_index.arr[matching.sent_id+1] - */ - __pyx_v_e_sent_len = ((__pyx_v_e_sent_end - __pyx_v_e_sent_start) - 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1507 - * 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] # <<<<<<<<<<<<<< - * f_sent_end = self.fda.sent_index.arr[matching.sent_id+1] - * f_sent_len = f_sent_end - f_sent_start - 1 - */ - __pyx_v_f_sent_start = (__pyx_v_self->fda->sent_index->arr[__pyx_v_matching->sent_id]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1508 - * 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] # <<<<<<<<<<<<<< - * f_sent_len = f_sent_end - f_sent_start - 1 - * - */ - __pyx_v_f_sent_end = (__pyx_v_self->fda->sent_index->arr[(__pyx_v_matching->sent_id + 1)]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1509 - * 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 # <<<<<<<<<<<<<< - * - * self.findexes1.reset() - */ - __pyx_v_f_sent_len = ((__pyx_v_f_sent_end - __pyx_v_f_sent_start) - 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1511 - * 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 = 1511; __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[8]; __pyx_lineno = 1511; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1512 - * - * self.findexes1.reset() - * sofar = 0 # <<<<<<<<<<<<<< - * for i in range(num_chunks): - * for j in range(chunklen[i]): - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_sofar = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1513 - * self.findexes1.reset() - * 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); - */ - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1514 - * 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1515 - * 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 = PyInt_FromLong((((__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 = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1515; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1516 - * 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_1 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); 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_DECREF(__pyx_v_sofar); - __pyx_v_sofar = __pyx_t_1; - __pyx_t_1 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1517 - * 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_7 = (((__pyx_v_i + 1) < __pyx_v_num_chunks) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1518 - * sofar += 1 - * if i+1 < num_chunks: - * self.findexes1.append(phrase[sofar]) # <<<<<<<<<<<<<< - * sofar += 1 - * - */ - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_phrase), __pyx_v_sofar); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_1); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1519 - * 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 = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_sofar); - __pyx_v_sofar = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L7; - } - __pyx_L7:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1522 - * - * - * e_links_low = malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<< - * e_links_high = malloc(e_sent_len*sizeof(int)) - * f_links_low = malloc(f_sent_len*sizeof(int)) - */ - __pyx_v_e_links_low = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1523 - * - * e_links_low = malloc(e_sent_len*sizeof(int)) - * e_links_high = malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<< - * f_links_low = malloc(f_sent_len*sizeof(int)) - * f_links_high = malloc(f_sent_len*sizeof(int)) - */ - __pyx_v_e_links_high = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1524 - * e_links_low = malloc(e_sent_len*sizeof(int)) - * e_links_high = malloc(e_sent_len*sizeof(int)) - * f_links_low = malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<< - * f_links_high = malloc(f_sent_len*sizeof(int)) - * f_gap_low = malloc((num_chunks+1)*sizeof(int)) - */ - __pyx_v_f_links_low = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1525 - * e_links_high = malloc(e_sent_len*sizeof(int)) - * f_links_low = malloc(f_sent_len*sizeof(int)) - * f_links_high = malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<< - * f_gap_low = malloc((num_chunks+1)*sizeof(int)) - * f_gap_high = malloc((num_chunks+1)*sizeof(int)) - */ - __pyx_v_f_links_high = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1526 - * f_links_low = malloc(f_sent_len*sizeof(int)) - * f_links_high = malloc(f_sent_len*sizeof(int)) - * f_gap_low = malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< - * f_gap_high = malloc((num_chunks+1)*sizeof(int)) - * e_gap_low = malloc((num_chunks+1)*sizeof(int)) - */ - __pyx_v_f_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1527 - * f_links_high = malloc(f_sent_len*sizeof(int)) - * f_gap_low = malloc((num_chunks+1)*sizeof(int)) - * f_gap_high = malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< - * e_gap_low = malloc((num_chunks+1)*sizeof(int)) - * e_gap_high = malloc((num_chunks+1)*sizeof(int)) - */ - __pyx_v_f_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1528 - * f_gap_low = malloc((num_chunks+1)*sizeof(int)) - * f_gap_high = malloc((num_chunks+1)*sizeof(int)) - * e_gap_low = malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< - * e_gap_high = malloc((num_chunks+1)*sizeof(int)) - * memset(f_gap_low, 0, (num_chunks+1)*sizeof(int)) - */ - __pyx_v_e_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1529 - * f_gap_high = malloc((num_chunks+1)*sizeof(int)) - * e_gap_low = malloc((num_chunks+1)*sizeof(int)) - * e_gap_high = 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)) - */ - __pyx_v_e_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1530 - * e_gap_low = malloc((num_chunks+1)*sizeof(int)) - * e_gap_high = 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)) - * memset(e_gap_low, 0, (num_chunks+1)*sizeof(int)) - */ - memset(__pyx_v_f_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1531 - * e_gap_high = 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)) # <<<<<<<<<<<<<< - * memset(e_gap_low, 0, (num_chunks+1)*sizeof(int)) - * memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) - */ - memset(__pyx_v_f_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1532 - * 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)) # <<<<<<<<<<<<<< - * memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) - * - */ - memset(__pyx_v_e_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1533 - * 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)) # <<<<<<<<<<<<<< - * - * reason_for_failure = "" - */ - memset(__pyx_v_e_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1535 - * memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) - * - * reason_for_failure = "" # <<<<<<<<<<<<<< - * - * for i from 0 <= i < e_sent_len: - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_47)); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_47); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1537 - * reason_for_failure = "" - * - * for i from 0 <= i < e_sent_len: # <<<<<<<<<<<<<< - * e_links_low[i] = -1 - * e_links_high[i] = -1 - */ - __pyx_t_2 = __pyx_v_e_sent_len; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1538 - * - * for i from 0 <= i < e_sent_len: - * e_links_low[i] = -1 # <<<<<<<<<<<<<< - * e_links_high[i] = -1 - * for i from 0 <= i < f_sent_len: - */ - (__pyx_v_e_links_low[__pyx_v_i]) = -1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1539 - * for i from 0 <= i < e_sent_len: - * e_links_low[i] = -1 - * e_links_high[i] = -1 # <<<<<<<<<<<<<< - * for i from 0 <= i < f_sent_len: - * f_links_low[i] = -1 - */ - (__pyx_v_e_links_high[__pyx_v_i]) = -1; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1540 - * e_links_low[i] = -1 - * e_links_high[i] = -1 - * for i from 0 <= i < f_sent_len: # <<<<<<<<<<<<<< - * f_links_low[i] = -1 - * f_links_high[i] = -1 - */ - __pyx_t_2 = __pyx_v_f_sent_len; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1541 - * e_links_high[i] = -1 - * for i from 0 <= i < f_sent_len: - * f_links_low[i] = -1 # <<<<<<<<<<<<<< - * f_links_high[i] = -1 - * - */ - (__pyx_v_f_links_low[__pyx_v_i]) = -1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1542 - * for i from 0 <= i < f_sent_len: - * f_links_low[i] = -1 - * f_links_high[i] = -1 # <<<<<<<<<<<<<< - * - * # this is really inefficient -- might be good to - */ - (__pyx_v_f_links_high[__pyx_v_i]) = -1; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1548 - * # links that we care about (but then how to look up - * # when we want to check something on the e side?) - * i = 0 # <<<<<<<<<<<<<< - * while i < num_links*2: - * f_i = sent_links[i] - */ - __pyx_v_i = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1549 - * # when we want to check something on the e side?) - * i = 0 - * while i < num_links*2: # <<<<<<<<<<<<<< - * f_i = sent_links[i] - * e_i = sent_links[i+1] - */ - while (1) { - __pyx_t_7 = ((__pyx_v_i < (__pyx_v_num_links * 2)) != 0); - if (!__pyx_t_7) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1550 - * i = 0 - * while i < num_links*2: - * 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: - */ - __pyx_v_f_i = (__pyx_v_sent_links[__pyx_v_i]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1551 - * while i < num_links*2: - * 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 - */ - __pyx_v_e_i = (__pyx_v_sent_links[(__pyx_v_i + 1)]); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1552 - * 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_7 = (((__pyx_v_f_links_low[__pyx_v_f_i]) == -1) != 0); - if (!__pyx_t_7) { - __pyx_t_8 = (((__pyx_v_f_links_low[__pyx_v_f_i]) > __pyx_v_e_i) != 0); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1553 - * 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: - * f_links_high[f_i] = e_i + 1 - */ - (__pyx_v_f_links_low[__pyx_v_f_i]) = __pyx_v_e_i; - goto __pyx_L14; - } - __pyx_L14:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1554 - * 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: # <<<<<<<<<<<<<< - * f_links_high[f_i] = e_i + 1 - * if e_links_low[e_i] == -1 or e_links_low[e_i] > f_i: - */ - __pyx_t_9 = (((__pyx_v_f_links_high[__pyx_v_f_i]) == -1) != 0); - if (!__pyx_t_9) { - __pyx_t_7 = (((__pyx_v_f_links_high[__pyx_v_f_i]) < (__pyx_v_e_i + 1)) != 0); - __pyx_t_8 = __pyx_t_7; - } else { - __pyx_t_8 = __pyx_t_9; - } - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1555 - * 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 # <<<<<<<<<<<<<< - * if e_links_low[e_i] == -1 or e_links_low[e_i] > f_i: - * e_links_low[e_i] = f_i - */ - (__pyx_v_f_links_high[__pyx_v_f_i]) = (__pyx_v_e_i + 1); - goto __pyx_L15; - } - __pyx_L15:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1556 - * 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_8 = (((__pyx_v_e_links_low[__pyx_v_e_i]) == -1) != 0); - if (!__pyx_t_8) { - __pyx_t_9 = (((__pyx_v_e_links_low[__pyx_v_e_i]) > __pyx_v_f_i) != 0); - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_8; - } - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1557 - * 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: - * e_links_high[e_i] = f_i + 1 - */ - (__pyx_v_e_links_low[__pyx_v_e_i]) = __pyx_v_f_i; - goto __pyx_L16; - } - __pyx_L16:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1558 - * 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_7 = (((__pyx_v_e_links_high[__pyx_v_e_i]) == -1) != 0); - if (!__pyx_t_7) { - __pyx_t_8 = (((__pyx_v_e_links_high[__pyx_v_e_i]) < (__pyx_v_f_i + 1)) != 0); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_7; - } - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1559 - * 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_v_e_links_high[__pyx_v_e_i]) = (__pyx_v_f_i + 1); - goto __pyx_L17; - } - __pyx_L17:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1560 - * 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 # <<<<<<<<<<<<<< - * - * als = [] - */ - __pyx_v_i = (__pyx_v_i + 2); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1562 - * 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 = 1562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_als = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1563 - * - * 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) - */ - __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1564 - * 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 = PyInt_FromLong(((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyInt_FromLong((__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 = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __Pyx_XDECREF(((PyObject *)__pyx_v_al)); - __pyx_v_al = ((PyObject*)__pyx_t_10); - __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1565 - * 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_11 = __Pyx_PyList_Append(__pyx_v_als, ((PyObject *)__pyx_v_al)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1567 - * als.append(al) - * # check all source-side alignment constraints - * met_constraints = 1 # <<<<<<<<<<<<<< - * if self.require_aligned_terminal: - * num_aligned_chunks = 0 - */ - __pyx_v_met_constraints = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1568 - * # 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_9 = (__pyx_v_self->require_aligned_terminal != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1569 - * met_constraints = 1 - * if self.require_aligned_terminal: - * num_aligned_chunks = 0 # <<<<<<<<<<<<<< - * for i from 0 <= i < num_chunks: - * for j from 0 <= j < chunklen[i]: - */ - __pyx_v_num_aligned_chunks = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1570 - * if self.require_aligned_terminal: - * 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: - */ - __pyx_t_2 = __pyx_v_num_chunks; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1571 - * 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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1572 - * 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_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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1573 - * 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 - * if num_aligned_chunks == 0: - */ - __pyx_v_num_aligned_chunks = (__pyx_v_num_aligned_chunks + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1574 - * 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_L25; - } - __pyx_L25:; - } - __pyx_L24_break:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1575 - * num_aligned_chunks = num_aligned_chunks + 1 - * break - * if num_aligned_chunks == 0: # <<<<<<<<<<<<<< - * reason_for_failure = "No aligned terminals" - * met_constraints = 0 - */ - __pyx_t_9 = ((__pyx_v_num_aligned_chunks == 0) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1576 - * break - * if num_aligned_chunks == 0: - * reason_for_failure = "No aligned terminals" # <<<<<<<<<<<<<< - * met_constraints = 0 - * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_133)); - __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_133); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1577 - * if num_aligned_chunks == 0: - * 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" - */ - __pyx_v_met_constraints = 0; - goto __pyx_L26; - } - __pyx_L26:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1578 - * 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_9 = ((__pyx_v_num_aligned_chunks < __pyx_v_num_chunks) != 0); - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = (__pyx_v_self->require_aligned_chunks != 0); - } - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1579 - * met_constraints = 0 - * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: - * reason_for_failure = "Unaligned chunk" # <<<<<<<<<<<<<< - * met_constraints = 0 - * - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_134)); - __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_134); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1580 - * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: - * reason_for_failure = "Unaligned chunk" - * met_constraints = 0 # <<<<<<<<<<<<<< - * - * if met_constraints and self.tight_phrases: - */ - __pyx_v_met_constraints = 0; - goto __pyx_L27; - } - __pyx_L27:; - goto __pyx_L20; - } - __pyx_L20:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1582 - * 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_7 = __pyx_v_self->tight_phrases; - __pyx_t_9 = __pyx_t_7; - } else { - __pyx_t_9 = (__pyx_v_met_constraints != 0); - } - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1584 - * 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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1585 - * # 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_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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1586 - * 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 - * break - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_135)); - __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_135); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1587 - * 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 # <<<<<<<<<<<<<< - * break - * if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1: - */ - __pyx_v_met_constraints = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1588 - * 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_L31; - } - __pyx_L31:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1589 - * 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_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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1590 - * 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 - * break - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_135)); - __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_135); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1591 - * 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 # <<<<<<<<<<<<<< - * break - * - */ - __pyx_v_met_constraints = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1592 - * 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_L32; - } - __pyx_L32:; - } - __pyx_L30_break:; - goto __pyx_L28; - } - __pyx_L28:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1594 - * break - * - * 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: - */ - __pyx_v_f_low = ((__pyx_v_matching->arr[__pyx_v_matching->start]) - __pyx_v_f_sent_start); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1595 - * - * 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: - * - */ - __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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1596 - * 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_9 = (__pyx_v_met_constraints != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1598 - * 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_10 = PyInt_FromLong(__pyx_v_f_high); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1602 - * 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_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_10, __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_10); __pyx_t_10 = 0; - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1603 - * self.train_min_gap_size, 0, - * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): - * gap_error = 0 # <<<<<<<<<<<<<< - * num_gaps = 0 - * - */ - __pyx_v_gap_error = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1604 - * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): - * gap_error = 0 - * num_gaps = 0 # <<<<<<<<<<<<<< - * - * if f_back_low < f_low: - */ - __pyx_v_num_gaps = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1606 - * num_gaps = 0 - * - * if f_back_low < f_low: # <<<<<<<<<<<<<< - * f_gap_low[0] = f_back_low - * f_gap_high[0] = f_low - */ - __pyx_t_9 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1607 - * - * if f_back_low < f_low: - * f_gap_low[0] = f_back_low # <<<<<<<<<<<<<< - * f_gap_high[0] = f_low - * num_gaps = 1 - */ - (__pyx_v_f_gap_low[0]) = __pyx_v_f_back_low; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1608 - * if f_back_low < f_low: - * f_gap_low[0] = f_back_low - * f_gap_high[0] = f_low # <<<<<<<<<<<<<< - * num_gaps = 1 - * gap_start = 0 - */ - (__pyx_v_f_gap_high[0]) = __pyx_v_f_low; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1609 - * f_gap_low[0] = f_back_low - * f_gap_high[0] = f_low - * num_gaps = 1 # <<<<<<<<<<<<<< - * gap_start = 0 - * phrase_len = phrase_len+1 - */ - __pyx_v_num_gaps = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1610 - * f_gap_high[0] = f_low - * num_gaps = 1 - * gap_start = 0 # <<<<<<<<<<<<<< - * phrase_len = phrase_len+1 - * if phrase_len > self.max_length: - */ - __pyx_v_gap_start = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1611 - * num_gaps = 1 - * gap_start = 0 - * phrase_len = phrase_len+1 # <<<<<<<<<<<<<< - * if phrase_len > self.max_length: - * gap_error = 1 - */ - __pyx_v_phrase_len = (__pyx_v_phrase_len + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1612 - * gap_start = 0 - * phrase_len = phrase_len+1 - * if phrase_len > self.max_length: # <<<<<<<<<<<<<< - * gap_error = 1 - * if self.tight_phrases: - */ - __pyx_t_9 = ((__pyx_v_phrase_len > __pyx_v_self->max_length) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1613 - * phrase_len = phrase_len+1 - * 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: - */ - __pyx_v_gap_error = 1; - goto __pyx_L36; - } - __pyx_L36:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1614 - * 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_9 = (__pyx_v_self->tight_phrases != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1615 - * 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 - * reason_for_failure = "Inside edges of preceding subphrase are not tight" - */ - __pyx_t_9 = (((__pyx_v_f_links_low[__pyx_v_f_back_low]) == -1) != 0); - if (!__pyx_t_9) { - __pyx_t_7 = (((__pyx_v_f_links_low[(__pyx_v_f_low - 1)]) == -1) != 0); - __pyx_t_8 = __pyx_t_7; - } else { - __pyx_t_8 = __pyx_t_9; - } - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1616 - * if self.tight_phrases: - * 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" - * else: - */ - __pyx_v_gap_error = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1617 - * 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" # <<<<<<<<<<<<<< - * else: - * gap_start = 1 - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_136)); - __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_136); - goto __pyx_L38; - } - __pyx_L38:; - goto __pyx_L37; - } - __pyx_L37:; - goto __pyx_L35; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1619 - * reason_for_failure = "Inside edges of preceding subphrase are not tight" - * 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 - */ - __pyx_v_gap_start = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1620 - * 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_8 = (((__pyx_v_f_links_low[__pyx_v_f_low]) == -1) != 0); - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = (__pyx_v_self->tight_phrases != 0); - } - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1623 - * # 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 # <<<<<<<<<<<<<< - * - * for i from 0 <= i < matching.size - 1: - */ - __pyx_v_met_constraints = 0; - goto __pyx_L39; - } - __pyx_L39:; - } - __pyx_L35:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1625 - * 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++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1626 - * - * 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 - * num_gaps = num_gaps + 1 - */ - (__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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1627 - * 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 # <<<<<<<<<<<<<< - * num_gaps = num_gaps + 1 - * - */ - (__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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1628 - * 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 # <<<<<<<<<<<<<< - * - * if f_high < f_back_high: - */ - __pyx_v_num_gaps = (__pyx_v_num_gaps + 1); - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1630 - * 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_9 = ((__pyx_v_f_high < __pyx_v_f_back_high) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1631 - * - * 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 - * num_gaps = num_gaps + 1 - */ - (__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_num_gaps)]) = __pyx_v_f_high; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1632 - * 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 # <<<<<<<<<<<<<< - * num_gaps = num_gaps + 1 - * phrase_len = phrase_len+1 - */ - (__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_num_gaps)]) = __pyx_v_f_back_high; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1633 - * f_gap_low[gap_start+num_gaps] = f_high - * f_gap_high[gap_start+num_gaps] = f_back_high - * num_gaps = num_gaps + 1 # <<<<<<<<<<<<<< - * phrase_len = phrase_len+1 - * if phrase_len > self.max_length: - */ - __pyx_v_num_gaps = (__pyx_v_num_gaps + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1634 - * f_gap_high[gap_start+num_gaps] = f_back_high - * num_gaps = num_gaps + 1 - * phrase_len = phrase_len+1 # <<<<<<<<<<<<<< - * if phrase_len > self.max_length: - * gap_error = 1 - */ - __pyx_v_phrase_len = (__pyx_v_phrase_len + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1635 - * 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_9 = ((__pyx_v_phrase_len > __pyx_v_self->max_length) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1636 - * phrase_len = phrase_len+1 - * 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: - */ - __pyx_v_gap_error = 1; - goto __pyx_L43; - } - __pyx_L43:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1637 - * 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_9 = (__pyx_v_self->tight_phrases != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1638 - * 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 - * reason_for_failure = "Inside edges of following subphrase are not tight" - */ - __pyx_t_9 = (((__pyx_v_f_links_low[(__pyx_v_f_back_high - 1)]) == -1) != 0); - if (!__pyx_t_9) { - __pyx_t_8 = (((__pyx_v_f_links_low[__pyx_v_f_high]) == -1) != 0); - __pyx_t_7 = __pyx_t_8; - } else { - __pyx_t_7 = __pyx_t_9; - } - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1639 - * if self.tight_phrases: - * 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" - * else: - */ - __pyx_v_gap_error = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1640 - * 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" # <<<<<<<<<<<<<< - * else: - * if self.tight_phrases and f_links_low[f_high-1] == -1: - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_137)); - __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_137); - goto __pyx_L45; - } - __pyx_L45:; - goto __pyx_L44; - } - __pyx_L44:; - goto __pyx_L42; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1642 - * 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_7 = (((__pyx_v_f_links_low[(__pyx_v_f_high - 1)]) == -1) != 0); - __pyx_t_9 = __pyx_t_7; - } else { - __pyx_t_9 = (__pyx_v_self->tight_phrases != 0); - } - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1643 - * else: - * if self.tight_phrases and f_links_low[f_high-1] == -1: - * met_constraints = 0 # <<<<<<<<<<<<<< - * - * if gap_error == 0: - */ - __pyx_v_met_constraints = 0; - goto __pyx_L46; - } - __pyx_L46:; - } - __pyx_L42:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1645 - * 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_9 = ((__pyx_v_gap_error == 0) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1646 - * - * if gap_error == 0: - * 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], - */ - __pyx_v_e_word_count = (__pyx_v_e_high - __pyx_v_e_low); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1647 - * if gap_error == 0: - * 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, - */ - __pyx_t_2 = __pyx_v_num_gaps; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1648 - * 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_10 = PyInt_FromLong((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1653 - * f_gap_low+gap_start+i, f_gap_high+gap_start+i, - * 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 - */ - __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_10, __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_10); __pyx_t_10 = 0; - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1655 - * 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]) - * break - */ - __pyx_v_gap_error = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1656 - * 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_10 = PyInt_FromLong((__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = PyInt_FromLong((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1656; __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 = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_10 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_138), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1657 - * 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_L50; - } - __pyx_L50:; - } - __pyx_L49_break:; - goto __pyx_L47; - } - __pyx_L47:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1659 - * break - * - * if gap_error == 0: # <<<<<<<<<<<<<< - * i = 1 - * self.findexes.reset() - */ - __pyx_t_9 = ((__pyx_v_gap_error == 0) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1660 - * - * if gap_error == 0: - * i = 1 # <<<<<<<<<<<<<< - * self.findexes.reset() - * if f_back_low < f_low: - */ - __pyx_v_i = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1661 - * 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 = 1661; __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[8]; __pyx_lineno = 1661; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1662 - * i = 1 - * self.findexes.reset() - * if f_back_low < f_low: # <<<<<<<<<<<<<< - * fphr_arr._append(sym_setindex(self.category, i)) - * i = i+1 - */ - __pyx_t_9 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1663 - * self.findexes.reset() - * if f_back_low < f_low: - * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< - * i = i+1 - * self.findexes.append(sym_setindex(self.category, i)) - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1664 - * if f_back_low < f_low: - * fphr_arr._append(sym_setindex(self.category, i)) - * i = i+1 # <<<<<<<<<<<<<< - * self.findexes.append(sym_setindex(self.category, i)) - * self.findexes.extend(self.findexes1) - */ - __pyx_v_i = (__pyx_v_i + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1665 - * 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 = PyInt_FromLong(__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 = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1665; __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; - goto __pyx_L52; - } - __pyx_L52:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1666 - * 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_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 = 1666; __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 = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->findexes1)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); - __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1667 - * 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]): - * fphr_arr._append(sym_setindex(self.category, i)) - */ - __pyx_t_2 = __pyx_v_phrase->n; - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1668 - * 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_9 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1669 - * for j from 0 <= j < phrase.n: - * if sym_isvar(phrase.syms[j]): - * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< - * i = i + 1 - * else: - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1670 - * if sym_isvar(phrase.syms[j]): - * fphr_arr._append(sym_setindex(self.category, i)) - * i = i + 1 # <<<<<<<<<<<<<< - * else: - * fphr_arr._append(phrase.syms[j]) - */ - __pyx_v_i = (__pyx_v_i + 1); - goto __pyx_L55; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1672 - * i = i + 1 - * else: - * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< - * if f_back_high > f_high: - * fphr_arr._append(sym_setindex(self.category, i)) - */ - ((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:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1673 - * 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_9 = ((__pyx_v_f_back_high > __pyx_v_f_high) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1674 - * 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)) - * - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1675 - * 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_10 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L56; - } - __pyx_L56:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1677 - * 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((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_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_10); - __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1678 - * - * 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_9 = (__pyx_v_met_constraints != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1681 - * 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) # <<<<<<<<<<<<<< - * if len(phrase_list) > 0: - * pair_count = 1.0 / len(phrase_list) - */ - __pyx_t_10 = ((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_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_v_phrase_list = __pyx_t_10; - __pyx_t_10 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1682 - * 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 = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = ((__pyx_t_13 > 0) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1683 - * 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 = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(__pyx_t_13 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_pair_count = (1.0 / __pyx_t_13); - goto __pyx_L58; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1685 - * pair_count = 1.0 / len(phrase_list) - * 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: - */ - __pyx_v_pair_count = 0.0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1686 - * 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_10 = PyInt_FromLong(__pyx_v_f_back_low); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyInt_FromLong(__pyx_v_e_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = PyInt_FromLong(__pyx_v_e_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __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 = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_14); - __Pyx_GIVEREF(__pyx_t_14); - __pyx_t_10 = 0; - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_14 = 0; - __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_139), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_14)); - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_t_14); - __pyx_t_14 = 0; - } - __pyx_L58:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1687 - * 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; - } 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 = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext; - } - 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 = 1687; __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 = 1687; __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 = 1687; __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 = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_15 = __pyx_t_16(__pyx_t_14); - if (unlikely(!__pyx_t_15)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_15); - } - 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_1 = PyList_GET_ITEM(sequence, 0); - __pyx_t_3 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __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 = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_1 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L61_unpacking_failed; - __Pyx_GOTREF(__pyx_t_1); - index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L61_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_17 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L62_unpacking_done; - __pyx_L61_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_17 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L62_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_phrase2); - __pyx_v_phrase2 = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_v_eindexes); - __pyx_v_eindexes = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1688 - * 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 = 1688; __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_15), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(((PyObject *)__pyx_v_als1)); - __pyx_v_als1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1689 - * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PyTuple_New(1); 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); - __Pyx_INCREF(((PyObject *)__pyx_v_als1)); - PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_als1)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_als1)); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__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 = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); - PyTuple_SET_ITEM(__pyx_t_15, 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); - __Pyx_GIVEREF(__pyx_v_phrase2); - PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - goto __pyx_L57; - } - __pyx_L57:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1690 - * 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 - * f_back_high - f_back_low + self.train_min_gap_size <= self.train_max_initial_size): - */ - __pyx_t_9 = ((__pyx_v_num_gaps < __pyx_v_self->max_nonterminals) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1691 - * 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_7 = ((__pyx_v_phrase_len < __pyx_v_self->max_length) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1692 - * 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_8 = ((((__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_8; - } else { - __pyx_t_18 = __pyx_t_7; - } - __pyx_t_7 = __pyx_t_18; - } else { - __pyx_t_7 = __pyx_t_9; - } - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1693 - * 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_7 = ((__pyx_v_f_back_low == __pyx_v_f_low) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1694 - * 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_9 = ((__pyx_v_f_low >= __pyx_v_self->train_min_gap_size) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1695 - * 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_8 = (((__pyx_v_f_links_low[(__pyx_v_f_low - 1)]) != -1) != 0); - if (__pyx_t_8) { - __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_8; - } - __pyx_t_8 = __pyx_t_20; - } 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_t_7; - } - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1696 - * 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 - * if self.tight_phrases: - */ - __pyx_v_f_x_low = (__pyx_v_f_low - __pyx_v_self->train_min_gap_size); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1697 - * ((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 # <<<<<<<<<<<<<< - * if self.tight_phrases: - * while f_x_low >= 0 and f_links_low[f_x_low] == -1: - */ - __pyx_v_met_constraints = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1698 - * 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_9 = (__pyx_v_self->tight_phrases != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1699 - * 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 - * if f_x_low < 0 or f_back_high - f_x_low > self.train_max_initial_size: - */ - while (1) { - __pyx_t_9 = ((__pyx_v_f_x_low >= 0) != 0); - if (__pyx_t_9) { - __pyx_t_7 = (((__pyx_v_f_links_low[__pyx_v_f_x_low]) == -1) != 0); - __pyx_t_18 = __pyx_t_7; - } else { - __pyx_t_18 = __pyx_t_9; - } - if (!__pyx_t_18) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1700 - * if self.tight_phrases: - * 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_v_f_x_low = (__pyx_v_f_x_low - 1); - } - goto __pyx_L65; - } - __pyx_L65:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1701 - * 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_9 = (((__pyx_v_f_back_high - __pyx_v_f_x_low) > __pyx_v_self->train_max_initial_size) != 0); - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_18; - } - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1702 - * 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 # <<<<<<<<<<<<<< - * - * if (met_constraints and - */ - __pyx_v_met_constraints = 0; - goto __pyx_L68; - } - __pyx_L68:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1704 - * 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)) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1705 - * - * 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 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1709 - * 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, 1, 0, 1, 0) == 1) and - * ((not self.tight_phrases) or f_links_low[f_x_low] != -1) and - */ - __pyx_t_7 = (((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_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1711 - * 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_9 = ((__pyx_v_f_links_low[__pyx_v_f_x_low]) != -1); - __pyx_t_8 = __pyx_t_9; - } else { - __pyx_t_8 = __pyx_t_18; - } - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1712 - * 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 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1716 - * -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_8; - } - __pyx_t_8 = __pyx_t_18; - } else { - __pyx_t_8 = __pyx_t_7; - } - __pyx_t_7 = __pyx_t_8; - } else { - __pyx_t_7 = (__pyx_v_met_constraints != 0); - } - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1718 - * self.train_max_initial_size, self.train_max_initial_size, - * 0, 0, 0, 0, 0, 0, 0)): - * fphr_arr._clear() # <<<<<<<<<<<<<< - * i = 1 - * self.findexes.reset() - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1719 - * 0, 0, 0, 0, 0, 0, 0)): - * fphr_arr._clear() - * i = 1 # <<<<<<<<<<<<<< - * self.findexes.reset() - * self.findexes.append(sym_setindex(self.category, i)) - */ - __pyx_v_i = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1720 - * 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 = 1720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1721 - * 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_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1721; __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_14); __pyx_t_14 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1722 - * self.findexes.reset() - * self.findexes.append(sym_setindex(self.category, i)) - * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< - * i = i+1 - * self.findexes.extend(self.findexes1) - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1723 - * self.findexes.append(sym_setindex(self.category, i)) - * fphr_arr._append(sym_setindex(self.category, i)) - * i = i+1 # <<<<<<<<<<<<<< - * self.findexes.extend(self.findexes1) - * for j from 0 <= j < phrase.n: - */ - __pyx_v_i = (__pyx_v_i + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1724 - * 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_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 = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1724; __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_15 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_1), NULL); 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_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1725 - * i = i+1 - * 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)) - */ - __pyx_t_2 = __pyx_v_phrase->n; - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1726 - * 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_7 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1727 - * for j from 0 <= j < phrase.n: - * if sym_isvar(phrase.syms[j]): - * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< - * i = i + 1 - * else: - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1728 - * if sym_isvar(phrase.syms[j]): - * fphr_arr._append(sym_setindex(self.category, i)) - * i = i + 1 # <<<<<<<<<<<<<< - * else: - * fphr_arr._append(phrase.syms[j]) - */ - __pyx_v_i = (__pyx_v_i + 1); - goto __pyx_L72; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1730 - * i = i + 1 - * else: - * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< - * if f_back_high > f_high: - * fphr_arr._append(sym_setindex(self.category, i)) - */ - ((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:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1731 - * 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_7 = ((__pyx_v_f_back_high > __pyx_v_f_high) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1732 - * 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)) - * fphr = Phrase(fphr_arr) - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1733 - * 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_15 = PyInt_FromLong(__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 = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1733; __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_1); __pyx_t_1 = 0; - goto __pyx_L73; - } - __pyx_L73:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1734 - * 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fphr_arr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); - __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_fphr)); - __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_15); - __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1737 - * 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) # <<<<<<<<<<<<<< - * if len(phrase_list) > 0: - * pair_count = 1.0 / len(phrase_list) - */ - __pyx_t_15 = ((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_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_v_phrase_list); - __pyx_v_phrase_list = __pyx_t_15; - __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1738 - * 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 = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((__pyx_t_13 > 0) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1739 - * 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 = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(__pyx_t_13 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_pair_count = (1.0 / __pyx_t_13); - goto __pyx_L74; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1741 - * pair_count = 1.0 / len(phrase_list) - * else: - * pair_count = 0 # <<<<<<<<<<<<<< - * for phrase2, eindexes in phrase_list: - * als2 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) - */ - __pyx_v_pair_count = 0.0; - } - __pyx_L74:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1742 - * 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)) { - __pyx_t_15 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_15); __pyx_t_13 = 0; - __pyx_t_16 = NULL; - } else { - __pyx_t_13 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext; - } - for (;;) { - if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_15)) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_15)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_15)) { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_15)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_1 = __pyx_t_16(__pyx_t_15); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __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_3 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_14 = PyList_GET_ITEM(sequence, 0); - __pyx_t_3 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_14 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_14)) goto __pyx_L77_unpacking_failed; - __Pyx_GOTREF(__pyx_t_14); - index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L77_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_17 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L78_unpacking_done; - __pyx_L77_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_17 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L78_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_phrase2); - __pyx_v_phrase2 = __pyx_t_14; - __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_v_eindexes); - __pyx_v_eindexes = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1743 - * 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_1 = ((PyObject *)__pyx_v_self->findexes); - __Pyx_INCREF(__pyx_t_1); - 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 = 1743; __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_1), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(((PyObject *)__pyx_v_als2)); - __pyx_v_als2 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1744 - * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __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 = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_als2)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_als2)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_als2)); - __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fphr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr)); - __Pyx_INCREF(__pyx_v_phrase2); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_phrase2); - __Pyx_GIVEREF(__pyx_v_phrase2); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_14); - __Pyx_GIVEREF(__pyx_t_14); - __pyx_t_3 = 0; - __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - goto __pyx_L69; - } - __pyx_L69:; - goto __pyx_L64; - } - __pyx_L64:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1746 - * 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_7 = ((__pyx_v_f_back_high == __pyx_v_f_high) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1747 - * - * 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_8 = (((__pyx_v_f_sent_len - __pyx_v_f_high) >= __pyx_v_self->train_min_gap_size) != 0); - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1748 - * 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_9 = (((__pyx_v_f_links_low[__pyx_v_f_high]) != -1) != 0); - if (__pyx_t_9) { - __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_9; - } - __pyx_t_9 = __pyx_t_19; - } else { - __pyx_t_9 = __pyx_t_18; - } - __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_7; - } - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1749 - * 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 - * if self.tight_phrases: - */ - __pyx_v_f_x_high = (__pyx_v_f_high + __pyx_v_self->train_min_gap_size); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1750 - * ((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 # <<<<<<<<<<<<<< - * if self.tight_phrases: - * while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: - */ - __pyx_v_met_constraints = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1751 - * f_x_high = f_high+self.train_min_gap_size - * met_constraints = 1 - * 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_8 = (__pyx_v_self->tight_phrases != 0); - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1752 - * met_constraints = 1 - * 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 - * if f_x_high > f_sent_len or f_x_high - f_back_low > self.train_max_initial_size: - */ - while (1) { - __pyx_t_8 = ((__pyx_v_f_x_high <= __pyx_v_f_sent_len) != 0); - if (__pyx_t_8) { - __pyx_t_7 = (((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) == -1) != 0); - __pyx_t_18 = __pyx_t_7; - } else { - __pyx_t_18 = __pyx_t_8; - } - if (!__pyx_t_18) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1753 - * 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 # <<<<<<<<<<<<<< - * if f_x_high > f_sent_len or f_x_high - f_back_low > self.train_max_initial_size: - * met_constraints = 0 - */ - __pyx_v_f_x_high = (__pyx_v_f_x_high + 1); - } - goto __pyx_L80; - } - __pyx_L80:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1754 - * 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_8 = (((__pyx_v_f_x_high - __pyx_v_f_back_low) > __pyx_v_self->train_max_initial_size) != 0); - __pyx_t_7 = __pyx_t_8; - } else { - __pyx_t_7 = __pyx_t_18; - } - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1755 - * 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 # <<<<<<<<<<<<<< - * - * if (met_constraints and - */ - __pyx_v_met_constraints = 0; - goto __pyx_L83; - } - __pyx_L83:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1757 - * 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)) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1758 - * - * 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_15 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1762 - * 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_15, __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_15); __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1764 - * 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_7 = (!(__pyx_v_self->tight_phrases != 0)); - if (!__pyx_t_7) { - __pyx_t_18 = ((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) != -1); - __pyx_t_8 = __pyx_t_18; - } else { - __pyx_t_8 = __pyx_t_7; - } - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1765 - * 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_14 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1770 - * 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_7 = (((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; - } else { - __pyx_t_7 = __pyx_t_8; - } - __pyx_t_8 = __pyx_t_7; - } else { - __pyx_t_8 = (((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_15, __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_15); __pyx_t_15 = 0; - } - __pyx_t_7 = __pyx_t_8; - } else { - __pyx_t_7 = (__pyx_v_met_constraints != 0); - } - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1772 - * self.train_max_initial_size, self.train_max_initial_size, - * 0, 0, 0, 0, 0, 0, 0)): - * fphr_arr._clear() # <<<<<<<<<<<<<< - * i = 1 - * self.findexes.reset() - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1773 - * 0, 0, 0, 0, 0, 0, 0)): - * fphr_arr._clear() - * i = 1 # <<<<<<<<<<<<<< - * self.findexes.reset() - * if f_back_low < f_low: - */ - __pyx_v_i = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1774 - * fphr_arr._clear() - * i = 1 - * self.findexes.reset() # <<<<<<<<<<<<<< - * if f_back_low < f_low: - * fphr_arr._append(sym_setindex(self.category, i)) - */ - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_14 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1775 - * i = 1 - * self.findexes.reset() - * if f_back_low < f_low: # <<<<<<<<<<<<<< - * fphr_arr._append(sym_setindex(self.category, i)) - * i = i+1 - */ - __pyx_t_7 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1776 - * self.findexes.reset() - * if f_back_low < f_low: - * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< - * i = i+1 - * self.findexes.append(sym_setindex(self.category, i)) - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1777 - * if f_back_low < f_low: - * fphr_arr._append(sym_setindex(self.category, i)) - * i = i+1 # <<<<<<<<<<<<<< - * self.findexes.append(sym_setindex(self.category, i)) - * self.findexes.extend(self.findexes1) - */ - __pyx_v_i = (__pyx_v_i + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1778 - * 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_14 = PyInt_FromLong(__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 = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - goto __pyx_L85; - } - __pyx_L85:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1779 - * 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_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 = 1779; __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 = 1779; __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_1 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1780 - * 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]): - * fphr_arr._append(sym_setindex(self.category, i)) - */ - __pyx_t_2 = __pyx_v_phrase->n; - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1781 - * 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_7 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1782 - * for j from 0 <= j < phrase.n: - * if sym_isvar(phrase.syms[j]): - * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< - * i = i + 1 - * else: - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1783 - * if sym_isvar(phrase.syms[j]): - * fphr_arr._append(sym_setindex(self.category, i)) - * i = i + 1 # <<<<<<<<<<<<<< - * else: - * fphr_arr._append(phrase.syms[j]) - */ - __pyx_v_i = (__pyx_v_i + 1); - goto __pyx_L88; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1785 - * i = i + 1 - * else: - * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< - * fphr_arr._append(sym_setindex(self.category, i)) - * self.findexes.append(sym_setindex(self.category, i)) - */ - ((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:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1786 - * else: - * 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) - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1787 - * 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_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1787; __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_14); __pyx_t_14 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1788 - * 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_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_INCREF(((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_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_fphr)); - __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1791 - * 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) # <<<<<<<<<<<<<< - * if len(phrase_list) > 0: - * pair_count = 1.0 / len(phrase_list) - */ - __pyx_t_1 = ((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_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_phrase_list); - __pyx_v_phrase_list = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1792 - * 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 = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((__pyx_t_13 > 0) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1793 - * 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 = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(__pyx_t_13 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_pair_count = (1.0 / __pyx_t_13); - goto __pyx_L89; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1795 - * pair_count = 1.0 / len(phrase_list) - * else: - * pair_count = 0 # <<<<<<<<<<<<<< - * for phrase2, eindexes in phrase_list: - * als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) - */ - __pyx_v_pair_count = 0.0; - } - __pyx_L89:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1796 - * 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_1 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0; - __pyx_t_16 = NULL; - } else { - __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - for (;;) { - if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_14 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_14 = __pyx_t_16(__pyx_t_1); - if (unlikely(!__pyx_t_14)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __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_3 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_15 = PyList_GET_ITEM(sequence, 0); - __pyx_t_3 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_15 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_15)) goto __pyx_L92_unpacking_failed; - __Pyx_GOTREF(__pyx_t_15); - index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L92_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_17 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L93_unpacking_done; - __pyx_L92_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_17 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L93_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_phrase2); - __pyx_v_phrase2 = __pyx_t_15; - __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_v_eindexes); - __pyx_v_eindexes = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1797 - * 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_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 = 1797; __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 = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_XDECREF(((PyObject *)__pyx_v_als3)); - __pyx_v_als3 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1798 - * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __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 = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_INCREF(((PyObject *)__pyx_v_als3)); - PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_als3)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_als3)); - __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(((PyObject *)__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 = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_INCREF(((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_14, 1, __pyx_v_phrase2); - __Pyx_GIVEREF(__pyx_v_phrase2); - PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_15); - __Pyx_GIVEREF(__pyx_t_15); - __pyx_t_3 = 0; - __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L84; - } - __pyx_L84:; - goto __pyx_L79; - } - __pyx_L79:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1799 - * 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_7 = ((__pyx_v_num_gaps < (__pyx_v_self->max_nonterminals - 1)) != 0); - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1800 - * 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_8 = (((__pyx_v_phrase_len + 1) < __pyx_v_self->max_length) != 0); - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1801 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1802 - * 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_9 = ((__pyx_v_f_back_low == __pyx_v_f_low) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1803 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1804 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1805 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1806 - * 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_9; - } - __pyx_t_9 = __pyx_t_19; - } else { - __pyx_t_9 = __pyx_t_18; - } - __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_7; - } - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1808 - * ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_high] != -1))): - * - * met_constraints = 1 # <<<<<<<<<<<<<< - * f_x_low = f_low-self.train_min_gap_size - * if self.tight_phrases: - */ - __pyx_v_met_constraints = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1809 - * - * met_constraints = 1 - * 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: - */ - __pyx_v_f_x_low = (__pyx_v_f_low - __pyx_v_self->train_min_gap_size); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1810 - * met_constraints = 1 - * 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: - * f_x_low = f_x_low - 1 - */ - __pyx_t_8 = (__pyx_v_self->tight_phrases != 0); - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1811 - * 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: # <<<<<<<<<<<<<< - * f_x_low = f_x_low - 1 - * if f_x_low < 0: - */ - while (1) { - __pyx_t_8 = ((__pyx_v_f_x_low >= 0) != 0); - if (__pyx_t_8) { - __pyx_t_7 = (((__pyx_v_f_links_low[__pyx_v_f_x_low]) == -1) != 0); - __pyx_t_18 = __pyx_t_7; - } else { - __pyx_t_18 = __pyx_t_8; - } - if (!__pyx_t_18) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1812 - * if self.tight_phrases: - * 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_v_f_x_low = (__pyx_v_f_x_low - 1); - } - goto __pyx_L95; - } - __pyx_L95:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1813 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1814 - * f_x_low = f_x_low - 1 - * if f_x_low < 0: - * met_constraints = 0 # <<<<<<<<<<<<<< - * - * f_x_high = f_high+self.train_min_gap_size - */ - __pyx_v_met_constraints = 0; - goto __pyx_L98; - } - __pyx_L98:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1816 - * met_constraints = 0 - * - * 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: - */ - __pyx_v_f_x_high = (__pyx_v_f_high + __pyx_v_self->train_min_gap_size); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1817 - * - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1818 - * 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 - * 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_8 = (((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) == -1) != 0); - __pyx_t_7 = __pyx_t_8; - } else { - __pyx_t_7 = __pyx_t_18; - } - if (!__pyx_t_7) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1819 - * 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 # <<<<<<<<<<<<<< - * if f_x_high > f_sent_len or f_x_high - f_x_low > self.train_max_initial_size: - * met_constraints = 0 - */ - __pyx_v_f_x_high = (__pyx_v_f_x_high + 1); - } - goto __pyx_L99; - } - __pyx_L99:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1820 - * 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_7 = ((__pyx_v_f_x_high > __pyx_v_f_sent_len) != 0); - if (!__pyx_t_7) { - __pyx_t_18 = (((__pyx_v_f_x_high - __pyx_v_f_x_low) > __pyx_v_self->train_max_initial_size) != 0); - __pyx_t_8 = __pyx_t_18; - } else { - __pyx_t_8 = __pyx_t_7; - } - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1821 - * 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 # <<<<<<<<<<<<<< - * - * if (met_constraints and - */ - __pyx_v_met_constraints = 0; - goto __pyx_L102; - } - __pyx_L102:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1823 - * 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)) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1824 - * - * 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_1 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1828 - * 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, 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 - */ - __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_1, __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_1); __pyx_t_1 = 0; - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1830 - * 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_7 = (!(__pyx_v_self->tight_phrases != 0)); - if (!__pyx_t_7) { - __pyx_t_18 = ((__pyx_v_f_links_low[__pyx_v_f_x_low]) != -1); - if (__pyx_t_18) { - __pyx_t_9 = ((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) != -1); - __pyx_t_19 = __pyx_t_9; - } else { - __pyx_t_19 = __pyx_t_18; - } - __pyx_t_18 = __pyx_t_19; - } else { - __pyx_t_18 = __pyx_t_7; - } - if (__pyx_t_18) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1831 - * 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_1 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1835 - * -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_7 = (((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_1, __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_1); __pyx_t_1 = 0; - if (__pyx_t_7) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1837 - * 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_1 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1842 - * 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_1, __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_1); __pyx_t_1 = 0; - __pyx_t_9 = __pyx_t_19; - } else { - __pyx_t_9 = __pyx_t_7; - } - __pyx_t_7 = __pyx_t_9; - } else { - __pyx_t_7 = __pyx_t_18; - } - __pyx_t_18 = __pyx_t_7; - } else { - __pyx_t_18 = __pyx_t_8; - } - __pyx_t_8 = __pyx_t_18; - } else { - __pyx_t_8 = (__pyx_v_met_constraints != 0); - } - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1844 - * self.train_max_initial_size, self.train_max_initial_size, - * 0, 0, 0, 0, 0, 0, 0)): - * fphr_arr._clear() # <<<<<<<<<<<<<< - * i = 1 - * self.findexes.reset() - */ - ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1845 - * 0, 0, 0, 0, 0, 0, 0)): - * fphr_arr._clear() - * i = 1 # <<<<<<<<<<<<<< - * self.findexes.reset() - * self.findexes.append(sym_setindex(self.category, i)) - */ - __pyx_v_i = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1846 - * 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_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 = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1847 - * 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 = PyInt_FromLong(__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 = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1847; __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_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1848 - * self.findexes.reset() - * self.findexes.append(sym_setindex(self.category, i)) - * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< - * i = i+1 - * self.findexes.extend(self.findexes1) - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1849 - * self.findexes.append(sym_setindex(self.category, i)) - * fphr_arr._append(sym_setindex(self.category, i)) - * i = i+1 # <<<<<<<<<<<<<< - * self.findexes.extend(self.findexes1) - * for j from 0 <= j < phrase.n: - */ - __pyx_v_i = (__pyx_v_i + 1); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1850 - * 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_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 = 1850; __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 = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); - PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_self->findexes1)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); - __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1851 - * i = i+1 - * 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)) - */ - __pyx_t_2 = __pyx_v_phrase->n; - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1852 - * 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1853 - * for j from 0 <= j < phrase.n: - * if sym_isvar(phrase.syms[j]): - * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< - * i = i + 1 - * else: - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1854 - * if sym_isvar(phrase.syms[j]): - * fphr_arr._append(sym_setindex(self.category, i)) - * i = i + 1 # <<<<<<<<<<<<<< - * else: - * fphr_arr._append(phrase.syms[j]) - */ - __pyx_v_i = (__pyx_v_i + 1); - goto __pyx_L106; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1856 - * i = i + 1 - * else: - * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< - * fphr_arr._append(sym_setindex(self.category, i)) - * self.findexes.append(sym_setindex(self.category, i)) - */ - ((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:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1857 - * else: - * 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) - */ - ((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)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1858 - * 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_14 = PyInt_FromLong(__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 = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1859 - * 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_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); - PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr_arr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); - __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_fphr)); - __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_14); - __pyx_t_14 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1862 - * 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) # <<<<<<<<<<<<<< - * if len(phrase_list) > 0: - * pair_count = 1.0 / len(phrase_list) - */ - __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 = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_v_phrase_list); - __pyx_v_phrase_list = __pyx_t_14; - __pyx_t_14 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1863 - * 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 = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = ((__pyx_t_13 > 0) != 0); - if (__pyx_t_8) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1864 - * 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 = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(__pyx_t_13 == 0)) { - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); - #endif - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - #ifdef WITH_THREAD - PyGILState_Release(__pyx_gilstate_save); - #endif - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_pair_count = (1.0 / __pyx_t_13); - goto __pyx_L107; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1866 - * pair_count = 1.0 / len(phrase_list) - * else: - * pair_count = 0 # <<<<<<<<<<<<<< - * for phrase2, eindexes in phrase_list: - * als4 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) - */ - __pyx_v_pair_count = 0.0; - } - __pyx_L107:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1867 - * 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)) { - __pyx_t_14 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_14); __pyx_t_13 = 0; - __pyx_t_16 = 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 = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext; - } - 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 = 1867; __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 = 1867; __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 = 1867; __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 = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_15 = __pyx_t_16(__pyx_t_14); - if (unlikely(!__pyx_t_15)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_15); - } - 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_1 = PyList_GET_ITEM(sequence, 0); - __pyx_t_3 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __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 = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_1 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L110_unpacking_failed; - __Pyx_GOTREF(__pyx_t_1); - index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L110_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_17 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L111_unpacking_done; - __pyx_L110_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_17 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L111_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_phrase2); - __pyx_v_phrase2 = __pyx_t_1; - __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_v_eindexes); - __pyx_v_eindexes = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1868 - * 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_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 = 1868; __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_15), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(((PyObject *)__pyx_v_als4)); - __pyx_v_als4 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1869 - * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_INCREF(((PyObject *)__pyx_v_als4)); - PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_als4)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_als4)); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__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 = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_15); - __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); - PyTuple_SET_ITEM(__pyx_t_15, 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); - __Pyx_GIVEREF(__pyx_v_phrase2); - PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - goto __pyx_L103; - } - __pyx_L103:; - goto __pyx_L94; - } - __pyx_L94:; - goto __pyx_L63; - } - __pyx_L63:; - goto __pyx_L51; - } - __pyx_L51:; - goto __pyx_L34; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1871 - * extracts.append((fphr, phrase2, pair_count, tuple(als4))) - * else: - * reason_for_failure = "Unable to extract basic phrase" # <<<<<<<<<<<<<< - * - * free(sent_links) - */ - __Pyx_INCREF(((PyObject *)__pyx_kp_s_140)); - __Pyx_DECREF(__pyx_v_reason_for_failure); - __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_140); - } - __pyx_L34:; - goto __pyx_L33; - } - __pyx_L33:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1873 - * reason_for_failure = "Unable to extract basic phrase" - * - * free(sent_links) # <<<<<<<<<<<<<< - * free(f_links_low) - * free(f_links_high) - */ - free(__pyx_v_sent_links); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1874 - * - * free(sent_links) - * free(f_links_low) # <<<<<<<<<<<<<< - * free(f_links_high) - * free(e_links_low) - */ - free(__pyx_v_f_links_low); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1875 - * free(sent_links) - * free(f_links_low) - * free(f_links_high) # <<<<<<<<<<<<<< - * free(e_links_low) - * free(e_links_high) - */ - free(__pyx_v_f_links_high); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1876 - * free(f_links_low) - * free(f_links_high) - * free(e_links_low) # <<<<<<<<<<<<<< - * free(e_links_high) - * free(f_gap_low) - */ - free(__pyx_v_e_links_low); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1877 - * free(f_links_high) - * free(e_links_low) - * free(e_links_high) # <<<<<<<<<<<<<< - * free(f_gap_low) - * free(f_gap_high) - */ - free(__pyx_v_e_links_high); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1878 - * free(e_links_low) - * free(e_links_high) - * free(f_gap_low) # <<<<<<<<<<<<<< - * free(f_gap_high) - * free(e_gap_low) - */ - free(__pyx_v_f_gap_low); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1879 - * free(e_links_high) - * free(f_gap_low) - * free(f_gap_high) # <<<<<<<<<<<<<< - * free(e_gap_low) - * free(e_gap_high) - */ - free(__pyx_v_f_gap_high); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1880 - * free(f_gap_low) - * free(f_gap_high) - * free(e_gap_low) # <<<<<<<<<<<<<< - * free(e_gap_high) - * - */ - free(__pyx_v_e_gap_low); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1881 - * free(f_gap_high) - * free(e_gap_low) - * free(e_gap_high) # <<<<<<<<<<<<<< - * - * return extracts - */ - free(__pyx_v_e_gap_high); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1883 - * free(e_gap_high) - * - * return extracts # <<<<<<<<<<<<<< - * - * # - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_extracts); - __pyx_r = __pyx_v_extracts; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_10); - __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:; - __Pyx_XDECREF(__pyx_v_extracts); - __Pyx_XDECREF(__pyx_v_phrase_list); - __Pyx_XDECREF((PyObject *)__pyx_v_fphr_arr); - __Pyx_XDECREF((PyObject *)__pyx_v_fphr); - __Pyx_XDECREF(__pyx_v_reason_for_failure); - __Pyx_XDECREF(__pyx_v_sofar); - __Pyx_XDECREF(__pyx_v_als); - __Pyx_XDECREF(__pyx_v_al); - __Pyx_XDECREF(__pyx_v_phrase2); - __Pyx_XDECREF(__pyx_v_eindexes); - __Pyx_XDECREF((PyObject *)__pyx_v_als1); - __Pyx_XDECREF((PyObject *)__pyx_v_als2); - __Pyx_XDECREF((PyObject *)__pyx_v_als3); - __Pyx_XDECREF((PyObject *)__pyx_v_als4); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_f_words = 0; - PyObject *__pyx_v_e_words = 0; - PyObject *__pyx_v_alignment = 0; - PyObject *__pyx_v_ctx_name = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_instance (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f_words,&__pyx_n_s__e_words,&__pyx_n_s__alignment,&__pyx_n_s__ctx_name,0}; - PyObject* values[4] = {0,0,0,0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1891 - * # 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 - */ - values[3] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__f_words)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 1891; __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 = 1891; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx_name); - if (value) { values[3] = value; kw_args--; } - } - } - 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 = 1891; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_f_words = values[0]; - __pyx_v_e_words = values[1]; - __pyx_v_alignment = values[2]; - __pyx_v_ctx_name = values[3]; - } - 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 = 1891; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instance(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_words, __pyx_v_e_words, __pyx_v_alignment, __pyx_v_ctx_name); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* 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 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; - PyObject *__pyx_v_e_i = 0; - PyObject *__pyx_v_e_j = 0; - PyObject *__pyx_v_min_bound = 0; - PyObject *__pyx_v_wc = 0; - PyObject *__pyx_v_links = 0; - PyObject *__pyx_v_nt = 0; - PyObject *__pyx_v_nt_open = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("extract (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__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,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,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 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__f_i)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - } - __pyx_v_f_i = values[0]; - __pyx_v_f_j = values[1]; - __pyx_v_e_i = values[2]; - __pyx_v_e_j = values[3]; - __pyx_v_min_bound = values[4]; - __pyx_v_wc = values[5]; - __pyx_v_links = values[6]; - __pyx_v_nt = values[7]; - __pyx_v_nt_open = values[8]; - } - 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 = 1925; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_self, __pyx_v_f_i, __pyx_v_f_j, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, __pyx_v_nt_open); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1925 - * # 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: - */ - -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; - PyObject *__pyx_v_link_i = NULL; - PyObject *__pyx_v_link_j = NULL; - PyObject *__pyx_v_new_e_i = NULL; - PyObject *__pyx_v_new_e_j = NULL; - PyObject *__pyx_v_new_min_bound = NULL; - PyObject *__pyx_v_i = NULL; - int __pyx_v_nt_collision; - PyObject *__pyx_v_link = NULL; - PyObject *__pyx_v_plus_links = NULL; - PyObject *__pyx_v_old_last_nt = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - 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_8 = NULL; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); - int __pyx_t_13; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - 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_cur_scope = __pyx_outer_scope; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1927 - * 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 = 1927; __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 = 1927; __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 = 1927; __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 = 1927; __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 = 1927; __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 = 1927; __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 = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __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 = 1927; __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 = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __pyx_t_5; - } else { - __pyx_t_6 = __pyx_t_3; - } - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1928 - * # Phrase extraction limits - * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: - * return # <<<<<<<<<<<<<< - * # Unaligned word - * if not al[f_j]: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1930 - * 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 = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __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 = 1930; __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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1932 - * 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 = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_3) { - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __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 = 1932; __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 = 1932; __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 = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __pyx_t_6; - } else { - __pyx_t_5 = __pyx_t_3; - } - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1933 - * # 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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __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, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __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 = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetItemInt(__pyx_t_1, __pyx_t_7, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1934 - * 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 = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __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 = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __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, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1935 - * 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_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__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_7 = 2; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, __pyx_t_7, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_int_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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetItemInt(__pyx_t_4, __pyx_t_7, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1938 - * # 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 = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = (!__pyx_t_5); - if (__pyx_t_3) { - __pyx_t_4 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_t_1 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__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 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __pyx_t_5; - } else { - __pyx_t_6 = __pyx_t_3; - } - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1939 - * # 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_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __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 = 1939; __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_1, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_t_4, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L6; - } - __pyx_L6:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1940 - * 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 - * link_i = fe_span[f_j][0] - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L4; - } - __pyx_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1942 - * 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 = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_8); __pyx_t_8 = 0; - __pyx_v_link_i = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1943 - * # 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(((PyObject *)__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 = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f_j); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_link_j = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1944 - * 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) - * # Check reverse links of newly covered words to see if they violate left - */ - __Pyx_INCREF(__pyx_v_e_i); - __pyx_t_8 = __pyx_v_e_i; - __Pyx_INCREF(__pyx_v_link_i); - __pyx_t_2 = __pyx_v_link_i; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1944; __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 = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { - __Pyx_INCREF(__pyx_t_8); - __pyx_t_4 = __pyx_t_8; - } else { - __Pyx_INCREF(__pyx_t_2); - __pyx_t_4 = __pyx_t_2; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __pyx_t_4; - __Pyx_INCREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_new_e_i = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1945 - * link_j = fe_span[f_j][1] - * new_e_i = min(link_i, e_i) - * new_e_j = max(link_j, e_j) # <<<<<<<<<<<<<< - * # Check reverse links of newly covered words to see if they violate left - * # bound (return) or extend minimum right bound for chunk - */ - __Pyx_INCREF(__pyx_v_e_j); - __pyx_t_8 = __pyx_v_e_j; - __Pyx_INCREF(__pyx_v_link_j); - __pyx_t_4 = __pyx_v_link_j; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __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 = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { - __Pyx_INCREF(__pyx_t_8); - __pyx_t_2 = __pyx_t_8; - } else { - __Pyx_INCREF(__pyx_t_4); - __pyx_t_2 = __pyx_t_4; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __pyx_t_2; - __Pyx_INCREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_new_e_j = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1948 - * # 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 # <<<<<<<<<<<<<< - * # First aligned word creates span - * if e_j == -1: - */ - __Pyx_INCREF(__pyx_v_min_bound); - __pyx_v_new_min_bound = __pyx_v_min_bound; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1950 - * 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_8 = PyObject_RichCompare(__pyx_v_e_j, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __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 = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1951 - * # 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_AsInt(__pyx_v_new_e_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __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_8 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1952 - * 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 = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __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 = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1953 - * 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]) - * # Other aligned words extend span - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L10; - } - __pyx_L10:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1954 - * 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(((PyObject *)__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 = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_INCREF(__pyx_v_new_min_bound); - __pyx_t_8 = __pyx_v_new_min_bound; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __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 = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { - __Pyx_INCREF(__pyx_t_2); - __pyx_t_4 = __pyx_t_2; - } else { - __Pyx_INCREF(__pyx_t_8); - __pyx_t_4 = __pyx_t_8; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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(__pyx_v_new_min_bound); - __pyx_v_new_min_bound = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1951 - * # 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 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L7; - } - /*else*/ { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1957 - * # 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_AsInt(__pyx_v_new_e_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_e_i); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __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 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1958 - * 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 = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __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 = 1958; __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 = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1959 - * 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]) - * for i from e_j < i <= new_e_j: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L13; - } - __pyx_L13:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1960 - * 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(((PyObject *)__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 = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_INCREF(__pyx_v_new_min_bound); - __pyx_t_2 = __pyx_v_new_min_bound; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __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 = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { - __Pyx_INCREF(__pyx_t_4); - __pyx_t_8 = __pyx_t_4; - } else { - __Pyx_INCREF(__pyx_t_2); - __pyx_t_8 = __pyx_t_2; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __pyx_t_8; - __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_v_new_min_bound); - __pyx_v_new_min_bound = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1957 - * # 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 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1961 - * 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_AsInt(__pyx_v_e_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __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 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1962 - * 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 = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1963 - * 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]) - * # Extract, extend with word (unless non-terminal open) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L16; - } - __pyx_L16:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1964 - * 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(((PyObject *)__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 = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_INCREF(__pyx_v_new_min_bound); - __pyx_t_4 = __pyx_v_new_min_bound; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __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 = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { - __Pyx_INCREF(__pyx_t_8); - __pyx_t_2 = __pyx_t_8; - } else { - __Pyx_INCREF(__pyx_t_4); - __pyx_t_2 = __pyx_t_4; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __pyx_t_2; - __Pyx_INCREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_new_min_bound); - __pyx_v_new_min_bound = __pyx_t_8; - __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1961 - * 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_8 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_8; - __pyx_t_8 = 0; - } - __pyx_L7:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1966 - * 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 = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((!__pyx_t_6) != 0); - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1967 - * # Extract, extend with word (unless non-terminal open) - * if not nt_open: - * nt_collision = False # <<<<<<<<<<<<<< - * for link in al[f_j]: - * if e_nt_cover[link]: - */ - __pyx_v_nt_collision = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1968 - * if not nt_open: - * nt_collision = False - * for link in al[f_j]: # <<<<<<<<<<<<<< - * if e_nt_cover[link]: - * nt_collision = True - */ - __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) { - __pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __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_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_8 = __pyx_t_12(__pyx_t_2); - if (unlikely(!__pyx_t_8)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF(__pyx_v_link); - __pyx_v_link = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1969 - * 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 = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover), __pyx_v_link); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 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_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1970 - * for link in al[f_j]: - * if e_nt_cover[link]: - * nt_collision = True # <<<<<<<<<<<<<< - * # Non-terminal collisions block word extraction and extension, but - * # may be okay for continuing non-terminals - */ - __pyx_v_nt_collision = 1; - goto __pyx_L20; - } - __pyx_L20:; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1973 - * # 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) { - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __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 = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_5 = __pyx_t_6; - } else { - __pyx_t_5 = __pyx_t_3; - } - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1974 - * # 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_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_v_plus_links = ((PyObject*)__pyx_t_8); - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1975 - * 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_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) { - __pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __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_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_8 = __pyx_t_12(__pyx_t_2); - if (unlikely(!__pyx_t_8)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF(__pyx_v_link); - __pyx_v_link = __pyx_t_8; - __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1976 - * plus_links = [] - * for link in al[f_j]: - * plus_links.append((f_j, link)) # <<<<<<<<<<<<<< - * cover[link] += 1 - * links.append(plus_links) - */ - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_f_j); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f_j); - __Pyx_GIVEREF(__pyx_v_f_j); - __Pyx_INCREF(__pyx_v_link); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_link); - __Pyx_GIVEREF(__pyx_v_link); - __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_plus_links, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1977 - * 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 = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_cover) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __pyx_t_14 = __pyx_cur_scope->__pyx_v_cover; - __Pyx_INCREF(__pyx_v_link); - __pyx_t_8 = __pyx_v_link; - if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_t_14), __pyx_t_8); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - if (PyObject_SetItem(((PyObject *)__pyx_t_14), __pyx_t_8, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1978 - * 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_2 = __Pyx_PyObject_Append(__pyx_v_links, ((PyObject *)__pyx_v_plus_links)); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1979 - * 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 = 1979; __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 = 1979; __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 = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __pyx_t_3; - } else { - __pyx_t_6 = __pyx_t_5; - } - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1980 - * 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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 1980; __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 = 1980; __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 = 1980; __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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __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_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __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 = 1980; __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 = 1980; __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 = 1980; __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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_f_i); - PyTuple_SET_ITEM(__pyx_t_8, 0, __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); - __Pyx_GIVEREF(__pyx_v_new_e_i); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_nt); - PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_nt); - __Pyx_GIVEREF(__pyx_v_nt); - __Pyx_INCREF(__pyx_v_links); - PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_links); - __Pyx_GIVEREF(__pyx_v_links); - __pyx_t_1 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L24; - } - __pyx_L24:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1981 - * 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 = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __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 = 1981; __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_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_8, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1982 - * 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_1 = __Pyx_PyObject_Pop(__pyx_v_links); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1983 - * 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_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __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; - __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 = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 1983; __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 = 1983; __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 = 1983; __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 = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_1 = __pyx_t_12(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_link); - __pyx_v_link = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1984 - * 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 = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_cover) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_INCREF(((PyObject *)__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; - if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_t_14), __pyx_t_1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_t_8, __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_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - if (PyObject_SetItem(((PyObject *)__pyx_t_14), __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __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; - __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L21; - } - __pyx_L21:; - goto __pyx_L17; - } - __pyx_L17:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1986 - * 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 = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_6) { - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __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_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __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 = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __pyx_t_5; - } else { - __pyx_t_3 = __pyx_t_6; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1988 - * 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_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_4, 0, 0, NULL, NULL, &__pyx_k_slice_141, 0, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_old_last_nt = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1989 - * # 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(__pyx_t_2, 2, __pyx_v_f_j, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1990 - * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __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_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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 = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1991 - * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_check); 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); - if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_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 = 1991; __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 = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_INCREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_1, 1, __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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__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 = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = ((!__pyx_t_3) != 0); - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1992 - * 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 (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1993 - * 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) - * span_inc(e_nt_cover, link_i, nt[-1][3] - 1) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L29; - } - __pyx_L29:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1994 - * 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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __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_t_2, __pyx_int_1); 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); - __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_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_INCREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link_i); - __Pyx_GIVEREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); 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); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1995 - * 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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); 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); - __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 = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - __Pyx_INCREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_link_i); - __Pyx_GIVEREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); 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); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1996 - * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_v_link_i, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L28; - } - __pyx_L28:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1997 - * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __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_v_link_j, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __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 = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1998 - * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_check); 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_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_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 = 1998; __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 = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_link_j); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_link_j); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__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 = 1998; __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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1999 - * 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 (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2000 - * 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) - * span_inc(e_nt_cover, nt[-1][4] + 1, link_j) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L31; - } - __pyx_L31:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2001 - * 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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __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_Add(__pyx_t_2, __pyx_int_1); 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); - __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_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_link_j); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); 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); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2002 - * 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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __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 = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_link_j); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_link_j); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __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_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2003 - * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_v_link_j, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L30; - } - __pyx_L30:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2004 - * 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 = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_3) { - __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 = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 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; - __pyx_t_5 = __pyx_t_6; - } else { - __pyx_t_5 = __pyx_t_3; - } - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2005 - * 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 = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 2005; __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 = 2005; __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 = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_f_words, 0, 0, &__pyx_v_f_i, &__pyx_t_4, NULL, 0, 0, 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_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_e_words, 0, 0, &__pyx_v_new_e_i, &__pyx_t_4, NULL, 0, 0, 1); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_f_i); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f_i); - __Pyx_GIVEREF(__pyx_v_f_i); - __Pyx_INCREF(__pyx_v_new_e_i); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_new_e_i); - __Pyx_GIVEREF(__pyx_v_new_e_i); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_nt); - PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_nt); - __Pyx_GIVEREF(__pyx_v_nt); - __Pyx_INCREF(__pyx_v_links); - PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_links); - __Pyx_GIVEREF(__pyx_v_links); - __pyx_t_1 = 0; - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_8); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L32; - } - __pyx_L32:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2006 - * 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_8 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __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 = 2006; __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_8, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, __pyx_t_4); 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_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2007 - * 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 (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2008 - * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_5) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2009 - * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); 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); - 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_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_t_4 = PyNumber_Subtract(__pyx_t_8, __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); - __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 = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_INCREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_link_i); - __Pyx_GIVEREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); 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); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2010 - * 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 = 2010; __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 = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_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 = 2010; __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 = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - __Pyx_INCREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_2, 1, __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L33; - } - __pyx_L33:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2011 - * 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_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_2, Py_GT); __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_2); __pyx_t_2 = 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) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2012 - * 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_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_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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __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 = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_link_j); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_link_j); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2013 - * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); 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); - 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_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_8, __pyx_int_1); 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); - __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_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_link_j); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); 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); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L34; - } - __pyx_L34:; - goto __pyx_L27; - } - __pyx_L27:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2015 - * 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 = 2015; __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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_v_f_j, __pyx_t_8); 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); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __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 = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_6 = __pyx_t_5; - } else { - __pyx_t_6 = __pyx_t_3; - } - if (__pyx_t_6) { - __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __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 = 2015; __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; - } else { - __pyx_t_3 = __pyx_t_6; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2017 - * 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 = 2017; __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 = 2017; __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 = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_INCREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_8, 1, __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); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), 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_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = ((!__pyx_t_3) != 0); - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2018 - * # Check for collisions - * 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) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L36; - } - __pyx_L36:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2019 - * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_INCREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_8, 1, __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); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2020 - * 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 = 2020; __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 = 2020; __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 = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - __Pyx_GIVEREF(((PyObject *)__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); - __Pyx_GIVEREF(__pyx_v_link_i); - __Pyx_INCREF(__pyx_v_link_j); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2021 - * 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 = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_6) { - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __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 = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = __pyx_t_8; - __pyx_t_8 = 0; - } else { - __Pyx_INCREF(__pyx_int_1); - __pyx_t_2 = __pyx_int_1; - } - __pyx_t_8 = PyList_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_f_j); - PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_f_j); - __Pyx_GIVEREF(__pyx_v_f_j); - __Pyx_INCREF(__pyx_v_f_j); - PyList_SET_ITEM(__pyx_t_8, 2, __pyx_v_f_j); - __Pyx_GIVEREF(__pyx_v_f_j); - __Pyx_INCREF(__pyx_v_link_i); - PyList_SET_ITEM(__pyx_t_8, 3, __pyx_v_link_i); - __Pyx_GIVEREF(__pyx_v_link_i); - __Pyx_INCREF(__pyx_v_link_j); - PyList_SET_ITEM(__pyx_t_8, 4, __pyx_v_link_j); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_nt, ((PyObject *)__pyx_t_8)); 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); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2023 - * 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 = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_6) { - __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 = 2023; __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 = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_15 = __pyx_t_3; - } else { - __pyx_t_15 = __pyx_t_6; - } - if (__pyx_t_15) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2024 - * # 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 = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 2024; __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 = 2024; __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 = 2024; __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 = 2024; __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 = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __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 = 2024; __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 = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __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_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_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(6); 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_INCREF(__pyx_v_f_i); - PyTuple_SET_ITEM(__pyx_t_8, 0, __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); - __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_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_nt); - PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_nt); - __Pyx_GIVEREF(__pyx_v_nt); - __Pyx_INCREF(__pyx_v_links); - PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_links); - __Pyx_GIVEREF(__pyx_v_links); - __pyx_t_4 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); 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_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __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; - goto __pyx_L37; - } - __pyx_L37:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2025 - * 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_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); 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_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __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_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_8, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __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_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2026 - * 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_4 = __Pyx_PyObject_Pop(__pyx_v_nt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2027 - * 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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); 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_2 = PyTuple_New(3); 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_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); - __Pyx_INCREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link_i); - __Pyx_GIVEREF(__pyx_v_link_i); - __Pyx_INCREF(__pyx_v_link_j); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2028 - * 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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); 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_t_2 = PyTuple_New(3); 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); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); - __Pyx_INCREF(__pyx_v_link_i); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link_i); - __Pyx_GIVEREF(__pyx_v_link_i); - __Pyx_INCREF(__pyx_v_link_j); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j); - __Pyx_GIVEREF(__pyx_v_link_j); - __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L35; - } - __pyx_L35:; - - __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(((PyObject *)__pyx_t_14)); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_link_i); - __Pyx_XDECREF(__pyx_v_link_j); - __Pyx_XDECREF(__pyx_v_new_e_i); - __Pyx_XDECREF(__pyx_v_new_e_j); - __Pyx_XDECREF(__pyx_v_new_min_bound); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_link); - __Pyx_XDECREF(__pyx_v_plus_links); - __Pyx_XDECREF(__pyx_v_old_last_nt); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1891 - * # 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 - */ - -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; - PyObject *__pyx_v_e_len = NULL; - PyObject *__pyx_v_f = NULL; - PyObject *__pyx_v_e = NULL; - CYTHON_UNUSED PyObject *__pyx_v_f_nt_cover = NULL; - long __pyx_v_f_i; - PyObject *__pyx_v_stats = NULL; - CYTHON_UNUSED PyObject *__pyx_v_lex_i = NULL; - CYTHON_UNUSED PyObject *__pyx_v_lex_j = NULL; - PyObject *__pyx_v_rule = NULL; - PyObject *__pyx_v_f_ph = NULL; - PyObject *__pyx_v_e_ph = NULL; - PyObject *__pyx_v_e_w = NULL; - PyObject *__pyx_v_f_w = NULL; - CYTHON_UNUSED PyObject *__pyx_v_i = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *(*__pyx_t_8)(PyObject *); - int __pyx_t_9; - long __pyx_t_10; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - Py_ssize_t __pyx_t_15; - PyObject *(*__pyx_t_16)(PyObject *); - int __pyx_lineno = 0; - 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); - 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_f_words = __pyx_v_f_words; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_words); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_words); - __pyx_cur_scope->__pyx_v_e_words = __pyx_v_e_words; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_words); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_words); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1893 - * def add_instance(self, f_words, e_words, alignment, ctx_name=None): - * - * self.online = True # <<<<<<<<<<<<<< - * - * # Rules extracted from this instance - */ - __pyx_cur_scope->__pyx_v_self->online = 1; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1900 - * # 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 = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_cur_scope->__pyx_v_rules = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1902 - * rules = set() - * - * f_len = len(f_words) # <<<<<<<<<<<<<< - * e_len = len(e_words) - * - */ - __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 = 1902; __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 = 1902; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1903 - * - * f_len = len(f_words) - * e_len = len(e_words) # <<<<<<<<<<<<<< - * - * # Pre-compute alignment info - */ - __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 = 1903; __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 = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_e_len = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1906 - * - * # 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 = 1906; __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 = 1906; __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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__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_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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - } - __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 = 1906; __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 = 1906; __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 = 1906; __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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_4 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_i); - __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 = 1906; __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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_cur_scope->__pyx_v_al = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1907 - * # 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 = 1907; __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 = 1907; __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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__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_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 = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - } - __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 = 1907; __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 = 1907; __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 = 1907; __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 = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_4 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF(__pyx_v_i); - __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 = 1907; __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 = 1907; __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); - __Pyx_INCREF(__pyx_int_neg_1); - 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 = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_cur_scope->__pyx_v_fe_span = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1908 - * 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 = 1908; __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 = 1908; __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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (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 = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - } - __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 = 1908; __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 = 1908; __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 = 1908; __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 = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_6 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_6)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_XDECREF(__pyx_v_i); - __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 = 1908; __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 = 1908; __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); - __Pyx_INCREF(__pyx_int_neg_1); - 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 = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_cur_scope->__pyx_v_ef_span = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1909 - * 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)) { - __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 = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - 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 = 1909; __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 = 1909; __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 = 1909; __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 = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_3 = __pyx_t_5(__pyx_t_1); - if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); - } - __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 = 1909; __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 = 1909; __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 = 1909; __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; - index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed; - __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 = 1909; __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; - __pyx_L11_unpacking_failed:; - __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 = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L12_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_f); - __pyx_v_f = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_v_e); - __pyx_v_e = __pyx_t_6; - __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1910 - * 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 (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_e); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __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_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1911 - * 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) - * ef_span[e][0] = min(ef_span[e][0], f) - */ - __Pyx_INCREF(__pyx_v_e); - __pyx_t_6 = __pyx_v_e; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_9) { - __Pyx_INCREF(__pyx_t_6); - __pyx_t_3 = __pyx_t_6; - } else { - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __pyx_t_3; - __Pyx_INCREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1912 - * al[f].append(e) - * 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) - * ef_span[e][1] = max(ef_span[e][1], f) - */ - __Pyx_INCREF(__pyx_v_e); - __pyx_t_6 = __pyx_v_e; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_9) { - __Pyx_INCREF(__pyx_t_6); - __pyx_t_3 = __pyx_t_6; - } else { - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __pyx_t_3; - __Pyx_INCREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1913 - * 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) # <<<<<<<<<<<<<< - * ef_span[e][1] = max(ef_span[e][1], f) - * - */ - __Pyx_INCREF(__pyx_v_f); - __pyx_t_6 = __pyx_v_f; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_9) { - __Pyx_INCREF(__pyx_t_6); - __pyx_t_3 = __pyx_t_6; - } else { - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __pyx_t_3; - __Pyx_INCREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1914 - * 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) # <<<<<<<<<<<<<< - * - * # Target side word coverage - */ - __Pyx_INCREF(__pyx_v_f); - __pyx_t_6 = __pyx_v_f; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_GT); __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_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_9) { - __Pyx_INCREF(__pyx_t_6); - __pyx_t_3 = __pyx_t_6; - } else { - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __pyx_t_3; - __Pyx_INCREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1917 - * - * # 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 = 1917; __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 = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_temp); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_temp; - } - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_cur_scope->__pyx_v_cover = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1919 - * 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 = 1919; __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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_temp); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_temp; - } - __pyx_v_f_nt_cover = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1920 - * # 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 = 1920; __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;} - __Pyx_GOTREF(__pyx_temp); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_temp; - } - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_cur_scope->__pyx_v_e_nt_cover = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1925 - * # 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_145, ((PyObject*)__pyx_cur_scope), __pyx_n_s_102, ((PyObject *)__pyx_k_codeobj_143)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2031 - * - * # 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_10 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_v_f_i = 0; __pyx_v_f_i < __pyx_t_10; __pyx_v_f_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2033 - * 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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_11 = ((!__pyx_t_9) != 0); - if (__pyx_t_11) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2034 - * # 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) - * - */ - goto __pyx_L13_continue; - goto __pyx_L15; - } - __pyx_L15:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2035 - * 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 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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 = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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_6, __pyx_t_3, __pyx_int_neg_1, __pyx_t_4, __pyx_int_0, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_12), __pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_L13_continue:; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2037 - * 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 (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_v_stats = __pyx_t_14; - __pyx_t_14 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2042 - * # 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 = 2042; __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 = 2042; __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_12 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - if (PyList_CheckExact(__pyx_t_12) || PyTuple_CheckExact(__pyx_t_12)) { - __pyx_t_13 = __pyx_t_12; __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_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; - } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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_12 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __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_12 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_12 = __pyx_t_5(__pyx_t_13); - if (unlikely(!__pyx_t_12)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_12); - } - 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __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_7 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_14 = PyList_GET_ITEM(sequence, 0); - __pyx_t_7 = PyList_GET_ITEM(sequence, 1); - __pyx_t_4 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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_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_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L18_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 = 2042; __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; - __pyx_L18_unpacking_failed:; - __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 = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L19_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_f); - __pyx_v_f = __pyx_t_14; - __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_v_lex_i); - __pyx_v_lex_i = __pyx_t_7; - __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_v_lex_j); - __pyx_v_lex_j = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2043 - * # 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_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__samples_f); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_f); - __pyx_t_4 = __pyx_v_f; - __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_t_4); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_14 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_t_4, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2046 - * - * # 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(((PyObject *)__pyx_cur_scope->__pyx_v_rules)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; - for (;;) { - { - __pyx_t_12 = __pyx_t_5(__pyx_t_13); - if (unlikely(!__pyx_t_12)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_12); - } - __Pyx_XDECREF(__pyx_v_rule); - __pyx_v_rule = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2047 - * # 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_12 = __Pyx_PyObject_GetSlice(__pyx_v_rule, 0, 3, NULL, NULL, &__pyx_k_slice_146, 0, 1, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_14 = PyList_GET_ITEM(sequence, 1); - __pyx_t_7 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(__pyx_t_7); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - #endif - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L22_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - 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_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 = 2047; __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; - __pyx_L22_unpacking_failed:; - __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 = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L23_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_f_ph); - __pyx_v_f_ph = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_v_e_ph); - __pyx_v_e_ph = __pyx_t_14; - __pyx_t_14 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_al); - __Pyx_DECREF(__pyx_cur_scope->__pyx_v_al); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_cur_scope->__pyx_v_al = __pyx_t_7; - __pyx_t_7 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2048 - * 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_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_f); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_f_ph); - __pyx_t_7 = __pyx_v_f_ph; - __pyx_t_14 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __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_12); __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2049 - * (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_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_e); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_e_ph); - __pyx_t_7 = __pyx_v_e_ph; - __pyx_t_4 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __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 = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2050 - * 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_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_fe); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_v_f_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_INCREF(__pyx_v_e_ph); - __pyx_t_12 = __pyx_v_e_ph; - __pyx_t_14 = PyObject_GetItem(__pyx_t_7, __pyx_t_12); if (!__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 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); 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_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyObject_SetItem(__pyx_t_7, __pyx_t_12, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2051 - * 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_al); 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_t_12 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_ph); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_v_e_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_9 = ((!__pyx_t_11) != 0); - if (__pyx_t_9) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2052 - * 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 counts - */ - __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 = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_12 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_ph); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_v_e_ph, __pyx_cur_scope->__pyx_v_al) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L24; - } - __pyx_L24:; - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2055 - * - * # Update Bilexical counts - * for e_w in e_words: # <<<<<<<<<<<<<< - * stats.bilex_e[e_w] += 1 - * for f_w in f_words: - */ - if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_e_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_e_words)) { - __pyx_t_13 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; - } - 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_12 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __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_12 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_12 = __pyx_t_5(__pyx_t_13); - if (unlikely(!__pyx_t_12)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_12); - } - __Pyx_XDECREF(__pyx_v_e_w); - __pyx_v_e_w = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2056 - * # Update Bilexical counts - * for e_w in e_words: - * stats.bilex_e[e_w] += 1 # <<<<<<<<<<<<<< - * for f_w in f_words: - * stats.bilex_f[f_w] += 1 - */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_e); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_e_w); - __pyx_t_7 = __pyx_v_e_w; - __pyx_t_4 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __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 = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2057 - * for e_w in e_words: - * stats.bilex_e[e_w] += 1 - * for f_w in f_words: # <<<<<<<<<<<<<< - * stats.bilex_f[f_w] += 1 - * for e_w in e_words: - */ - if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_f_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_f_words)) { - __pyx_t_13 = __pyx_cur_scope->__pyx_v_f_words; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_f_words); 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; - } - 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_12 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __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_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __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_12 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __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_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_12 = __pyx_t_5(__pyx_t_13); - if (unlikely(!__pyx_t_12)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_12); - } - __Pyx_XDECREF(__pyx_v_f_w); - __pyx_v_f_w = __pyx_t_12; - __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2058 - * stats.bilex_e[e_w] += 1 - * for f_w in f_words: - * stats.bilex_f[f_w] += 1 # <<<<<<<<<<<<<< - * for e_w in e_words: - * stats.bilex_fe[f_w][e_w] += 1 - */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_f); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_v_f_w); - __pyx_t_7 = __pyx_v_f_w; - __pyx_t_14 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_14, __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_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __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; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2059 - * for f_w in f_words: - * stats.bilex_f[f_w] += 1 - * for e_w in e_words: # <<<<<<<<<<<<<< - * stats.bilex_fe[f_w][e_w] += 1 - * - */ - if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_e_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_e_words)) { - __pyx_t_12 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_12); __pyx_t_15 = 0; - __pyx_t_16 = NULL; - } else { - __pyx_t_15 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_16 = Py_TYPE(__pyx_t_12)->tp_iternext; - } - for (;;) { - if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_12)) { - if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_12)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_15); __Pyx_INCREF(__pyx_t_7); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_12, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_12)) { - if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_12)) break; - #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_15); __Pyx_INCREF(__pyx_t_7); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_12, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_7 = __pyx_t_16(__pyx_t_12); - if (unlikely(!__pyx_t_7)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF(__pyx_v_e_w); - __pyx_v_e_w = __pyx_t_7; - __pyx_t_7 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2060 - * stats.bilex_f[f_w] += 1 - * for e_w in e_words: - * stats.bilex_fe[f_w][e_w] += 1 # <<<<<<<<<<<<<< - * - * # Create a rule from source, target, non-terminals, and alignments - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_w); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_v_e_w); - __pyx_t_7 = __pyx_v_e_w; - __pyx_t_14 = PyObject_GetItem(__pyx_t_4, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyObject_SetItem(__pyx_t_4, __pyx_t_7, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __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_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_e_len); - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_XDECREF(__pyx_v_f_nt_cover); - __Pyx_XDECREF(__pyx_v_stats); - __Pyx_XDECREF(__pyx_v_lex_i); - __Pyx_XDECREF(__pyx_v_lex_j); - __Pyx_XDECREF(__pyx_v_rule); - __Pyx_XDECREF(__pyx_v_f_ph); - __Pyx_XDECREF(__pyx_v_e_ph); - __Pyx_XDECREF(__pyx_v_e_w); - __Pyx_XDECREF(__pyx_v_f_w); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_f_i = 0; - PyObject *__pyx_v_e_i = 0; - PyObject *__pyx_v_f_span = 0; - PyObject *__pyx_v_e_span = 0; - PyObject *__pyx_v_nt = 0; - PyObject *__pyx_v_al = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("form_rule (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f_i,&__pyx_n_s__e_i,&__pyx_n_s__f_span,&__pyx_n_s__e_span,&__pyx_n_s__nt,&__pyx_n_s__al,0}; - PyObject* values[6] = {0,0,0,0,0,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 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__f_i)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 2063; __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 = 2063; __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 = 2063; __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 = 2063; __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 = 2063; __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 = 2063; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - } - __pyx_v_f_i = values[0]; - __pyx_v_e_i = values[1]; - __pyx_v_f_span = values[2]; - __pyx_v_e_span = values[3]; - __pyx_v_nt = values[4]; - __pyx_v_al = values[5]; - } - 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 = 2063; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_i, __pyx_v_e_i, __pyx_v_f_span, __pyx_v_e_span, __pyx_v_nt, __pyx_v_al); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7 = {__Pyx_NAMESTR("lambda7"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_x = 0; - PyObject *__pyx_v_y = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda7 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0}; - PyObject* values[2] = {0,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__x)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 2066; __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 = 2066; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_x = values[0]; - __pyx_v_y = values[1]; - } - 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 = 2066; __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_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_lambda_funcdef_lambda7(__pyx_self, __pyx_v_x, __pyx_v_y); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2066 - * - * # 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 - */ - -static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) { - 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("lambda7", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __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 = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8 = {__Pyx_NAMESTR("lambda8"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_x = 0; - PyObject *__pyx_v_y = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda8 (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0}; - PyObject* values[2] = {0,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__x)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda8") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_x = values[0]; - __pyx_v_y = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __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_lambda8(__pyx_self, __pyx_v_x, __pyx_v_y); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2090 - * # 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) - */ - -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; - 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("lambda8", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __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 = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda8", __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 */ - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2124 - * 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) - * - */ - -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; - 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); - 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_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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *(*__pyx_t_7)(PyObject *); - int __pyx_t_8; - int __pyx_t_9; - 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; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_1 = ((PyObject *)__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 = 2124; __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 = 2124; __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; - #if CYTHON_COMPILING_IN_CPYTHON - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_5 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __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 = 2124; __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 = 2124; __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; - index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed; - __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 = 2124; __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; - __pyx_L6_unpacking_failed:; - __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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L7_unpacking_done:; - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_i); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_i = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_j); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_j); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_j = __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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromLong(((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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 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_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_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; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("genexpr", __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; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2063 - * - * # 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 - */ - -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; - PyObject *__pyx_v_nt_inv = NULL; - PyObject *__pyx_v_f_sym = NULL; - PyObject *__pyx_v_off = NULL; - PyObject *__pyx_v_next_nt = NULL; - PyObject *__pyx_v_nt_len = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_e_sym = NULL; - PyObject *__pyx_v_links_inv = NULL; - PyObject *__pyx_v_links_len = NULL; - PyObject *__pyx_v_nt_i = NULL; - PyObject *__pyx_v_lex_f_i = NULL; - PyObject *__pyx_v_lex_f_j = NULL; - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_f = NULL; - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_e = NULL; - PyObject *__pyx_v_a = NULL; - PyObject *__pyx_v_sub = NULL; - PyObject *__pyx_v_link = 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)(PyObject *); - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - 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); - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2066 - * - * # 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 = 2066; __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 = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7, 0, __pyx_n_s_147, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_nt_inv = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2067 - * # 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_k_slice_148, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __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 = 2067; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_f_sym = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2068 - * 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: - * nt_len = (next_nt[2] - next_nt[1]) + 1 - */ - __Pyx_INCREF(__pyx_v_f_i); - __pyx_v_off = __pyx_v_f_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2069 - * 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)) { - __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 = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - } - 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 = 2069; __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 = 2069; __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 = 2069; __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 = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_2 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_2)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF(__pyx_v_next_nt); - __pyx_v_next_nt = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2070 - * 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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __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 = 2070; __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 = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_v_nt_len); - __pyx_v_nt_len = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2071 - * for next_nt in nt: - * nt_len = (next_nt[2] - next_nt[1]) + 1 - * i = 0 # <<<<<<<<<<<<<< - * while i < nt_len: - * f_sym.pop(next_nt[1] - off) - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2072 - * nt_len = (next_nt[2] - next_nt[1]) + 1 - * i = 0 - * while i < nt_len: # <<<<<<<<<<<<<< - * f_sym.pop(next_nt[1] - off) - * 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 = 2072; __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 = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_7) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2073 - * 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_PyObject_GetAttrStr(((PyObject *)__pyx_v_f_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __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 = 2073; __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); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __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_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2074 - * 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_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_2 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2075 - * 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_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = PyList_Insert(__pyx_v_f_sym, __pyx_t_8, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2076 - * 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_6 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_6); 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_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_v_off); - __pyx_v_off = __pyx_t_2; - __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2077 - * 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_k_slice_149, 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 = 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 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__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(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_e_sym = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2078 - * off += (nt_len - 1) - * e_sym = list(e_span[:]) - * off = e_i # <<<<<<<<<<<<<< - * for next_nt in nt_inv: - * nt_len = (next_nt[4] - next_nt[3]) + 1 - */ - __Pyx_INCREF(__pyx_v_e_i); - __Pyx_DECREF(__pyx_v_off); - __pyx_v_off = __pyx_v_e_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2079 - * 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)) { - __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 = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - } - 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 = 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_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 = 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)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF(__pyx_v_next_nt); - __pyx_v_next_nt = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2080 - * 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_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_6); 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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_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_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_v_nt_len); - __pyx_v_nt_len = __pyx_t_6; - __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2081 - * for next_nt in nt_inv: - * nt_len = (next_nt[4] - next_nt[3]) + 1 - * i = 0 # <<<<<<<<<<<<<< - * while i < nt_len: - * e_sym.pop(next_nt[3] - off) - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2082 - * nt_len = (next_nt[4] - next_nt[3]) + 1 - * i = 0 - * while i < nt_len: # <<<<<<<<<<<<<< - * e_sym.pop(next_nt[3] - off) - * i += 1 - */ - while (1) { - __pyx_t_6 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; - if (!__pyx_t_7) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2083 - * 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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_e_sym), __pyx_n_s__pop); 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_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __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 = 2083; __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[8]; __pyx_lineno = 2083; __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(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2084 - * 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 = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_2 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2085 - * 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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __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 = 2085; __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 = 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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_9 = __Pyx_PyInt_AsInt(__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 = PyInt_FromLong(__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_e_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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2086 - * 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 = 2086; __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 = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_off); - __pyx_v_off = __pyx_t_2; - __pyx_t_2 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2089 - * - * # 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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; - } - 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 = 2089; __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 = 2089; __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 = 2089; __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF(__pyx_v_sub); - __pyx_v_sub = __pyx_t_1; - __pyx_t_1 = 0; - if (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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - 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 = 2089; __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 = 2089; __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 = 2089; __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - } else { - __pyx_t_6 = __pyx_t_11(__pyx_t_1); - if (unlikely(!__pyx_t_6)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_XDECREF(__pyx_v_link); - __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 = 2089; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(((PyObject *)__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 = 2089; __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; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_cur_scope->__pyx_v_links = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2090 - * # 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 = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_links)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_links)); - __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_links)); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8, 0, __pyx_n_s_147, NULL, __pyx_n_s_102, NULL); 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); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_links_inv = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2091 - * 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) - * nt_i = 0 - */ - __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_links); - __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 = 2091; __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 = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_links_len = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2092 - * 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 = 2092; __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 = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_nt_len); - __pyx_v_nt_len = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2093 - * links_len = len(links) - * nt_len = len(nt) - * nt_i = 0 # <<<<<<<<<<<<<< - * off = f_i - * i = 0 - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_nt_i = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2094 - * nt_len = len(nt) - * nt_i = 0 - * off = f_i # <<<<<<<<<<<<<< - * i = 0 - * while i < links_len: - */ - __Pyx_INCREF(__pyx_v_f_i); - __Pyx_DECREF(__pyx_v_off); - __pyx_v_off = __pyx_v_f_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2095 - * nt_i = 0 - * off = f_i - * i = 0 # <<<<<<<<<<<<<< - * while i < links_len: - * while nt_i < nt_len and links[i][0] > nt[nt_i][1]: - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2096 - * off = f_i - * i = 0 - * 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]) - */ - while (1) { - __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __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 = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_7) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2097 - * i = 0 - * 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 - */ - while (1) { - __pyx_t_1 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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 = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_7) { - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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_RichCompare(__pyx_t_2, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_14 = __pyx_t_13; - } else { - __pyx_t_14 = __pyx_t_7; - } - if (!__pyx_t_14) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2098 - * 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_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __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_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __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_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __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_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_off); - __pyx_v_off = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2099 - * 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_2 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); 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_DECREF(__pyx_v_nt_i); - __pyx_v_nt_i = __pyx_t_2; - __pyx_t_2 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2100 - * off += (nt[nt_i][2] - nt[nt_i][1]) - * nt_i += 1 - * links[i][0] -= off # <<<<<<<<<<<<<< - * i += 1 - * nt_i = 0 - */ - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__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_4 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_v_off); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetItemInt(__pyx_t_2, __pyx_t_4, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2101 - * nt_i += 1 - * links[i][0] -= off - * i += 1 # <<<<<<<<<<<<<< - * nt_i = 0 - * off = e_i - */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_2 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2102 - * links[i][0] -= off - * i += 1 - * nt_i = 0 # <<<<<<<<<<<<<< - * off = e_i - * i = 0 - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF(__pyx_v_nt_i); - __pyx_v_nt_i = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2103 - * i += 1 - * nt_i = 0 - * off = e_i # <<<<<<<<<<<<<< - * i = 0 - * while i < links_len: - */ - __Pyx_INCREF(__pyx_v_e_i); - __Pyx_DECREF(__pyx_v_off); - __pyx_v_off = __pyx_v_e_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2104 - * nt_i = 0 - * off = e_i - * i = 0 # <<<<<<<<<<<<<< - * while i < links_len: - * while nt_i < nt_len and links_inv[i][1] > nt_inv[nt_i][3]: - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_int_0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2105 - * off = e_i - * i = 0 - * 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]) - */ - while (1) { - __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_14) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2106 - * i = 0 - * 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 - */ - 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 = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 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_14) { - __pyx_t_2 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __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_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __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_3, __pyx_t_1, Py_GT); __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_3); __pyx_t_3 = 0; - __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 = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = __pyx_t_7; - } else { - __pyx_t_13 = __pyx_t_14; - } - if (!__pyx_t_13) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2107 - * 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_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__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, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__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_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__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, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__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 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __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_InPlaceAdd(__pyx_v_off, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__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_DECREF(__pyx_v_off); - __pyx_v_off = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2108 - * 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_3 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_nt_i); - __pyx_v_nt_i = __pyx_t_3; - __pyx_t_3 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2109 - * off += (nt_inv[nt_i][4] - nt_inv[nt_i][3]) - * nt_i += 1 - * links_inv[i][1] -= off # <<<<<<<<<<<<<< - * i += 1 - * - */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = 1; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_off); 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(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetItemInt(__pyx_t_3, __pyx_t_4, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2110 - * nt_i += 1 - * links_inv[i][1] -= off - * i += 1 # <<<<<<<<<<<<<< - * - * # Find lexical span - */ - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); 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_v_i); - __pyx_v_i = __pyx_t_3; - __pyx_t_3 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2113 - * - * # Find lexical span - * lex_f_i = f_i # <<<<<<<<<<<<<< - * lex_f_j = f_i + (len(f_span) - 1) - * if nt: - */ - __Pyx_INCREF(__pyx_v_f_i); - __pyx_v_lex_f_i = __pyx_v_f_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2114 - * # 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 = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Add(__pyx_v_f_i, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_lex_f_j = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2115 - * 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 = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_13) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2116 - * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __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_RichCompare(__pyx_t_3, __pyx_v_lex_f_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__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_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); 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_1); __pyx_t_1 = 0; - if (__pyx_t_13) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2117 - * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __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_t_3, __pyx_t_2); 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(__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 = 2117; __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_InPlaceAdd(__pyx_v_lex_f_i, __pyx_t_2); 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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_lex_f_i); - __pyx_v_lex_f_i = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L24; - } - __pyx_L24:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2118 - * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __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_lex_f_j, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_13) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2119 - * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __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_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_lex_f_j, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_lex_f_j); - __pyx_v_lex_f_j = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L25; - } - __pyx_L25:; - goto __pyx_L23; - } - __pyx_L23:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2122 - * - * # 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_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_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_f_sym)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f_sym)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_f_sym)); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2123 - * # 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_e_sym)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_e_sym)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_e_sym)); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2124 - * 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 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(((PyObject*)__pyx_cur_scope)); 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_a = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2125 - * 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) # <<<<<<<<<<<<<< - * - * # Rule string from rule - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_f)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); - __Pyx_INCREF(((PyObject *)__pyx_v_e)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_e)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_e)); - __Pyx_INCREF(((PyObject *)__pyx_v_a)); - PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_a)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); - __Pyx_INCREF(__pyx_v_lex_f_i); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_lex_f_i); - __Pyx_GIVEREF(__pyx_v_lex_f_i); - __Pyx_INCREF(__pyx_v_lex_f_j); - PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_lex_f_j); - __Pyx_GIVEREF(__pyx_v_lex_f_j); - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_nt_inv); - __Pyx_XDECREF(__pyx_v_f_sym); - __Pyx_XDECREF(__pyx_v_off); - __Pyx_XDECREF(__pyx_v_next_nt); - __Pyx_XDECREF(__pyx_v_nt_len); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_e_sym); - __Pyx_XDECREF(__pyx_v_links_inv); - __Pyx_XDECREF(__pyx_v_links_len); - __Pyx_XDECREF(__pyx_v_nt_i); - __Pyx_XDECREF(__pyx_v_lex_f_i); - __Pyx_XDECREF(__pyx_v_lex_f_j); - __Pyx_XDECREF((PyObject *)__pyx_v_f); - __Pyx_XDECREF((PyObject *)__pyx_v_e); - __Pyx_XDECREF(__pyx_v_a); - __Pyx_XDECREF(__pyx_v_sub); - __Pyx_XDECREF(__pyx_v_link); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_f = 0; - PyObject *__pyx_v_e = 0; - PyObject *__pyx_v_a = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("fmt_rule (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__a,0}; - PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__f)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 2128; __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 = 2128; __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 = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_f = values[0]; - __pyx_v_e = values[1]; - __pyx_v_a = values[2]; - } - 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 = 2128; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f, __pyx_v_e, __pyx_v_a); - __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 */ - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2129 - * # 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) - * - */ - -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; - 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); - 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_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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = 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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __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 = 2129; __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)) { - __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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; - } - for (;;) { - if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #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 = 2129; __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 = 2129; __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 = 2129; __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 = 2129; __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(); - else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_packed); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_packed); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_packed = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_150), __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __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 = 2129; __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 = 2129; __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 = 2129; __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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2128 - * - * # 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) - */ - -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; - 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; - 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); - 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_a = __pyx_v_a; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_a); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2129 - * # 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_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); 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_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(((PyObject*)__pyx_cur_scope)); 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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __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[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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_a_str = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2130 - * 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) # <<<<<<<<<<<<<< - * - * # Lookup online stats for phrase pair (f, e). Return None if no match. - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_151), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __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 = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f); - __Pyx_GIVEREF(__pyx_v_f); - __Pyx_INCREF(__pyx_v_e); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_e); - __Pyx_GIVEREF(__pyx_v_e); - __Pyx_INCREF(__pyx_v_a_str); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_a_str); - __Pyx_GIVEREF(__pyx_v_a_str); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.fmt_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_a_str); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_f = 0; - PyObject *__pyx_v_e = 0; - PyObject *__pyx_v_ctx_name = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("online_ctx_lookup (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__ctx_name,0}; - PyObject* values[3] = {0,0,0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2134 - * # 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): # <<<<<<<<<<<<<< - * if self.online: - * stats = self.online_stats[ctx_name] - */ - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__f)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 2134; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx_name); - if (value) { values[2] = value; kw_args--; } - } - } - 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 = 2134; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_f = values[0]; - __pyx_v_e = values[1]; - __pyx_v_ctx_name = values[2]; - } - 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 = 2134; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_lookup(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f, __pyx_v_e, __pyx_v_ctx_name); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_lookup(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_ctx_name) { - PyObject *__pyx_v_stats = NULL; - PyObject *__pyx_v_fcount = NULL; - PyObject *__pyx_v_fsample_count = NULL; - PyObject *__pyx_v_d = NULL; - PyObject *__pyx_v_paircount = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - 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; - __Pyx_RefNannySetupContext("online_ctx_lookup", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2135 - * # IMPORTANT: use get() to avoid adding items to defaultdict - * 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) - */ - __pyx_t_1 = (__pyx_v_self->online != 0); - if (__pyx_t_1) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2136 - * 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 (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_stats = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2137 - * 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 = 2137; __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 = 2137; __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 = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f); - __Pyx_GIVEREF(__pyx_v_f); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __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_2)); __pyx_t_2 = 0; - __pyx_v_fcount = __pyx_t_4; - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2138 - * 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 = 2138; __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 = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __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 = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f); - __Pyx_GIVEREF(__pyx_v_f); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_v_fsample_count = __pyx_t_3; - __pyx_t_3 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2139 - * 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_f, stats.bilex_e, stats.bilex_fe) - */ - __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 = 2139; __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 = 2139; __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 = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_f); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f); - __Pyx_GIVEREF(__pyx_v_f); - __Pyx_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None); - __Pyx_GIVEREF(Py_None); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); 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_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_d = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2140 - * 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_f, stats.bilex_e, stats.bilex_fe) - * return None - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_d); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __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 = 2140; __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 = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_e); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_e); - __Pyx_GIVEREF(__pyx_v_e); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); 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); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_2 = __pyx_t_5; - __pyx_t_5 = 0; - } else { - __Pyx_INCREF(__pyx_int_0); - __pyx_t_2 = __pyx_int_0; - } - __pyx_v_paircount = __pyx_t_2; - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2141 - * d = stats.phrases_fe.get(f, None) - * paircount = d.get(e, 0) if d else 0 - * return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe) # <<<<<<<<<<<<<< - * return None - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_152); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __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_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_e); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_fcount); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fcount); - __Pyx_GIVEREF(__pyx_v_fcount); - __Pyx_INCREF(__pyx_v_fsample_count); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_fsample_count); - __Pyx_GIVEREF(__pyx_v_fsample_count); - __Pyx_INCREF(__pyx_v_paircount); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_paircount); - __Pyx_GIVEREF(__pyx_v_paircount); - PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_5 = 0; - __pyx_t_4 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2142 - * paircount = d.get(e, 0) if d else 0 - * return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe) - * return None # <<<<<<<<<<<<<< - * - * # Find all phrases that we might try to extract - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __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.HieroCachingRuleFactory.online_ctx_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_stats); - __Pyx_XDECREF(__pyx_v_fcount); - __Pyx_XDECREF(__pyx_v_fsample_count); - __Pyx_XDECREF(__pyx_v_d); - __Pyx_XDECREF(__pyx_v_paircount); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_34get_f_phrases(PyObject *__pyx_v_self, PyObject *__pyx_v_f_words); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_34get_f_phrases(PyObject *__pyx_v_self, PyObject *__pyx_v_f_words) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_f_phrases (wrapper)", 0); - __pyx_r = __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)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* 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 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; - PyObject *__pyx_v_lex_i = 0; - PyObject *__pyx_v_lex_j = 0; - PyObject *__pyx_v_wc = 0; - PyObject *__pyx_v_ntc = 0; - PyObject *__pyx_v_syms = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("extract (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__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,0}; - PyObject* values[7] = {0,0,0,0,0,0,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 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__f_i)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 2152; __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 = 2152; __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 = 2152; __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 = 2152; __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 = 2152; __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 = 2152; __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 = 2152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - } - __pyx_v_f_i = values[0]; - __pyx_v_f_j = values[1]; - __pyx_v_lex_i = values[2]; - __pyx_v_lex_j = values[3]; - __pyx_v_wc = values[4]; - __pyx_v_ntc = values[5]; - __pyx_v_syms = values[6]; - } - 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 = 2152; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_self, __pyx_v_f_i, __pyx_v_f_j, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_v_ntc, __pyx_v_syms); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152 - * 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: - */ - -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_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; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - 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_cur_scope = __pyx_outer_scope; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2154 - * 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 - */ - if (unlikely(!__pyx_cur_scope->__pyx_v_f_len)) { __Pyx_RaiseClosureNameError("f_len"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2154; __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 = 2154; __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 = 2154; __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 = 2154; __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 = 2154; __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 = 2154; __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 = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2154; __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 = 2154; __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 = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __pyx_t_5; - } else { - __pyx_t_6 = __pyx_t_3; - } - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2155 - * # Phrase extraction limits - * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: - * return # <<<<<<<<<<<<<< - * # Extend with word - * if wc + ntc < self.max_length: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2157 - * 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 = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_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 = 2157; __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_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2158 - * # 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 = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2159 - * 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_syms); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_syms); - __Pyx_GIVEREF(__pyx_v_syms); - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2160 - * 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) - * phrases.add((f, new_lex_i, new_lex_j)) - */ - __Pyx_INCREF(__pyx_v_f_j); - __pyx_t_1 = __pyx_v_f_j; - __Pyx_INCREF(__pyx_v_lex_i); - __pyx_t_2 = __pyx_v_lex_i; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_6) { - __Pyx_INCREF(__pyx_t_1); - __pyx_t_4 = __pyx_t_1; - } else { - __Pyx_INCREF(__pyx_t_2); - __pyx_t_4 = __pyx_t_2; - } - __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_lex_i = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2161 - * f = Phrase(syms) - * 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) - */ - __Pyx_INCREF(__pyx_v_f_j); - __pyx_t_1 = __pyx_v_f_j; - __Pyx_INCREF(__pyx_v_lex_j); - __pyx_t_4 = __pyx_v_lex_j; - __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[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_6) { - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_t_1; - } else { - __Pyx_INCREF(__pyx_t_4); - __pyx_t_2 = __pyx_t_4; - } - __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_2); __pyx_t_2 = 0; - __pyx_v_new_lex_j = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2162 - * 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 = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 2162; __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 = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_f)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); - __Pyx_INCREF(__pyx_v_new_lex_i); - PyTuple_SET_ITEM(__pyx_t_1, 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_1, 2, __pyx_v_new_lex_j); - __Pyx_GIVEREF(__pyx_v_new_lex_j); - __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2163 - * 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_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2163; __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 = 2163; __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_1, __pyx_v_new_lex_i, __pyx_v_new_lex_j, __pyx_t_2, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2163; __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2164 - * 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 = 2164; __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_L4:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2166 - * 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 = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_6) { - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __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); - } else { - __pyx_t_3 = __pyx_t_6; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2168 - * 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 = 2168; __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 = 2168; __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_4, __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 = 2168; __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; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2170 - * 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_2 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __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_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2171 - * # 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 = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = (!__pyx_t_3); - if (!__pyx_t_6) { - __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_ntc, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __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 = 2171; __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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__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_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __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; - } else { - __pyx_t_3 = __pyx_t_6; - } - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2172 - * 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: - */ - __pyx_t_4 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__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 = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2173 - * 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_syms); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_syms); - __Pyx_GIVEREF(__pyx_v_syms); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_XDECREF(((PyObject *)__pyx_v_f)); - __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_4); - __pyx_t_4 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2174 - * 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_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_3) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2175 - * 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 = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(((PyObject *)__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 = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_v_f)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_f)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); - __Pyx_INCREF(__pyx_v_lex_i); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_lex_i); - __Pyx_GIVEREF(__pyx_v_lex_i); - __Pyx_INCREF(__pyx_v_lex_j); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_lex_j); - __Pyx_GIVEREF(__pyx_v_lex_j); - __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - goto __pyx_L8; - } - __pyx_L8:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2176 - * 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_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __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 = 2176; __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_4, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_t_1, __pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __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; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2177 - * 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_2 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L7; - } - __pyx_L7:; - goto __pyx_L6; - } - __pyx_L6:; - - __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_7); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_f_phrases.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_f); - __Pyx_XDECREF(__pyx_v_new_lex_i); - __Pyx_XDECREF(__pyx_v_new_lex_j); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2147 - * # (Used for EGivenFCoherent) - * # Return set of (fphrase, lex_i, lex_j) - * def get_f_phrases(self, f_words): # <<<<<<<<<<<<<< - * - * f_len = len(f_words) - */ - -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; - long __pyx_v_f_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - long __pyx_t_3; - 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; - __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); - 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_f_words = __pyx_v_f_words; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_words); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_words); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2149 - * def get_f_phrases(self, f_words): - * - * f_len = len(f_words) # <<<<<<<<<<<<<< - * phrases = set() # (fphrase, lex_i, lex_j) - * - */ - __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 = 2149; __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 = 2149; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150 - * - * 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 = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_cur_scope->__pyx_v_phrases = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152 - * 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_155, ((PyObject*)__pyx_cur_scope), __pyx_n_s_102, ((PyObject *)__pyx_k_codeobj_154)); 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_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_extract = __pyx_t_1; - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2180 - * - * # 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, []) - * - */ - __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_v_f_i = 0; __pyx_v_f_i < __pyx_t_3; __pyx_v_f_i++) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2181 - * # 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 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __pyx_cur_scope->__pyx_v_f_len; - __Pyx_INCREF(__pyx_t_5); - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_4, __pyx_t_5, __pyx_int_neg_1, __pyx_int_0, __pyx_int_0, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __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_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2183 - * extract(f_i, f_i, f_len, -1, 0, 0, []) - * - * return phrases # <<<<<<<<<<<<<< - * - * # Drop online stats for a context - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrases)); - __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_phrases); - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_f_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_ctx_name = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("drop_ctx (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctx_name,0}; - PyObject* values[1] = {0}; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2186 - * - * # Drop online stats for a context - * def drop_ctx(self, ctx_name=None): # <<<<<<<<<<<<<< - * self.online_stats.pop(ctx_name, None) - * - */ - values[0] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - 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__ctx_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, "drop_ctx") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_ctx_name = values[0]; - } - 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 = 2186; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_ctx_name); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_ctx_name) { - 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("drop_ctx", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2187 - * # 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 = 2187; __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 = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_ctx_name); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ctx_name); - __Pyx_GIVEREF(__pyx_v_ctx_name); - __Pyx_INCREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None); - __Pyx_GIVEREF(Py_None); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.drop_ctx", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_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 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; - PyObject *__pyx_v_j = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("span_check (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vec,&__pyx_n_s__i,&__pyx_n_s__j,0}; - PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__vec)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 2190; __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 = 2190; __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 = 2190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_vec = values[0]; - __pyx_v_i = values[1]; - __pyx_v_j = values[2]; - } - 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 = 2190; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16span_check(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190 - * - * # Spans are _inclusive_ on both ends [i, j] - * def span_check(vec, i, j): # <<<<<<<<<<<<<< - * k = i - * while k <= j: - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { - PyObject *__pyx_v_k = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("span_check", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2191 - * # Spans are _inclusive_ on both ends [i, j] - * def span_check(vec, i, j): - * k = i # <<<<<<<<<<<<<< - * while k <= j: - * if vec[k]: - */ - __Pyx_INCREF(__pyx_v_i); - __pyx_v_k = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2192 - * def span_check(vec, i, j): - * k = i - * while k <= j: # <<<<<<<<<<<<<< - * if vec[k]: - * 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 = 2192; __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 = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_2) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2193 - * k = i - * while k <= j: - * if vec[k]: # <<<<<<<<<<<<<< - * return False - * k += 1 - */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __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 = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2194 - * while k <= j: - * if vec[k]: - * return False # <<<<<<<<<<<<<< - * k += 1 - * return True - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - goto __pyx_L5; - } - __pyx_L5:; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2195 - * 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 = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_k); - __pyx_v_k = __pyx_t_1; - __pyx_t_1 = 0; - } - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196 - * return False - * k += 1 - * return True # <<<<<<<<<<<<<< - * - * def span_inc(vec, i, j): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cdec.sa._sa.span_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_k); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* 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 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; - PyObject *__pyx_v_j = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("span_inc (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vec,&__pyx_n_s__i,&__pyx_n_s__j,0}; - PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__vec)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 2198; __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 = 2198; __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 = 2198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_vec = values[0]; - __pyx_v_i = values[1]; - __pyx_v_j = values[2]; - } - 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 = 2198; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_18span_inc(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198 - * return True - * - * def span_inc(vec, i, j): # <<<<<<<<<<<<<< - * k = i - * while k <= j: - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { - PyObject *__pyx_v_k = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - 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("span_inc", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2199 - * - * def span_inc(vec, i, j): - * k = i # <<<<<<<<<<<<<< - * while k <= j: - * vec[k] += 1 - */ - __Pyx_INCREF(__pyx_v_i); - __pyx_v_k = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2200 - * def span_inc(vec, i, j): - * k = i - * while k <= j: # <<<<<<<<<<<<<< - * vec[k] += 1 - * 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 = 2200; __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 = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_2) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2201 - * k = i - * while k <= j: - * vec[k] += 1 # <<<<<<<<<<<<<< - * k += 1 - * - */ - __Pyx_INCREF(__pyx_v_k); - __pyx_t_1 = __pyx_v_k; - __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __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 = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202 - * 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 = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_k); - __pyx_v_k = __pyx_t_1; - __pyx_t_1 = 0; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.span_inc", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_k); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* 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 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; - PyObject *__pyx_v_j = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("span_dec (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vec,&__pyx_n_s__i,&__pyx_n_s__j,0}; - PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - 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__vec)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - 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 = 2204; __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 = 2204; __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 = 2204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_vec = values[0]; - __pyx_v_i = values[1]; - __pyx_v_j = values[2]; - } - 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 = 2204; __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(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_20span_dec(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204 - * k += 1 - * - * def span_dec(vec, i, j): # <<<<<<<<<<<<<< - * k = i - * while k <= j: - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { - PyObject *__pyx_v_k = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - 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("span_dec", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2205 - * - * def span_dec(vec, i, j): - * k = i # <<<<<<<<<<<<<< - * while k <= j: - * vec[k] -= 1 - */ - __Pyx_INCREF(__pyx_v_i); - __pyx_v_k = __pyx_v_i; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2206 - * def span_dec(vec, i, j): - * k = i - * while k <= j: # <<<<<<<<<<<<<< - * vec[k] -= 1 - * 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 = 2206; __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 = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!__pyx_t_2) break; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2207 - * k = i - * while k <= j: - * vec[k] -= 1 # <<<<<<<<<<<<<< - * k += 1 - */ - __Pyx_INCREF(__pyx_v_k); - __pyx_t_1 = __pyx_v_k; - __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2207; __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 = 2207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2207; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2208 - * 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 = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_k); - __pyx_v_k = __pyx_t_1; - __pyx_t_1 = 0; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.span_dec", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_k); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __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_2sa_3_sa_13FeatureVector___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":7 - * - * cdef class FeatureVector: - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.names = IntList(INITIAL_CAPACITY, INCREMENT) - * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) - */ - -static int __pyx_pf_4cdec_2sa_3_sa_13FeatureVector___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self) { - int __pyx_r; - __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("__cinit__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":8 - * cdef class FeatureVector: - * def __cinit__(self): - * self.names = IntList(INITIAL_CAPACITY, INCREMENT) # <<<<<<<<<<<<<< - * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__INITIAL_CAPACITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__INCREMENT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __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[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->names); - __Pyx_DECREF(((PyObject *)__pyx_v_self->names)); - __pyx_v_self->names = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":9 - * def __cinit__(self): - * self.names = IntList(INITIAL_CAPACITY, INCREMENT) - * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) # <<<<<<<<<<<<<< - * - * def set(self, unsigned name, float value): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__INITIAL_CAPACITY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__INCREMENT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 9; __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[13]; __pyx_lineno = 9; __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); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->values); - __Pyx_DECREF(((PyObject *)__pyx_v_self->values)); - __pyx_v_self->values = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_3); - __pyx_t_3 = 0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - unsigned int __pyx_v_name; - float __pyx_v_value; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__value,0}; - PyObject* values[2] = {0,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__name)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_name = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_name == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_value = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.set", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self), __pyx_v_name, __pyx_v_value); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":11 - * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) - * - * def set(self, unsigned name, float value): # <<<<<<<<<<<<<< - * self.names.append(name) - * self.values.append(value) - */ - -static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self, unsigned int __pyx_v_name, float __pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("set", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":12 - * - * def set(self, unsigned name, float value): - * self.names.append(name) # <<<<<<<<<<<<<< - * self.values.append(value) - * - */ - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->names), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 12; __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; - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":13 - * def set(self, unsigned name, float value): - * self.names.append(name) - * self.values.append(value) # <<<<<<<<<<<<<< - * - * def __iter__(self): - */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->values), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __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; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.set", __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_13FeatureVector_6generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_4__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":15 - * self.values.append(value) - * - * def __iter__(self): # <<<<<<<<<<<<<< - * cdef unsigned i - * for i in range(self.names.len): - */ - -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; - 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); - if (unlikely(!__pyx_cur_scope)) { - __Pyx_RefNannyFinishContext(); - return NULL; - } - __Pyx_GOTREF(__pyx_cur_scope); - __pyx_cur_scope->__pyx_v_self = __pyx_v_self; - __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); - { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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); - PyObject *__pyx_r = NULL; - int __pyx_t_1; - unsigned int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("None", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - case 1: goto __pyx_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":17 - * def __iter__(self): - * cdef unsigned i - * for i in range(self.names.len): # <<<<<<<<<<<<<< - * yield (FD.word(self.names[i]), self.values[i]) - * - */ - __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->names->len; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_cur_scope->__pyx_v_i = __pyx_t_2; - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":18 - * cdef unsigned i - * for i in range(self.names.len): - * yield (FD.word(self.names[i]), self.values[i]) # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self->names), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_4cdec_2sa_3_sa_FD->__pyx_vtab)->word(__pyx_v_4cdec_2sa_3_sa_FD, __pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self->values), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __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[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_r = ((PyObject *)__pyx_t_6); - __pyx_t_6 = 0; - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_r); - __pyx_generator->resume_label = -1; - __Pyx_Generator_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return NULL; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_8__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_8__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str__(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self)); - __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 */ - -/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":21 - * - * def __str__(self): - * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< - * - * cdef class Scorer: - */ - -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; - 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); - 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_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_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("cdec.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 */ -{ - 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); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - 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_L6_resume_from_yield; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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))) { - __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; - } - 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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_feat); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_feat); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_feat = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_156), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_r = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - /* return from generator, yielding value */ - __pyx_generator->resume_label = 1; - return __pyx_r; - __pyx_L6_resume_from_yield:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - PyErr_SetNone(PyExc_StopIteration); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("genexpr", __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; -} - -/* "/home/mdenkows/cdec/python/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) - * - */ - -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; - 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("__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); - 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); - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":21 - * - * def __str__(self): - * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< - * - * cdef class Scorer: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); 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_2 = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __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[13]; __pyx_lineno = 21; __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[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_4cdec_2sa_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_4cdec_2sa_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_models = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __Pyx_INCREF(__pyx_args); - __pyx_v_models = __pyx_args; - __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)__pyx_v_self), __pyx_v_models); - __Pyx_XDECREF(__pyx_v_models); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":25 - * cdef class Scorer: - * cdef models - * def __init__(self, *models): # <<<<<<<<<<<<<< - * names = [FD.index(model.__name__) for model in models] - * self.models = zip(names, models) - */ - -static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_self, PyObject *__pyx_v_models) { - PyObject *__pyx_v_names = NULL; - PyObject *__pyx_v_model = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - char *__pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":26 - * cdef models - * def __init__(self, *models): - * names = [FD.index(model.__name__) for model in models] # <<<<<<<<<<<<<< - * self.models = zip(names, models) - * - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = ((PyObject *)__pyx_v_models); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - for (;;) { - 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[13]; __pyx_lineno = 26; __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[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - __Pyx_XDECREF(__pyx_v_model); - __pyx_v_model = __pyx_t_4; - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s____name__); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(((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; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_names = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":27 - * def __init__(self, *models): - * names = [FD.index(model.__name__) for model in models] - * self.models = zip(names, models) # <<<<<<<<<<<<<< - * - * cdef FeatureVector score(self, ctx): - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_names)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_names)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_names)); - __Pyx_INCREF(((PyObject *)__pyx_v_models)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_models)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_models)); - __pyx_t_2 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->models); - __Pyx_DECREF(__pyx_v_self->models); - __pyx_v_self->models = __pyx_t_2; - __pyx_t_2 = 0; - - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("cdec.sa._sa.Scorer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_names); - __Pyx_XDECREF(__pyx_v_model); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":29 - * self.models = zip(names, models) - * - * cdef FeatureVector score(self, ctx): # <<<<<<<<<<<<<< - * cdef FeatureVector scores = FeatureVector() - * for name, model in self.models: - */ - -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) { - struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_scores = 0; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_model = NULL; - struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *(*__pyx_t_8)(PyObject *); - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("score", 0); - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":30 - * - * cdef FeatureVector score(self, ctx): - * cdef FeatureVector scores = FeatureVector() # <<<<<<<<<<<<<< - * for name, model in self.models: - * scores.set(name, model(ctx)) - */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FeatureVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/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)) { - __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; - } - 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 - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - 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 - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - #if CYTHON_COMPILING_IN_CPYTHON - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - { - Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 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[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = NULL; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L6_unpacking_done:; - } - __Pyx_XDECREF(__pyx_v_name); - __pyx_v_name = __pyx_t_5; - __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_v_model); - __pyx_v_model = __pyx_t_6; - __pyx_t_6 = 0; - - /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_v_model, ((PyObject *)__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(((PyObject *)__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_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(((PyObject *)__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; - - /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":33 - * for name, model in self.models: - * scores.set(name, model(ctx)) - * return scores # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __Pyx_INCREF(((PyObject *)__pyx_v_scores)); - __pyx_r = __pyx_v_scores; - goto __pyx_L0; - - __pyx_r = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("cdec.sa._sa.Scorer.score", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_scores); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_model); - __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_FeatureVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o); - p->names = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->values = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_FeatureVector(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p = (struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->names); - Py_CLEAR(p->values); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_FeatureVector(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p = (struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o; - if (p->names) { - e = (*v)(((PyObject*)p->names), a); if (e) return e; - } - if (p->values) { - e = (*v)(((PyObject*)p->values), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_FeatureVector(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p = (struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o; - PyObject* tmp; - tmp = ((PyObject*)p->names); - p->names = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->values); - p->values = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -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)}, - {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*/ - sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa_FeatureVector, /*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_2sa_3_sa_13FeatureVector_8__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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_FeatureVector, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_FeatureVector, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - __pyx_pw_4cdec_2sa_3_sa_13FeatureVector_5__iter__, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_FeatureVector, /*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_FeatureVector, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray __pyx_vtable_4cdec_2sa_3_sa_SuffixArray; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_SuffixArray(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_SuffixArray; - p->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_SuffixArray(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->darray); - Py_CLEAR(p->sa); - Py_CLEAR(p->ha); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_SuffixArray(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o; - if (p->darray) { - e = (*v)(((PyObject*)p->darray), a); if (e) return e; - } - if (p->sa) { - e = (*v)(((PyObject*)p->sa), a); if (e) return e; - } - if (p->ha) { - e = (*v)(((PyObject*)p->ha), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_SuffixArray(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o; - PyObject* tmp; - tmp = ((PyObject*)p->darray); - p->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->sa); - p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->ha); - p->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} -static PyObject *__pyx_sq_item_4cdec_2sa_3_sa_SuffixArray(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_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)}, - {0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_SuffixArray = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_4cdec_2sa_3_sa_SuffixArray, /*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_SuffixArray = { - 0, /*mp_length*/ - __pyx_pw_4cdec_2sa_3_sa_11SuffixArray_3__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_SuffixArray = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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_SuffixArray, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_SuffixArray, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_SuffixArray, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_SuffixArray, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_SuffixArray, /*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_SuffixArray, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o); - p->__pyx_v_word_ids = 0; - p->__pyx_v_words = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o; - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o; - if (p->__pyx_v_word_ids) { - e = (*v)(p->__pyx_v_word_ids, a); if (e) return e; - } - if (p->__pyx_v_words) { - e = (*v)(p->__pyx_v_words, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_word_ids); - p->__pyx_v_word_ids = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_words); - p->__pyx_v_words = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_4_make_lattice, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, /*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_4_make_lattice, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_24_fmt_rule *)o); - p->__pyx_v_a = 0; - p->__pyx_v_self = 0; - 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; - 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); - } 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) { - 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; - if (p->__pyx_v_a) { - e = (*v)(p->__pyx_v_a, 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_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; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_a); - p->__pyx_v_a = 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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*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_24_fmt_rule, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*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_24_fmt_rule, /*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_2sa_3_sa_LCP(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_LCP *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o); - p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); - p->lcp = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_3LCP_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_LCP(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_LCP *p = (struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->sa); - Py_CLEAR(p->lcp); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_LCP(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_LCP *p = (struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o; - if (p->sa) { - e = (*v)(((PyObject*)p->sa), a); if (e) return e; - } - if (p->lcp) { - e = (*v)(((PyObject*)p->lcp), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_LCP(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_LCP *p = (struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o; - PyObject* tmp; - tmp = ((PyObject*)p->sa); - p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->lcp); - p->lcp = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -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)}, - {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*/ - sizeof(struct __pyx_obj_4cdec_2sa_3_sa_LCP), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa_LCP, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_LCP, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_LCP, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_LCP, /*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_LCP, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_17_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_a = 0; - p->__pyx_t_0 = 0; - 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; - 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); - } 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) { - 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; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_a) { - e = (*v)(p->__pyx_v_a, 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_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; - PyObject* tmp; - 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); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_a); - p->__pyx_v_a = 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_2sa_3_sa___pyx_scope_struct_17_genexpr[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 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_17_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_OnlineStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o); - p->samples_f = Py_None; Py_INCREF(Py_None); - p->phrases_f = Py_None; Py_INCREF(Py_None); - p->phrases_e = Py_None; Py_INCREF(Py_None); - p->phrases_fe = Py_None; Py_INCREF(Py_None); - p->phrases_al = Py_None; Py_INCREF(Py_None); - p->bilex_f = Py_None; Py_INCREF(Py_None); - p->bilex_e = Py_None; Py_INCREF(Py_None); - p->bilex_fe = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_OnlineStats(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p = (struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->samples_f); - Py_CLEAR(p->phrases_f); - Py_CLEAR(p->phrases_e); - Py_CLEAR(p->phrases_fe); - Py_CLEAR(p->phrases_al); - Py_CLEAR(p->bilex_f); - Py_CLEAR(p->bilex_e); - Py_CLEAR(p->bilex_fe); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_OnlineStats(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p = (struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o; - if (p->samples_f) { - e = (*v)(p->samples_f, a); if (e) return e; - } - if (p->phrases_f) { - e = (*v)(p->phrases_f, a); if (e) return e; - } - if (p->phrases_e) { - e = (*v)(p->phrases_e, a); if (e) return e; - } - if (p->phrases_fe) { - e = (*v)(p->phrases_fe, a); if (e) return e; - } - if (p->phrases_al) { - e = (*v)(p->phrases_al, a); if (e) return e; - } - if (p->bilex_f) { - e = (*v)(p->bilex_f, a); if (e) return e; - } - if (p->bilex_e) { - e = (*v)(p->bilex_e, a); if (e) return e; - } - if (p->bilex_fe) { - e = (*v)(p->bilex_fe, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_OnlineStats(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p = (struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o; - PyObject* tmp; - tmp = ((PyObject*)p->samples_f); - p->samples_f = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->phrases_f); - p->phrases_f = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->phrases_e); - p->phrases_e = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->phrases_fe); - p->phrases_fe = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->phrases_al); - p->phrases_al = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->bilex_f); - p->bilex_f = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->bilex_e); - p->bilex_e = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->bilex_fe); - p->bilex_fe = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_samples_f(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_samples_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_5__del__(o); - } -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_OnlineStats[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_OnlineStats[] = { - {(char *)"samples_f", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_samples_f, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_samples_f, 0, 0}, - {(char *)"phrases_f", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f, 0, 0}, - {(char *)"phrases_e", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e, 0, 0}, - {(char *)"phrases_fe", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe, 0, 0}, - {(char *)"phrases_al", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al, 0, 0}, - {(char *)"bilex_f", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f, 0, 0}, - {(char *)"bilex_e", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e, 0, 0}, - {(char *)"bilex_fe", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_OnlineStats = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_OnlineStats, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_OnlineStats, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_OnlineStats, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_4cdec_2sa_3_sa_OnlineStats, /*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_OnlineStats, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList __pyx_vtable_4cdec_2sa_3_sa_IntList; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_IntList(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_IntList *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_IntList; - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_7IntList_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_IntList(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_4cdec_2sa_3_sa_7IntList_15__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_2sa_3_sa_IntList(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_2sa_3_sa_IntList(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_7IntList_22__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_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)}, - {0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_IntList = { - __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_4cdec_2sa_3_sa_IntList, /*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_IntList = { - __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__, /*mp_length*/ - __pyx_pw_4cdec_2sa_3_sa_7IntList_20__getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_4cdec_2sa_3_sa_IntList, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_IntList = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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_IntList, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_IntList, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_4cdec_2sa_3_sa_7IntList_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*/ - __pyx_pw_4cdec_2sa_3_sa_7IntList_17__iter__, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_IntList, /*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_IntList, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase __pyx_vtable_4cdec_2sa_3_sa_Phrase; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Phrase(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_Phrase *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - 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; - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_6Phrase_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Phrase(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_4cdec_2sa_3_sa_6Phrase_3__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_2sa_3_sa_Phrase(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_2sa_3_sa_6Phrase_words(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_6Phrase_5words_1__get__(o); -} - -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)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Phrase[] = { - {(char *)"words", __pyx_getprop_4cdec_2sa_3_sa_6Phrase_words, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_Phrase = { - __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_4cdec_2sa_3_sa_Phrase, /*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_Phrase = { - __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__, /*mp_length*/ - __pyx_pw_4cdec_2sa_3_sa_6Phrase_27__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Phrase = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - __pyx_pw_4cdec_2sa_3_sa_6Phrase_21__cmp__, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &__pyx_tp_as_sequence_Phrase, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_Phrase, /*tp_as_mapping*/ - __pyx_pw_4cdec_2sa_3_sa_6Phrase_23__hash__, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_4cdec_2sa_3_sa_6Phrase_5__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*/ - __pyx_pw_4cdec_2sa_3_sa_6Phrase_29__iter__, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_Phrase, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_4cdec_2sa_3_sa_Phrase, /*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_Phrase, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o); - p->children = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_8TrieNode_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieNode(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->children); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_TrieNode(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o; - if (p->children) { - e = (*v)(p->children, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_TrieNode(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o; - PyObject* tmp; - tmp = ((PyObject*)p->children); - p->children = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_8TrieNode_children(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_8TrieNode_children(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_5__del__(o); - } -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_TrieNode[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_TrieNode[] = { - {(char *)"children", __pyx_getprop_4cdec_2sa_3_sa_8TrieNode_children, __pyx_setprop_4cdec_2sa_3_sa_8TrieNode_children, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieNode = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_TrieNode, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_TrieNode, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_TrieNode, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_4cdec_2sa_3_sa_TrieNode, /*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_TrieNode, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_2_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_line = 0; - p->__pyx_t_0 = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)o; - PyObject_GC_UnTrack(o); - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_line) { - e = (*v)(p->__pyx_v_line, 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_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_line); - p->__pyx_v_line = 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_2sa_3_sa___pyx_scope_struct_2_genexpr[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_2_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static 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[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_1_read_bitext *)o); - p->__pyx_v_fp = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o, visitproc v, void *a) { - int e; - 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; - if (p->__pyx_v_fp) { - e = (*v)(p->__pyx_v_fp, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { - 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* tmp; - tmp = ((PyObject*)p->__pyx_v_fp); - p->__pyx_v_fp = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_1_read_bitext, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, /*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_1_read_bitext, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_29_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_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; - 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); - } 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) { - 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; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_feat) { - e = (*v)(p->__pyx_v_feat, a); if (e) return e; - } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_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; - PyObject* tmp; - 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); - 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_2sa_3_sa___pyx_scope_struct_29_genexpr[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 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_29_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static 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 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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *)o); - p->__pyx_v_extract = 0; - p->__pyx_v_f_len = 0; - p->__pyx_v_f_words = 0; - p->__pyx_v_phrases = 0; - p->__pyx_v_self = 0; - 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; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_extract); - Py_CLEAR(p->__pyx_v_f_len); - 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); - } 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) { - 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; - if (p->__pyx_v_extract) { - e = (*v)(p->__pyx_v_extract, a); if (e) return e; - } - if (p->__pyx_v_f_len) { - e = (*v)(p->__pyx_v_f_len, a); if (e) return e; - } - if (p->__pyx_v_f_words) { - e = (*v)(p->__pyx_v_f_words, a); if (e) return e; - } - if (p->__pyx_v_phrases) { - e = (*v)(p->__pyx_v_phrases, 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_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; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_extract); - p->__pyx_v_extract = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f_len); - p->__pyx_v_f_len = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f_words); - p->__pyx_v_f_words = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_phrases); - p->__pyx_v_phrases = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*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_26_get_f_phrases, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*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_26_get_f_phrases, /*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_2sa_3_sa_ExtendedTrieNode(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p; - PyObject *o = __pyx_tp_new_4cdec_2sa_3_sa_TrieNode(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o); - p->phrase = Py_None; Py_INCREF(Py_None); - p->phrase_location = Py_None; Py_INCREF(Py_None); - p->suffix_link = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_ExtendedTrieNode(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->phrase); - Py_CLEAR(p->phrase_location); - Py_CLEAR(p->suffix_link); - PyObject_GC_Track(o); - __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieNode(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_ExtendedTrieNode(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o; - e = __pyx_tp_traverse_4cdec_2sa_3_sa_TrieNode(o, v, a); if (e) return e; - if (p->phrase) { - e = (*v)(p->phrase, a); if (e) return e; - } - if (p->phrase_location) { - e = (*v)(p->phrase_location, a); if (e) return e; - } - if (p->suffix_link) { - e = (*v)(p->suffix_link, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_ExtendedTrieNode(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o; - PyObject* tmp; - __pyx_tp_clear_4cdec_2sa_3_sa_TrieNode(o); - tmp = ((PyObject*)p->phrase); - p->phrase = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->phrase_location); - p->phrase_location = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->suffix_link); - p->suffix_link = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(o); - } -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_ExtendedTrieNode[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_ExtendedTrieNode[] = { - {(char *)"phrase", __pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase, __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase, 0, 0}, - {(char *)"phrase_location", __pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location, __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location, 0, 0}, - {(char *)"suffix_link", __pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link, __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_4cdec_2sa_3_sa_ExtendedTrieNode, /*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_ExtendedTrieNode, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment __pyx_vtable_4cdec_2sa_3_sa_Alignment; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Alignment(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Alignment; - p->links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9Alignment_5__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Alignment(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->links); - Py_CLEAR(p->sent_index); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_Alignment(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o; - if (p->links) { - e = (*v)(((PyObject*)p->links), a); if (e) return e; - } - if (p->sent_index) { - e = (*v)(((PyObject*)p->sent_index), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_Alignment(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o; - PyObject* tmp; - tmp = ((PyObject*)p->links); - p->links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->sent_index); - p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -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)}, - {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*/ - sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Alignment), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa_Alignment, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_Alignment, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_Alignment, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_Alignment, /*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_Alignment, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_19_input *)o); - p->__pyx_v_alignment = 0; - p->__pyx_v_als = 0; - p->__pyx_v_alslist = 0; - p->__pyx_v_chunklen = 0; - p->__pyx_v_count = 0; - p->__pyx_v_ctx_name = 0; - p->__pyx_v_e = 0; - p->__pyx_v_elist = 0; - p->__pyx_v_extract = 0; - p->__pyx_v_extract_start = 0; - p->__pyx_v_extract_stop = 0; - p->__pyx_v_extracts = 0; - p->__pyx_v_f = 0; - p->__pyx_v_f_syms = 0; - p->__pyx_v_fcount = 0; - p->__pyx_v_fphrases = 0; - p->__pyx_v_frontier = 0; - p->__pyx_v_frontier_nodes = 0; - p->__pyx_v_fwords = 0; - p->__pyx_v_genexpr = 0; - p->__pyx_v_hiero_phrase = 0; - p->__pyx_v_input_match = 0; - p->__pyx_v_intersect_start_time = 0; - p->__pyx_v_intersect_stop_time = 0; - p->__pyx_v_is_shadow_path = 0; - p->__pyx_v_key = 0; - p->__pyx_v_lex_i = 0; - p->__pyx_v_lex_j = 0; - p->__pyx_v_loc = 0; - p->__pyx_v_locs = 0; - p->__pyx_v_max_locs = 0; - p->__pyx_v_meta = 0; - p->__pyx_v_new_frontier = 0; - p->__pyx_v_new_node = 0; - p->__pyx_v_next_states = 0; - p->__pyx_v_node = 0; - p->__pyx_v_nodes_isteps_away_buffer = 0; - p->__pyx_v_pathlen = 0; - p->__pyx_v_phrase = 0; - p->__pyx_v_phrase_location = 0; - p->__pyx_v_prefix = 0; - p->__pyx_v_reachable_buffer = 0; - p->__pyx_v_sa_range = 0; - p->__pyx_v_sample = 0; - p->__pyx_v_scores = 0; - p->__pyx_v_seen_phrases = 0; - p->__pyx_v_self = 0; - p->__pyx_v_spanlen = 0; - p->__pyx_v_stats = 0; - p->__pyx_v_stop_time = 0; - p->__pyx_v_suffix_link = 0; - p->__pyx_v_suffix_link_xcat_index = 0; - p->__pyx_v_word_id = 0; - p->__pyx_v_xcat_index = 0; - p->__pyx_v_xnode = 0; - p->__pyx_v_xroot = 0; - p->__pyx_t_3 = 0; - p->__pyx_t_4 = 0; - p->__pyx_t_5 = 0; - 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; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_alignment); - Py_CLEAR(p->__pyx_v_als); - Py_CLEAR(p->__pyx_v_alslist); - Py_CLEAR(p->__pyx_v_chunklen); - Py_CLEAR(p->__pyx_v_count); - Py_CLEAR(p->__pyx_v_ctx_name); - Py_CLEAR(p->__pyx_v_e); - Py_CLEAR(p->__pyx_v_elist); - Py_CLEAR(p->__pyx_v_extract); - Py_CLEAR(p->__pyx_v_extract_start); - Py_CLEAR(p->__pyx_v_extract_stop); - Py_CLEAR(p->__pyx_v_extracts); - Py_CLEAR(p->__pyx_v_f); - Py_CLEAR(p->__pyx_v_f_syms); - Py_CLEAR(p->__pyx_v_fcount); - Py_CLEAR(p->__pyx_v_fphrases); - Py_CLEAR(p->__pyx_v_frontier); - Py_CLEAR(p->__pyx_v_frontier_nodes); - Py_CLEAR(p->__pyx_v_fwords); - Py_CLEAR(p->__pyx_v_genexpr); - Py_CLEAR(p->__pyx_v_hiero_phrase); - Py_CLEAR(p->__pyx_v_input_match); - Py_CLEAR(p->__pyx_v_intersect_start_time); - Py_CLEAR(p->__pyx_v_intersect_stop_time); - Py_CLEAR(p->__pyx_v_is_shadow_path); - Py_CLEAR(p->__pyx_v_key); - Py_CLEAR(p->__pyx_v_lex_i); - Py_CLEAR(p->__pyx_v_lex_j); - Py_CLEAR(p->__pyx_v_loc); - Py_CLEAR(p->__pyx_v_locs); - Py_CLEAR(p->__pyx_v_max_locs); - Py_CLEAR(p->__pyx_v_meta); - Py_CLEAR(p->__pyx_v_new_frontier); - Py_CLEAR(p->__pyx_v_new_node); - Py_CLEAR(p->__pyx_v_next_states); - Py_CLEAR(p->__pyx_v_node); - Py_CLEAR(p->__pyx_v_nodes_isteps_away_buffer); - Py_CLEAR(p->__pyx_v_pathlen); - Py_CLEAR(p->__pyx_v_phrase); - Py_CLEAR(p->__pyx_v_phrase_location); - Py_CLEAR(p->__pyx_v_prefix); - Py_CLEAR(p->__pyx_v_reachable_buffer); - Py_CLEAR(p->__pyx_v_sa_range); - Py_CLEAR(p->__pyx_v_sample); - Py_CLEAR(p->__pyx_v_scores); - Py_CLEAR(p->__pyx_v_seen_phrases); - Py_CLEAR(p->__pyx_v_self); - Py_CLEAR(p->__pyx_v_spanlen); - Py_CLEAR(p->__pyx_v_stats); - Py_CLEAR(p->__pyx_v_stop_time); - Py_CLEAR(p->__pyx_v_suffix_link); - Py_CLEAR(p->__pyx_v_suffix_link_xcat_index); - Py_CLEAR(p->__pyx_v_word_id); - 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_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); - } 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) { - 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; - if (p->__pyx_v_alignment) { - e = (*v)(p->__pyx_v_alignment, a); if (e) return e; - } - if (p->__pyx_v_als) { - e = (*v)(p->__pyx_v_als, a); if (e) return e; - } - if (p->__pyx_v_alslist) { - e = (*v)(p->__pyx_v_alslist, a); if (e) return e; - } - if (p->__pyx_v_chunklen) { - e = (*v)(((PyObject*)p->__pyx_v_chunklen), a); if (e) return e; - } - if (p->__pyx_v_count) { - e = (*v)(p->__pyx_v_count, a); if (e) return e; - } - if (p->__pyx_v_ctx_name) { - e = (*v)(p->__pyx_v_ctx_name, a); if (e) return e; - } - if (p->__pyx_v_e) { - e = (*v)(p->__pyx_v_e, a); if (e) return e; - } - if (p->__pyx_v_elist) { - e = (*v)(p->__pyx_v_elist, a); if (e) return e; - } - if (p->__pyx_v_extract) { - e = (*v)(p->__pyx_v_extract, a); if (e) return e; - } - if (p->__pyx_v_extract_start) { - e = (*v)(p->__pyx_v_extract_start, a); if (e) return e; - } - if (p->__pyx_v_extract_stop) { - e = (*v)(p->__pyx_v_extract_stop, a); if (e) return e; - } - if (p->__pyx_v_extracts) { - e = (*v)(p->__pyx_v_extracts, a); if (e) return e; - } - if (p->__pyx_v_f) { - e = (*v)(p->__pyx_v_f, a); if (e) return e; - } - if (p->__pyx_v_f_syms) { - e = (*v)(p->__pyx_v_f_syms, a); if (e) return e; - } - if (p->__pyx_v_fcount) { - e = (*v)(p->__pyx_v_fcount, a); if (e) return e; - } - if (p->__pyx_v_fphrases) { - e = (*v)(p->__pyx_v_fphrases, a); if (e) return e; - } - if (p->__pyx_v_frontier) { - e = (*v)(p->__pyx_v_frontier, a); if (e) return e; - } - if (p->__pyx_v_frontier_nodes) { - e = (*v)(p->__pyx_v_frontier_nodes, a); if (e) return e; - } - if (p->__pyx_v_fwords) { - e = (*v)(p->__pyx_v_fwords, a); if (e) return e; - } - if (p->__pyx_v_genexpr) { - e = (*v)(p->__pyx_v_genexpr, a); if (e) return e; - } - if (p->__pyx_v_hiero_phrase) { - e = (*v)(((PyObject*)p->__pyx_v_hiero_phrase), a); if (e) return e; - } - if (p->__pyx_v_input_match) { - e = (*v)(p->__pyx_v_input_match, a); if (e) return e; - } - if (p->__pyx_v_intersect_start_time) { - e = (*v)(p->__pyx_v_intersect_start_time, a); if (e) return e; - } - if (p->__pyx_v_intersect_stop_time) { - e = (*v)(p->__pyx_v_intersect_stop_time, a); if (e) return e; - } - if (p->__pyx_v_is_shadow_path) { - e = (*v)(p->__pyx_v_is_shadow_path, 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_lex_i) { - e = (*v)(p->__pyx_v_lex_i, a); if (e) return e; - } - if (p->__pyx_v_lex_j) { - e = (*v)(p->__pyx_v_lex_j, a); if (e) return e; - } - if (p->__pyx_v_loc) { - e = (*v)(p->__pyx_v_loc, a); if (e) return e; - } - if (p->__pyx_v_locs) { - e = (*v)(p->__pyx_v_locs, a); if (e) return e; - } - if (p->__pyx_v_max_locs) { - e = (*v)(p->__pyx_v_max_locs, a); if (e) return e; - } - if (p->__pyx_v_meta) { - e = (*v)(p->__pyx_v_meta, a); if (e) return e; - } - if (p->__pyx_v_new_frontier) { - e = (*v)(p->__pyx_v_new_frontier, a); if (e) return e; - } - if (p->__pyx_v_new_node) { - e = (*v)(p->__pyx_v_new_node, a); if (e) return e; - } - if (p->__pyx_v_next_states) { - e = (*v)(p->__pyx_v_next_states, a); if (e) return e; - } - if (p->__pyx_v_node) { - e = (*v)(p->__pyx_v_node, a); if (e) return e; - } - if (p->__pyx_v_nodes_isteps_away_buffer) { - e = (*v)(p->__pyx_v_nodes_isteps_away_buffer, a); if (e) return e; - } - if (p->__pyx_v_pathlen) { - e = (*v)(p->__pyx_v_pathlen, a); if (e) return e; - } - if (p->__pyx_v_phrase) { - e = (*v)(p->__pyx_v_phrase, a); if (e) return e; - } - if (p->__pyx_v_phrase_location) { - e = (*v)(((PyObject*)p->__pyx_v_phrase_location), a); if (e) return e; - } - if (p->__pyx_v_prefix) { - e = (*v)(p->__pyx_v_prefix, a); if (e) return e; - } - if (p->__pyx_v_reachable_buffer) { - e = (*v)(p->__pyx_v_reachable_buffer, a); if (e) return e; - } - if (p->__pyx_v_sa_range) { - e = (*v)(p->__pyx_v_sa_range, a); if (e) return e; - } - if (p->__pyx_v_sample) { - e = (*v)(((PyObject*)p->__pyx_v_sample), a); if (e) return e; - } - if (p->__pyx_v_scores) { - e = (*v)(((PyObject*)p->__pyx_v_scores), a); if (e) return e; - } - if (p->__pyx_v_seen_phrases) { - e = (*v)(p->__pyx_v_seen_phrases, 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_spanlen) { - e = (*v)(p->__pyx_v_spanlen, a); if (e) return e; - } - if (p->__pyx_v_stats) { - e = (*v)(p->__pyx_v_stats, a); if (e) return e; - } - if (p->__pyx_v_stop_time) { - e = (*v)(p->__pyx_v_stop_time, a); if (e) return e; - } - if (p->__pyx_v_suffix_link) { - e = (*v)(p->__pyx_v_suffix_link, a); if (e) return e; - } - if (p->__pyx_v_suffix_link_xcat_index) { - e = (*v)(p->__pyx_v_suffix_link_xcat_index, a); if (e) return e; - } - if (p->__pyx_v_word_id) { - e = (*v)(p->__pyx_v_word_id, a); if (e) return e; - } - if (p->__pyx_v_xcat_index) { - e = (*v)(p->__pyx_v_xcat_index, a); if (e) return e; - } - if (p->__pyx_v_xnode) { - e = (*v)(p->__pyx_v_xnode, a); if (e) return e; - } - 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_4) { - e = (*v)(p->__pyx_t_4, a); if (e) return e; - } - if (p->__pyx_t_5) { - e = (*v)(p->__pyx_t_5, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_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; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_alignment); - p->__pyx_v_alignment = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_als); - p->__pyx_v_als = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_alslist); - p->__pyx_v_alslist = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_chunklen); - p->__pyx_v_chunklen = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_count); - p->__pyx_v_count = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_ctx_name); - p->__pyx_v_ctx_name = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_e); - p->__pyx_v_e = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_elist); - p->__pyx_v_elist = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_extract); - p->__pyx_v_extract = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_extract_start); - p->__pyx_v_extract_start = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_extract_stop); - p->__pyx_v_extract_stop = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_extracts); - p->__pyx_v_extracts = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f); - p->__pyx_v_f = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f_syms); - p->__pyx_v_f_syms = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_fcount); - p->__pyx_v_fcount = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_fphrases); - p->__pyx_v_fphrases = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_frontier); - p->__pyx_v_frontier = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_frontier_nodes); - p->__pyx_v_frontier_nodes = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_fwords); - p->__pyx_v_fwords = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_genexpr); - p->__pyx_v_genexpr = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_hiero_phrase); - p->__pyx_v_hiero_phrase = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_input_match); - p->__pyx_v_input_match = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_intersect_start_time); - p->__pyx_v_intersect_start_time = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_intersect_stop_time); - p->__pyx_v_intersect_stop_time = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_is_shadow_path); - p->__pyx_v_is_shadow_path = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_key); - p->__pyx_v_key = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_lex_i); - p->__pyx_v_lex_i = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_lex_j); - p->__pyx_v_lex_j = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_loc); - p->__pyx_v_loc = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_locs); - p->__pyx_v_locs = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_max_locs); - p->__pyx_v_max_locs = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_meta); - p->__pyx_v_meta = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_new_frontier); - p->__pyx_v_new_frontier = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_new_node); - p->__pyx_v_new_node = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_next_states); - p->__pyx_v_next_states = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_node); - p->__pyx_v_node = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_nodes_isteps_away_buffer); - p->__pyx_v_nodes_isteps_away_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_pathlen); - p->__pyx_v_pathlen = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_phrase); - p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_phrase_location); - p->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_prefix); - p->__pyx_v_prefix = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_reachable_buffer); - p->__pyx_v_reachable_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_sa_range); - p->__pyx_v_sa_range = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_sample); - p->__pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_scores); - p->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_seen_phrases); - p->__pyx_v_seen_phrases = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_spanlen); - p->__pyx_v_spanlen = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_stats); - p->__pyx_v_stats = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_stop_time); - p->__pyx_v_stop_time = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_suffix_link); - p->__pyx_v_suffix_link = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_suffix_link_xcat_index); - p->__pyx_v_suffix_link_xcat_index = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_word_id); - p->__pyx_v_word_id = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_xcat_index); - p->__pyx_v_xcat_index = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_xnode); - p->__pyx_v_xnode = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - 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); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_4); - p->__pyx_t_4 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_5); - p->__pyx_t_5 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_19_input[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*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_19_input, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*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_19_input, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_13_decode_words *)o); - p->__pyx_v_syms = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyObject *o) { - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyObject *o, visitproc v, void *a) { - int e; - 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; - if (p->__pyx_v_syms) { - e = (*v)(p->__pyx_v_syms, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyObject *o) { - 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* tmp; - tmp = ((PyObject*)p->__pyx_v_syms); - p->__pyx_v_syms = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_13_decode_words, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, /*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_13_decode_words, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_23_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_i = 0; - p->__pyx_v_j = 0; - p->__pyx_t_0 = 0; - 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; - 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); - } 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) { - 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; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), 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_j) { - e = (*v)(p->__pyx_v_j, 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_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; - PyObject* tmp; - 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); - 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_j); - p->__pyx_v_j = 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_2sa_3_sa___pyx_scope_struct_23_genexpr[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 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_23_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Rule(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_Rule *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o); - p->f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); - p->e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); - p->scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); - p->word_alignments = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Rule(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Rule *p = (struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->f); - Py_CLEAR(p->e); - Py_CLEAR(p->scores); - Py_CLEAR(p->word_alignments); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_Rule(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_Rule *p = (struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o; - if (p->f) { - e = (*v)(((PyObject*)p->f), a); if (e) return e; - } - if (p->e) { - e = (*v)(((PyObject*)p->e), a); if (e) return e; - } - if (p->scores) { - e = (*v)(((PyObject*)p->scores), a); if (e) return e; - } - if (p->word_alignments) { - e = (*v)(p->word_alignments, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_Rule(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Rule *p = (struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o; - PyObject* tmp; - tmp = ((PyObject*)p->f); - p->f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->e); - p->e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->scores); - p->scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->word_alignments); - p->word_alignments = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_4Rule_f(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_4Rule_1f_1__get__(o); -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_4Rule_e(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_4Rule_1e_1__get__(o); -} - -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)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Rule[] = { - {(char *)"f", __pyx_getprop_4cdec_2sa_3_sa_4Rule_f, 0, 0, 0}, - {(char *)"e", __pyx_getprop_4cdec_2sa_3_sa_4Rule_e, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Rule = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - __pyx_pw_4cdec_2sa_3_sa_4Rule_5__cmp__, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - __pyx_pw_4cdec_2sa_3_sa_4Rule_3__hash__, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_4cdec_2sa_3_sa_4Rule_11__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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_Rule, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_Rule, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_Rule, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_4cdec_2sa_3_sa_Rule, /*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_Rule, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_20_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_word = 0; - p->__pyx_t_0 = 0; - 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; - 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); - } 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) { - 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; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_word) { - e = (*v)(p->__pyx_v_word, 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_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; - PyObject* tmp; - 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); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_word); - p->__pyx_v_word = 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_2sa_3_sa___pyx_scope_struct_20_genexpr[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 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_20_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation __pyx_vtable_4cdec_2sa_3_sa_Precomputation; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Precomputation(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Precomputation; - p->precomputed_index = Py_None; Py_INCREF(Py_None); - p->precomputed_collocations = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_14Precomputation_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Precomputation(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p = (struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->precomputed_index); - Py_CLEAR(p->precomputed_collocations); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_Precomputation(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p = (struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o; - if (p->precomputed_index) { - e = (*v)(p->precomputed_index, a); if (e) return e; - } - if (p->precomputed_collocations) { - e = (*v)(p->precomputed_collocations, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_Precomputation(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p = (struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o; - PyObject* tmp; - tmp = ((PyObject*)p->precomputed_index); - p->precomputed_index = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->precomputed_collocations); - p->precomputed_collocations = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -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)}, - {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*/ - sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa_Precomputation, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_Precomputation, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_Precomputation, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_Precomputation, /*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_Precomputation, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *p; - 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__)); - 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_2sa_3_sa___pyx_scope_struct_27___iter__ *)o); - p->__pyx_v_self = 0; - 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; - 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); - } 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) { - 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; - 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) { - 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; - PyObject* tmp; - 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 PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*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_27___iter__, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*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_27___iter__, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static 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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_21_add_instance *)o); - p->__pyx_v_al = 0; - p->__pyx_v_cover = 0; - p->__pyx_v_e_nt_cover = 0; - p->__pyx_v_e_words = 0; - p->__pyx_v_ef_span = 0; - p->__pyx_v_extract = 0; - p->__pyx_v_f_len = 0; - p->__pyx_v_f_words = 0; - p->__pyx_v_fe_span = 0; - p->__pyx_v_rules = 0; - p->__pyx_v_self = 0; - 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; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_al); - Py_CLEAR(p->__pyx_v_cover); - Py_CLEAR(p->__pyx_v_e_nt_cover); - Py_CLEAR(p->__pyx_v_e_words); - Py_CLEAR(p->__pyx_v_ef_span); - Py_CLEAR(p->__pyx_v_extract); - Py_CLEAR(p->__pyx_v_f_len); - Py_CLEAR(p->__pyx_v_f_words); - 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); - } 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) { - 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; - if (p->__pyx_v_al) { - e = (*v)(p->__pyx_v_al, a); if (e) return e; - } - if (p->__pyx_v_cover) { - e = (*v)(p->__pyx_v_cover, a); if (e) return e; - } - if (p->__pyx_v_e_nt_cover) { - e = (*v)(p->__pyx_v_e_nt_cover, a); if (e) return e; - } - if (p->__pyx_v_e_words) { - e = (*v)(p->__pyx_v_e_words, a); if (e) return e; - } - if (p->__pyx_v_ef_span) { - e = (*v)(p->__pyx_v_ef_span, a); if (e) return e; - } - if (p->__pyx_v_extract) { - e = (*v)(p->__pyx_v_extract, a); if (e) return e; - } - if (p->__pyx_v_f_len) { - e = (*v)(p->__pyx_v_f_len, a); if (e) return e; - } - if (p->__pyx_v_f_words) { - e = (*v)(p->__pyx_v_f_words, a); if (e) return e; - } - if (p->__pyx_v_fe_span) { - e = (*v)(p->__pyx_v_fe_span, a); if (e) return e; - } - if (p->__pyx_v_rules) { - e = (*v)(p->__pyx_v_rules, 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_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; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_al); - p->__pyx_v_al = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_cover); - p->__pyx_v_cover = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_e_nt_cover); - p->__pyx_v_e_nt_cover = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_e_words); - p->__pyx_v_e_words = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_ef_span); - p->__pyx_v_ef_span = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_extract); - p->__pyx_v_extract = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f_len); - p->__pyx_v_f_len = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_f_words); - p->__pyx_v_f_words = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_fe_span); - p->__pyx_v_fe_span = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_rules); - p->__pyx_v_rules = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*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_21_add_instance, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*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_21_add_instance, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap __pyx_vtable_4cdec_2sa_3_sa_TrieMap; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieMap(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_TrieMap; - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_7TrieMap_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieMap(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_4cdec_2sa_3_sa_7TrieMap_3__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_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)}, - {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*/ - sizeof(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieMap, /*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*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_TrieMap, /*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_TrieMap, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_18_alignments *)o); - p->__pyx_v_point = 0; - p->__pyx_v_self = 0; - p->__pyx_t_0 = 0; - 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; - 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); - } 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) { - 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; - if (p->__pyx_v_point) { - e = (*v)(p->__pyx_v_point, 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_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_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; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_point); - p->__pyx_v_point = 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_Rule *)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_2sa_3_sa___pyx_scope_struct_18_alignments[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*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_18_alignments, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*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_18_alignments, /*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_2sa_3_sa_VEBIterator(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_2sa_3_sa_VEBIterator(PyObject *o) { - (*Py_TYPE(o)->tp_free)(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)}, - {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*/ - sizeof(struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa_VEBIterator, /*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*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - __pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_VEBIterator, /*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_VEBIterator, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_5_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_word = 0; - p->__pyx_t_0 = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_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_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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_word) { - e = (*v)(p->__pyx_v_word, 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_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)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); - 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_2sa_3_sa___pyx_scope_struct_5_genexpr[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_5_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList __pyx_vtable_4cdec_2sa_3_sa_FloatList; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_FloatList(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_FloatList *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_FloatList; - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9FloatList_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_FloatList(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_4cdec_2sa_3_sa_9FloatList_3__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_2sa_3_sa_FloatList(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_2sa_3_sa_FloatList(PyObject *o, PyObject *i, PyObject *v) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_9FloatList_7__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_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)}, - {0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_FloatList = { - __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_4cdec_2sa_3_sa_FloatList, /*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_FloatList = { - __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__, /*mp_length*/ - __pyx_pw_4cdec_2sa_3_sa_9FloatList_5__getitem__, /*mp_subscript*/ - __pyx_mp_ass_subscript_4cdec_2sa_3_sa_FloatList, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_FloatList = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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_FloatList, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_FloatList, /*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*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_FloatList, /*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_FloatList, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap __pyx_vtable_4cdec_2sa_3_sa_StringMap; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_StringMap(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_StringMap *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_StringMap; - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9StringMap_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_StringMap(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_4cdec_2sa_3_sa_9StringMap_3__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_2sa_3_sa_StringMap[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_StringMap = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_StringMap, /*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_StringMap, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *p; - 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__)))) { - 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__)); - 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_2sa_3_sa___pyx_scope_struct_15___iter__ *)o); - p->__pyx_v_self = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyObject *o) { - 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__))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyObject *o, visitproc v, void *a) { - int e; - 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; - 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_15___iter__(PyObject *o) { - 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* 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); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_15___iter__, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, /*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_15___iter__, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static 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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *p; - 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__)); - 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_2sa_3_sa___pyx_scope_struct_16___str__ *)o); - p->__pyx_v_self = 0; - 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; - 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); - } 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) { - 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; - 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) { - 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; - PyObject* tmp; - 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 PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_16___str__[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 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___str__, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_16___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_2sa_3_sa___pyx_scope_struct_16___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_2sa_3_sa_TrieTable(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o); - p->root = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9TrieTable_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieTable(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->root); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_TrieTable(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o; - if (p->root) { - e = (*v)(p->root, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_TrieTable(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o; - PyObject* tmp; - tmp = ((PyObject*)p->root); - p->root = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9TrieTable_extended(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_extended(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_3__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9TrieTable_count(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_count(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_3__set__(o, v); - } - else { - PyErr_SetString(PyExc_NotImplementedError, "__del__"); - return -1; - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9TrieTable_root(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_root(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_5__del__(o); - } -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_TrieTable[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_TrieTable[] = { - {(char *)"extended", __pyx_getprop_4cdec_2sa_3_sa_9TrieTable_extended, __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_extended, 0, 0}, - {(char *)"count", __pyx_getprop_4cdec_2sa_3_sa_9TrieTable_count, __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_count, 0, 0}, - {(char *)"root", __pyx_getprop_4cdec_2sa_3_sa_9TrieTable_root, __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_root, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieTable = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_TrieTable, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_TrieTable, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_TrieTable, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_4cdec_2sa_3_sa_TrieTable, /*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_TrieTable, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_11_encode_words *)o); - p->__pyx_v_words = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyObject *o) { - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyObject *o, visitproc v, void *a) { - int e; - 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; - if (p->__pyx_v_words) { - e = (*v)(p->__pyx_v_words, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyObject *o) { - 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* tmp; - tmp = ((PyObject*)p->__pyx_v_words); - p->__pyx_v_words = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_11_encode_words, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, /*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_11_encode_words, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_25_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_packed = 0; - p->__pyx_t_0 = 0; - 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; - 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); - } 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) { - 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; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_packed) { - e = (*v)(p->__pyx_v_packed, 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_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; - PyObject* tmp; - 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); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_packed); - p->__pyx_v_packed = 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_2sa_3_sa___pyx_scope_struct_25_genexpr[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 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_25_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_12_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_word = 0; - p->__pyx_t_0 = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_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_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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_word) { - e = (*v)(p->__pyx_v_word, 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_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *)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); - 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_2sa_3_sa___pyx_scope_struct_12_genexpr[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_12_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_6_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_word = 0; - p->__pyx_t_0 = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_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_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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___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_word) { - e = (*v)(p->__pyx_v_word, 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_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)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); - 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_2sa_3_sa___pyx_scope_struct_6_genexpr[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_6_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static 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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *p; - 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)); - 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_2sa_3_sa___pyx_scope_struct_22_form_rule *)o); - p->__pyx_v_links = 0; - p->__pyx_v_self = 0; - 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; - 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); - } 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) { - 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; - if (p->__pyx_v_links) { - e = (*v)(p->__pyx_v_links, 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_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; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_links); - p->__pyx_v_links = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*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_22_form_rule, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*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_22_form_rule, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_10_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v__ = 0; - p->__pyx_v_sym = 0; - p->__pyx_t_0 = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v__) { - e = (*v)(p->__pyx_v__, a); if (e) return e; - } - if (p->__pyx_v_sym) { - e = (*v)(p->__pyx_v_sym, 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_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v__); - p->__pyx_v__ = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_sym); - p->__pyx_v_sym = 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_2sa_3_sa___pyx_scope_struct_10_genexpr[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_10_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB __pyx_vtable_4cdec_2sa_3_sa_VEB; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_VEB(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_VEB *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_VEB; - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_3VEB_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_VEB(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_4cdec_2sa_3_sa_3VEB_3__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_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)}, - {0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_VEB = { - __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - __pyx_pw_4cdec_2sa_3_sa_3VEB_13__contains__, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_VEB = { - __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_VEB = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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_VEB, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_VEB, /*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_2sa_3_sa_3VEB_5__iter__, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_VEB, /*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_VEB, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice[8]; -static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice = 0; - -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)o); - p->__pyx_v_lattice = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o) { - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o, visitproc v, void *a) { - int e; - 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; - if (p->__pyx_v_lattice) { - e = (*v)(p->__pyx_v_lattice, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o) { - 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* tmp; - tmp = ((PyObject*)p->__pyx_v_lattice); - p->__pyx_v_lattice = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_7_decode_lattice, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, /*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_7_decode_lattice, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_PhraseLocation __pyx_vtable_4cdec_2sa_3_sa_PhraseLocation; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_PhraseLocation(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_PhraseLocation; - p->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_PhraseLocation(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->arr); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_PhraseLocation(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o; - if (p->arr) { - e = (*v)(((PyObject*)p->arr), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_PhraseLocation(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o; - PyObject* tmp; - tmp = ((PyObject*)p->arr); - p->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_PhraseLocation[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_PhraseLocation = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_PhraseLocation, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_PhraseLocation, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_PhraseLocation, /*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_PhraseLocation, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer __pyx_vtable_4cdec_2sa_3_sa_Scorer; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Scorer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Scorer; - p->models = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Scorer(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p = (struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->models); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_Scorer(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p = (struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o; - if (p->models) { - e = (*v)(p->models, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_Scorer(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p = (struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o; - PyObject* tmp; - tmp = ((PyObject*)p->models); - p->models = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Scorer[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Scorer = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_Scorer, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_Scorer, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_Scorer, /*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_2sa_3_sa_6Scorer_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa_Scorer, /*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_2sa_3_sa_Sampler(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o); - p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_7Sampler_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Sampler(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p = (struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->sa); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_Sampler(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p = (struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o; - if (p->sa) { - e = (*v)(((PyObject*)p->sa), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_Sampler(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p = (struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o; - PyObject* tmp; - tmp = ((PyObject*)p->sa); - p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -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)}, - {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*/ - sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Sampler), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa_Sampler, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("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*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_Sampler, /*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_Sampler, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet __pyx_vtable_4cdec_2sa_3_sa_Alphabet; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Alphabet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Alphabet; - p->terminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); - p->nonterminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); - p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_8Alphabet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Alphabet(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o; - PyObject_GC_UnTrack(o); - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_4cdec_2sa_3_sa_8Alphabet_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); - --Py_REFCNT(o); - PyErr_Restore(etype, eval, etb); - } - Py_CLEAR(p->terminals); - Py_CLEAR(p->nonterminals); - Py_CLEAR(p->id2sym); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_Alphabet(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o; - if (p->terminals) { - e = (*v)(((PyObject*)p->terminals), a); if (e) return e; - } - if (p->nonterminals) { - e = (*v)(((PyObject*)p->nonterminals), a); if (e) return e; - } - if (p->id2sym) { - e = (*v)(p->id2sym, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_Alphabet(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o; - PyObject* tmp; - tmp = ((PyObject*)p->terminals); - p->terminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->nonterminals); - p->nonterminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->id2sym); - p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_8Alphabet_terminals(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_8Alphabet_9terminals_1__get__(o); -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_8Alphabet_nonterminals(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_8Alphabet_12nonterminals_1__get__(o); -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Alphabet[] = { - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Alphabet[] = { - {(char *)"terminals", __pyx_getprop_4cdec_2sa_3_sa_8Alphabet_terminals, 0, 0, 0}, - {(char *)"nonterminals", __pyx_getprop_4cdec_2sa_3_sa_8Alphabet_nonterminals, 0, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Alphabet = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_Alphabet, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_Alphabet, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_Alphabet, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_4cdec_2sa_3_sa_Alphabet, /*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_Alphabet, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex __pyx_vtable_4cdec_2sa_3_sa_BiLex; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BiLex(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_BiLex; - p->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - p->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - p->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->id2eword = Py_None; Py_INCREF(Py_None); - p->id2fword = Py_None; Py_INCREF(Py_None); - p->eword2id = Py_None; Py_INCREF(Py_None); - p->fword2id = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_BiLex(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p = (struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->col1); - Py_CLEAR(p->col2); - Py_CLEAR(p->f_index); - Py_CLEAR(p->e_index); - Py_CLEAR(p->id2eword); - Py_CLEAR(p->id2fword); - Py_CLEAR(p->eword2id); - Py_CLEAR(p->fword2id); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_BiLex(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p = (struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o; - if (p->col1) { - e = (*v)(((PyObject*)p->col1), a); if (e) return e; - } - if (p->col2) { - e = (*v)(((PyObject*)p->col2), a); if (e) return e; - } - if (p->f_index) { - e = (*v)(((PyObject*)p->f_index), a); if (e) return e; - } - if (p->e_index) { - e = (*v)(((PyObject*)p->e_index), a); if (e) return e; - } - if (p->id2eword) { - e = (*v)(p->id2eword, a); if (e) return e; - } - if (p->id2fword) { - e = (*v)(p->id2fword, a); if (e) return e; - } - if (p->eword2id) { - e = (*v)(p->eword2id, a); if (e) return e; - } - if (p->fword2id) { - e = (*v)(p->fword2id, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_BiLex(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p = (struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o; - PyObject* tmp; - tmp = ((PyObject*)p->col1); - p->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->col2); - p->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->f_index); - p->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->e_index); - p->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->id2eword); - p->id2eword = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->id2fword); - p->id2fword = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->eword2id); - p->eword2id = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->fword2id); - p->fword2id = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -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("get_e_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_f_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_score"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_5BiLex_16write_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*/ - sizeof(struct __pyx_obj_4cdec_2sa_3_sa_BiLex), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa_BiLex, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_BiLex, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_BiLex, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_BiLex, /*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_BiLex, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray __pyx_vtable_4cdec_2sa_3_sa_DataArray; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_DataArray(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_DataArray; - p->word2id = Py_None; Py_INCREF(Py_None); - p->id2word = Py_None; Py_INCREF(Py_None); - p->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9DataArray_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_DataArray(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->word2id); - Py_CLEAR(p->id2word); - Py_CLEAR(p->data); - Py_CLEAR(p->sent_id); - Py_CLEAR(p->sent_index); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_DataArray(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o; - if (p->word2id) { - e = (*v)(p->word2id, a); if (e) return e; - } - if (p->id2word) { - e = (*v)(p->id2word, a); if (e) return e; - } - if (p->data) { - e = (*v)(((PyObject*)p->data), a); if (e) return e; - } - if (p->sent_id) { - e = (*v)(((PyObject*)p->sent_id), a); if (e) return e; - } - if (p->sent_index) { - e = (*v)(((PyObject*)p->sent_index), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_DataArray(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o; - PyObject* tmp; - tmp = ((PyObject*)p->word2id); - p->word2id = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->id2word); - p->id2word = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->data); - p->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->sent_id); - p->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->sent_index); - p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} -static PyObject *__pyx_sq_item_4cdec_2sa_3_sa_DataArray(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_2sa_3_sa_9DataArray_word2id(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_word2id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_id2word(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_id2word(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_data(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_data(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_id(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_5__del__(o); - } -} - -static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_index(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_1__get__(o); -} - -static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_index(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { - if (v) { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_3__set__(o, v); - } - else { - return __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_5__del__(o); - } -} - -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)}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_DataArray[] = { - {(char *)"word2id", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_word2id, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_word2id, 0, 0}, - {(char *)"id2word", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_id2word, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_id2word, 0, 0}, - {(char *)"data", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_data, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_data, 0, 0}, - {(char *)"sent_id", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_id, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_id, 0, 0}, - {(char *)"sent_index", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_index, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_index, 0, 0}, - {0, 0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_DataArray = { - __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_4cdec_2sa_3_sa_DataArray, /*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_DataArray = { - __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__, /*mp_length*/ - __pyx_pw_4cdec_2sa_3_sa_9DataArray_11__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_DataArray = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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_DataArray, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_DataArray, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_DataArray, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_DataArray, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_DataArray, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_4cdec_2sa_3_sa_DataArray, /*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_DataArray, /*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_2sa_3_sa_BitSetIterator(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_2sa_3_sa_BitSetIterator(PyObject *o) { - (*Py_TYPE(o)->tp_free)(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)}, - {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*/ - sizeof(struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa_BitSetIterator, /*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*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - __pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_BitSetIterator, /*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_BitSetIterator, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o); - p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_HieroCachingRuleFactory; - p->rules = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)Py_None); Py_INCREF(Py_None); - p->sampler = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)Py_None); Py_INCREF(Py_None); - p->scorer = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)Py_None); Py_INCREF(Py_None); - p->precomputed_index = Py_None; Py_INCREF(Py_None); - p->precomputed_collocations = Py_None; Py_INCREF(Py_None); - p->precompute_file = Py_None; Py_INCREF(Py_None); - p->max_rank = Py_None; Py_INCREF(Py_None); - p->prev_norm_prefix = Py_None; Py_INCREF(Py_None); - p->fsa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); - p->fda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - p->eda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - p->alignment = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)Py_None); Py_INCREF(Py_None); - p->eid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->fid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->findexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->findexes1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - p->online_stats = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(o, a, k) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->rules); - Py_CLEAR(p->sampler); - Py_CLEAR(p->scorer); - Py_CLEAR(p->precomputed_index); - Py_CLEAR(p->precomputed_collocations); - Py_CLEAR(p->precompute_file); - Py_CLEAR(p->max_rank); - Py_CLEAR(p->prev_norm_prefix); - Py_CLEAR(p->fsa); - Py_CLEAR(p->fda); - Py_CLEAR(p->eda); - Py_CLEAR(p->alignment); - Py_CLEAR(p->eid2symid); - Py_CLEAR(p->fid2symid); - Py_CLEAR(p->findexes); - Py_CLEAR(p->findexes1); - Py_CLEAR(p->online_stats); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o; - if (p->rules) { - e = (*v)(((PyObject*)p->rules), a); if (e) return e; - } - if (p->sampler) { - e = (*v)(((PyObject*)p->sampler), a); if (e) return e; - } - if (p->scorer) { - e = (*v)(((PyObject*)p->scorer), a); if (e) return e; - } - if (p->precomputed_index) { - e = (*v)(p->precomputed_index, a); if (e) return e; - } - if (p->precomputed_collocations) { - e = (*v)(p->precomputed_collocations, a); if (e) return e; - } - if (p->precompute_file) { - e = (*v)(p->precompute_file, a); if (e) return e; - } - if (p->max_rank) { - e = (*v)(p->max_rank, a); if (e) return e; - } - if (p->prev_norm_prefix) { - e = (*v)(p->prev_norm_prefix, a); if (e) return e; - } - if (p->fsa) { - e = (*v)(((PyObject*)p->fsa), a); if (e) return e; - } - if (p->fda) { - e = (*v)(((PyObject*)p->fda), a); if (e) return e; - } - if (p->eda) { - e = (*v)(((PyObject*)p->eda), a); if (e) return e; - } - if (p->alignment) { - e = (*v)(((PyObject*)p->alignment), a); if (e) return e; - } - if (p->eid2symid) { - e = (*v)(((PyObject*)p->eid2symid), a); if (e) return e; - } - if (p->fid2symid) { - e = (*v)(((PyObject*)p->fid2symid), a); if (e) return e; - } - if (p->findexes) { - e = (*v)(((PyObject*)p->findexes), a); if (e) return e; - } - if (p->findexes1) { - e = (*v)(((PyObject*)p->findexes1), a); if (e) return e; - } - if (p->online_stats) { - e = (*v)(p->online_stats, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o; - PyObject* tmp; - tmp = ((PyObject*)p->rules); - p->rules = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->sampler); - p->sampler = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->scorer); - p->scorer = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->precomputed_index); - p->precomputed_index = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->precomputed_collocations); - p->precomputed_collocations = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->precompute_file); - p->precompute_file = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->max_rank); - p->max_rank = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->prev_norm_prefix); - p->prev_norm_prefix = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->fsa); - p->fsa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->fda); - p->fda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->eda); - p->eda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->alignment); - p->alignment = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->eid2symid); - p->eid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->fid2symid); - p->fid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->findexes); - p->findexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->findexes1); - p->findexes1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->online_stats); - p->online_stats = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -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)}, - {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*/ - sizeof(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*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|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*/ - __pyx_tp_traverse_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*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_HieroCachingRuleFactory, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *p; - 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__)); - 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_2sa_3_sa___pyx_scope_struct_28___str__ *)o); - p->__pyx_v_self = 0; - 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; - 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); - } 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) { - 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; - 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) { - 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; - PyObject* tmp; - 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 PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_28___str__[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___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*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - 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_28___str__, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_28___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_2sa_3_sa___pyx_scope_struct_28___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 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[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o); - p->__pyx_v_ngram = 0; - p->__pyx_v_ngram_start = 0; - p->__pyx_v_ngram_starts = 0; - p->__pyx_v_run_start = 0; - p->__pyx_v_self = 0; - p->__pyx_v_veb = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_ngram); - Py_CLEAR(p->__pyx_v_ngram_start); - Py_CLEAR(p->__pyx_v_ngram_starts); - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o; - if (p->__pyx_v_ngram) { - e = (*v)(p->__pyx_v_ngram, a); if (e) return e; - } - if (p->__pyx_v_ngram_start) { - e = (*v)(((PyObject*)p->__pyx_v_ngram_start), a); if (e) return e; - } - if (p->__pyx_v_ngram_starts) { - e = (*v)(p->__pyx_v_ngram_starts, a); if (e) return e; - } - if (p->__pyx_v_run_start) { - e = (*v)(((PyObject*)p->__pyx_v_run_start), 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_veb) { - e = (*v)(((PyObject*)p->__pyx_v_veb), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_ngram); - p->__pyx_v_ngram = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_ngram_start); - p->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_ngram_starts); - p->__pyx_v_ngram_starts = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_run_start); - p->__pyx_v_run_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)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_LCP *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_veb); - p->__pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_3_compute_stats, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, /*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_3_compute_stats, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_14_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_sym = 0; - p->__pyx_t_0 = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o; - PyObject_GC_UnTrack(o); - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_sym) { - e = (*v)(p->__pyx_v_sym, 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_2sa_3_sa___pyx_scope_struct_14_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_sym); - p->__pyx_v_sym = 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_2sa_3_sa___pyx_scope_struct_14_genexpr[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_14_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct____iter__[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *p; - 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__)))) { - 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__)); - 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_2sa_3_sa___pyx_scope_struct____iter__ *)o); - p->__pyx_v_self = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyObject *o) { - 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__))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___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_2sa_3_sa___pyx_scope_struct____iter__(PyObject *o) { - 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* tmp; - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct____iter__[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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____iter__, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct____iter__, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct____iter__, /*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____iter__, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr[8]; -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_8_genexpr *)o); - p->__pyx_outer_scope = 0; - p->__pyx_v_arc = 0; - p->__pyx_v_dist = 0; - p->__pyx_v_node = 0; - p->__pyx_v_sym = 0; - p->__pyx_v_weight = 0; - p->__pyx_t_0 = 0; - p->__pyx_t_3 = 0; - p->__pyx_t_4 = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_arc); - Py_CLEAR(p->__pyx_v_dist); - Py_CLEAR(p->__pyx_v_node); - Py_CLEAR(p->__pyx_v_sym); - Py_CLEAR(p->__pyx_v_weight); - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_arc) { - e = (*v)(p->__pyx_v_arc, a); if (e) return e; - } - if (p->__pyx_v_dist) { - e = (*v)(p->__pyx_v_dist, a); if (e) return e; - } - if (p->__pyx_v_node) { - e = (*v)(p->__pyx_v_node, a); if (e) return e; - } - if (p->__pyx_v_sym) { - e = (*v)(p->__pyx_v_sym, 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_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; - } - if (p->__pyx_t_4) { - e = (*v)(p->__pyx_t_4, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObject *o) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)o; - PyObject* tmp; - tmp = ((PyObject*)p->__pyx_outer_scope); - p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_arc); - p->__pyx_v_arc = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_dist); - p->__pyx_v_dist = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_node); - p->__pyx_v_node = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_sym); - p->__pyx_v_sym = 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_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); - tmp = ((PyObject*)p->__pyx_t_4); - p->__pyx_t_4 = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_8_genexpr, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BitSet(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_2sa_3_sa_6BitSet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; - } - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa_BitSet(PyObject *o) { - { - PyObject *etype, *eval, *etb; - PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); - __pyx_pw_4cdec_2sa_3_sa_6BitSet_3__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_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)}, - {0, 0, 0, 0} -}; - -static PySequenceMethods __pyx_tp_as_sequence_BitSet = { - __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - __pyx_pw_4cdec_2sa_3_sa_6BitSet_19__contains__, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_BitSet = { - __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BitSet = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("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*/ - 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_BitSet, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BitSet, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_4cdec_2sa_3_sa_6BitSet_11__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*/ - __pyx_pw_4cdec_2sa_3_sa_6BitSet_5__iter__, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa_BitSet, /*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_BitSet, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; - -static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence[8]; -static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence = 0; - -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) { - struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *p; - 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)))) { - 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)); - 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_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)o); - p->__pyx_v_lattice = 0; - return o; -} - -static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o) { - 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))) { - __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); - } -} - -static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o, visitproc v, void *a) { - int e; - 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; - if (p->__pyx_v_lattice) { - e = (*v)(p->__pyx_v_lattice, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o) { - 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* tmp; - tmp = ((PyObject*)p->__pyx_v_lattice); - p->__pyx_v_lattice = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence[] = { - {0, 0, 0, 0} -}; - -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*/ - 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*/ - 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_9_decode_sentence, /*tp_traverse*/ - __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, /*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_9_decode_sentence, /*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 PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - __Pyx_NAMESTR("_sa"), - 0, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, - {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, - {&__pyx_n_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 1}, - {&__pyx_n_s_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 1, 1}, - {&__pyx_kp_s_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 0, 1, 0}, - {&__pyx_kp_s_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 0, 1, 0}, - {&__pyx_n_s_107, __pyx_k_107, sizeof(__pyx_k_107), 0, 0, 1, 1}, - {&__pyx_n_s_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 0, 1, 1}, - {&__pyx_kp_s_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 0, 1, 0}, - {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0}, - {&__pyx_kp_s_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 0, 1, 0}, - {&__pyx_kp_s_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 0, 1, 0}, - {&__pyx_kp_s_115, __pyx_k_115, sizeof(__pyx_k_115), 0, 0, 1, 0}, - {&__pyx_kp_s_116, __pyx_k_116, sizeof(__pyx_k_116), 0, 0, 1, 0}, - {&__pyx_kp_s_117, __pyx_k_117, sizeof(__pyx_k_117), 0, 0, 1, 0}, - {&__pyx_kp_s_118, __pyx_k_118, sizeof(__pyx_k_118), 0, 0, 1, 0}, - {&__pyx_kp_s_119, __pyx_k_119, sizeof(__pyx_k_119), 0, 0, 1, 0}, - {&__pyx_kp_s_120, __pyx_k_120, sizeof(__pyx_k_120), 0, 0, 1, 0}, - {&__pyx_kp_s_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 0, 1, 0}, - {&__pyx_kp_s_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 0, 1, 0}, - {&__pyx_n_s_123, __pyx_k_123, sizeof(__pyx_k_123), 0, 0, 1, 1}, - {&__pyx_kp_s_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 0, 1, 0}, - {&__pyx_n_s_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 0, 1, 1}, - {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0}, - {&__pyx_n_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 1}, - {&__pyx_n_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 1}, - {&__pyx_kp_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 0}, - {&__pyx_kp_s_131, __pyx_k_131, sizeof(__pyx_k_131), 0, 0, 1, 0}, - {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0}, - {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0}, - {&__pyx_kp_s_134, __pyx_k_134, sizeof(__pyx_k_134), 0, 0, 1, 0}, - {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 0}, - {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0}, - {&__pyx_kp_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 0}, - {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0}, - {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0}, - {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, - {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0}, - {&__pyx_kp_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0}, - {&__pyx_n_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 1}, - {&__pyx_n_s_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 0, 1, 1}, - {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, - {&__pyx_kp_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 0}, - {&__pyx_kp_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 0}, - {&__pyx_n_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 1}, - {&__pyx_n_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 1}, - {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0}, - {&__pyx_kp_s_158, __pyx_k_158, sizeof(__pyx_k_158), 0, 0, 1, 0}, - {&__pyx_kp_s_161, __pyx_k_161, sizeof(__pyx_k_161), 0, 0, 1, 0}, - {&__pyx_kp_s_165, __pyx_k_165, sizeof(__pyx_k_165), 0, 0, 1, 0}, - {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, - {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, - {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, - {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, - {&__pyx_n_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 1}, - {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, - {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0}, - {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0}, - {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, - {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 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_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, - {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0}, - {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0}, - {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0}, - {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0}, - {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, - {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0}, - {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0}, - {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0}, - {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0}, - {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0}, - {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0}, - {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0}, - {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0}, - {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, - {&__pyx_kp_s_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 0, 1, 0}, - {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0}, - {&__pyx_n_s_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 0, 1, 1}, - {&__pyx_n_s_73, __pyx_k_73, sizeof(__pyx_k_73), 0, 0, 1, 1}, - {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0}, - {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0}, - {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, - {&__pyx_kp_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 0}, - {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 0}, - {&__pyx_kp_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 0}, - {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0}, - {&__pyx_kp_s_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 0, 1, 0}, - {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0}, - {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, - {&__pyx_kp_s_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 0, 1, 0}, - {&__pyx_kp_s_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 0, 1, 0}, - {&__pyx_kp_s_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 0, 1, 0}, - {&__pyx_kp_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 0}, - {&__pyx_kp_s_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 0, 1, 0}, - {&__pyx_kp_s_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 0, 1, 0}, - {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0}, - {&__pyx_kp_s__0, __pyx_k__0, sizeof(__pyx_k__0), 0, 0, 1, 0}, - {&__pyx_kp_s__1, __pyx_k__1, sizeof(__pyx_k__1), 0, 0, 1, 0}, - {&__pyx_n_s__Counter, __pyx_k__Counter, sizeof(__pyx_k__Counter), 0, 0, 1, 1}, - {&__pyx_n_s__END_OF_FILE, __pyx_k__END_OF_FILE, sizeof(__pyx_k__END_OF_FILE), 0, 0, 1, 1}, - {&__pyx_n_s__END_OF_LINE, __pyx_k__END_OF_LINE, sizeof(__pyx_k__END_OF_LINE), 0, 0, 1, 1}, - {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1}, - {&__pyx_n_s__FeatureContext, __pyx_k__FeatureContext, sizeof(__pyx_k__FeatureContext), 0, 0, 1, 1}, - {&__pyx_n_s__GzipFile, __pyx_k__GzipFile, sizeof(__pyx_k__GzipFile), 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_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1}, - {&__pyx_n_s__NULL, __pyx_k__NULL, sizeof(__pyx_k__NULL), 0, 0, 1, 1}, - {&__pyx_n_s__RUSAGE_SELF, __pyx_k__RUSAGE_SELF, sizeof(__pyx_k__RUSAGE_SELF), 0, 0, 1, 1}, - {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 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____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____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 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____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s___columns, __pyx_k___columns, sizeof(__pyx_k___columns), 0, 0, 1, 1}, - {&__pyx_n_s___doquicksort, __pyx_k___doquicksort, sizeof(__pyx_k___doquicksort), 0, 0, 1, 1}, - {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, - {&__pyx_n_s__advance, __pyx_k__advance, sizeof(__pyx_k__advance), 0, 0, 1, 1}, - {&__pyx_n_s__al, __pyx_k__al, sizeof(__pyx_k__al), 0, 0, 1, 1}, - {&__pyx_n_s__alignment, __pyx_k__alignment, sizeof(__pyx_k__alignment), 0, 0, 1, 1}, - {&__pyx_n_s__alignments, __pyx_k__alignments, sizeof(__pyx_k__alignments), 0, 0, 1, 1}, - {&__pyx_n_s__alphabet_size, __pyx_k__alphabet_size, sizeof(__pyx_k__alphabet_size), 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__arity, __pyx_k__arity, sizeof(__pyx_k__arity), 0, 0, 1, 1}, - {&__pyx_n_s__arr, __pyx_k__arr, sizeof(__pyx_k__arr), 0, 0, 1, 1}, - {&__pyx_n_s__arr_high, __pyx_k__arr_high, sizeof(__pyx_k__arr_high), 0, 0, 1, 1}, - {&__pyx_n_s__arr_low, __pyx_k__arr_low, sizeof(__pyx_k__arr_low), 0, 0, 1, 1}, - {&__pyx_n_s__bilex_e, __pyx_k__bilex_e, sizeof(__pyx_k__bilex_e), 0, 0, 1, 1}, - {&__pyx_n_s__bilex_f, __pyx_k__bilex_f, sizeof(__pyx_k__bilex_f), 0, 0, 1, 1}, - {&__pyx_n_s__bilex_fe, __pyx_k__bilex_fe, sizeof(__pyx_k__bilex_fe), 0, 0, 1, 1}, - {&__pyx_n_s__by_slack_factor, __pyx_k__by_slack_factor, sizeof(__pyx_k__by_slack_factor), 0, 0, 1, 1}, - {&__pyx_n_s__category, __pyx_k__category, sizeof(__pyx_k__category), 0, 0, 1, 1}, - {&__pyx_n_s__chain, __pyx_k__chain, sizeof(__pyx_k__chain), 0, 0, 1, 1}, - {&__pyx_n_s__children, __pyx_k__children, sizeof(__pyx_k__children), 0, 0, 1, 1}, - {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1}, - {&__pyx_n_s__cmp, __pyx_k__cmp, sizeof(__pyx_k__cmp), 0, 0, 1, 1}, - {&__pyx_n_s__col, __pyx_k__col, sizeof(__pyx_k__col), 0, 0, 1, 1}, - {&__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__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_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_sentence, __pyx_k__decode_sentence, sizeof(__pyx_k__decode_sentence), 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__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__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1}, - {&__pyx_n_s__e_i, __pyx_k__e_i, sizeof(__pyx_k__e_i), 0, 0, 1, 1}, - {&__pyx_n_s__e_j, __pyx_k__e_j, sizeof(__pyx_k__e_j), 0, 0, 1, 1}, - {&__pyx_n_s__e_span, __pyx_k__e_span, sizeof(__pyx_k__e_span), 0, 0, 1, 1}, - {&__pyx_n_s__e_text, __pyx_k__e_text, sizeof(__pyx_k__e_text), 0, 0, 1, 1}, - {&__pyx_n_s__e_words, __pyx_k__e_words, sizeof(__pyx_k__e_words), 0, 0, 1, 1}, - {&__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__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, - {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, - {&__pyx_n_s__ephrase, __pyx_k__ephrase, sizeof(__pyx_k__ephrase), 0, 0, 1, 1}, - {&__pyx_n_s__eword, __pyx_k__eword, sizeof(__pyx_k__eword), 0, 0, 1, 1}, - {&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1}, - {&__pyx_n_s__extended, __pyx_k__extended, sizeof(__pyx_k__extended), 0, 0, 1, 1}, - {&__pyx_n_s__extract, __pyx_k__extract, sizeof(__pyx_k__extract), 0, 0, 1, 1}, - {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, - {&__pyx_n_s__f_i, __pyx_k__f_i, sizeof(__pyx_k__f_i), 0, 0, 1, 1}, - {&__pyx_n_s__f_j, __pyx_k__f_j, sizeof(__pyx_k__f_j), 0, 0, 1, 1}, - {&__pyx_n_s__f_span, __pyx_k__f_span, sizeof(__pyx_k__f_span), 0, 0, 1, 1}, - {&__pyx_n_s__f_text, __pyx_k__f_text, sizeof(__pyx_k__f_text), 0, 0, 1, 1}, - {&__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__form_rule, __pyx_k__form_rule, sizeof(__pyx_k__form_rule), 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}, - {&__pyx_n_s__from_binary, __pyx_k__from_binary, sizeof(__pyx_k__from_binary), 0, 0, 1, 1}, - {&__pyx_n_s__from_data, __pyx_k__from_data, sizeof(__pyx_k__from_data), 0, 0, 1, 1}, - {&__pyx_n_s__from_iterable, __pyx_k__from_iterable, sizeof(__pyx_k__from_iterable), 0, 0, 1, 1}, - {&__pyx_n_s__from_stats, __pyx_k__from_stats, sizeof(__pyx_k__from_stats), 0, 0, 1, 1}, - {&__pyx_n_s__from_text, __pyx_k__from_text, sizeof(__pyx_k__from_text), 0, 0, 1, 1}, - {&__pyx_n_s__frontier, __pyx_k__frontier, sizeof(__pyx_k__frontier), 0, 0, 1, 1}, - {&__pyx_n_s__fsample_count, __pyx_k__fsample_count, sizeof(__pyx_k__fsample_count), 0, 0, 1, 1}, - {&__pyx_n_s__fsarray, __pyx_k__fsarray, sizeof(__pyx_k__fsarray), 0, 0, 1, 1}, - {&__pyx_n_s__fword, __pyx_k__fword, sizeof(__pyx_k__fword), 0, 0, 1, 1}, - {&__pyx_n_s__fwords, __pyx_k__fwords, sizeof(__pyx_k__fwords), 0, 0, 1, 1}, - {&__pyx_n_s__gc, __pyx_k__gc, sizeof(__pyx_k__gc), 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__getLogger, __pyx_k__getLogger, sizeof(__pyx_k__getLogger), 0, 0, 1, 1}, - {&__pyx_n_s__get_e_id, __pyx_k__get_e_id, sizeof(__pyx_k__get_e_id), 0, 0, 1, 1}, - {&__pyx_n_s__get_f_id, __pyx_k__get_f_id, sizeof(__pyx_k__get_f_id), 0, 0, 1, 1}, - {&__pyx_n_s__get_f_phrases, __pyx_k__get_f_phrases, sizeof(__pyx_k__get_f_phrases), 0, 0, 1, 1}, - {&__pyx_n_s__get_id, __pyx_k__get_id, sizeof(__pyx_k__get_id), 0, 0, 1, 1}, - {&__pyx_n_s__get_next_states, __pyx_k__get_next_states, sizeof(__pyx_k__get_next_states), 0, 0, 1, 1}, - {&__pyx_n_s__get_word, __pyx_k__get_word, sizeof(__pyx_k__get_word), 0, 0, 1, 1}, - {&__pyx_n_s__getchunk, __pyx_k__getchunk, sizeof(__pyx_k__getchunk), 0, 0, 1, 1}, - {&__pyx_n_s__getrusage, __pyx_k__getrusage, sizeof(__pyx_k__getrusage), 0, 0, 1, 1}, - {&__pyx_n_s__gzip, __pyx_k__gzip, sizeof(__pyx_k__gzip), 0, 0, 1, 1}, - {&__pyx_n_s__gzip_or_text, __pyx_k__gzip_or_text, sizeof(__pyx_k__gzip_or_text), 0, 0, 1, 1}, - {&__pyx_n_s__h, __pyx_k__h, sizeof(__pyx_k__h), 0, 0, 1, 1}, - {&__pyx_n_s__high, __pyx_k__high, sizeof(__pyx_k__high), 0, 0, 1, 1}, - {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, - {&__pyx_n_s__ifrom, __pyx_k__ifrom, sizeof(__pyx_k__ifrom), 0, 0, 1, 1}, - {&__pyx_n_s__increment, __pyx_k__increment, sizeof(__pyx_k__increment), 0, 0, 1, 1}, - {&__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_match, __pyx_k__input_match, sizeof(__pyx_k__input_match), 0, 0, 1, 1}, - {&__pyx_n_s__input_span, __pyx_k__input_span, sizeof(__pyx_k__input_span), 0, 0, 1, 1}, - {&__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__iteritems, __pyx_k__iteritems, sizeof(__pyx_k__iteritems), 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}, - {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 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__lattice, __pyx_k__lattice, sizeof(__pyx_k__lattice), 0, 0, 1, 1}, - {&__pyx_n_s__lex_i, __pyx_k__lex_i, sizeof(__pyx_k__lex_i), 0, 0, 1, 1}, - {&__pyx_n_s__lex_j, __pyx_k__lex_j, sizeof(__pyx_k__lex_j), 0, 0, 1, 1}, - {&__pyx_n_s__lhs, __pyx_k__lhs, sizeof(__pyx_k__lhs), 0, 0, 1, 1}, - {&__pyx_n_s__link, __pyx_k__link, sizeof(__pyx_k__link), 0, 0, 1, 1}, - {&__pyx_n_s__link_i, __pyx_k__link_i, sizeof(__pyx_k__link_i), 0, 0, 1, 1}, - {&__pyx_n_s__link_j, __pyx_k__link_j, sizeof(__pyx_k__link_j), 0, 0, 1, 1}, - {&__pyx_n_s__links, __pyx_k__links, sizeof(__pyx_k__links), 0, 0, 1, 1}, - {&__pyx_n_s__logger, __pyx_k__logger, sizeof(__pyx_k__logger), 0, 0, 1, 1}, - {&__pyx_n_s__logging, __pyx_k__logging, sizeof(__pyx_k__logging), 0, 0, 1, 1}, - {&__pyx_n_s__lookup, __pyx_k__lookup, sizeof(__pyx_k__lookup), 0, 0, 1, 1}, - {&__pyx_n_s__low, __pyx_k__low, sizeof(__pyx_k__low), 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__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}, - {&__pyx_n_s__max_chunks, __pyx_k__max_chunks, sizeof(__pyx_k__max_chunks), 0, 0, 1, 1}, - {&__pyx_n_s__max_initial_size, __pyx_k__max_initial_size, sizeof(__pyx_k__max_initial_size), 0, 0, 1, 1}, - {&__pyx_n_s__max_length, __pyx_k__max_length, sizeof(__pyx_k__max_length), 0, 0, 1, 1}, - {&__pyx_n_s__max_nonterminals, __pyx_k__max_nonterminals, sizeof(__pyx_k__max_nonterminals), 0, 0, 1, 1}, - {&__pyx_n_s__max_target_chunks, __pyx_k__max_target_chunks, sizeof(__pyx_k__max_target_chunks), 0, 0, 1, 1}, - {&__pyx_n_s__max_target_length, __pyx_k__max_target_length, sizeof(__pyx_k__max_target_length), 0, 0, 1, 1}, - {&__pyx_n_s__merge, __pyx_k__merge, sizeof(__pyx_k__merge), 0, 0, 1, 1}, - {&__pyx_n_s__meta, __pyx_k__meta, sizeof(__pyx_k__meta), 0, 0, 1, 1}, - {&__pyx_n_s__min_bound, __pyx_k__min_bound, sizeof(__pyx_k__min_bound), 0, 0, 1, 1}, - {&__pyx_n_s__min_dist, __pyx_k__min_dist, sizeof(__pyx_k__min_dist), 0, 0, 1, 1}, - {&__pyx_n_s__min_gap_size, __pyx_k__min_gap_size, sizeof(__pyx_k__min_gap_size), 0, 0, 1, 1}, - {&__pyx_n_s__monitor_cpu, __pyx_k__monitor_cpu, sizeof(__pyx_k__monitor_cpu), 0, 0, 1, 1}, - {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1}, - {&__pyx_n_s__namedtuple, __pyx_k__namedtuple, sizeof(__pyx_k__namedtuple), 0, 0, 1, 1}, - {&__pyx_n_s__new_e_i, __pyx_k__new_e_i, sizeof(__pyx_k__new_e_i), 0, 0, 1, 1}, - {&__pyx_n_s__new_e_j, __pyx_k__new_e_j, sizeof(__pyx_k__new_e_j), 0, 0, 1, 1}, - {&__pyx_n_s__new_lex_i, __pyx_k__new_lex_i, sizeof(__pyx_k__new_lex_i), 0, 0, 1, 1}, - {&__pyx_n_s__new_lex_j, __pyx_k__new_lex_j, sizeof(__pyx_k__new_lex_j), 0, 0, 1, 1}, - {&__pyx_n_s__new_min_bound, __pyx_k__new_min_bound, sizeof(__pyx_k__new_min_bound), 0, 0, 1, 1}, - {&__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_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}, - {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1}, - {&__pyx_n_s__old_last_nt, __pyx_k__old_last_nt, sizeof(__pyx_k__old_last_nt), 0, 0, 1, 1}, - {&__pyx_n_s__online, __pyx_k__online, sizeof(__pyx_k__online), 0, 0, 1, 1}, - {&__pyx_n_s__online_ctx_lookup, __pyx_k__online_ctx_lookup, sizeof(__pyx_k__online_ctx_lookup), 0, 0, 1, 1}, - {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1}, - {&__pyx_n_s__pad, __pyx_k__pad, sizeof(__pyx_k__pad), 0, 0, 1, 1}, - {&__pyx_n_s__paircount, __pyx_k__paircount, sizeof(__pyx_k__paircount), 0, 0, 1, 1}, - {&__pyx_n_s__partition, __pyx_k__partition, sizeof(__pyx_k__partition), 0, 0, 1, 1}, - {&__pyx_n_s__pathlen, __pyx_k__pathlen, sizeof(__pyx_k__pathlen), 0, 0, 1, 1}, - {&__pyx_n_s__pattern2phrase, __pyx_k__pattern2phrase, sizeof(__pyx_k__pattern2phrase), 0, 0, 1, 1}, - {&__pyx_n_s__pattern2phrase_plus, __pyx_k__pattern2phrase_plus, sizeof(__pyx_k__pattern2phrase_plus), 0, 0, 1, 1}, - {&__pyx_n_s__phrase, __pyx_k__phrase, sizeof(__pyx_k__phrase), 0, 0, 1, 1}, - {&__pyx_n_s__phrase_location, __pyx_k__phrase_location, sizeof(__pyx_k__phrase_location), 0, 0, 1, 1}, - {&__pyx_n_s__phrases_al, __pyx_k__phrases_al, sizeof(__pyx_k__phrases_al), 0, 0, 1, 1}, - {&__pyx_n_s__phrases_e, __pyx_k__phrases_e, sizeof(__pyx_k__phrases_e), 0, 0, 1, 1}, - {&__pyx_n_s__phrases_f, __pyx_k__phrases_f, sizeof(__pyx_k__phrases_f), 0, 0, 1, 1}, - {&__pyx_n_s__phrases_fe, __pyx_k__phrases_fe, sizeof(__pyx_k__phrases_fe), 0, 0, 1, 1}, - {&__pyx_n_s__plus_links, __pyx_k__plus_links, sizeof(__pyx_k__plus_links), 0, 0, 1, 1}, - {&__pyx_n_s__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1}, - {&__pyx_n_s__precompute, __pyx_k__precompute, sizeof(__pyx_k__precompute), 0, 0, 1, 1}, - {&__pyx_n_s__precompute_file, __pyx_k__precompute_file, sizeof(__pyx_k__precompute_file), 0, 0, 1, 1}, - {&__pyx_n_s__precompute_rank, __pyx_k__precompute_rank, sizeof(__pyx_k__precompute_rank), 0, 0, 1, 1}, - {&__pyx_n_s__precomputed, __pyx_k__precomputed, sizeof(__pyx_k__precomputed), 0, 0, 1, 1}, - {&__pyx_n_s__q3sort, __pyx_k__q3sort, sizeof(__pyx_k__q3sort), 0, 0, 1, 1}, - {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__reachable, __pyx_k__reachable, sizeof(__pyx_k__reachable), 0, 0, 1, 1}, - {&__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_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__res, __pyx_k__res, sizeof(__pyx_k__res), 0, 0, 1, 1}, - {&__pyx_n_s__reset, __pyx_k__reset, sizeof(__pyx_k__reset), 0, 0, 1, 1}, - {&__pyx_n_s__resource, __pyx_k__resource, sizeof(__pyx_k__resource), 0, 0, 1, 1}, - {&__pyx_n_s__ru_stime, __pyx_k__ru_stime, sizeof(__pyx_k__ru_stime), 0, 0, 1, 1}, - {&__pyx_n_s__ru_utime, __pyx_k__ru_utime, sizeof(__pyx_k__ru_utime), 0, 0, 1, 1}, - {&__pyx_n_s__sa, __pyx_k__sa, sizeof(__pyx_k__sa), 0, 0, 1, 1}, - {&__pyx_n_s__sa_high, __pyx_k__sa_high, sizeof(__pyx_k__sa_high), 0, 0, 1, 1}, - {&__pyx_n_s__sa_low, __pyx_k__sa_low, sizeof(__pyx_k__sa_low), 0, 0, 1, 1}, - {&__pyx_n_s__sample, __pyx_k__sample, sizeof(__pyx_k__sample), 0, 0, 1, 1}, - {&__pyx_n_s__sample_size, __pyx_k__sample_size, sizeof(__pyx_k__sample_size), 0, 0, 1, 1}, - {&__pyx_n_s__sampler, __pyx_k__sampler, sizeof(__pyx_k__sampler), 0, 0, 1, 1}, - {&__pyx_n_s__samples_f, __pyx_k__samples_f, sizeof(__pyx_k__samples_f), 0, 0, 1, 1}, - {&__pyx_n_s__sarray, __pyx_k__sarray, sizeof(__pyx_k__sarray), 0, 0, 1, 1}, - {&__pyx_n_s__scorer, __pyx_k__scorer, sizeof(__pyx_k__scorer), 0, 0, 1, 1}, - {&__pyx_n_s__scores, __pyx_k__scores, sizeof(__pyx_k__scores), 0, 0, 1, 1}, - {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, - {&__pyx_n_s__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1}, - {&__pyx_n_s__set, __pyx_k__set, sizeof(__pyx_k__set), 0, 0, 1, 1}, - {&__pyx_n_s__shortest, __pyx_k__shortest, sizeof(__pyx_k__shortest), 0, 0, 1, 1}, - {&__pyx_n_s__side, __pyx_k__side, sizeof(__pyx_k__side), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, - {&__pyx_n_s__skip, __pyx_k__skip, sizeof(__pyx_k__skip), 0, 0, 1, 1}, - {&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1}, - {&__pyx_n_s__source, __pyx_k__source, sizeof(__pyx_k__source), 0, 0, 1, 1}, - {&__pyx_n_s__span_check, __pyx_k__span_check, sizeof(__pyx_k__span_check), 0, 0, 1, 1}, - {&__pyx_n_s__span_dec, __pyx_k__span_dec, sizeof(__pyx_k__span_dec), 0, 0, 1, 1}, - {&__pyx_n_s__span_inc, __pyx_k__span_inc, sizeof(__pyx_k__span_inc), 0, 0, 1, 1}, - {&__pyx_n_s__spanlen, __pyx_k__spanlen, sizeof(__pyx_k__spanlen), 0, 0, 1, 1}, - {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, - {&__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__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}, - {&__pyx_n_s__test_sentence, __pyx_k__test_sentence, sizeof(__pyx_k__test_sentence), 0, 0, 1, 1}, - {&__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__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}, - {&__pyx_n_s__use_baeza_yates, __pyx_k__use_baeza_yates, sizeof(__pyx_k__use_baeza_yates), 0, 0, 1, 1}, - {&__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_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}, - {&__pyx_n_s__warn, __pyx_k__warn, sizeof(__pyx_k__warn), 0, 0, 1, 1}, - {&__pyx_n_s__wc, __pyx_k__wc, sizeof(__pyx_k__wc), 0, 0, 1, 1}, - {&__pyx_n_s__word, __pyx_k__word, sizeof(__pyx_k__word), 0, 0, 1, 1}, - {&__pyx_n_s__word_alignments, __pyx_k__word_alignments, sizeof(__pyx_k__word_alignments), 0, 0, 1, 1}, - {&__pyx_n_s__word_ids, __pyx_k__word_ids, sizeof(__pyx_k__word_ids), 0, 0, 1, 1}, - {&__pyx_n_s__words, __pyx_k__words, sizeof(__pyx_k__words), 0, 0, 1, 1}, - {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1}, - {&__pyx_n_s__write_text, __pyx_k__write_text, sizeof(__pyx_k__write_text), 0, 0, 1, 1}, - {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, - {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, - {&__pyx_n_s__zip, __pyx_k__zip, sizeof(__pyx_k__zip), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __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 = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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 = 363; __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_sorted = __Pyx_GetBuiltinName(__pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 976; __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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * self.sent_id = IntList(1000,1000) - * self.sent_index = IntList(1000,1000) - */ - __pyx_k_tuple_11 = PyTuple_Pack(2, __pyx_int_1000, __pyx_int_1000); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_11); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * self.sent_index = IntList(1000,1000) - * self.use_sent_id = use_sent_id - */ - __pyx_k_tuple_12 = PyTuple_Pack(2, __pyx_int_1000, __pyx_int_1000); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_12); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":22 - * self.data = IntList(1000,1000) - * self.sent_id = IntList(1000,1000) - * self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<< - * self.use_sent_id = use_sent_id - * if from_binary: - */ - __pyx_k_tuple_13 = PyTuple_Pack(2, __pyx_int_1000, __pyx_int_1000); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_13); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_16); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61 - * - * def write_text(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * for w_id in self.data: - * if w_id > 1: - */ - __pyx_k_tuple_17 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_17); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69 - * - * def read_text(self, char* filename): - * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< - * self.read_text_data(fp) - * - */ - __pyx_k_tuple_18 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_18); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_20); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73 - * - * 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_k_tuple_21 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_21); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); - - /* "/home/mdenkows/cdec/python/cdec/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_k_slice_22 = PySlice_New(__pyx_int_2, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_22); - __Pyx_GIVEREF(__pyx_k_slice_22); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":144 - * for i in self.data: - * f.write("%d " %i) - * f.write("\n") # <<<<<<<<<<<<<< - * for i in self.sent_index: - * f.write("%d " %i) - */ - __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_24); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_25); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_26); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":153 - * for word in self.id2word: - * f.write("%s %d " % (word, self.word2id[word])) - * f.write("\n") # <<<<<<<<<<<<<< - * - * def write_enhanced(self, char* filename): - */ - __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_28); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); - - /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * self.write_enhanced_handle(self, f) - */ - __pyx_k_tuple_30 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_30); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":48 - * - * def __cinit__(self, from_binary=None, from_text=None): - * self.links = IntList(1000,1000) # <<<<<<<<<<<<<< - * self.sent_index = IntList(1000,1000) - * if from_binary: - */ - __pyx_k_tuple_31 = PyTuple_Pack(2, __pyx_int_1000, __pyx_int_1000); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_31); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); - - /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< - * if from_binary: - * self.read_binary(from_binary) - */ - __pyx_k_tuple_32 = PyTuple_Pack(2, __pyx_int_1000, __pyx_int_1000); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_32); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":61 - * pairs = line.split() - * for pair in pairs: - * (i, j) = map(int, pair.split('-')) # <<<<<<<<<<<<<< - * self.links.append(self.link(i, j)) - * self.sent_index.append(len(self.links)) - */ - __pyx_k_tuple_34 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_33)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_34); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56 - * - * def read_text(self, char* filename): - * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< - * for line in f: - * self.sent_index.append(len(self.links)) - */ - __pyx_k_tuple_35 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_35); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_36 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_36); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":80 - * sent_num = sent_num + 1 - * f.write("%d-%d " % self.unlink(link)) - * f.write("\n") # <<<<<<<<<<<<<< - * - * def write_binary(self, char* filename): - */ - __pyx_k_tuple_38 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_38); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73 - * - * def write_text(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * sent_num = 0 - * for i, link in enumerate(self.links): - */ - __pyx_k_tuple_39 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_39); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":93 - * for link in self.links: - * f.write("%d " % link) - * f.write("\n") # <<<<<<<<<<<<<< - * for i in self.sent_index: - * f.write("%d " % i) - */ - __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_40); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":96 - * for i in self.sent_index: - * f.write("%d " % i) - * f.write("\n") # <<<<<<<<<<<<<< - * - * def alignment(self, i): - */ - __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_41); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * for link in self.links: - * f.write("%d " % link) - */ - __pyx_k_tuple_42 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_42); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":297 - * - * # Re-read file, placing words into buckets - * f.seek(0) # <<<<<<<<<<<<<< - * for line in f: - * (fword, eword, score1, score2) = line.split() - */ - __pyx_k_tuple_45 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_45); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273 - * - * fcount = IntList() - * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< - * # first loop merely establishes size of array objects - * for line in f: - */ - __pyx_k_tuple_46 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_46); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":339 - * - * if i > j: - * raise Exception("Sort error in CLex") # <<<<<<<<<<<<<< - * if i == j: #empty interval - * return - */ - __pyx_k_tuple_49 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_48)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_49); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":362 - * 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_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_51); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":365 - * 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_k_tuple_53 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_53); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":368 - * 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_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_55); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":371 - * for i, w in enumerate(self.id2eword): - * f.write("%d %s " % (i, w)) - * f.write("\n") # <<<<<<<<<<<<<< - * - * - */ - __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_56); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * for i in self.f_index: - * f.write("%d " % i) - */ - __pyx_k_tuple_57 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_57); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57)); - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404 - * cdef i, N, e_id, f_id - * - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * N = len(self.e_index) - * f_id = 0 - */ - __pyx_k_tuple_59 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_59); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":13 - * cdef IntList rank - * - * logger.info("Constructing LCP array") # <<<<<<<<<<<<<< - * self.sa = sa - * n = self.sa.sa.len - */ - __pyx_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_63); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63)); - - /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":34 - * if h > 0: - * h = h-1 - * logger.info("LCP array completed") # <<<<<<<<<<<<<< - * - * def compute_stats(self, int max_n): - */ - __pyx_k_tuple_65 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_65); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65)); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":297 - * pattern_rank = {} - * - * logger.info("Precomputing frequent intersections") # <<<<<<<<<<<<<< - * cdef float start_time = monitor_cpu() - * - */ - __pyx_k_tuple_75 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_74)); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_75); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":314 - * queue = IntList(increment=1000) - * - * logger.info(" Computing inverted indexes...") # <<<<<<<<<<<<<< - * N = len(data) - * for i from 0 <= i < N: - */ - __pyx_k_tuple_77 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_76)); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_77); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77)); - - /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":329 - * trie_node_data_append(node, i) - * - * logger.info(" Computing collocations...") # <<<<<<<<<<<<<< - * N = len(queue) - * ptr1 = 0 - */ - __pyx_k_tuple_79 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_78)); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_79); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_81 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_81); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_82 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_82); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_83 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_83); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_84 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_84); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_95 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_94)); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_95); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_98 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_98); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98)); - - /* "/home/mdenkows/cdec/python/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_k_tuple_99 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_99); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99)); - - /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189 - * - * def write_enhanced(self, char* filename): - * with open(filename, "w") as f: # <<<<<<<<<<<<<< - * self.darray.write_enhanced_handle(f) - * for a_i in self.sa: - */ - __pyx_k_tuple_100 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_100); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":144 - * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) - * else: - * logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<< - * - * def sample(self, PhraseLocation phrase_location): - */ - __pyx_k_tuple_106 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_105)); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_106); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":357 - * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) - * if alignment is None: - * raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<< - * self.alignment = alignment - * - */ - __pyx_k_tuple_111 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_110)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_111); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1069 - * else: - * #ERROR: We never get here - * raise Exception("Keyword trie error") # <<<<<<<<<<<<<< - * # checking whether lookup_required - * if lookup_required: - */ - __pyx_k_tuple_127 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_126)); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_127); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_127)); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1988 - * 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_k_slice_141 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_141)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_141); - __Pyx_GIVEREF(__pyx_k_slice_141); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1925 - * # 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_k_tuple_142 = PyTuple_Pack(19, ((PyObject *)__pyx_n_s__f_i), ((PyObject *)__pyx_n_s__f_j), ((PyObject *)__pyx_n_s__e_i), ((PyObject *)__pyx_n_s__e_j), ((PyObject *)__pyx_n_s__min_bound), ((PyObject *)__pyx_n_s__wc), ((PyObject *)__pyx_n_s__links), ((PyObject *)__pyx_n_s__nt), ((PyObject *)__pyx_n_s__nt_open), ((PyObject *)__pyx_n_s__link_i), ((PyObject *)__pyx_n_s__link_j), ((PyObject *)__pyx_n_s__new_e_i), ((PyObject *)__pyx_n_s__new_e_j), ((PyObject *)__pyx_n_s__new_min_bound), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__nt_collision), ((PyObject *)__pyx_n_s__link), ((PyObject *)__pyx_n_s__plus_links), ((PyObject *)__pyx_n_s__old_last_nt)); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_142); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_142)); - __pyx_k_codeobj_143 = (PyObject*)__Pyx_PyCode_New(9, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__extract, 1925, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_143)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2047 - * # 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_k_slice_146 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_k_slice_146)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_146); - __Pyx_GIVEREF(__pyx_k_slice_146); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2067 - * # 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_k_slice_148 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_148)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_148); - __Pyx_GIVEREF(__pyx_k_slice_148); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2077 - * 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_k_slice_149 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_149)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_149); - __Pyx_GIVEREF(__pyx_k_slice_149); - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152 - * 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_k_tuple_153 = PyTuple_Pack(10, ((PyObject *)__pyx_n_s__f_i), ((PyObject *)__pyx_n_s__f_j), ((PyObject *)__pyx_n_s__lex_i), ((PyObject *)__pyx_n_s__lex_j), ((PyObject *)__pyx_n_s__wc), ((PyObject *)__pyx_n_s__ntc), ((PyObject *)__pyx_n_s__syms), ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__new_lex_i), ((PyObject *)__pyx_n_s__new_lex_j)); if (unlikely(!__pyx_k_tuple_153)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_153); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_153)); - __pyx_k_codeobj_154 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__extract, 2152, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_154)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "cdec/sa/_sa.pyx":5 - * import gzip - * - * def monitor_cpu(): # <<<<<<<<<<<<<< - * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ - * resource.getrusage(resource.RUSAGE_SELF).ru_stime) - */ - __pyx_k_codeobj_157 = (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_158, __pyx_n_s__monitor_cpu, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_157)) {__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) - * - * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< - * if filename.endswith('.gz'): - * return gzip.GzipFile(filename) - */ - __pyx_k_tuple_159 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__filename), ((PyObject *)__pyx_n_s__filename)); if (unlikely(!__pyx_k_tuple_159)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_159); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_159)); - __pyx_k_codeobj_160 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_159, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__gzip_or_text, 9, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_160)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "cdec/sa/_sa.pyx":15 - * return open(filename) - * - * logger = logging.getLogger('cdec.sa') # <<<<<<<<<<<<<< - * - * include "float_list.pxi" - */ - __pyx_k_tuple_162 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_161)); if (unlikely(!__pyx_k_tuple_162)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_162); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_162)); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107 - * return ALPHABET.fromstring(string, terminal) - * - * def isvar(sym): # <<<<<<<<<<<<<< - * return sym_isvar(sym) - * - */ - __pyx_k_tuple_163 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__sym)); if (unlikely(!__pyx_k_tuple_163)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_163); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_163)); - __pyx_k_codeobj_164 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__isvar, 107, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_164)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110 - * return sym_isvar(sym) - * - * def make_lattice(words): # <<<<<<<<<<<<<< - * word_ids = (sym_fromstring(word, True) for word in words) - * return tuple(((word, None, 1), ) for word in word_ids) - */ - __pyx_k_tuple_166 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__words), ((PyObject *)__pyx_n_s__word_ids), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_166)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_166); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_166)); - __pyx_k_codeobj_167 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__make_lattice, 110, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_167)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114 - * return tuple(((word, None, 1), ) for word in word_ids) - * - * 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_k_tuple_168 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__lattice), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_168)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_168); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_168)); - __pyx_k_codeobj_169 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_lattice, 114, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_169)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118 - * for arc in node for node in lattice) - * - * def decode_sentence(lattice): # <<<<<<<<<<<<<< - * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) - * - */ - __pyx_k_tuple_170 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__lattice), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_170)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_170); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_170)); - __pyx_k_codeobj_171 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_sentence, 118, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_171)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121 - * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) - * - * def encode_words(words): # <<<<<<<<<<<<<< - * return tuple(sym_fromstring(word, True) for word in words) - * - */ - __pyx_k_tuple_172 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__words), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_172)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_172); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_172)); - __pyx_k_codeobj_173 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__encode_words, 121, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_173)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124 - * return tuple(sym_fromstring(word, True) for word in words) - * - * def decode_words(syms): # <<<<<<<<<<<<<< - * return tuple(sym_tostring(sym) for sym in syms) - */ - __pyx_k_tuple_174 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__syms), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_174)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_174); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_174)); - __pyx_k_codeobj_175 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_words, 124, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_175)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190 - * - * # Spans are _inclusive_ on both ends [i, j] - * def span_check(vec, i, j): # <<<<<<<<<<<<<< - * k = i - * while k <= j: - */ - __pyx_k_tuple_177 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_177)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_177); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_177)); - __pyx_k_codeobj_178 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_check, 2190, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_178)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198 - * return True - * - * def span_inc(vec, i, j): # <<<<<<<<<<<<<< - * k = i - * while k <= j: - */ - __pyx_k_tuple_179 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_179); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_179)); - __pyx_k_codeobj_180 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_inc, 2198, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_180)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204 - * k += 1 - * - * def span_dec(vec, i, j): # <<<<<<<<<<<<<< - * k = i - * while k <= j: - */ - __pyx_k_tuple_181 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_181); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_181)); - __pyx_k_codeobj_182 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_dec, 2204, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_182)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -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_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC init_sa(void); /*proto*/ -PyMODINIT_FUNC init_sa(void) -#else -PyMODINIT_FUNC PyInit__sa(void); /*proto*/ -PyMODINIT_FUNC PyInit__sa(void) -#endif -{ - 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_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__sa(void)", 0); - if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __Pyx_CyFunction_USED - if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #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); - #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.sa._sa")) { - if (unlikely(PyDict_SetItemString(modules, "cdec.sa._sa", __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;} - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #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;}; - } - /*--- 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 ---*/ - if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Global init code ---*/ - __pyx_v_4cdec_2sa_3_sa_ALPHABET = ((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)Py_None); Py_INCREF(Py_None); - __pyx_v_4cdec_2sa_3_sa_FD = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - if (__Pyx_ExportFunction("sym_tostring", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_tostring, "char *(int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("sym_tocat", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_tocat, "char *(int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("sym_isvar", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_isvar, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("sym_getindex", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_getindex, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /*--- Type init code ---*/ - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_FeatureVector = &__pyx_type_4cdec_2sa_3_sa_FeatureVector; - __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; - __pyx_vtable_4cdec_2sa_3_sa_SuffixArray.__pyx___search_low = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low; - __pyx_vtable_4cdec_2sa_3_sa_SuffixArray.__pyx___get_range = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, int, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_11SuffixArray___get_range; - __pyx_vtable_4cdec_2sa_3_sa_SuffixArray.__pyx___lookup_helper = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_SuffixArray = &__pyx_type_4cdec_2sa_3_sa_SuffixArray; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_LCP = &__pyx_type_4cdec_2sa_3_sa_LCP; - 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_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_OnlineStats) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_OnlineStats = &__pyx_type_4cdec_2sa_3_sa_OnlineStats; - __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; - __pyx_vtable_4cdec_2sa_3_sa_IntList._append = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, int))__pyx_f_4cdec_2sa_3_sa_7IntList__append; - __pyx_vtable_4cdec_2sa_3_sa_IntList._extend = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, struct __pyx_obj_4cdec_2sa_3_sa_IntList *))__pyx_f_4cdec_2sa_3_sa_7IntList__extend; - __pyx_vtable_4cdec_2sa_3_sa_IntList._extend_arr = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, int *, int))__pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr; - __pyx_vtable_4cdec_2sa_3_sa_IntList._clear = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *))__pyx_f_4cdec_2sa_3_sa_7IntList__clear; - __pyx_vtable_4cdec_2sa_3_sa_IntList.write_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, FILE *))__pyx_f_4cdec_2sa_3_sa_7IntList_write_handle; - __pyx_vtable_4cdec_2sa_3_sa_IntList.read_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, FILE *))__pyx_f_4cdec_2sa_3_sa_7IntList_read_handle; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_IntList = &__pyx_type_4cdec_2sa_3_sa_IntList; - __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; - __pyx_vtable_4cdec_2sa_3_sa_Phrase.chunklen = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, int))__pyx_f_4cdec_2sa_3_sa_6Phrase_chunklen; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_Phrase = &__pyx_type_4cdec_2sa_3_sa_Phrase; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "TrieNode", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa_TrieNode = &__pyx_type_4cdec_2sa_3_sa_TrieNode; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext; - 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_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_26_get_f_phrases) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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; - __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 = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ExtendedTrieNode", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode = &__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode; - __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; - __pyx_vtable_4cdec_2sa_3_sa_Alignment._unlink = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *, int, int *, int *))__pyx_f_4cdec_2sa_3_sa_9Alignment__unlink; - __pyx_vtable_4cdec_2sa_3_sa_Alignment._get_sent_links = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *, int, int *))__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_Alignment = &__pyx_type_4cdec_2sa_3_sa_Alignment; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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_13_decode_words) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_Rule = &__pyx_type_4cdec_2sa_3_sa_Rule; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr; - __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; - __pyx_vtable_4cdec_2sa_3_sa_Precomputation.write_map = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *, PyObject *, FILE *))__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_Precomputation = &__pyx_type_4cdec_2sa_3_sa_Precomputation; - 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_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_21_add_instance) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance; - __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; - __pyx_vtable_4cdec_2sa_3_sa_TrieMap._contains = (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__contains; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_TrieMap = &__pyx_type_4cdec_2sa_3_sa_TrieMap; - 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_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_VEBIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_VEBIterator = &__pyx_type_4cdec_2sa_3_sa_VEBIterator; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr; - __pyx_vtabptr_4cdec_2sa_3_sa_FloatList = &__pyx_vtable_4cdec_2sa_3_sa_FloatList; - __pyx_vtable_4cdec_2sa_3_sa_FloatList.set = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, int, float))__pyx_f_4cdec_2sa_3_sa_9FloatList_set; - __pyx_vtable_4cdec_2sa_3_sa_FloatList.write_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *))__pyx_f_4cdec_2sa_3_sa_9FloatList_write_handle; - __pyx_vtable_4cdec_2sa_3_sa_FloatList.read_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *))__pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_FloatList = &__pyx_type_4cdec_2sa_3_sa_FloatList; - __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; - __pyx_vtable_4cdec_2sa_3_sa_StringMap.index = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *, char *))__pyx_f_4cdec_2sa_3_sa_9StringMap_index; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_StringMap = &__pyx_type_4cdec_2sa_3_sa_StringMap; - 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_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_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_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "TrieTable", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa_TrieTable = &__pyx_type_4cdec_2sa_3_sa_TrieTable; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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_12_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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_10_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr; - __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; - __pyx_vtable_4cdec_2sa_3_sa_VEB._insert = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_VEB *, int))__pyx_f_4cdec_2sa_3_sa_3VEB__insert; - __pyx_vtable_4cdec_2sa_3_sa_VEB._first = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_VEB *))__pyx_f_4cdec_2sa_3_sa_3VEB__first; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_VEB = &__pyx_type_4cdec_2sa_3_sa_VEB; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice; - __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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 = 109; __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation = &__pyx_type_4cdec_2sa_3_sa_PhraseLocation; - __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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_Scorer = &__pyx_type_4cdec_2sa_3_sa_Scorer; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Sampler", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 131; __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_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; - __pyx_vtable_4cdec_2sa_3_sa_Alphabet.isword = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_isword; - __pyx_vtable_4cdec_2sa_3_sa_Alphabet.getindex = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_getindex; - __pyx_vtable_4cdec_2sa_3_sa_Alphabet.setindex = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_setindex; - __pyx_vtable_4cdec_2sa_3_sa_Alphabet.clearindex = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_clearindex; - __pyx_vtable_4cdec_2sa_3_sa_Alphabet.match = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_match; - __pyx_vtable_4cdec_2sa_3_sa_Alphabet.tocat = (char *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_tocat; - __pyx_vtable_4cdec_2sa_3_sa_Alphabet.fromcat = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, char *))__pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat; - __pyx_vtable_4cdec_2sa_3_sa_Alphabet.tostring = (char *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring; - __pyx_vtable_4cdec_2sa_3_sa_Alphabet.fromstring = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, char *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_Alphabet = &__pyx_type_4cdec_2sa_3_sa_Alphabet; - __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; - __pyx_vtable_4cdec_2sa_3_sa_BiLex._add_node = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, struct __pyx_t_4cdec_2sa_3_sa__node *, int *, float, int *))__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node; - __pyx_vtable_4cdec_2sa_3_sa_BiLex.write_wordlist = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, PyObject *, FILE *))__pyx_f_4cdec_2sa_3_sa_5BiLex_write_wordlist; - __pyx_vtable_4cdec_2sa_3_sa_BiLex.read_wordlist = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, PyObject *, PyObject *, FILE *))__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist; - __pyx_vtable_4cdec_2sa_3_sa_BiLex.swap = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, int, int))__pyx_f_4cdec_2sa_3_sa_5BiLex_swap; - __pyx_vtable_4cdec_2sa_3_sa_BiLex.qsort = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, int, int, PyObject *))__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_BiLex = &__pyx_type_4cdec_2sa_3_sa_BiLex; - __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; - __pyx_vtable_4cdec_2sa_3_sa_DataArray.write_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *, FILE *))__pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_DataArray = &__pyx_type_4cdec_2sa_3_sa_DataArray; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_BitSetIterator = &__pyx_type_4cdec_2sa_3_sa_BitSetIterator; - __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; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.baeza_yates_helper = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.compare_matchings_set = (long (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_set; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.compare_matchings = (long (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.merge_helper = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.sort_phrase_loc = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_IntList *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.intersect_helper = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_helper; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.loc2str = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.intersect = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, PyObject *, PyObject *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.find_fixpoint = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, PyObject *, int *, int *, int *, int *, int, int, int *, int *, int *, int *, int, int, int, int, int, int, int, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.find_projection = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_projection; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.int_arr_extend = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int *, int *, int *, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.extract_phrases = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int, int, int, int *, int *, int *, int, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrases; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.create_alignments = (struct __pyx_obj_4cdec_2sa_3_sa_IntList *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int *, int, struct __pyx_obj_4cdec_2sa_3_sa_IntList *, struct __pyx_obj_4cdec_2sa_3_sa_IntList *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_create_alignments; - __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.extract = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int *, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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 = 253; __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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa_HieroCachingRuleFactory = &__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory; - 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_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_3_compute_stats) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr; - 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_ptype_4cdec_2sa_3_sa___pyx_scope_struct____iter__ = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct____iter__; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr; - 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;} - 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;} - __pyx_ptype_4cdec_2sa_3_sa_BitSet = &__pyx_type_4cdec_2sa_3_sa_BitSet; - if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence; - /*--- Type import code ---*/ - /*--- Variable import code ---*/ - /*--- Function import code ---*/ - /*--- Execution code ---*/ - - /* "cdec/sa/_sa.pyx":1 - * import logging # <<<<<<<<<<<<<< - * import resource - * import gzip - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); 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__logging, __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; - - /* "cdec/sa/_sa.pyx":2 - * import logging - * import resource # <<<<<<<<<<<<<< - * import gzip - * - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__resource), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__resource, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "cdec/sa/_sa.pyx":3 - * import logging - * import resource - * import gzip # <<<<<<<<<<<<<< - * - * def monitor_cpu(): - */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__gzip), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__gzip, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "cdec/sa/_sa.pyx":5 - * import gzip - * - * def monitor_cpu(): # <<<<<<<<<<<<<< - * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ - * resource.getrusage(resource.RUSAGE_SELF).ru_stime) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_1monitor_cpu, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__monitor_cpu, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "cdec/sa/_sa.pyx":9 - * resource.getrusage(resource.RUSAGE_SELF).ru_stime) - * - * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< - * if filename.endswith('.gz'): - * return gzip.GzipFile(filename) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_3gzip_or_text, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__gzip_or_text, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "cdec/sa/_sa.pyx":15 - * return open(filename) - * - * logger = logging.getLogger('cdec.sa') # <<<<<<<<<<<<<< - * - * include "float_list.pxi" - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_162), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - 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; - - /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":8 - * # May need to revisit if things get really tight, though. - * - * cdef int ALIGNMENT_CODE = 1 << 16 # <<<<<<<<<<<<<< - * - * cdef class Alignment: - */ - __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE = 65536; - - /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54 - * cdef id2eword, id2fword, eword2id, fword2id - * - * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< - * earray=None, fsarray=None, alignment=None): - * self.id2eword = [] - */ - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_k_43 = __pyx_t_1; - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":17 - * from libc.string cimport memset - * - * cdef int MIN_BOTTOM_SIZE = 32 # <<<<<<<<<<<<<< - * cdef int MIN_BOTTOM_BITS = 5 - * cdef int LOWER_MASK[32] - */ - __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE = 32; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":18 - * - * cdef int MIN_BOTTOM_SIZE = 32 - * cdef int MIN_BOTTOM_BITS = 5 # <<<<<<<<<<<<<< - * cdef int LOWER_MASK[32] - * - */ - __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS = 5; - - /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":28 - * LOWER_MASK[i] = mask - * - * _init_lower_mask() # <<<<<<<<<<<<<< - * - * cdef struct _BitSet: - */ - __pyx_f_4cdec_2sa_3_sa__init_lower_mask(); - - /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":4 - * from libc.stdlib cimport malloc, realloc, strtol - * - * cdef int INDEX_SHIFT = 3 # <<<<<<<<<<<<<< - * cdef int INDEX_MASK = (1<= 3 - "name '%U' is not defined", name); -#else - "name '%s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON - result = PyDict_GetItem(__pyx_d, name); - if (result) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() 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'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -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) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - 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)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -static CYTHON_INLINE void __Pyx_ErrRestore(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->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_Restore(type, value, tb); -#endif -} -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(type, value, tb); -#endif -} - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - 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); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - 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)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - #endif - } - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else /* Python 3+ */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - 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; - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } -#if PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -} - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -static CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CPYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_Clear(); - else - return NULL; - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -static CYTHON_INLINE PyObject* __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 */ - } else { - return __Pyx_PyObject_CallMethod1(L, __pyx_n_s__append, x); - } -} - -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 CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { - PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); -} - -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_COMPILING_IN_CPYTHON - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; - } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; - } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; - } - } else { - if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_Clear(); - else - goto bad; - } - } - return ms->sq_slice(obj, cstart, cstop); - } -#endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) -#endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; - } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; - } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } -#if CYTHON_COMPILING_IN_CPYTHON - result = mp->mp_subscript(obj, py_slice); -#else - result = PyObject_GetItem(obj, py_slice); -#endif - if (!_py_slice) { - Py_DECREF(py_slice); - } - return result; - } - PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); -bad: - return NULL; -} - -static CYTHON_INLINE int __Pyx_div_int(int a, int b) { - int q = a / b; - int r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -static CYTHON_INLINE int __Pyx_mod_int(int a, int b) { - int r = a % b; - r += ((r != 0) & ((r ^ b) < 0)) * b; - return r; -} - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", 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", - index, (index == 1) ? "" : "s"); -} - -static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); - PyObject* exc_type = tstate->curexc_type; - if (unlikely(exc_type)) { - if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } - } - return 0; -#endif -} - -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else { - return __Pyx_IterFinish(); - } - return 0; -} - -static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, - int is_list, int wraparound, int boundscheck) { -#if CYTHON_COMPILING_IN_CPYTHON - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); - return 1; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_Clear(); - else - return -1; - } - } - return m->sq_ass_item(o, i, v); - } - } -#else -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { -#else - if (is_list || PySequence_Check(o)) { -#endif - return PySequence_SetItem(o, i, v); - } -#endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); -} - -static double __Pyx__PyObject_AsDouble(PyObject* obj) { - PyObject* float_value; -#if CYTHON_COMPILING_IN_PYPY - float_value = PyNumber_Float(obj); -#else - PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number; - if (likely(nb) && likely(nb->nb_float)) { - float_value = nb->nb_float(obj); - if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) { - PyErr_Format(PyExc_TypeError, - "__float__ returned non-float (type %.200s)", - Py_TYPE(float_value)->tp_name); - Py_DECREF(float_value); - goto bad; - } - } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { -#if PY_MAJOR_VERSION >= 3 - float_value = PyFloat_FromString(obj); -#else - float_value = PyFloat_FromString(obj, 0); -#endif - } else { - PyObject* args = PyTuple_New(1); - if (unlikely(!args)) goto bad; - PyTuple_SET_ITEM(args, 0, obj); - float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0); - PyTuple_SET_ITEM(args, 0, 0); - Py_DECREF(args); - } -#endif - if (likely(float_value)) { - double value = PyFloat_AS_DOUBLE(float_value); - Py_DECREF(float_value); - return value; - } -bad: - return (double)-1; -} - -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -static CYTHON_INLINE long __Pyx_div_long(long a, long b) { - long q = a / b; - long r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); - return q; -} - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(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; - } - else { - if (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); - return 0; -} - -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 PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) -{ - if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -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 */ - Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, 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 = op->func_name; - Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, 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 = op->func_qualname; - Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - tmp = op->func_dict; - Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op) -{ - PyObject* dict = PyModule_GetDict(__pyx_m); - Py_XINCREF(dict); - return dict; -} -static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) -{ - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - Py_DECREF(res); - return 0; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_tuple; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_kwdict; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value || value == Py_None) { - value = NULL; - } else if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { - PyObject* result = op->func_annotations; - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(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 */ -#define PY_WRITE_RESTRICTED WRITE_RESTRICTED -#endif -static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); -#else - return PyString_FromString(m->func.m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* code) { - __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); - if (op == NULL) - return NULL; - op->flags = flags; - op->func_weakreflist = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; - Py_XINCREF(closure); - op->func_closure = closure; - Py_XINCREF(module); - op->func.m_module = module; - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; - op->func_classobj = NULL; - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - PyObject_GC_Track(op); - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyMem_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - if (m->func_weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return PyMethod_New(func, - type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; - return PyMethod_New(func, obj, type); -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -#if CYTHON_COMPILING_IN_PYPY -static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - Py_ssize_t size; - switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) { - case METH_VARARGS: - if (likely(kw == NULL) || PyDict_Size(kw) == 0) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL) || PyDict_Size(kw) == 0) { - size = PyTuple_GET_SIZE(arg); - if (size == 0) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%zd given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL) || PyDict_Size(kw) == 0) { - size = PyTuple_GET_SIZE(arg); - if (size == 1) - return (*meth)(self, PyTuple_GET_ITEM(arg, 0)); - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%zd given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} -#else -static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return PyCFunction_Call(func, arg, kw); -} -#endif -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/ - sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ -#if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ -#else - 0, /*reserved*/ -#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*/ -#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) - return -1; - __pyx_CyFunctionType = &__pyx_CyFunctionType_type; - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyMem_Malloc(size); - if (!m->defaults) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000 - if (likely(PyList_CheckExact(L)) - && likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) { - Py_SIZE(L) -= 1; - return PyList_GET_ITEM(L, PyList_GET_SIZE(L)); - } -#if PY_VERSION_HEX >= 0x02050000 - else if (Py_TYPE(L) == (&PySet_Type)) { - return PySet_Pop(L); - } -#endif -#endif - return __Pyx_PyObject_CallMethod0(L, __pyx_n_s__pop); -} - -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -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 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(); - } - } - 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 - } - } - #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); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -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; - } - 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; - } - return (unsigned short)val; - } - 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; - } - 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; - } - return (char)val; - } - 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; - } - return (short)__Pyx_PyInt_AsLong(x); -} - -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; - } - 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; - } - return (signed char)__Pyx_PyInt_AsSignedLong(x); -} - -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; - } - return (signed short)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { - const signed int neg_one = (signed 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; - } - return (signed int)val; - } - return (signed int)__Pyx_PyInt_AsSignedLong(x); -} - -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; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#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; - 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; - } - 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]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - 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]; - } - } -#endif -#endif - return (unsigned long)PyLong_AsLong(x); - } - } else { - unsigned long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned long)-1; - val = __Pyx_PyInt_AsUnsignedLong(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; - 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; - } - 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]; - } - } -#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; - } - 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]; - } - } -#endif -#endif - return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); - } - } else { - unsigned PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsUnsignedLongLong(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 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]; - } - } -#endif -#endif - return (long)PyLong_AsLong(x); - } - } 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 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; - 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; - } - 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]; - } - } -#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; - } - 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]; - } - } -#endif -#endif - return (PY_LONG_LONG)PyLong_AsLongLong(x); - } - } else { - PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsLongLong(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 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]; - } - } -#endif -#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]; - } - } -#endif -#endif - return (signed long)PyLong_AsLong(x); - } - } 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_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; - 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; - } - 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]; - } - } -#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; - } - 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]; - } - } -#endif -#endif - return (signed PY_LONG_LONG)PyLong_AsLongLong(x); - } - } else { - signed PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsSignedLongLong(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; -} - -static PyObject *__Pyx_Generator_Next(PyObject *self); -static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value); -static PyObject *__Pyx_Generator_Close(PyObject *self); -static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args); -static PyTypeObject *__pyx_GeneratorType = 0; -#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) -#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) -#if 1 || PY_VERSION_HEX < 0x030300B0 -static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { - PyObject *et, *ev, *tb; - PyObject *value = NULL; - __Pyx_ErrFetch(&et, &ev, &tb); - if (!et) { - Py_XDECREF(tb); - Py_XDECREF(ev); - Py_INCREF(Py_None); - *pvalue = Py_None; - return 0; - } - if (unlikely(et != PyExc_StopIteration) && - unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) { - __Pyx_ErrRestore(et, ev, tb); - return -1; - } - if (likely(et == PyExc_StopIteration)) { - if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) { - if (!ev) { - Py_INCREF(Py_None); - ev = Py_None; - } - Py_XDECREF(tb); - Py_DECREF(et); - *pvalue = ev; - return 0; - } - } - PyErr_NormalizeException(&et, &ev, &tb); - if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) { - __Pyx_ErrRestore(et, ev, tb); - return -1; - } - Py_XDECREF(tb); - Py_DECREF(et); -#if PY_VERSION_HEX >= 0x030300A0 - value = ((PyStopIterationObject *)ev)->value; - Py_INCREF(value); - Py_DECREF(ev); -#else - { - PyObject* args = PyObject_GetAttr(ev, __pyx_n_s__args); - Py_DECREF(ev); - if (likely(args)) { - value = PyObject_GetItem(args, 0); - Py_DECREF(args); - } - if (unlikely(!value)) { - __Pyx_ErrRestore(NULL, NULL, NULL); - Py_INCREF(Py_None); - value = Py_None; - } - } -#endif - *pvalue = value; - return 0; -} -#endif -static CYTHON_INLINE -void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) { - PyObject *exc_type = self->exc_type; - PyObject *exc_value = self->exc_value; - PyObject *exc_traceback = self->exc_traceback; - self->exc_type = NULL; - self->exc_value = NULL; - self->exc_traceback = NULL; - Py_XDECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_traceback); -} -static CYTHON_INLINE -int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) { - if (unlikely(gen->is_running)) { - PyErr_SetString(PyExc_ValueError, - "generator already executing"); - return 1; - } - return 0; -} -static CYTHON_INLINE -PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) { - PyObject *retval; - assert(!self->is_running); - if (unlikely(self->resume_label == 0)) { - if (unlikely(value && value != Py_None)) { - PyErr_SetString(PyExc_TypeError, - "can't send non-None value to a " - "just-started generator"); - return NULL; - } - } - if (unlikely(self->resume_label == -1)) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - if (value) { -#if CYTHON_COMPILING_IN_PYPY -#else - /* Generators always return to their most recent caller, not - * necessarily their creator. */ - if (self->exc_traceback) { - PyThreadState *tstate = PyThreadState_GET(); - PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; - PyFrameObject *f = tb->tb_frame; - Py_XINCREF(tstate->frame); - assert(f->f_back == NULL); - f->f_back = tstate->frame; - } -#endif - __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, - &self->exc_traceback); - } else { - __Pyx_Generator_ExceptionClear(self); - } - self->is_running = 1; - retval = self->body((PyObject *) self, value); - self->is_running = 0; - if (retval) { - __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, - &self->exc_traceback); -#if CYTHON_COMPILING_IN_PYPY -#else - /* Don't keep the reference to f_back any longer than necessary. It - * may keep a chain of frames alive or it could create a reference - * cycle. */ - if (self->exc_traceback) { - PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; - PyFrameObject *f = tb->tb_frame; - Py_CLEAR(f->f_back); - } -#endif - } else { - __Pyx_Generator_ExceptionClear(self); - } - return retval; -} -static CYTHON_INLINE -PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) { - PyObject *ret; - PyObject *val = NULL; - __Pyx_Generator_Undelegate(gen); - __Pyx_PyGen_FetchStopIterationValue(&val); - ret = __Pyx_Generator_SendEx(gen, val); - Py_XDECREF(val); - return ret; -} -static PyObject *__Pyx_Generator_Next(PyObject *self) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; - PyObject *yf = gen->yieldfrom; - if (unlikely(__Pyx_Generator_CheckRunning(gen))) - return NULL; - if (yf) { - PyObject *ret; - gen->is_running = 1; - ret = Py_TYPE(yf)->tp_iternext(yf); - gen->is_running = 0; - if (likely(ret)) { - return ret; - } - return __Pyx_Generator_FinishDelegation(gen); - } - return __Pyx_Generator_SendEx(gen, Py_None); -} -static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; - PyObject *yf = gen->yieldfrom; - if (unlikely(__Pyx_Generator_CheckRunning(gen))) - return NULL; - if (yf) { - PyObject *ret; - gen->is_running = 1; - if (__Pyx_Generator_CheckExact(yf)) { - ret = __Pyx_Generator_Send(yf, value); - } else { - if (value == Py_None) - ret = PyIter_Next(yf); - else - ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s__send, value); - } - gen->is_running = 0; - if (likely(ret)) { - return ret; - } - return __Pyx_Generator_FinishDelegation(gen); - } - return __Pyx_Generator_SendEx(gen, value); -} -static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) { - PyObject *retval = NULL; - int err = 0; - if (__Pyx_Generator_CheckExact(yf)) { - retval = __Pyx_Generator_Close(yf); - if (!retval) - return -1; - } else { - PyObject *meth; - gen->is_running = 1; - meth = PyObject_GetAttr(yf, __pyx_n_s__close); - if (unlikely(!meth)) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_WriteUnraisable(yf); - } - PyErr_Clear(); - } else { - retval = PyObject_CallFunction(meth, NULL); - Py_DECREF(meth); - if (!retval) - err = -1; - } - gen->is_running = 0; - } - Py_XDECREF(retval); - return err; -} -static PyObject *__Pyx_Generator_Close(PyObject *self) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; - PyObject *retval, *raised_exception; - PyObject *yf = gen->yieldfrom; - int err = 0; - if (unlikely(__Pyx_Generator_CheckRunning(gen))) - return NULL; - if (yf) { - Py_INCREF(yf); - err = __Pyx_Generator_CloseIter(gen, yf); - __Pyx_Generator_Undelegate(gen); - Py_DECREF(yf); - } - if (err == 0) -#if PY_VERSION_HEX < 0x02050000 - PyErr_SetNone(PyExc_StopIteration); -#else - PyErr_SetNone(PyExc_GeneratorExit); -#endif - retval = __Pyx_Generator_SendEx(gen, NULL); - if (retval) { - Py_DECREF(retval); - PyErr_SetString(PyExc_RuntimeError, - "generator ignored GeneratorExit"); - return NULL; - } - 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 */ - Py_INCREF(Py_None); - return Py_None; - } - return NULL; -} -static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; - PyObject *typ; - PyObject *tb = NULL; - PyObject *val = NULL; - PyObject *yf = gen->yieldfrom; - if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) - return NULL; - if (unlikely(__Pyx_Generator_CheckRunning(gen))) - return NULL; - if (yf) { - PyObject *ret; - Py_INCREF(yf); -#if PY_VERSION_HEX >= 0x02050000 - if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { - int err = __Pyx_Generator_CloseIter(gen, yf); - Py_DECREF(yf); - __Pyx_Generator_Undelegate(gen); - if (err < 0) - return __Pyx_Generator_SendEx(gen, NULL); - goto throw_here; - } -#endif - gen->is_running = 1; - if (__Pyx_Generator_CheckExact(yf)) { - ret = __Pyx_Generator_Throw(yf, args); - } else { - PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s__throw); - if (unlikely(!meth)) { - Py_DECREF(yf); - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { - gen->is_running = 0; - return NULL; - } - PyErr_Clear(); - __Pyx_Generator_Undelegate(gen); - gen->is_running = 0; - goto throw_here; - } - ret = PyObject_CallObject(meth, args); - Py_DECREF(meth); - } - gen->is_running = 0; - Py_DECREF(yf); - if (!ret) { - ret = __Pyx_Generator_FinishDelegation(gen); - } - return ret; - } -throw_here: - __Pyx_Raise(typ, val, tb, NULL); - return __Pyx_Generator_SendEx(gen, NULL); -} -static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; - Py_VISIT(gen->closure); - Py_VISIT(gen->classobj); - Py_VISIT(gen->yieldfrom); - Py_VISIT(gen->exc_type); - Py_VISIT(gen->exc_value); - Py_VISIT(gen->exc_traceback); - return 0; -} -static int __Pyx_Generator_clear(PyObject *self) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; - Py_CLEAR(gen->closure); - Py_CLEAR(gen->classobj); - Py_CLEAR(gen->yieldfrom); - Py_CLEAR(gen->exc_type); - Py_CLEAR(gen->exc_value); - Py_CLEAR(gen->exc_traceback); - return 0; -} -static void __Pyx_Generator_dealloc(PyObject *self) { - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; - PyObject_GC_UnTrack(gen); - if (gen->gi_weakreflist != NULL) - PyObject_ClearWeakRefs(self); - PyObject_GC_Track(self); - if (gen->resume_label > 0) { - Py_TYPE(gen)->tp_del(self); - if (self->ob_refcnt > 0) - return; /* resurrected. :( */ - } - PyObject_GC_UnTrack(self); - __Pyx_Generator_clear(self); - PyObject_GC_Del(gen); -} -static void __Pyx_Generator_del(PyObject *self) { - PyObject *res; - PyObject *error_type, *error_value, *error_traceback; - __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; - if (gen->resume_label <= 0) - return ; - assert(self->ob_refcnt == 0); - self->ob_refcnt = 1; - __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); - res = __Pyx_Generator_Close(self); - if (res == NULL) - PyErr_WriteUnraisable(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. - */ - 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. - */ - { - Py_ssize_t refcnt = self->ob_refcnt; - _Py_NewReference(self); - self->ob_refcnt = refcnt; - } -#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 -} -static PyMemberDef __pyx_Generator_memberlist[] = { - {(char *) "gi_running", -#if PY_VERSION_HEX >= 0x02060000 - T_BOOL, -#else - T_BYTE, -#endif - 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}, - {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*/ -#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_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*/ -#endif -}; -static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, - PyObject *closure) { - __pyx_GeneratorObject *gen = - PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type); - if (gen == NULL) - return NULL; - gen->body = body; - gen->closure = closure; - Py_XINCREF(closure); - gen->is_running = 0; - gen->resume_label = 0; - gen->classobj = NULL; - gen->yieldfrom = NULL; - gen->exc_type = NULL; - gen->exc_value = NULL; - gen->exc_traceback = NULL; - gen->gi_weakreflist = NULL; - 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)) { - return -1; - } - __pyx_GeneratorType = &__pyx_GeneratorType_type; - return 0; -} - -static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "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; -} - -static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - union { - void (*fp)(void); - void *p; - } tmp; - d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); - if (!d) { - PyErr_Clear(); - d = PyDict_New(); - if (!d) - goto bad; - Py_INCREF(d); - if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) - goto bad; - } - tmp.fp = f; -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - cobj = PyCapsule_New(tmp.p, sig, 0); -#else - cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); -#endif - if (!cobj) - goto bad; - if (PyDict_SetItemString(d, name, cobj) < 0) - goto bad; - Py_DECREF(cobj); - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(cobj); - Py_XDECREF(d); - 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 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else /* Python 3+ has unicode identifiers */ - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++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 char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else /* PY_VERSION_HEX < 0x03030000 */ - if (PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_DATA_SIZE(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ - return PyUnicode_AsUTF8AndSize(o, length); -#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ -#endif /* PY_VERSION_HEX < 0x03030000 */ - } else -#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (r < 0) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { - PyNumberMethods *m; - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return Py_INCREF(x), x; - m = Py_TYPE(x)->tp_as_number; -#if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } -#else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%s__ returned non-%s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* 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; -} - - -#endif /* Py_PYTHON_H */ diff --git a/python/cdec/sa/_sa.cpp b/python/cdec/sa/_sa.cpp new file mode 100644 index 00000000..a9f7855e --- /dev/null +++ b/python/cdec/sa/_sa.cpp @@ -0,0 +1,80647 @@ +/* Generated by Cython 0.19.1 on Tue Sep 24 13:39:51 2013 */ + +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#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+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#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 *); +#endif +#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) +#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") +#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) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #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) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #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__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__cdec__sa___sa +#define __PYX_HAVE_API__cdec__sa___sa +#include "string.h" +#include "stdio.h" +#include "stdlib.h" +#include "strmap.h" +#include "math.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# 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*/ + +#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 +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#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) +#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; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +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 +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#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; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) 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) { + __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++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) 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) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#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; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) 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); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + 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; +} +#endif +#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__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +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", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector; +struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule; +struct __pyx_obj_4cdec_2sa_3_sa_LCP; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats; +struct __pyx_obj_4cdec_2sa_3_sa_IntList; +struct __pyx_obj_4cdec_2sa_3_sa_Phrase; +struct __pyx_obj_4cdec_2sa_3_sa_TrieNode; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases; +struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode; +struct __pyx_obj_4cdec_2sa_3_sa_Alignment; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_Rule; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_Precomputation; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance; +struct __pyx_obj_4cdec_2sa_3_sa_TrieMap; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments; +struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_FloatList; +struct __pyx_obj_4cdec_2sa_3_sa_StringMap; +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_TrieTable; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_VEB; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice; +struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation; +struct __pyx_obj_4cdec_2sa_3_sa_Scorer; +struct __pyx_obj_4cdec_2sa_3_sa_Sampler; +struct __pyx_obj_4cdec_2sa_3_sa_Alphabet; +struct __pyx_obj_4cdec_2sa_3_sa_BiLex; +struct __pyx_obj_4cdec_2sa_3_sa_DataArray; +struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator; +struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr; +struct __pyx_obj_4cdec_2sa_3_sa_BitSet; +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence; +struct __pyx_t_4cdec_2sa_3_sa__node; +struct __pyx_t_4cdec_2sa_3_sa__BitSet; +struct __pyx_t_4cdec_2sa_3_sa__VEB; +struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge; +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; + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":9 + * from libc.string cimport memset, strcpy + * + * cdef struct _node: # <<<<<<<<<<<<<< + * _node* smaller + * _node* bigger + */ +struct __pyx_t_4cdec_2sa_3_sa__node { + struct __pyx_t_4cdec_2sa_3_sa__node *smaller; + struct __pyx_t_4cdec_2sa_3_sa__node *bigger; + int key; + int val; +}; + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":30 + * _init_lower_mask() + * + * cdef struct _BitSet: # <<<<<<<<<<<<<< + * long bitset + * int min_val + */ +struct __pyx_t_4cdec_2sa_3_sa__BitSet { + long bitset; + int min_val; + int max_val; + int size; +}; + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":168 + * return result + * + * cdef struct _VEB: # <<<<<<<<<<<<<< + * int top_universe_size + * int num_bottom_bits + */ +struct __pyx_t_4cdec_2sa_3_sa__VEB { + int top_universe_size; + int num_bottom_bits; + int max_val; + int min_val; + int size; + void *top; + void **bottom; +}; + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":10 + * cdef struct _Trie_Node # forward decl + * + * cdef struct _Trie_Edge: # <<<<<<<<<<<<<< + * int val + * _Trie_Node* node + */ +struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge { + int val; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *node; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *bigger; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *smaller; +}; + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":8 + * from libc.string cimport memset, memcpy + * + * cdef struct _Trie_Node # forward decl # <<<<<<<<<<<<<< + * + * cdef struct _Trie_Edge: + */ +struct __pyx_t_4cdec_2sa_3_sa__Trie_Node { + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *root; + int *arr; + int arr_len; +}; + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":101 + * + * # linked list structure for storing matches in BaselineRuleFactory + * cdef struct match_node: # <<<<<<<<<<<<<< + * int* match + * match_node* next + */ +struct __pyx_t_4cdec_2sa_3_sa_match_node { + int *match; + struct __pyx_t_4cdec_2sa_3_sa_match_node *next; +}; + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":197 + * + * # struct used to encapsulate a single matching + * cdef struct Matching: # <<<<<<<<<<<<<< + * int* arr + * int start + */ +struct __pyx_t_4cdec_2sa_3_sa_Matching { + int *arr; + int start; + int end; + int sent_id; + int size; +}; + +/* "cdec/sa/_sa.pxd":25 + * cdef void read_handle(self, FILE* f) + * + * cdef class FeatureVector: # <<<<<<<<<<<<<< + * cdef IntList names + * cdef FloatList values + */ +struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa_IntList *names; + struct __pyx_obj_4cdec_2sa_3_sa_FloatList *values; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":6 + * from libc.stdio cimport FILE, fclose, fopen + * + * cdef class SuffixArray: # <<<<<<<<<<<<<< + * cdef DataArray darray + * cdef IntList sa + */ +struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray { + PyObject_HEAD + struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *__pyx_vtab; + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *darray; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *sa; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *ha; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110 + * return sym_isvar(sym) + * + * def make_lattice(words): # <<<<<<<<<<<<<< + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice { + PyObject_HEAD + PyObject *__pyx_v_word_ids; + PyObject *__pyx_v_words; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2128 + * + * # 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 { + PyObject_HEAD + PyObject *__pyx_v_a; + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":5 + * as k most frequent n-grams""" + * + * cdef class LCP: # <<<<<<<<<<<<<< + * cdef SuffixArray sa + * cdef IntList lcp + */ +struct __pyx_obj_4cdec_2sa_3_sa_LCP { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *sa; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *lcp; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186 + * 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 { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *__pyx_outer_scope; + PyObject *__pyx_v_a; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":39 + * ]) + * + * cdef class OnlineStats: # <<<<<<<<<<<<<< + * cdef public samples_f + * cdef public phrases_f + */ +struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats { + PyObject_HEAD + PyObject *samples_f; + PyObject *phrases_f; + PyObject *phrases_e; + PyObject *phrases_fe; + PyObject *phrases_al; + PyObject *bilex_f; + PyObject *bilex_e; + PyObject *bilex_fe; +}; + + +/* "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; +}; + + +/* "cdec/sa/_sa.pxd":29 + * cdef FloatList values + * + * cdef class Phrase: # <<<<<<<<<<<<<< + * cdef int *syms + * cdef int n, *varpos, n_vars + */ +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; + int n_vars; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":71 + * cdef int EPSILON = sym_fromstring('*EPS*', True) + * + * cdef class TrieNode: # <<<<<<<<<<<<<< + * cdef public children + * + */ +struct __pyx_obj_4cdec_2sa_3_sa_TrieNode { + PyObject_HEAD + PyObject *children; +}; + + +/* "/home/mdenkows/cdec/python/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) + * + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *__pyx_outer_scope; + PyObject *__pyx_v_line; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":72 + * self.read_text_data(fp) + * + * def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<< + * with gzip_or_text(filename) as fp: + * data = (line.split(' ||| ')[side] for line in fp) + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext { + PyObject_HEAD + PyObject *__pyx_v_fp; + int __pyx_v_side; +}; + + +/* "/home/mdenkows/cdec/python/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 { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *__pyx_outer_scope; + PyObject *__pyx_v_feat; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2147 + * # (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 { + PyObject_HEAD + PyObject *__pyx_v_extract; + PyObject *__pyx_v_f_len; + PyObject *__pyx_v_f_words; + PyObject *__pyx_v_phrases; + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":77 + * self.children = {} + * + * cdef class ExtendedTrieNode(TrieNode): # <<<<<<<<<<<<<< + * cdef public phrase + * cdef public phrase_location + */ +struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode { + struct __pyx_obj_4cdec_2sa_3_sa_TrieNode __pyx_base; + PyObject *phrase; + PyObject *phrase_location; + PyObject *suffix_link; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":10 + * cdef int ALIGNMENT_CODE = 1 << 16 + * + * cdef class Alignment: # <<<<<<<<<<<<<< + * cdef IntList links + * cdef IntList sent_index + */ +struct __pyx_obj_4cdec_2sa_3_sa_Alignment { + PyObject_HEAD + struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *__pyx_vtab; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *links; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *sent_index; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":978 + * 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 { + PyObject_HEAD + PyObject *__pyx_v_alignment; + PyObject *__pyx_v_als; + PyObject *__pyx_v_alslist; + int __pyx_v_alt; + int __pyx_v_alt_id; + int __pyx_v_arity; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_chunklen; + PyObject *__pyx_v_count; + PyObject *__pyx_v_ctx_name; + PyObject *__pyx_v_e; + PyObject *__pyx_v_elist; + PyObject *__pyx_v_extract; + PyObject *__pyx_v_extract_start; + PyObject *__pyx_v_extract_stop; + PyObject *__pyx_v_extracts; + PyObject *__pyx_v_f; + PyObject *__pyx_v_f_syms; + PyObject *__pyx_v_fcount; + int __pyx_v_flen; + PyObject *__pyx_v_fphrases; + PyObject *__pyx_v_frontier; + PyObject *__pyx_v_frontier_nodes; + PyObject *__pyx_v_fwords; + PyObject *__pyx_v_genexpr; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_hiero_phrase; + long __pyx_v_hit; + int __pyx_v_i; + PyObject *__pyx_v_input_match; + PyObject *__pyx_v_intersect_start_time; + PyObject *__pyx_v_intersect_stop_time; + PyObject *__pyx_v_is_shadow_path; + int __pyx_v_j; + int __pyx_v_k; + PyObject *__pyx_v_key; + PyObject *__pyx_v_lex_i; + PyObject *__pyx_v_lex_j; + PyObject *__pyx_v_loc; + PyObject *__pyx_v_locs; + int __pyx_v_lookup_required; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_matching; + PyObject *__pyx_v_max_locs; + PyObject *__pyx_v_meta; + PyObject *__pyx_v_new_frontier; + PyObject *__pyx_v_new_node; + PyObject *__pyx_v_next_states; + PyObject *__pyx_v_node; + PyObject *__pyx_v_nodes_isteps_away_buffer; + int __pyx_v_nualt; + int __pyx_v_num_samples; + int __pyx_v_num_subpatterns; + PyObject *__pyx_v_pathlen; + PyObject *__pyx_v_phrase; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_phrase_location; + PyObject *__pyx_v_prefix; + PyObject *__pyx_v_reachable_buffer; + PyObject *__pyx_v_sa_range; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_sample; + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_scores; + PyObject *__pyx_v_seen_phrases; + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; + PyObject *__pyx_v_spanlen; + float __pyx_v_start_time; + PyObject *__pyx_v_stats; + PyObject *__pyx_v_stop_time; + PyObject *__pyx_v_suffix_link; + int __pyx_v_suffix_link_xcat; + PyObject *__pyx_v_suffix_link_xcat_index; + PyObject *__pyx_v_word_id; + int __pyx_v_x1; + int __pyx_v_xcat; + PyObject *__pyx_v_xcat_index; + PyObject *__pyx_v_xnode; + PyObject *__pyx_v_xroot; + Py_ssize_t __pyx_t_0; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3; + PyObject *__pyx_t_4; + PyObject *__pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *(*__pyx_t_11)(PyObject *); +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124 + * return tuple(sym_fromstring(word, True) for word in words) + * + * def decode_words(syms): # <<<<<<<<<<<<<< + * return tuple(sym_tostring(sym) for sym in syms) + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words { + PyObject_HEAD + PyObject *__pyx_v_syms; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2124 + * 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 { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *__pyx_outer_scope; + PyObject *__pyx_v_i; + PyObject *__pyx_v_j; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; +}; + + +/* "cdec/sa/_sa.pxd":35 + * 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; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1193 + * 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 { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *__pyx_outer_scope; + PyObject *__pyx_v_word; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":188 + * + * + * cdef class Precomputation: # <<<<<<<<<<<<<< + * cdef int precompute_rank + * cdef int precompute_secondary_rank + */ +struct __pyx_obj_4cdec_2sa_3_sa_Precomputation { + PyObject_HEAD + struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *__pyx_vtab; + int precompute_rank; + int precompute_secondary_rank; + int max_length; + int max_nonterminals; + int train_max_initial_size; + int train_min_gap_size; + PyObject *precomputed_index; + PyObject *precomputed_collocations; +}; + + +/* "/home/mdenkows/cdec/python/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__ { + PyObject_HEAD + unsigned int __pyx_v_i; + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self; + int __pyx_t_0; + unsigned int __pyx_t_1; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1891 + * # 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 { + PyObject_HEAD + PyObject *__pyx_v_al; + PyObject *__pyx_v_cover; + PyObject *__pyx_v_e_nt_cover; + PyObject *__pyx_v_e_words; + PyObject *__pyx_v_ef_span; + PyObject *__pyx_v_extract; + PyObject *__pyx_v_f_len; + PyObject *__pyx_v_f_words; + PyObject *__pyx_v_fe_span; + PyObject *__pyx_v_rules; + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":109 + * trie_node_to_map(edge.node, result, prefix, include_zeros) + * + * cdef class TrieMap: # <<<<<<<<<<<<<< + * + * cdef _Trie_Node** root + */ +struct __pyx_obj_4cdec_2sa_3_sa_TrieMap { + PyObject_HEAD + struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *__pyx_vtab; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node **root; + int V; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":189 + * 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 { + PyObject_HEAD + PyObject *__pyx_v_point; + struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":340 + * + * + * cdef class VEBIterator: # <<<<<<<<<<<<<< + * cdef _VEB* v + * cdef int next_val + */ +struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator { + PyObject_HEAD + struct __pyx_t_4cdec_2sa_3_sa__VEB *v; + int next_val; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111 + * + * def make_lattice(words): + * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< + * return tuple(((word, None, 1), ) for word in word_ids) + * + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *__pyx_outer_scope; + PyObject *__pyx_v_word; + 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 + * + * cdef class FloatList: # <<<<<<<<<<<<<< + * cdef int size + * cdef int increment + */ +struct __pyx_obj_4cdec_2sa_3_sa_FloatList { + PyObject_HEAD + struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *__pyx_vtab; + int size; + int increment; + int len; + float *arr; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":8 + * char* stringmap_word(StrMap *vocab, int i) + * + * cdef class StringMap: # <<<<<<<<<<<<<< + * cdef StrMap *vocab + * cdef char *word(self, int i) + */ +struct __pyx_obj_4cdec_2sa_3_sa_StringMap { + PyObject_HEAD + struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *__pyx_vtab; + StrMap *vocab; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":140 + * return self.syms[i] + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i from 0 <= i < self.n: + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ { + PyObject_HEAD + int __pyx_v_i; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self; + int __pyx_t_0; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":182 + * 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__ { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":88 + * + * + * cdef class TrieTable: # <<<<<<<<<<<<<< + * cdef public int extended + * cdef public int count + */ +struct __pyx_obj_4cdec_2sa_3_sa_TrieTable { + PyObject_HEAD + int extended; + int count; + PyObject *root; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121 + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) + * + * def encode_words(words): # <<<<<<<<<<<<<< + * return tuple(sym_fromstring(word, True) for word in words) + * + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words { + PyObject_HEAD + PyObject *__pyx_v_words; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2129 + * # 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 { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *__pyx_outer_scope; + PyObject *__pyx_v_packed; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122 + * + * def encode_words(words): + * return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< + * + * def decode_words(syms): + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *__pyx_outer_scope; + PyObject *__pyx_v_word; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * def decode_lattice(lattice): + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *__pyx_outer_scope; + PyObject *__pyx_v_word; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2063 + * + * # 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 { + PyObject_HEAD + PyObject *__pyx_v_links; + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119 + * + * def decode_sentence(lattice): + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< + * + * def encode_words(words): + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr { + PyObject_HEAD + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_outer_scope; + PyObject *__pyx_v__; + PyObject *__pyx_v_sym; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; + PyObject *(*__pyx_t_2)(PyObject *); +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":354 + * + * + * cdef class VEB: # <<<<<<<<<<<<<< + * cdef _VEB* veb + * cdef int _findsucc(self, int i) + */ +struct __pyx_obj_4cdec_2sa_3_sa_VEB { + PyObject_HEAD + struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *__pyx_vtab; + struct __pyx_t_4cdec_2sa_3_sa__VEB *veb; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114 + * return tuple(((word, None, 1), ) for word in word_ids) + * + * 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) + */ +struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice { + PyObject_HEAD + PyObject *__pyx_v_lattice; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":109 + * # in the suffix array; if discontiguous, it is the set of + * # actual locations (packed into an array) + * cdef class PhraseLocation: # <<<<<<<<<<<<<< + * cdef int sa_low + * cdef int sa_high + */ +struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation { + PyObject_HEAD + struct __pyx_vtabstruct_4cdec_2sa_3_sa_PhraseLocation *__pyx_vtab; + int sa_low; + int sa_high; + int arr_low; + int arr_high; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *arr; + int num_subpatterns; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":23 + * return ' '.join('%s=%s' % feat for feat in self) + * + * cdef class Scorer: # <<<<<<<<<<<<<< + * cdef models + * def __init__(self, *models): + */ +struct __pyx_obj_4cdec_2sa_3_sa_Scorer { + PyObject_HEAD + struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer *__pyx_vtab; + PyObject *models; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":131 + * + * + * cdef class Sampler: # <<<<<<<<<<<<<< + * '''A Sampler implements a logic for choosing + * samples from a population range''' + */ +struct __pyx_obj_4cdec_2sa_3_sa_Sampler { + PyObject_HEAD + int sample_size; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *sa; +}; + + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":7 + * cdef int INDEX_MASK = (1<SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#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) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ + +static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize_t start, + Py_ssize_t end, int direction) +{ + const char* self_ptr = PyBytes_AS_STRING(self); + Py_ssize_t self_len = PyBytes_GET_SIZE(self); + 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); + } +#if PY_MAJOR_VERSION < 3 + else if ( PyUnicode_Check(arg) ) { + return PyUnicode_Tailmatch(self, arg, start, end, direction); + } +#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; + else if (end < 0) + end += self_len; + if (end < 0) + end = 0; + if (start < 0) + start += self_len; + if (start < 0) + start = 0; + if (direction > 0) { + if (end-sub_len > start) + start = end - sub_len; + } + if (start + sub_len <= end) + retval = !memcmp(self_ptr+start, sub_ptr, 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, + Py_ssize_t end, int direction) +{ + if (unlikely(PyTuple_Check(substr))) { + Py_ssize_t i, count = PyTuple_GET_SIZE(substr); + for (i = 0; i < count; i++) { + int result; +#if CYTHON_COMPILING_IN_CPYTHON + result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substr, i), + start, end, direction); +#else + PyObject* sub = PySequence_GetItem(substr, i); + if (unlikely(!sub)) return -1; + result = __Pyx_PyBytes_SingleTailmatch(self, sub, start, end, direction); + Py_DECREF(sub); +#endif + if (result) { + return result; + } + } + return 0; + } + return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction); +} + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +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*/ + +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 void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +#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 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))) +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); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + 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 = 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*/ + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); + +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */ + +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +static CYTHON_INLINE int __Pyx_mod_int(int, int); /* proto */ + +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 int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v, is_list, wraparound, boundscheck) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +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 */ +#if CYTHON_COMPILING_IN_PYPY +#define __Pyx_PyObject_AsDouble(obj) \ +(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \ + likely(PyInt_CheckExact(obj)) ? \ + PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj)) +#else +#define __Pyx_PyObject_AsDouble(obj) \ +((likely(PyFloat_CheckExact(obj))) ? \ + PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) +#endif + +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); + +static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +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 */ + +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) + PyErr_SetObject(PyExc_KeyError, args); + Py_XDECREF(args); + } + return NULL; + } + Py_INCREF(value); + return value; +} +#else + #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#endif + +#define __Pyx_CyFunction_USED 1 +#include +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CyFunction_GetClosure(f) \ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#define __Pyx_CyFunction_GetClassObj(f) \ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#define __Pyx_CyFunction_Defaults(type, f) \ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { + PyCFunctionObject func; + int flags; + PyObject *func_dict; + PyObject *func_weakreflist; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_code; + PyObject *func_closure; + PyObject *func_classobj; /* No-args super() class cell */ + void *defaults; + int defaults_pyobjects; + PyObject *defaults_tuple; /* Const defaults tuple */ + PyObject *defaults_kwdict; /* Const kwonly defaults dict */ + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; /* function annotations dict */ +} __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) +static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *self, PyObject *module, + PyObject* code); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __Pyx_CyFunction_init(void); + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L); /*proto*/ + +#include + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/ + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*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 short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +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*/ + +#define __Pyx_Generator_USED +#include +#include +typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); +typedef struct { + PyObject_HEAD + __pyx_generator_body_t body; + PyObject *closure; + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; + PyObject *gi_weakreflist; + PyObject *classobj; + PyObject *yieldfrom; + int resume_label; + char is_running; // using T_BOOL for property below requires char value +} __pyx_GeneratorObject; +static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, + PyObject *closure); +static int __pyx_Generator_init(void); +static int __Pyx_Generator_clear(PyObject* self); +#if 1 || PY_VERSION_HEX < 0x030300B0 +static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) +#endif + +static int __Pyx_check_binary_version(void); + +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*/ + + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'libc.math' */ + +/* Module declarations from 'cdec.sa._sa' */ +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_FeatureVector = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_SuffixArray = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_LCP = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_OnlineStats = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_IntList = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Phrase = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_TrieNode = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext = 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_26_get_f_phrases = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Alignment = 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_13_decode_words = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Rule = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Precomputation = 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_21_add_instance = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_TrieMap = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_VEBIterator = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_FloatList = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_StringMap = 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_TrieTable = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words = 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_12_genexpr = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = 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_10_genexpr = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_VEB = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Scorer = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Sampler = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_Alphabet = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_BiLex = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_DataArray = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_BitSetIterator = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_HieroCachingRuleFactory = 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_3_compute_stats = 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____iter__ = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa_BitSet = 0; +static PyTypeObject *__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence = 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; +static int __pyx_v_4cdec_2sa_3_sa_LOWER_MASK[32]; +static int __pyx_v_4cdec_2sa_3_sa_INDEX_SHIFT; +static int __pyx_v_4cdec_2sa_3_sa_INDEX_MASK; +static struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_4cdec_2sa_3_sa_ALPHABET = 0; +static int __pyx_v_4cdec_2sa_3_sa_PRECOMPUTE; +static int __pyx_v_4cdec_2sa_3_sa_MERGE; +static int __pyx_v_4cdec_2sa_3_sa_BAEZA_YATES; +static int __pyx_v_4cdec_2sa_3_sa_EPSILON; +static struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_4cdec_2sa_3_sa_FD = 0; +static char *__pyx_f_4cdec_2sa_3_sa_sym_tostring(int); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_sym_isvar(int); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_sym_getindex(int); /*proto*/ +static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int); /*proto*/ +static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__node *); /*proto*/ +static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *, int); /*proto*/ +static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void); /*proto*/ +static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(void); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa__BitSet *, int); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__BitSet *, int); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa__BitSet *, int); /*proto*/ +static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long); /*proto*/ +static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB *, int); /*proto*/ +static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__VEB *); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VEB *, int); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VEB *, int); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_sym_setindex(int, int); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_sym_fromstring(char *, int); /*proto*/ +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie_node(void); /*proto*/ +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie_edge(int); /*proto*/ +static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_node(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *); /*proto*/ +static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *); /*proto*/ +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_find(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *, int); /*proto*/ +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *, int); /*proto*/ +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_insert(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *, int); /*proto*/ +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *, PyObject *, PyObject *, int); /*proto*/ +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *, PyObject *, PyObject *, int); /*proto*/ +static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa_Matching *, int *, int, int, int *); /*proto*/ +static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int, int, int *); /*proto*/ +static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *, int *, int *, int); /*proto*/ +static int __pyx_f_4cdec_2sa_3_sa_median(int, int, int); /*proto*/ +static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int, int, int *, int, int, int *, int *); /*proto*/ +#define __Pyx_MODULE_NAME "cdec.sa._sa" +int __pyx_module_is_main_cdec__sa___sa = 0; + +/* Implementation of 'cdec.sa._sa' */ +static PyObject *__pyx_builtin_open; +static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_map; +static PyObject *__pyx_builtin_Exception; +static PyObject *__pyx_builtin_zip; +static PyObject *__pyx_builtin_StopIteration; +static PyObject *__pyx_builtin_cmp; +static PyObject *__pyx_builtin_sorted; +static PyObject *__pyx_builtin_max; +static PyObject *__pyx_pf_4cdec_2sa_3_sa_monitor_cpu(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_2gzip_or_text(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len); /* proto */ +static void __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /* proto */ +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, float __pyx_v_val); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ +static void __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_16__iter__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /* proto */ +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_27append(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_31write(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_33read(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9StringMap___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self); /* proto */ +static void __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side, int __pyx_v_use_sent_id); /* proto */ +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_11read_bitext_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename, int __pyx_v_side); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4data___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_from_text, PyObject *__pyx_v_from_data, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_earray, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_alignment); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_6BitSet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ +static void __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, int __pyx_v_size); /* proto */ +static void __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_LCP *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sa); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3LCP_2compute_stats(struct __pyx_obj_4cdec_2sa_3_sa_LCP *__pyx_v_self, int __pyx_v_max_n); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self); /* proto */ +static void __pyx_pf_4cdec_2sa_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sym); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_3genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_lattice_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_15decode_sentence_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12decode_words_genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_syms); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words); /* proto */ +static void __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_10arity(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci); /* proto */ +#if PY_MAJOR_VERSION < 3 +static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +#endif +static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +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 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 +static int __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); /* proto */ +#endif +static PyObject *__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); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_7__str___genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_12alignments(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1f___get__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1e___get__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size); /* proto */ +static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_from_stats, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_precompute_rank, PyObject *__pyx_v_precompute_secondary_rank, PyObject *__pyx_v_max_length, PyObject *__pyx_v_max_nonterminals, PyObject *__pyx_v_train_max_initial_size, PyObject *__pyx_v_train_min_gap_size); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_stats, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sarray); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_side); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_v_h, struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa, PyObject *__pyx_v_pad); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(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_10read_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_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 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 */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_phrase, PyObject *__pyx_v_phrase_location, PyObject *__pyx_v_suffix_link); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_self, int __pyx_v_sa_low, int __pyx_v_sa_high, int __pyx_v_arr_low, int __pyx_v_arr_high, PyObject *__pyx_v_arr, int __pyx_v_num_subpatterns); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_self, int __pyx_v_sample_size, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_phrase_location); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_alignment, float __pyx_v_by_slack_factor, char *__pyx_v_category, PyObject *__pyx_v_max_chunks, unsigned int __pyx_v_max_initial_size, unsigned int __pyx_v_max_length, unsigned int __pyx_v_max_nonterminals, PyObject *__pyx_v_max_target_chunks, PyObject *__pyx_v_max_target_length, unsigned int __pyx_v_min_gap_size, PyObject *__pyx_v_precompute_file, unsigned int __pyx_v_precompute_secondary_rank, unsigned int __pyx_v_precompute_rank, int __pyx_v_require_aligned_terminal, int __pyx_v_require_aligned_chunks, unsigned int __pyx_v_train_max_initial_size, unsigned int __pyx_v_train_min_gap_size, int __pyx_v_tight_phrases, int __pyx_v_use_baeza_yates, int __pyx_v_use_collocations, int __pyx_v_use_index); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray, struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_edarray, struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_sampler, struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_scorer); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_frontier, PyObject *__pyx_v_res, PyObject *__pyx_v_fwords); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_skip, PyObject *__pyx_v_i, PyObject *__pyx_v_spanlen, PyObject *__pyx_v_pathlen, PyObject *__pyx_v_fwords, PyObject *__pyx_v_next_states, PyObject *__pyx_v_reachable_buffer); /* proto */ +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_lambda5(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda6(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_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_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 */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_lookup(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_ctx_name); /* proto */ +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); /* proto */ +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); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_ctx_name); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_13FeatureVector___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self, unsigned int __pyx_v_name, float __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str___genexpr(PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self); /* proto */ +static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_self, PyObject *__pyx_v_models); /* proto */ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_FeatureVector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_SuffixArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(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_LCP(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_OnlineStats(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_IntList(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Phrase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieNode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(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_26_get_f_phrases(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_ExtendedTrieNode(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Alignment(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_13_decode_words(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_Rule(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_Precomputation(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_21_add_instance(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieMap(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_VEBIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_FloatList(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_StringMap(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_TrieTable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(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_12_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(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_10_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_VEB(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_PhraseLocation(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Scorer(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Sampler(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Alphabet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BiLex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_DataArray(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BitSetIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_HieroCachingRuleFactory(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_3_compute_stats(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____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BitSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static char __pyx_k_1[] = ".gz"; +static char __pyx_k_2[] = "Requested index %d of %d-length FloatList"; +static char __pyx_k_3[] = "IntList["; +static char __pyx_k_4[] = ","; +static char __pyx_k_5[] = "]"; +static char __pyx_k_6[] = "len="; +static char __pyx_k_7[] = "%s not in IntList"; +static char __pyx_k_8[] = "Requested index %d of %d-length IntList"; +static char __pyx_k_9[] = "Requested index %d:%d of %d-length IntList"; +static char __pyx_k_10[] = "Illegal key type %s for IntList"; +static char __pyx_k_14[] = "%s "; +static char __pyx_k_15[] = "\n"; +static char __pyx_k_19[] = " ||| "; +static char __pyx_k_23[] = "%d "; +static char __pyx_k_27[] = "%s %d "; +static char __pyx_k_29[] = "write_enhanced_handle"; +static char __pyx_k_33[] = "-"; +static char __pyx_k_37[] = "%d-%d "; +static char __pyx_k_44[] = "%d-%d out of bounds (I=%d,J=%d) in line %d\n"; +static char __pyx_k_47[] = ""; +static char __pyx_k_48[] = "Sort error in CLex"; +static char __pyx_k_50[] = " "; +static char __pyx_k_52[] = "%d %f %f "; +static char __pyx_k_54[] = "%d %s "; +static char __pyx_k_58[] = "%s %s %.6f %.6f\n"; +static char __pyx_k_60[] = " ("; +static char __pyx_k_61[] = ")"; +static char __pyx_k_62[] = "Constructing LCP array"; +static char __pyx_k_64[] = "LCP array completed"; +static char __pyx_k_66[] = "[%s,%d]"; +static char __pyx_k_67[] = "[%s]"; +static char __pyx_k_68[] = "\\"; +static char __pyx_k_69[] = " "; +static char __pyx_k_70[] = "Invalid LHS symbol: %d"; +static char __pyx_k_71[] = "%d-%d"; +static char __pyx_k_72[] = "precompute_secondary_rank"; +static char __pyx_k_73[] = "train_max_initial_size"; +static char __pyx_k_74[] = "Precomputing frequent intersections"; +static char __pyx_k_76[] = " Computing inverted indexes..."; +static char __pyx_k_78[] = " Computing collocations..."; +static char __pyx_k_80[] = " %d sentences"; +static char __pyx_k_85[] = "X "; +static char __pyx_k_86[] = "ERROR: unexpected pattern %s in set of precomputed collocations"; +static char __pyx_k_87[] = "RANK %d\tCOUNT, COST: %d %d\tCUMUL: %d, %d"; +static char __pyx_k_88[] = "Precomputed collocations for %d patterns out of %d possible (upper bound %d)"; +static char __pyx_k_89[] = "Precomputed inverted index for %d patterns "; +static char __pyx_k_90[] = "Precomputation took %f seconds"; +static char __pyx_k_91[] = " Bucket sort took %f seconds"; +static char __pyx_k_92[] = " Refining, sort depth = %d"; +static char __pyx_k_93[] = " Refinement took %f seconds"; +static char __pyx_k_94[] = " Finalizing sort..."; +static char __pyx_k_96[] = "Suffix array construction took %f seconds"; +static char __pyx_k_97[] = "Unexpected condition found in q3sort: sort from %d to %d"; +static char __pyx_k__0[] = "0"; +static char __pyx_k__1[] = "1"; +static char __pyx_k__a[] = "a"; +static char __pyx_k__e[] = "e"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__j[] = "j"; +static char __pyx_k__k[] = "k"; +static char __pyx_k__r[] = "r"; +static char __pyx_k__w[] = "w"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; +static char __pyx_k_101[] = "OnlineStats.__cinit__.."; +static char __pyx_k_102[] = "cdec.sa._sa"; +static char __pyx_k_104[] = "Sampling strategy: uniform, max sample size = %d"; +static char __pyx_k_105[] = "Sampling strategy: no sampling"; +static char __pyx_k_107[] = "require_aligned_terminal"; +static char __pyx_k_108[] = "require_aligned_chunks"; +static char __pyx_k_109[] = "[X]"; +static char __pyx_k_110[] = "Must specify an alignment object"; +static char __pyx_k_112[] = "Reading precomputed data from file %s... "; +static char __pyx_k_113[] = "Precomputation done with max nonterminals %d, decoder uses %d"; +static char __pyx_k_114[] = "Precomputation done with max terminals %d, decoder uses %d"; +static char __pyx_k_115[] = "Precomputation done with max initial size %d, decoder uses %d"; +static char __pyx_k_116[] = "Precomputation done with min gap size %d, decoder uses %d"; +static char __pyx_k_117[] = "Converting %d hash keys on precomputed inverted index... "; +static char __pyx_k_118[] = "Converting %d hash keys on precomputed collocations... "; +static char __pyx_k_119[] = "Processing precomputations took %f seconds"; +static char __pyx_k_120[] = "{"; + static char __pyx_k_121[] = "("; +static char __pyx_k_122[] = "}"; +static char __pyx_k_123[] = "get_precomputed_collocation"; +static char __pyx_k_124[] = "double binary"; +static char __pyx_k_125[] = "HieroCachingRuleFactory.input..lambda4.."; +static char __pyx_k_126[] = "Keyword trie error"; +static char __pyx_k_128[] = "HieroCachingRuleFactory.input.."; +static char __pyx_k_129[] = "get_all_nodes_isteps_away"; +static char __pyx_k_130[] = "Total time for rule lookup, extraction, and scoring = %f seconds"; +static char __pyx_k_131[] = " Extract time = %f seconds"; +static char __pyx_k_132[] = " Intersect time = %f seconds"; +static char __pyx_k_133[] = "No aligned terminals"; +static char __pyx_k_134[] = "Unaligned chunk"; +static char __pyx_k_135[] = "Gaps are not tight phrases"; +static char __pyx_k_136[] = "Inside edges of preceding subphrase are not tight"; +static char __pyx_k_137[] = "Inside edges of following subphrase are not tight"; +static char __pyx_k_138[] = "Subphrase [%d, %d] failed integrity check"; +static char __pyx_k_139[] = "Didn't extract anything from [%d, %d] -> [%d, %d]"; +static char __pyx_k_140[] = "Unable to extract basic phrase"; +static char __pyx_k_144[] = "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi"; +static char __pyx_k_145[] = "HieroCachingRuleFactory.add_instance..extract"; +static char __pyx_k_147[] = "HieroCachingRuleFactory.form_rule.."; +static char __pyx_k_150[] = "{0}-{1}"; +static char __pyx_k_151[] = "[X] ||| {0} ||| {1} ||| {2}"; +static char __pyx_k_152[] = "OnlineFeatureContext"; +static char __pyx_k_155[] = "HieroCachingRuleFactory.get_f_phrases..extract"; +static char __pyx_k_156[] = "%s=%s"; +static char __pyx_k_158[] = "/home/mdenkows/cdec/python/cdec/sa/_sa.pyx"; +static char __pyx_k_161[] = "cdec.sa"; +static char __pyx_k_165[] = "/home/mdenkows/cdec/python/cdec/sa/sym.pxi"; +static char __pyx_k_176[] = "*EPS*"; +static char __pyx_k__al[] = "al"; +static char __pyx_k__gc[] = "gc"; +static char __pyx_k__nt[] = "nt"; +static char __pyx_k__sa[] = "sa"; +static char __pyx_k__wc[] = "wc"; +static char __pyx_k__arr[] = "arr"; +static char __pyx_k__cmp[] = "cmp"; +static char __pyx_k__col[] = "col"; +static char __pyx_k__e_i[] = "e_i"; +static char __pyx_k__e_j[] = "e_j"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__f_i[] = "f_i"; +static char __pyx_k__f_j[] = "f_j"; +static char __pyx_k__get[] = "get"; +static char __pyx_k__isa[] = "isa"; +static char __pyx_k__ito[] = "ito"; +static char __pyx_k__key[] = "key"; +static char __pyx_k__lhs[] = "lhs"; +static char __pyx_k__low[] = "low"; +static char __pyx_k__map[] = "map"; +static char __pyx_k__max[] = "max"; +static char __pyx_k__ntc[] = "ntc"; +static char __pyx_k__pad[] = "pad"; +static char __pyx_k__pop[] = "pop"; +static char __pyx_k__res[] = "res"; +static char __pyx_k__set[] = "set"; +static char __pyx_k__sym[] = "sym"; +static char __pyx_k__vec[] = "vec"; +static char __pyx_k__zip[] = "zip"; +static char __pyx_k__NULL[] = "NULL"; +static char __pyx_k__args[] = "args"; +static char __pyx_k__dist[] = "dist"; +static char __pyx_k__gzip[] = "gzip"; +static char __pyx_k__high[] = "high"; +static char __pyx_k__info[] = "info"; +static char __pyx_k__join[] = "join"; +static char __pyx_k__link[] = "link"; +static char __pyx_k__meta[] = "meta"; +static char __pyx_k__name[] = "name"; +static char __pyx_k__open[] = "open"; +static char __pyx_k__seek[] = "seek"; +static char __pyx_k__send[] = "send"; +static char __pyx_k__side[] = "side"; +static char __pyx_k__size[] = "size"; +static char __pyx_k__skip[] = "skip"; +static char __pyx_k__stop[] = "stop"; +static char __pyx_k__syms[] = "syms"; +static char __pyx_k__warn[] = "warn"; +static char __pyx_k__word[] = "word"; +static char __pyx_k___SEP_[] = "_SEP_"; +static char __pyx_k__arity[] = "arity"; +static char __pyx_k__chain[] = "chain"; +static char __pyx_k__close[] = "close"; +static char __pyx_k__debug[] = "debug"; +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__isvar[] = "isvar"; +static char __pyx_k__lex_i[] = "lex_i"; +static char __pyx_k__lex_j[] = "lex_j"; +static char __pyx_k__links[] = "links"; +static char __pyx_k__merge[] = "merge"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__reset[] = "reset"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__stats[] = "stats"; +static char __pyx_k__throw[] = "throw"; +static char __pyx_k__toMap[] = "toMap"; +static char __pyx_k__value[] = "value"; +static char __pyx_k__words[] = "words"; +static char __pyx_k__write[] = "write"; +static char __pyx_k__append[] = "append"; +static char __pyx_k__e_span[] = "e_span"; +static char __pyx_k__e_text[] = "e_text"; +static char __pyx_k__earray[] = "earray"; +static char __pyx_k__extend[] = "extend"; +static char __pyx_k__f_span[] = "f_span"; +static char __pyx_k__f_text[] = "f_text"; +static char __pyx_k__fcount[] = "fcount"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__fwords[] = "fwords"; +static char __pyx_k__get_id[] = "get_id"; +static char __pyx_k__insert[] = "insert"; +static char __pyx_k__link_i[] = "link_i"; +static char __pyx_k__link_j[] = "link_j"; +static char __pyx_k__logger[] = "logger"; +static char __pyx_k__lookup[] = "lookup"; +static char __pyx_k__offset[] = "offset"; +static char __pyx_k__online[] = "online"; +static char __pyx_k__phrase[] = "phrase"; +static char __pyx_k__q3sort[] = "q3sort"; +static char __pyx_k__sa_low[] = "sa_low"; +static char __pyx_k__sample[] = "sample"; +static char __pyx_k__sarray[] = "sarray"; +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__unlink[] = "unlink"; +static char __pyx_k__Counter[] = "Counter"; +static char __pyx_k__advance[] = "advance"; +static char __pyx_k__arr_low[] = "arr_low"; +static char __pyx_k__bilex_e[] = "bilex_e"; +static char __pyx_k__bilex_f[] = "bilex_f"; +static char __pyx_k__collect[] = "collect"; +static char __pyx_k__e_words[] = "e_words"; +static char __pyx_k__edarray[] = "edarray"; +static char __pyx_k__ephrase[] = "ephrase"; +static char __pyx_k__extract[] = "extract"; +static char __pyx_k__f_words[] = "f_words"; +static char __pyx_k__fphrase[] = "fphrase"; +static char __pyx_k__fsarray[] = "fsarray"; +static char __pyx_k__genexpr[] = "genexpr"; +static char __pyx_k__lattice[] = "lattice"; +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_open[] = "nt_open"; +static char __pyx_k__pathlen[] = "pathlen"; +static char __pyx_k__sa_high[] = "sa_high"; +static char __pyx_k__sampler[] = "sampler"; +static char __pyx_k__spanlen[] = "spanlen"; +static char __pyx_k__GzipFile[] = "GzipFile"; +static char __pyx_k____exit__[] = "__exit__"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____name__[] = "__name__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k___columns[] = "_columns"; +static char __pyx_k__arr_high[] = "arr_high"; +static char __pyx_k__bilex_fe[] = "bilex_fe"; +static char __pyx_k__category[] = "category"; +static char __pyx_k__children[] = "children"; +static char __pyx_k__ctx_name[] = "ctx_name"; +static char __pyx_k__curr_idx[] = "curr_idx"; +static char __pyx_k__extended[] = "extended"; +static char __pyx_k__filename[] = "filename"; +static char __pyx_k__frontier[] = "frontier"; +static char __pyx_k__get_e_id[] = "get_e_id"; +static char __pyx_k__get_f_id[] = "get_f_id"; +static char __pyx_k__get_word[] = "get_word"; +static char __pyx_k__getchunk[] = "getchunk"; +static char __pyx_k__min_dist[] = "min_dist"; +static char __pyx_k__resource[] = "resource"; +static char __pyx_k__ru_stime[] = "ru_stime"; +static char __pyx_k__ru_utime[] = "ru_utime"; +static char __pyx_k__shortest[] = "shortest"; +static char __pyx_k__span_dec[] = "span_dec"; +static char __pyx_k__span_inc[] = "span_inc"; +static char __pyx_k__word_ids[] = "word_ids"; +static char __pyx_k__Exception[] = "Exception"; +static char __pyx_k__INCREMENT[] = "INCREMENT"; +static char __pyx_k__TypeError[] = "TypeError"; +static char __pyx_k____enter__[] = "__enter__"; +static char __pyx_k__alignment[] = "alignment"; +static char __pyx_k__enumerate[] = "enumerate"; +static char __pyx_k__form_rule[] = "form_rule"; +static char __pyx_k__from_data[] = "from_data"; +static char __pyx_k__from_text[] = "from_text"; +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__itertools[] = "itertools"; +static char __pyx_k__min_bound[] = "min_bound"; +static char __pyx_k__new_lex_i[] = "new_lex_i"; +static char __pyx_k__new_lex_j[] = "new_lex_j"; +static char __pyx_k__paircount[] = "paircount"; +static char __pyx_k__partition[] = "partition"; +static char __pyx_k__phrases_e[] = "phrases_e"; +static char __pyx_k__phrases_f[] = "phrases_f"; +static char __pyx_k__reachable[] = "reachable"; +static char __pyx_k__read_text[] = "read_text"; +static char __pyx_k__samples_f[] = "samples_f"; +static char __pyx_k__use_index[] = "use_index"; +static char __pyx_k__IndexError[] = "IndexError"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____import__[] = "__import__"; +static char __pyx_k__alignments[] = "alignments"; +static char __pyx_k__from_stats[] = "from_stats"; +static char __pyx_k__input_span[] = "input_span"; +static char __pyx_k__itervalues[] = "itervalues"; +static char __pyx_k__max_chunks[] = "max_chunks"; +static char __pyx_k__max_length[] = "max_length"; +static char __pyx_k__namedtuple[] = "namedtuple"; +static char __pyx_k__phrases_al[] = "phrases_al"; +static char __pyx_k__phrases_fe[] = "phrases_fe"; +static char __pyx_k__plus_links[] = "plus_links"; +static char __pyx_k__precompute[] = "precompute"; +static char __pyx_k__span_check[] = "span_check"; +static char __pyx_k__write_text[] = "write_text"; +static char __pyx_k__END_OF_FILE[] = "END_OF_FILE"; +static char __pyx_k__END_OF_LINE[] = "END_OF_LINE"; +static char __pyx_k__RUSAGE_SELF[] = "RUSAGE_SELF"; +static char __pyx_k__collections[] = "collections"; +static char __pyx_k__defaultdict[] = "defaultdict"; +static char __pyx_k__from_binary[] = "from_binary"; +static char __pyx_k__initial_len[] = "initial_len"; +static char __pyx_k__input_match[] = "input_match"; +static char __pyx_k__monitor_cpu[] = "monitor_cpu"; +static char __pyx_k__next_states[] = "next_states"; +static char __pyx_k__old_last_nt[] = "old_last_nt"; +static char __pyx_k__precomputed[] = "precomputed"; +static char __pyx_k__read_binary[] = "read_binary"; +static char __pyx_k__read_bitext[] = "read_bitext"; +static char __pyx_k__sample_size[] = "sample_size"; +static char __pyx_k__suffix_link[] = "suffix_link"; +static char __pyx_k__use_sent_id[] = "use_sent_id"; +static char __pyx_k___doquicksort[] = "_doquicksort"; +static char __pyx_k__decode_words[] = "decode_words"; +static char __pyx_k__encode_words[] = "encode_words"; +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__StopIteration[] = "StopIteration"; +static char __pyx_k__alphabet_size[] = "alphabet_size"; +static char __pyx_k__from_iterable[] = "from_iterable"; +static char __pyx_k__fsample_count[] = "fsample_count"; +static char __pyx_k__get_f_phrases[] = "get_f_phrases"; +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____pyx_vtable__[] = "__pyx_vtable__"; +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__by_slack_factor[] = "by_slack_factor"; +static char __pyx_k__decode_sentence[] = "decode_sentence"; +static char __pyx_k__get_next_states[] = "get_next_states"; +static char __pyx_k__num_subpatterns[] = "num_subpatterns"; +static char __pyx_k__phrase_location[] = "phrase_location"; +static char __pyx_k__precompute_file[] = "precompute_file"; +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__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__use_collocations[] = "use_collocations"; +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"; +static char __pyx_k__train_min_gap_size[] = "train_min_gap_size"; +static char __pyx_k__pattern2phrase_plus[] = "pattern2phrase_plus"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_10; +static PyObject *__pyx_n_s_101; +static PyObject *__pyx_n_s_102; +static PyObject *__pyx_kp_s_104; +static PyObject *__pyx_kp_s_105; +static PyObject *__pyx_n_s_107; +static PyObject *__pyx_n_s_108; +static PyObject *__pyx_kp_s_110; +static PyObject *__pyx_kp_s_112; +static PyObject *__pyx_kp_s_113; +static PyObject *__pyx_kp_s_114; +static PyObject *__pyx_kp_s_115; +static PyObject *__pyx_kp_s_116; +static PyObject *__pyx_kp_s_117; +static PyObject *__pyx_kp_s_118; +static PyObject *__pyx_kp_s_119; +static PyObject *__pyx_kp_s_120; +static PyObject *__pyx_kp_s_121; +static PyObject *__pyx_kp_s_122; +static PyObject *__pyx_n_s_123; +static PyObject *__pyx_kp_s_124; +static PyObject *__pyx_n_s_125; +static PyObject *__pyx_kp_s_126; +static PyObject *__pyx_n_s_128; +static PyObject *__pyx_n_s_129; +static PyObject *__pyx_kp_s_130; +static PyObject *__pyx_kp_s_131; +static PyObject *__pyx_kp_s_132; +static PyObject *__pyx_kp_s_133; +static PyObject *__pyx_kp_s_134; +static PyObject *__pyx_kp_s_135; +static PyObject *__pyx_kp_s_136; +static PyObject *__pyx_kp_s_137; +static PyObject *__pyx_kp_s_138; +static PyObject *__pyx_kp_s_139; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_140; +static PyObject *__pyx_kp_s_144; +static PyObject *__pyx_n_s_145; +static PyObject *__pyx_n_s_147; +static PyObject *__pyx_kp_s_15; +static PyObject *__pyx_kp_s_150; +static PyObject *__pyx_kp_s_151; +static PyObject *__pyx_n_s_152; +static PyObject *__pyx_n_s_155; +static PyObject *__pyx_kp_s_156; +static PyObject *__pyx_kp_s_158; +static PyObject *__pyx_kp_s_161; +static PyObject *__pyx_kp_s_165; +static PyObject *__pyx_kp_s_19; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_23; +static PyObject *__pyx_kp_s_27; +static PyObject *__pyx_n_s_29; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_33; +static PyObject *__pyx_kp_s_37; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_44; +static PyObject *__pyx_kp_s_47; +static PyObject *__pyx_kp_s_48; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_50; +static PyObject *__pyx_kp_s_52; +static PyObject *__pyx_kp_s_54; +static PyObject *__pyx_kp_s_58; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_s_60; +static PyObject *__pyx_kp_s_61; +static PyObject *__pyx_kp_s_62; +static PyObject *__pyx_kp_s_64; +static PyObject *__pyx_kp_s_66; +static PyObject *__pyx_kp_s_67; +static PyObject *__pyx_kp_s_68; +static PyObject *__pyx_kp_s_69; +static PyObject *__pyx_kp_s_7; +static PyObject *__pyx_kp_s_70; +static PyObject *__pyx_kp_s_71; +static PyObject *__pyx_n_s_72; +static PyObject *__pyx_n_s_73; +static PyObject *__pyx_kp_s_74; +static PyObject *__pyx_kp_s_76; +static PyObject *__pyx_kp_s_78; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_80; +static PyObject *__pyx_kp_s_85; +static PyObject *__pyx_kp_s_86; +static PyObject *__pyx_kp_s_87; +static PyObject *__pyx_kp_s_88; +static PyObject *__pyx_kp_s_89; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_kp_s_90; +static PyObject *__pyx_kp_s_91; +static PyObject *__pyx_kp_s_92; +static PyObject *__pyx_kp_s_93; +static PyObject *__pyx_kp_s_94; +static PyObject *__pyx_kp_s_96; +static PyObject *__pyx_kp_s_97; +static PyObject *__pyx_kp_s__0; +static PyObject *__pyx_kp_s__1; +static PyObject *__pyx_n_s__Counter; +static PyObject *__pyx_n_s__END_OF_FILE; +static PyObject *__pyx_n_s__END_OF_LINE; +static PyObject *__pyx_n_s__Exception; +static PyObject *__pyx_n_s__FeatureContext; +static PyObject *__pyx_n_s__GzipFile; +static PyObject *__pyx_n_s__INCREMENT; +static PyObject *__pyx_n_s__INITIAL_CAPACITY; +static PyObject *__pyx_n_s__IndexError; +static PyObject *__pyx_n_s__NULL; +static PyObject *__pyx_n_s__RUSAGE_SELF; +static PyObject *__pyx_n_s__StopIteration; +static PyObject *__pyx_n_s__TypeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____enter__; +static PyObject *__pyx_n_s____exit__; +static PyObject *__pyx_n_s____import__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____name__; +static PyObject *__pyx_n_s____pyx_vtable__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___columns; +static PyObject *__pyx_n_s___doquicksort; +static PyObject *__pyx_n_s__a; +static PyObject *__pyx_n_s__advance; +static PyObject *__pyx_n_s__al; +static PyObject *__pyx_n_s__alignment; +static PyObject *__pyx_n_s__alignments; +static PyObject *__pyx_n_s__alphabet_size; +static PyObject *__pyx_n_s__append; +static PyObject *__pyx_n_s__args; +static PyObject *__pyx_n_s__arity; +static PyObject *__pyx_n_s__arr; +static PyObject *__pyx_n_s__arr_high; +static PyObject *__pyx_n_s__arr_low; +static PyObject *__pyx_n_s__bilex_e; +static PyObject *__pyx_n_s__bilex_f; +static PyObject *__pyx_n_s__bilex_fe; +static PyObject *__pyx_n_s__by_slack_factor; +static PyObject *__pyx_n_s__category; +static PyObject *__pyx_n_s__chain; +static PyObject *__pyx_n_s__children; +static PyObject *__pyx_n_s__close; +static PyObject *__pyx_n_s__cmp; +static PyObject *__pyx_n_s__col; +static PyObject *__pyx_n_s__collect; +static PyObject *__pyx_n_s__collections; +static PyObject *__pyx_n_s__ctx_name; +static PyObject *__pyx_n_s__curr_idx; +static PyObject *__pyx_n_s__debug; +static PyObject *__pyx_n_s__decode_lattice; +static PyObject *__pyx_n_s__decode_sentence; +static PyObject *__pyx_n_s__decode_words; +static PyObject *__pyx_n_s__defaultdict; +static PyObject *__pyx_n_s__dist; +static PyObject *__pyx_n_s__e; +static PyObject *__pyx_n_s__e_i; +static PyObject *__pyx_n_s__e_j; +static PyObject *__pyx_n_s__e_span; +static PyObject *__pyx_n_s__e_text; +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__end; +static PyObject *__pyx_n_s__enumerate; +static PyObject *__pyx_n_s__ephrase; +static PyObject *__pyx_n_s__eword; +static PyObject *__pyx_n_s__extend; +static PyObject *__pyx_n_s__extended; +static PyObject *__pyx_n_s__extract; +static PyObject *__pyx_n_s__f; +static PyObject *__pyx_n_s__f_i; +static PyObject *__pyx_n_s__f_j; +static PyObject *__pyx_n_s__f_span; +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__form_rule; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__fphrase; +static PyObject *__pyx_n_s__from_binary; +static PyObject *__pyx_n_s__from_data; +static PyObject *__pyx_n_s__from_iterable; +static PyObject *__pyx_n_s__from_stats; +static PyObject *__pyx_n_s__from_text; +static PyObject *__pyx_n_s__frontier; +static PyObject *__pyx_n_s__fsample_count; +static PyObject *__pyx_n_s__fsarray; +static PyObject *__pyx_n_s__fword; +static PyObject *__pyx_n_s__fwords; +static PyObject *__pyx_n_s__gc; +static PyObject *__pyx_n_s__genexpr; +static PyObject *__pyx_n_s__get; +static PyObject *__pyx_n_s__getLogger; +static PyObject *__pyx_n_s__get_e_id; +static PyObject *__pyx_n_s__get_f_id; +static PyObject *__pyx_n_s__get_f_phrases; +static PyObject *__pyx_n_s__get_id; +static PyObject *__pyx_n_s__get_next_states; +static PyObject *__pyx_n_s__get_word; +static PyObject *__pyx_n_s__getchunk; +static PyObject *__pyx_n_s__getrusage; +static PyObject *__pyx_n_s__gzip; +static PyObject *__pyx_n_s__gzip_or_text; +static PyObject *__pyx_n_s__h; +static PyObject *__pyx_n_s__high; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__ifrom; +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_match; +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__iteritems; +static PyObject *__pyx_n_s__itertools; +static PyObject *__pyx_n_s__itervalues; +static PyObject *__pyx_n_s__ito; +static PyObject *__pyx_n_s__j; +static PyObject *__pyx_n_s__join; +static PyObject *__pyx_n_s__k; +static PyObject *__pyx_n_s__key; +static PyObject *__pyx_n_s__lattice; +static PyObject *__pyx_n_s__lex_i; +static PyObject *__pyx_n_s__lex_j; +static PyObject *__pyx_n_s__lhs; +static PyObject *__pyx_n_s__link; +static PyObject *__pyx_n_s__link_i; +static PyObject *__pyx_n_s__link_j; +static PyObject *__pyx_n_s__links; +static PyObject *__pyx_n_s__logger; +static PyObject *__pyx_n_s__logging; +static PyObject *__pyx_n_s__lookup; +static PyObject *__pyx_n_s__low; +static PyObject *__pyx_n_s__make_lattice; +static PyObject *__pyx_n_s__map; +static PyObject *__pyx_n_s__matches; +static PyObject *__pyx_n_s__max; +static PyObject *__pyx_n_s__max_chunks; +static PyObject *__pyx_n_s__max_initial_size; +static PyObject *__pyx_n_s__max_length; +static PyObject *__pyx_n_s__max_nonterminals; +static PyObject *__pyx_n_s__max_target_chunks; +static PyObject *__pyx_n_s__max_target_length; +static PyObject *__pyx_n_s__merge; +static PyObject *__pyx_n_s__meta; +static PyObject *__pyx_n_s__min_bound; +static PyObject *__pyx_n_s__min_dist; +static PyObject *__pyx_n_s__min_gap_size; +static PyObject *__pyx_n_s__monitor_cpu; +static PyObject *__pyx_n_s__name; +static PyObject *__pyx_n_s__namedtuple; +static PyObject *__pyx_n_s__new_e_i; +static PyObject *__pyx_n_s__new_e_j; +static PyObject *__pyx_n_s__new_lex_i; +static PyObject *__pyx_n_s__new_lex_j; +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_open; +static PyObject *__pyx_n_s__ntc; +static PyObject *__pyx_n_s__num_subpatterns; +static PyObject *__pyx_n_s__offset; +static PyObject *__pyx_n_s__old_last_nt; +static PyObject *__pyx_n_s__online; +static PyObject *__pyx_n_s__online_ctx_lookup; +static PyObject *__pyx_n_s__open; +static PyObject *__pyx_n_s__pad; +static PyObject *__pyx_n_s__paircount; +static PyObject *__pyx_n_s__partition; +static PyObject *__pyx_n_s__pathlen; +static PyObject *__pyx_n_s__pattern2phrase; +static PyObject *__pyx_n_s__pattern2phrase_plus; +static PyObject *__pyx_n_s__phrase; +static PyObject *__pyx_n_s__phrase_location; +static PyObject *__pyx_n_s__phrases_al; +static PyObject *__pyx_n_s__phrases_e; +static PyObject *__pyx_n_s__phrases_f; +static PyObject *__pyx_n_s__phrases_fe; +static PyObject *__pyx_n_s__plus_links; +static PyObject *__pyx_n_s__pop; +static PyObject *__pyx_n_s__precompute; +static PyObject *__pyx_n_s__precompute_file; +static PyObject *__pyx_n_s__precompute_rank; +static PyObject *__pyx_n_s__precomputed; +static PyObject *__pyx_n_s__q3sort; +static PyObject *__pyx_n_s__range; +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_text; +static PyObject *__pyx_n_s__read_text_data; +static PyObject *__pyx_n_s__res; +static PyObject *__pyx_n_s__reset; +static PyObject *__pyx_n_s__resource; +static PyObject *__pyx_n_s__ru_stime; +static PyObject *__pyx_n_s__ru_utime; +static PyObject *__pyx_n_s__sa; +static PyObject *__pyx_n_s__sa_high; +static PyObject *__pyx_n_s__sa_low; +static PyObject *__pyx_n_s__sample; +static PyObject *__pyx_n_s__sample_size; +static PyObject *__pyx_n_s__sampler; +static PyObject *__pyx_n_s__samples_f; +static PyObject *__pyx_n_s__sarray; +static PyObject *__pyx_n_s__scorer; +static PyObject *__pyx_n_s__scores; +static PyObject *__pyx_n_s__seek; +static PyObject *__pyx_n_s__send; +static PyObject *__pyx_n_s__set; +static PyObject *__pyx_n_s__shortest; +static PyObject *__pyx_n_s__side; +static PyObject *__pyx_n_s__size; +static PyObject *__pyx_n_s__skip; +static PyObject *__pyx_n_s__sorted; +static PyObject *__pyx_n_s__source; +static PyObject *__pyx_n_s__span_check; +static PyObject *__pyx_n_s__span_dec; +static PyObject *__pyx_n_s__span_inc; +static PyObject *__pyx_n_s__spanlen; +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__suffix_link; +static PyObject *__pyx_n_s__sym; +static PyObject *__pyx_n_s__syms; +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__train_min_gap_size; +static PyObject *__pyx_n_s__unlink; +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_n_s__value; +static PyObject *__pyx_n_s__vec; +static PyObject *__pyx_n_s__w; +static PyObject *__pyx_n_s__warn; +static PyObject *__pyx_n_s__wc; +static PyObject *__pyx_n_s__word; +static PyObject *__pyx_n_s__word_alignments; +static PyObject *__pyx_n_s__word_ids; +static PyObject *__pyx_n_s__words; +static PyObject *__pyx_n_s__write; +static PyObject *__pyx_n_s__write_text; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_n_s__zip; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_5; +static PyObject *__pyx_int_7; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_10; +static PyObject *__pyx_int_20; +static PyObject *__pyx_int_1000; +static PyObject *__pyx_k_43; +static PyObject *__pyx_k_103; +static PyObject *__pyx_k_slice_22; +static PyObject *__pyx_k_tuple_11; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_13; +static PyObject *__pyx_k_tuple_16; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_18; +static PyObject *__pyx_k_tuple_20; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_tuple_24; +static PyObject *__pyx_k_tuple_25; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_28; +static PyObject *__pyx_k_tuple_30; +static PyObject *__pyx_k_tuple_31; +static PyObject *__pyx_k_tuple_32; +static PyObject *__pyx_k_tuple_34; +static PyObject *__pyx_k_tuple_35; +static PyObject *__pyx_k_tuple_36; +static PyObject *__pyx_k_tuple_38; +static PyObject *__pyx_k_tuple_39; +static PyObject *__pyx_k_tuple_40; +static PyObject *__pyx_k_tuple_41; +static PyObject *__pyx_k_tuple_42; +static PyObject *__pyx_k_tuple_45; +static PyObject *__pyx_k_tuple_46; +static PyObject *__pyx_k_tuple_49; +static PyObject *__pyx_k_tuple_51; +static PyObject *__pyx_k_tuple_53; +static PyObject *__pyx_k_tuple_55; +static PyObject *__pyx_k_tuple_56; +static PyObject *__pyx_k_tuple_57; +static PyObject *__pyx_k_tuple_59; +static PyObject *__pyx_k_tuple_63; +static PyObject *__pyx_k_tuple_65; +static PyObject *__pyx_k_tuple_75; +static PyObject *__pyx_k_tuple_77; +static PyObject *__pyx_k_tuple_79; +static PyObject *__pyx_k_tuple_81; +static PyObject *__pyx_k_tuple_82; +static PyObject *__pyx_k_tuple_83; +static PyObject *__pyx_k_tuple_84; +static PyObject *__pyx_k_tuple_95; +static PyObject *__pyx_k_tuple_98; +static PyObject *__pyx_k_tuple_99; +static PyObject *__pyx_k_slice_141; +static PyObject *__pyx_k_slice_146; +static PyObject *__pyx_k_slice_148; +static PyObject *__pyx_k_slice_149; +static PyObject *__pyx_k_tuple_100; +static PyObject *__pyx_k_tuple_106; +static PyObject *__pyx_k_tuple_111; +static PyObject *__pyx_k_tuple_127; +static PyObject *__pyx_k_tuple_142; +static PyObject *__pyx_k_tuple_153; +static PyObject *__pyx_k_tuple_159; +static PyObject *__pyx_k_tuple_162; +static PyObject *__pyx_k_tuple_163; +static PyObject *__pyx_k_tuple_166; +static PyObject *__pyx_k_tuple_168; +static PyObject *__pyx_k_tuple_170; +static PyObject *__pyx_k_tuple_172; +static PyObject *__pyx_k_tuple_174; +static PyObject *__pyx_k_tuple_177; +static PyObject *__pyx_k_tuple_179; +static PyObject *__pyx_k_tuple_181; +static PyObject *__pyx_k_codeobj_143; +static PyObject *__pyx_k_codeobj_154; +static PyObject *__pyx_k_codeobj_157; +static PyObject *__pyx_k_codeobj_160; +static PyObject *__pyx_k_codeobj_164; +static PyObject *__pyx_k_codeobj_167; +static PyObject *__pyx_k_codeobj_169; +static PyObject *__pyx_k_codeobj_171; +static PyObject *__pyx_k_codeobj_173; +static PyObject *__pyx_k_codeobj_175; +static PyObject *__pyx_k_codeobj_178; +static PyObject *__pyx_k_codeobj_180; +static PyObject *__pyx_k_codeobj_182; + +/* 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 PyObject *__pyx_pw_4cdec_2sa_3_sa_1monitor_cpu(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("monitor_cpu (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_monitor_cpu(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cdec/sa/_sa.pyx":5 + * import gzip + * + * def monitor_cpu(): # <<<<<<<<<<<<<< + * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ + * resource.getrusage(resource.RUSAGE_SELF).ru_stime) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_monitor_cpu(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("monitor_cpu", 0); + + /* "cdec/sa/_sa.pyx":6 + * + * def monitor_cpu(): + * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ # <<<<<<<<<<<<<< + * resource.getrusage(resource.RUSAGE_SELF).ru_stime) + * + */ + __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_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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cdec/sa/_sa.pyx":7 + * def monitor_cpu(): + * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ + * resource.getrusage(resource.RUSAGE_SELF).ru_stime) # <<<<<<<<<<<<<< + * + * 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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__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_4); __pyx_t_4 = 0; + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.monitor_cpu", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_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 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; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gzip_or_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[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_2gzip_or_text(__pyx_self, ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cdec/sa/_sa.pyx":9 + * resource.getrusage(resource.RUSAGE_SELF).ru_stime) + * + * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< + * if filename.endswith('.gz'): + * return gzip.GzipFile(filename) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_2gzip_or_text(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_filename) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + 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("gzip_or_text", 0); + + /* "cdec/sa/_sa.pyx":10 + * + * def gzip_or_text(char* filename): + * if filename.endswith('.gz'): # <<<<<<<<<<<<<< + * return gzip.GzipFile(filename) + * else: + */ + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = __Pyx_PyBytes_Tailmatch(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_s_1), 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if ((__pyx_t_2 != 0)) { + + /* "cdec/sa/_sa.pyx":11 + * def gzip_or_text(char* filename): + * if filename.endswith('.gz'): + * return gzip.GzipFile(filename) # <<<<<<<<<<<<<< + * else: + * 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_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(((PyObject *)__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_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__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[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_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "cdec/sa/_sa.pyx":13 + * return gzip.GzipFile(filename) + * else: + * return open(filename) # <<<<<<<<<<<<<< + * + * logger = logging.getLogger('cdec.sa') + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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[0]; __pyx_lineno = 13; __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)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.gzip_or_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9FloatList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_size; + int __pyx_v_increment; + int __pyx_v_initial_len; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__increment,&__pyx_n_s__initial_len,0}; + PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__size); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__increment); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__initial_len); + if (value) { values[2] = 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[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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; + } + } + if (values[0]) { + __pyx_v_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_size = ((int)0); + } + if (values[1]) { + __pyx_v_increment = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_increment == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_increment = ((int)1); + } + if (values[2]) { + __pyx_v_initial_len = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_initial_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_initial_len = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.FloatList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":11 + * cdef class FloatList: + * + * def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<< + * if initial_len > size: + * size = initial_len + */ + +static int __pyx_pf_4cdec_2sa_3_sa_9FloatList___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":12 + * + * def __cinit__(self, int size=0, int increment=1, int initial_len=0): + * if initial_len > size: # <<<<<<<<<<<<<< + * size = initial_len + * self.size = size + */ + __pyx_t_1 = ((__pyx_v_initial_len > __pyx_v_size) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * self.size = size + * self.increment = increment + */ + __pyx_v_size = __pyx_v_initial_len; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":14 + * if initial_len > size: + * size = initial_len + * self.size = size # <<<<<<<<<<<<<< + * self.increment = increment + * self.len = initial_len + */ + __pyx_v_self->size = __pyx_v_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":15 + * size = initial_len + * self.size = size + * self.increment = increment # <<<<<<<<<<<<<< + * self.len = initial_len + * self.arr = malloc(size*sizeof(float)) + */ + __pyx_v_self->increment = __pyx_v_increment; + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":16 + * self.size = size + * self.increment = increment + * self.len = initial_len # <<<<<<<<<<<<<< + * self.arr = malloc(size*sizeof(float)) + * memset(self.arr, 0, initial_len*sizeof(float)) + */ + __pyx_v_self->len = __pyx_v_initial_len; + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":17 + * self.increment = increment + * self.len = initial_len + * self.arr = malloc(size*sizeof(float)) # <<<<<<<<<<<<<< + * memset(self.arr, 0, initial_len*sizeof(float)) + * + */ + __pyx_v_self->arr = ((float *)malloc((__pyx_v_size * (sizeof(float))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":18 + * self.len = initial_len + * self.arr = malloc(size*sizeof(float)) + * memset(self.arr, 0, initial_len*sizeof(float)) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + memset(__pyx_v_self->arr, 0, (__pyx_v_initial_len * (sizeof(float)))); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_4cdec_2sa_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_9FloatList_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":20 + * memset(self.arr, 0, initial_len*sizeof(float)) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * free(self.arr) + * + */ + +static void __pyx_pf_4cdec_2sa_3_sa_9FloatList_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":21 + * + * def __dealloc__(self): + * free(self.arr) # <<<<<<<<<<<<<< + * + * def __getitem__(self, i): + */ + free(__pyx_v_self->arr); + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":23 + * free(self.arr) + * + * def __getitem__(self, i): # <<<<<<<<<<<<<< + * j = i + * if i<0: + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_4__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_v_j = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":24 + * + * def __getitem__(self, i): + * j = i # <<<<<<<<<<<<<< + * if i<0: + * j = self.len + i + */ + __Pyx_INCREF(__pyx_v_i); + __pyx_v_j = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":25 + * def __getitem__(self, i): + * j = i + * if i<0: # <<<<<<<<<<<<<< + * j = self.len + i + * if j<0 or j>=self.len: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __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[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":26 + * j = i + * 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)) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":27 + * 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)) + * 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_2) { + __pyx_t_3 = PyInt_FromLong(__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; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< + * return self.arr[j] + * + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __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[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __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[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * + * 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_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.FloatList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_j); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":31 + * return self.arr[j] + * + * cdef void set(self, int i, float v): # <<<<<<<<<<<<<< + * j = i + * if i<0: + */ + +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) { + int __pyx_v_j; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":32 + * + * cdef void set(self, int i, float v): + * j = i # <<<<<<<<<<<<<< + * if i<0: + * j = self.len + i + */ + __pyx_v_j = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":33 + * cdef void set(self, int i, float v): + * j = i + * if i<0: # <<<<<<<<<<<<<< + * j = self.len + i + * if j<0 or j>=self.len: + */ + __pyx_t_1 = ((__pyx_v_i < 0) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":34 + * j = i + * 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)) + */ + __pyx_v_j = (__pyx_v_self->len + __pyx_v_i); + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__pyx_v_i); 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 = PyInt_FromLong(__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_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); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__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(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__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, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__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_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * + * def __setitem__(self, i, val): + */ + (__pyx_v_self->arr[__pyx_v_j]) = __pyx_v_v; + + goto __pyx_L0; + __pyx_L1_error:; + __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); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9FloatList_7__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":39 + * self.arr[j] = v + * + * def __setitem__(self, i, val): # <<<<<<<<<<<<<< + * self.set(i, val) + * + */ + +static int __pyx_pf_4cdec_2sa_3_sa_9FloatList_6__setitem__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + float __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":40 + * + * def __setitem__(self, i, val): + * self.set(i, val) # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.FloatList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":42 + * self.set(i, val) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.len + * + */ + +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9FloatList_8__len__(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":43 + * + * def __len__(self): + * return self.len # <<<<<<<<<<<<<< + * + * def append(self, float val): + */ + __pyx_r = __pyx_v_self->len; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_11append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { + float __pyx_v_val; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("append (wrapper)", 0); + assert(__pyx_arg_val); { + __pyx_v_val = __pyx_PyFloat_AsFloat(__pyx_arg_val); if (unlikely((__pyx_v_val == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.FloatList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((float)__pyx_v_val)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":45 + * return self.len + * + * def append(self, float val): # <<<<<<<<<<<<<< + * if self.len == self.size: + * self.size = self.size + self.increment + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_10append(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, float __pyx_v_val) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("append", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":46 + * + * def append(self, float val): + * if self.len == self.size: # <<<<<<<<<<<<<< + * self.size = self.size + self.increment + * self.arr = realloc(self.arr, self.size*sizeof(float)) + */ + __pyx_t_1 = ((__pyx_v_self->len == __pyx_v_self->size) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":47 + * def append(self, float val): + * if self.len == self.size: + * self.size = self.size + self.increment # <<<<<<<<<<<<<< + * self.arr = realloc(self.arr, self.size*sizeof(float)) + * self.arr[self.len] = val + */ + __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->increment); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":48 + * if self.len == self.size: + * self.size = self.size + self.increment + * self.arr = realloc(self.arr, self.size*sizeof(float)) # <<<<<<<<<<<<<< + * self.arr[self.len] = val + * self.len = self.len + 1 + */ + __pyx_v_self->arr = ((float *)realloc(__pyx_v_self->arr, (__pyx_v_self->size * (sizeof(float))))); + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":49 + * self.size = self.size + self.increment + * self.arr = realloc(self.arr, self.size*sizeof(float)) + * self.arr[self.len] = val # <<<<<<<<<<<<<< + * self.len = self.len + 1 + * + */ + (__pyx_v_self->arr[__pyx_v_self->len]) = __pyx_v_val; + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":50 + * self.arr = realloc(self.arr, self.size*sizeof(float)) + * self.arr[self.len] = val + * self.len = self.len + 1 # <<<<<<<<<<<<<< + * + * cdef void write_handle(self, FILE* f): + */ + __pyx_v_self->len = (__pyx_v_self->len + 1); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":52 + * self.len = self.len + 1 + * + * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< + * fwrite(&(self.len), sizeof(float), 1, f) + * fwrite(self.arr, sizeof(float), self.len, f) + */ + +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) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_handle", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":53 + * + * cdef void write_handle(self, FILE* f): + * fwrite(&(self.len), sizeof(float), 1, f) # <<<<<<<<<<<<<< + * fwrite(self.arr, sizeof(float), self.len, f) + * + */ + fwrite((&__pyx_v_self->len), (sizeof(float)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * def write(self, char* filename): + */ + fwrite(__pyx_v_self->arr, (sizeof(float)), __pyx_v_self->len, __pyx_v_f); + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_13write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write (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[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.FloatList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":56 + * fwrite(self.arr, sizeof(float), self.len, f) + * + * def write(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_12write(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":58 + * def write(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "w") # <<<<<<<<<<<<<< + * self.write_handle(f) + * fclose(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":59 + * cdef FILE* f + * f = fopen(filename, "w") + * self.write_handle(f) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":60 + * f = fopen(filename, "w") + * self.write_handle(f) + * fclose(f) # <<<<<<<<<<<<<< + * + * cdef void read_handle(self, FILE* f): + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":62 + * fclose(f) + * + * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< + * free(self.arr) + * fread(&(self.len), sizeof(float), 1, f) + */ + +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) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("read_handle", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":63 + * + * cdef void read_handle(self, FILE* f): + * free(self.arr) # <<<<<<<<<<<<<< + * fread(&(self.len), sizeof(float), 1, f) + * self.arr = malloc(self.len * sizeof(float)) + */ + free(__pyx_v_self->arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":64 + * cdef void read_handle(self, FILE* f): + * free(self.arr) + * fread(&(self.len), sizeof(float), 1, f) # <<<<<<<<<<<<<< + * self.arr = malloc(self.len * sizeof(float)) + * self.size = self.len + */ + fread((&__pyx_v_self->len), (sizeof(float)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":65 + * free(self.arr) + * fread(&(self.len), sizeof(float), 1, f) + * self.arr = malloc(self.len * sizeof(float)) # <<<<<<<<<<<<<< + * self.size = self.len + * fread(self.arr, sizeof(float), self.len, f) + */ + __pyx_v_self->arr = ((float *)malloc((__pyx_v_self->len * (sizeof(float))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":66 + * fread(&(self.len), sizeof(float), 1, f) + * self.arr = malloc(self.len * sizeof(float)) + * self.size = self.len # <<<<<<<<<<<<<< + * fread(self.arr, sizeof(float), self.len, f) + * + */ + __pyx_t_1 = __pyx_v_self->len; + __pyx_v_self->size = __pyx_t_1; + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":67 + * self.arr = malloc(self.len * sizeof(float)) + * self.size = self.len + * fread(self.arr, sizeof(float), self.len, f) # <<<<<<<<<<<<<< + * + * def read(self, char* filename): + */ + fread(__pyx_v_self->arr, (sizeof(float)), __pyx_v_self->len, __pyx_v_f); + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9FloatList_15read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read (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[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.FloatList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":69 + * fread(self.arr, sizeof(float), self.len, f) + * + * def read(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9FloatList_14read(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":71 + * def read(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "r") # <<<<<<<<<<<<<< + * self.read_handle(f) + * fclose(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":72 + * cdef FILE* f + * f = fopen(filename, "r") + * self.read_handle(f) # <<<<<<<<<<<<<< + * fclose(f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/float_list.pxi":73 + * f = fopen(filename, "r") + * self.read_handle(f) + * fclose(f) # <<<<<<<<<<<<<< + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_7IntList_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_size; + int __pyx_v_increment; + int __pyx_v_initial_len; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__increment,&__pyx_n_s__initial_len,0}; + PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__size); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__increment); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__initial_len); + if (value) { values[2] = 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[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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; + } + } + if (values[0]) { + __pyx_v_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_size = ((int)0); + } + if (values[1]) { + __pyx_v_increment = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_increment == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_increment = ((int)1); + } + if (values[2]) { + __pyx_v_initial_len = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_initial_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_initial_len = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.IntList.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), __pyx_v_size, __pyx_v_increment, __pyx_v_initial_len); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":11 + * cdef class IntList: + * + * def __cinit__(self, int size=0, int increment=1, int initial_len=0): # <<<<<<<<<<<<<< + * if initial_len > size: + * size = initial_len + */ + +static int __pyx_pf_4cdec_2sa_3_sa_7IntList___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_size, int __pyx_v_increment, int __pyx_v_initial_len) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":12 + * + * def __cinit__(self, int size=0, int increment=1, int initial_len=0): + * if initial_len > size: # <<<<<<<<<<<<<< + * size = initial_len + * self.size = size + */ + __pyx_t_1 = ((__pyx_v_initial_len > __pyx_v_size) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * self.size = size + * self.increment = increment + */ + __pyx_v_size = __pyx_v_initial_len; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":14 + * if initial_len > size: + * size = initial_len + * self.size = size # <<<<<<<<<<<<<< + * self.increment = increment + * self.len = initial_len + */ + __pyx_v_self->size = __pyx_v_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":15 + * size = initial_len + * self.size = size + * self.increment = increment # <<<<<<<<<<<<<< + * self.len = initial_len + * self.arr = malloc(size*sizeof(int)) + */ + __pyx_v_self->increment = __pyx_v_increment; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":16 + * self.size = size + * self.increment = increment + * self.len = initial_len # <<<<<<<<<<<<<< + * self.arr = malloc(size*sizeof(int)) + * memset(self.arr, 0, initial_len*sizeof(int)) + */ + __pyx_v_self->len = __pyx_v_initial_len; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":17 + * self.increment = increment + * self.len = initial_len + * self.arr = malloc(size*sizeof(int)) # <<<<<<<<<<<<<< + * memset(self.arr, 0, initial_len*sizeof(int)) + * + */ + __pyx_v_self->arr = ((int *)malloc((__pyx_v_size * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":18 + * self.len = initial_len + * self.arr = malloc(size*sizeof(int)) + * memset(self.arr, 0, initial_len*sizeof(int)) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + memset(__pyx_v_self->arr, 0, (__pyx_v_initial_len * (sizeof(int)))); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_3__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_3__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":20 + * memset(self.arr, 0, initial_len*sizeof(int)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * ret = "IntList[" + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_2__str__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { + PyObject *__pyx_v_ret = NULL; + int __pyx_v_idx; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":22 + * def __str__(self): + * cdef unsigned i + * ret = "IntList[" # <<<<<<<<<<<<<< + * for idx in range(self.size): + * if idx>0: + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + __pyx_v_ret = ((PyObject *)__pyx_kp_s_3); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":23 + * cdef unsigned i + * ret = "IntList[" + * for idx in range(self.size): # <<<<<<<<<<<<<< + * if idx>0: + * ret += "," + */ + __pyx_t_1 = __pyx_v_self->size; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_idx = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":24 + * ret = "IntList[" + * for idx in range(self.size): + * if idx>0: # <<<<<<<<<<<<<< + * ret += "," + * ret += str(self.arr[idx]) + */ + __pyx_t_3 = ((__pyx_v_idx > 0) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":25 + * for idx in range(self.size): + * if idx>0: + * ret += "," # <<<<<<<<<<<<<< + * ret += str(self.arr[idx]) + * ret += "]" + */ + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_ret, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_ret); + __pyx_v_ret = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":26 + * if idx>0: + * ret += "," + * ret += str(self.arr[idx]) # <<<<<<<<<<<<<< + * ret += "]" + * ret += "len=" + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_self->arr[__pyx_v_idx])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __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[2]; __pyx_lineno = 26; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_ret, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_ret); + __pyx_v_ret = __pyx_t_5; + __pyx_t_5 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":27 + * ret += "," + * ret += str(self.arr[idx]) + * ret += "]" # <<<<<<<<<<<<<< + * ret += "len=" + * ret += str(self.len) + */ + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_ret, ((PyObject *)__pyx_kp_s_5)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_ret); + __pyx_v_ret = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":28 + * ret += str(self.arr[idx]) + * ret += "]" + * ret += "len=" # <<<<<<<<<<<<<< + * ret += str(self.len) + * return ret + */ + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_ret, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_ret); + __pyx_v_ret = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":29 + * ret += "]" + * ret += "len=" + * ret += str(self.len) # <<<<<<<<<<<<<< + * return ret + * + */ + __pyx_t_5 = PyInt_FromLong(__pyx_v_self->len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __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[2]; __pyx_lineno = 29; __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(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_ret, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_ret); + __pyx_v_ret = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":30 + * ret += "len=" + * ret += str(self.len) + * return ret # <<<<<<<<<<<<<< + * + * def index(self, int val): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_ret); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cdec.sa._sa.IntList.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_5index(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { + int __pyx_v_val; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("index (wrapper)", 0); + assert(__pyx_arg_val); { + __pyx_v_val = __Pyx_PyInt_AsInt(__pyx_arg_val); if (unlikely((__pyx_v_val == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.IntList.index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_4index(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":32 + * return ret + * + * def index(self, int val): # <<<<<<<<<<<<<< + * cdef unsigned i + * for i in range(self.len): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_4index(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { + unsigned int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + unsigned int __pyx_t_2; + int __pyx_t_3; + 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("index", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":34 + * def index(self, int val): + * cdef unsigned i + * for i in range(self.len): # <<<<<<<<<<<<<< + * if self.arr[i] == val: + * return i + */ + __pyx_t_1 = __pyx_v_self->len; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":35 + * cdef unsigned i + * for i in range(self.len): + * if self.arr[i] == val: # <<<<<<<<<<<<<< + * return i + * raise ValueError('%s not in IntList' % val) + */ + __pyx_t_3 = (((__pyx_v_self->arr[__pyx_v_i]) == __pyx_v_val) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":36 + * for i in range(self.len): + * if self.arr[i] == val: + * return i # <<<<<<<<<<<<<< + * raise ValueError('%s not in IntList' % val) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":37 + * if self.arr[i] == val: + * return i + * raise ValueError('%s not in IntList' % val) # <<<<<<<<<<<<<< + * + * def partition(self,start,end): + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_val); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __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); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cdec.sa._sa.IntList.index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_7partition(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("partition (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; + PyObject* values[2] = {0,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__start)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("partition", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "partition") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_start = values[0]; + __pyx_v_end = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("partition", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":39 + * raise ValueError('%s not in IntList' % val) + * + * def partition(self,start,end): # <<<<<<<<<<<<<< + * pivot = self.arr[end] + * bottom = start-1 + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_6partition(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { + PyObject *__pyx_v_pivot = NULL; + PyObject *__pyx_v_bottom = NULL; + PyObject *__pyx_v_top = NULL; + long __pyx_v_done; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("partition", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":40 + * + * def partition(self,start,end): + * pivot = self.arr[end] # <<<<<<<<<<<<<< + * bottom = start-1 + * top = end + */ + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_end); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_pivot = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":41 + * def partition(self,start,end): + * pivot = self.arr[end] + * bottom = start-1 # <<<<<<<<<<<<<< + * top = end + * done = 0 + */ + __pyx_t_2 = PyNumber_Subtract(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_bottom = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":42 + * pivot = self.arr[end] + * bottom = start-1 + * top = end # <<<<<<<<<<<<<< + * done = 0 + * while not done: + */ + __Pyx_INCREF(__pyx_v_end); + __pyx_v_top = __pyx_v_end; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":43 + * bottom = start-1 + * top = end + * done = 0 # <<<<<<<<<<<<<< + * while not done: + * while not done: + */ + __pyx_v_done = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":44 + * top = end + * done = 0 + * while not done: # <<<<<<<<<<<<<< + * while not done: + * bottom += 1 + */ + while (1) { + __pyx_t_3 = ((!(__pyx_v_done != 0)) != 0); + if (!__pyx_t_3) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":45 + * done = 0 + * while not done: + * while not done: # <<<<<<<<<<<<<< + * bottom += 1 + * if bottom == top: + */ + while (1) { + __pyx_t_3 = ((!(__pyx_v_done != 0)) != 0); + if (!__pyx_t_3) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":46 + * while not done: + * while not done: + * bottom += 1 # <<<<<<<<<<<<<< + * if bottom == top: + * done = 1 + */ + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_bottom, __pyx_int_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(__pyx_v_bottom); + __pyx_v_bottom = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":47 + * while not done: + * bottom += 1 + * if bottom == top: # <<<<<<<<<<<<<< + * done = 1 + * break + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_bottom, __pyx_v_top, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 47; __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[2]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":48 + * bottom += 1 + * if bottom == top: + * done = 1 # <<<<<<<<<<<<<< + * break + * if self.arr[bottom] > pivot: + */ + __pyx_v_done = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":49 + * if bottom == top: + * done = 1 + * break # <<<<<<<<<<<<<< + * if self.arr[bottom] > pivot: + * self.arr[top] = self.arr[bottom] + */ + goto __pyx_L6_break; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":50 + * done = 1 + * break + * if self.arr[bottom] > pivot: # <<<<<<<<<<<<<< + * self.arr[top] = self.arr[bottom] + * break + */ + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_bottom); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_v_pivot, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 50; __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[2]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":51 + * break + * if self.arr[bottom] > pivot: + * self.arr[top] = self.arr[bottom] # <<<<<<<<<<<<<< + * break + * while not done: + */ + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_bottom); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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]); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":52 + * if self.arr[bottom] > pivot: + * self.arr[top] = self.arr[bottom] + * break # <<<<<<<<<<<<<< + * while not done: + * top -= 1 + */ + goto __pyx_L6_break; + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L6_break:; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":53 + * self.arr[top] = self.arr[bottom] + * break + * while not done: # <<<<<<<<<<<<<< + * top -= 1 + * if top == bottom: + */ + while (1) { + __pyx_t_3 = ((!(__pyx_v_done != 0)) != 0); + if (!__pyx_t_3) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":54 + * break + * while not done: + * top -= 1 # <<<<<<<<<<<<<< + * if top == bottom: + * done = 1 + */ + __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_v_top, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_top); + __pyx_v_top = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":55 + * while not done: + * top -= 1 + * if top == bottom: # <<<<<<<<<<<<<< + * done = 1 + * break + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_top, __pyx_v_bottom, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":56 + * top -= 1 + * if top == bottom: + * done = 1 # <<<<<<<<<<<<<< + * break + * if self.arr[top] < pivot: + */ + __pyx_v_done = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":57 + * if top == bottom: + * done = 1 + * break # <<<<<<<<<<<<<< + * if self.arr[top] < pivot: + * self.arr[bottom] = self.arr[top] + */ + goto __pyx_L10_break; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":58 + * done = 1 + * break + * if self.arr[top] < pivot: # <<<<<<<<<<<<<< + * self.arr[bottom] = self.arr[top] + * break + */ + __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 = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_self->arr[__pyx_t_1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_v_pivot, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[2]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":59 + * break + * if self.arr[top] < pivot: + * self.arr[bottom] = self.arr[top] # <<<<<<<<<<<<<< + * break + * self.arr[top] = pivot + */ + __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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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]); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":60 + * if self.arr[top] < pivot: + * self.arr[bottom] = self.arr[top] + * break # <<<<<<<<<<<<<< + * self.arr[top] = pivot + * return top + */ + goto __pyx_L10_break; + goto __pyx_L12; + } + __pyx_L12:; + } + __pyx_L10_break:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":61 + * self.arr[bottom] = self.arr[top] + * break + * self.arr[top] = pivot # <<<<<<<<<<<<<< + * return top + * + */ + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_pivot); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":62 + * break + * self.arr[top] = pivot + * return top # <<<<<<<<<<<<<< + * + * def _doquicksort(self,start,end): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_top); + __pyx_r = __pyx_v_top; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.IntList.partition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pivot); + __Pyx_XDECREF(__pyx_v_bottom); + __Pyx_XDECREF(__pyx_v_top); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_9_doquicksort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_doquicksort (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; + PyObject* values[2] = {0,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__start)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_doquicksort", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_doquicksort") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_start = values[0]; + __pyx_v_end = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_doquicksort", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), __pyx_v_start, __pyx_v_end); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":64 + * return top + * + * def _doquicksort(self,start,end): # <<<<<<<<<<<<<< + * if start < end: + * split = self.partition(start,end) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_8_doquicksort(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { + PyObject *__pyx_v_split = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + 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("_doquicksort", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":65 + * + * def _doquicksort(self,start,end): + * if start < end: # <<<<<<<<<<<<<< + * split = self.partition(start,end) + * self._doquicksort(start,split-1) + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 65; __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[2]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/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_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_split = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/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_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_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_1, 0, __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":68 + * split = self.partition(start,end) + * self._doquicksort(start,split-1) + * self._doquicksort(split+1,end) # <<<<<<<<<<<<<< + * else: + * return + */ + __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_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":70 + * self._doquicksort(split+1,end) + * else: + * return # <<<<<<<<<<<<<< + * + * def sort(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.IntList._doquicksort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_split); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_11sort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sort (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":72 + * return + * + * def sort(self): # <<<<<<<<<<<<<< + * self._doquicksort(0,self.len-1) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_10sort(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sort", 0); + + /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong((__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_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_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 0, __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.IntList.sort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_13reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":75 + * self._doquicksort(0,self.len-1) + * + * def reset(self): # <<<<<<<<<<<<<< + * self.len = 0 + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_12reset(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":76 + * + * def reset(self): + * self.len = 0 # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->len = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_4cdec_2sa_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_7IntList_15__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":78 + * self.len = 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * free(self.arr) + * + */ + +static void __pyx_pf_4cdec_2sa_3_sa_7IntList_14__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":79 + * + * def __dealloc__(self): + * free(self.arr) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + free(__pyx_v_self->arr); + + __Pyx_RefNannyFinishContext(); +} +static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_17__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_16__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":81 + * free(self.arr) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(self.len): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_16__iter__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____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____iter__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct____iter__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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(); + return __pyx_r; +} + +static PyObject *__pyx_gb_4cdec_2sa_3_sa_7IntList_18generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = 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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":83 + * def __iter__(self): + * cdef int i + * for i in range(self.len): # <<<<<<<<<<<<<< + * yield self.arr[i] + * + */ + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->len; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_cur_scope->__pyx_v_i = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":84 + * cdef int i + * for i in range(self.len): + * yield self.arr[i] # <<<<<<<<<<<<<< + * + * def __getitem__(self, index): + */ + __pyx_t_3 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_self->arr[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __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_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_20__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":86 + * yield self.arr[i] + * + * def __getitem__(self, index): # <<<<<<<<<<<<<< + * cdef int i, j, k + * if isinstance(index, int): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_19__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_index) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + 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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":88 + * def __getitem__(self, index): + * cdef int i, j, k + * if isinstance(index, int): # <<<<<<<<<<<<<< + * j = index + * if j < 0: + */ + __pyx_t_1 = PyInt_Check(__pyx_v_index); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":89 + * cdef int i, j, k + * if isinstance(index, int): + * j = index # <<<<<<<<<<<<<< + * if j < 0: + * j = self.len + j + */ + __pyx_t_3 = __Pyx_PyInt_AsInt(__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":90 + * if isinstance(index, int): + * j = index + * if j < 0: # <<<<<<<<<<<<<< + * j = self.len + j + * if j<0 or j>=self.len: + */ + __pyx_t_2 = ((__pyx_v_j < 0) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":91 + * j = index + * 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)) + */ + __pyx_v_j = (__pyx_v_self->len + __pyx_v_j); + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__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_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); + __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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__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(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__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, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_6), NULL); 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(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * elif isinstance(index, slice): + * i = index.start + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyInt_FromLong((__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; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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_AsInt(__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_v_i = __pyx_t_3; + + /* "/home/mdenkows/cdec/python/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_AsInt(__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_v_j = __pyx_t_3; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":99 + * j = index.stop + * if i < 0: + * i = self.len + i # <<<<<<<<<<<<<< + * if j < 0: + * j = self.len + j + */ + __pyx_v_i = (__pyx_v_self->len + __pyx_v_i); + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":101 + * 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: + * 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; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * raise IndexError("Requested index %d:%d of %d-length IntList" % (index.start, index.stop, self.len)) + * result = () + */ + __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; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/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_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_GOTREF(__pyx_t_6); + __pyx_t_9 = PyInt_FromLong(__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_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_10, 1, __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_5 = 0; + __pyx_t_6 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), ((PyObject *)__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(((PyObject *)__pyx_t_9)); + __Pyx_DECREF(((PyObject *)__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, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__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(((PyObject *)__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_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/mdenkows/cdec/python/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 = () # <<<<<<<<<<<<<< + * for k from i <= k < j: + * result = result + (self.arr[k],) + */ + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + __pyx_v_result = __pyx_empty_tuple; + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * result = result + (self.arr[k],) + * return result + */ + __pyx_t_3 = __pyx_v_j; + for (__pyx_v_k = __pyx_v_i; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":106 + * result = () + * for k from i <= k < j: + * result = result + (self.arr[k],) # <<<<<<<<<<<<<< + * return result + * else: + */ + __pyx_t_9 = PyInt_FromLong((__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(((PyObject *)__pyx_v_result), ((PyObject *)__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(((PyObject *)__pyx_t_9)); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = ((PyObject*)__pyx_t_9); + __pyx_t_9 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":107 + * for k from i <= k < j: + * result = result + (self.arr[k],) + * return result # <<<<<<<<<<<<<< + * else: + * raise TypeError("Illegal key type %s for IntList" % type(index)) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), ((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(((PyObject *)__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, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__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(((PyObject *)__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_filename = __pyx_f[2]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("cdec.sa._sa.IntList.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":111 + * raise TypeError("Illegal key type %s for IntList" % type(index)) + * + * cdef void set(self, int i, int val): # <<<<<<<<<<<<<< + * j = i + * if i<0: + */ + +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) { + int __pyx_v_j; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":112 + * + * cdef void set(self, int i, int val): + * j = i # <<<<<<<<<<<<<< + * if i<0: + * j = self.len + i + */ + __pyx_v_j = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":113 + * cdef void set(self, int i, int val): + * j = i + * if i<0: # <<<<<<<<<<<<<< + * j = self.len + i + * if j<0 or j>=self.len: + */ + __pyx_t_1 = ((__pyx_v_i < 0) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":114 + * j = i + * 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)) + */ + __pyx_v_j = (__pyx_v_self->len + __pyx_v_i); + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__pyx_v_i); 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 = PyInt_FromLong(__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_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); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__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(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__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, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__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_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * + * def __setitem__(self, i, val): + */ + (__pyx_v_self->arr[__pyx_v_j]) = __pyx_v_val; + + goto __pyx_L0; + __pyx_L1_error:; + __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); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_7IntList_22__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_i), ((PyObject *)__pyx_v_val)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":119 + * self.arr[j] = val + * + * def __setitem__(self, i, val): # <<<<<<<<<<<<<< + * self.set(i, val) + * + */ + +static int __pyx_pf_4cdec_2sa_3_sa_7IntList_21__setitem__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_i, PyObject *__pyx_v_val) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":120 + * + * def __setitem__(self, i, val): + * self.set(i, val) # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__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); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.IntList.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":122 + * self.set(i, val) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.len + * + */ + +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_7IntList_23__len__(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":123 + * + * def __len__(self): + * return self.len # <<<<<<<<<<<<<< + * + * def get_size(self): + */ + __pyx_r = __pyx_v_self->len; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_26get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_size (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":125 + * return self.len + * + * def get_size(self): # <<<<<<<<<<<<<< + * return self.size + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_25get_size(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_size", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":126 + * + * def get_size(self): + * return self.size # <<<<<<<<<<<<<< + * + * def append(self, int val): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.IntList.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_28append(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { + int __pyx_v_val; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("append (wrapper)", 0); + assert(__pyx_arg_val); { + __pyx_v_val = __Pyx_PyInt_AsInt(__pyx_arg_val); if (unlikely((__pyx_v_val == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.IntList.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_27append(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((int)__pyx_v_val)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":128 + * return self.size + * + * def append(self, int val): # <<<<<<<<<<<<<< + * self._append(val) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_27append(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, int __pyx_v_val) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("append", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":129 + * + * def append(self, int val): + * self._append(val) # <<<<<<<<<<<<<< + * + * cdef void _append(self, int val): + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->_append(__pyx_v_self, __pyx_v_val); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":131 + * self._append(val) + * + * cdef void _append(self, int val): # <<<<<<<<<<<<<< + * if self.len == self.size: + * self.size = self.size + self.increment + */ + +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) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("_append", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":132 + * + * cdef void _append(self, int val): + * if self.len == self.size: # <<<<<<<<<<<<<< + * self.size = self.size + self.increment + * self.arr = realloc(self.arr, self.size*sizeof(int)) + */ + __pyx_t_1 = ((__pyx_v_self->len == __pyx_v_self->size) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":133 + * cdef void _append(self, int val): + * if self.len == self.size: + * self.size = self.size + self.increment # <<<<<<<<<<<<<< + * self.arr = realloc(self.arr, self.size*sizeof(int)) + * self.arr[self.len] = val + */ + __pyx_v_self->size = (__pyx_v_self->size + __pyx_v_self->increment); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":134 + * if self.len == self.size: + * self.size = self.size + self.increment + * self.arr = realloc(self.arr, self.size*sizeof(int)) # <<<<<<<<<<<<<< + * self.arr[self.len] = val + * self.len = self.len + 1 + */ + __pyx_v_self->arr = ((int *)realloc(__pyx_v_self->arr, (__pyx_v_self->size * (sizeof(int))))); + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":135 + * self.size = self.size + self.increment + * self.arr = realloc(self.arr, self.size*sizeof(int)) + * self.arr[self.len] = val # <<<<<<<<<<<<<< + * self.len = self.len + 1 + * + */ + (__pyx_v_self->arr[__pyx_v_self->len]) = __pyx_v_val; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":136 + * self.arr = realloc(self.arr, self.size*sizeof(int)) + * self.arr[self.len] = val + * self.len = self.len + 1 # <<<<<<<<<<<<<< + * + * def extend(self, other): + */ + __pyx_v_self->len = (__pyx_v_self->len + 1); + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_30extend(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("extend (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":138 + * self.len = self.len + 1 + * + * def extend(self, other): # <<<<<<<<<<<<<< + * self._extend(other) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_29extend(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("extend", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":139 + * + * def extend(self, other): + * self._extend(other) # <<<<<<<<<<<<<< + * + * cdef void _extend(self, IntList other): + */ + 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)); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.IntList.extend", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":141 + * self._extend(other) + * + * cdef void _extend(self, IntList other): # <<<<<<<<<<<<<< + * self._extend_arr(other.arr, other.len) + * + */ + +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) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_extend", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":142 + * + * cdef void _extend(self, IntList other): + * self._extend_arr(other.arr, other.len) # <<<<<<<<<<<<<< + * + * cdef void _extend_arr(self, int* other, int other_len): + */ + ((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); + + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":144 + * self._extend_arr(other.arr, other.len) + * + * cdef void _extend_arr(self, int* other, int other_len): # <<<<<<<<<<<<<< + * if self.size < self.len + other_len: + * self.size = self.len + other_len + */ + +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) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("_extend_arr", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":145 + * + * cdef void _extend_arr(self, int* other, int other_len): + * if self.size < self.len + other_len: # <<<<<<<<<<<<<< + * self.size = self.len + other_len + * self.arr = realloc(self.arr, self.size*sizeof(int)) + */ + __pyx_t_1 = ((__pyx_v_self->size < (__pyx_v_self->len + __pyx_v_other_len)) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * self.arr = realloc(self.arr, self.size*sizeof(int)) + * memcpy(self.arr+self.len, other, other_len*sizeof(int)) + */ + __pyx_v_self->size = (__pyx_v_self->len + __pyx_v_other_len); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":147 + * if self.size < self.len + other_len: + * self.size = self.len + other_len + * self.arr = realloc(self.arr, self.size*sizeof(int)) # <<<<<<<<<<<<<< + * memcpy(self.arr+self.len, other, other_len*sizeof(int)) + * self.len = self.len + other_len + */ + __pyx_v_self->arr = ((int *)realloc(__pyx_v_self->arr, (__pyx_v_self->size * (sizeof(int))))); + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":148 + * self.size = self.len + other_len + * self.arr = realloc(self.arr, self.size*sizeof(int)) + * memcpy(self.arr+self.len, other, other_len*sizeof(int)) # <<<<<<<<<<<<<< + * self.len = self.len + other_len + * + */ + memcpy((__pyx_v_self->arr + __pyx_v_self->len), __pyx_v_other, (__pyx_v_other_len * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":149 + * self.arr = realloc(self.arr, self.size*sizeof(int)) + * memcpy(self.arr+self.len, other, other_len*sizeof(int)) + * self.len = self.len + other_len # <<<<<<<<<<<<<< + * + * cdef void _clear(self): + */ + __pyx_v_self->len = (__pyx_v_self->len + __pyx_v_other_len); + + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":151 + * self.len = self.len + other_len + * + * cdef void _clear(self): # <<<<<<<<<<<<<< + * free(self.arr) + * self.len = 0 + */ + +static void __pyx_f_4cdec_2sa_3_sa_7IntList__clear(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_clear", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":152 + * + * cdef void _clear(self): + * free(self.arr) # <<<<<<<<<<<<<< + * self.len = 0 + * self.size = 0 + */ + free(__pyx_v_self->arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":153 + * cdef void _clear(self): + * free(self.arr) + * self.len = 0 # <<<<<<<<<<<<<< + * self.size = 0 + * self.arr = malloc(0) + */ + __pyx_v_self->len = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":154 + * free(self.arr) + * self.len = 0 + * self.size = 0 # <<<<<<<<<<<<<< + * self.arr = malloc(0) + * + */ + __pyx_v_self->size = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":155 + * self.len = 0 + * self.size = 0 + * self.arr = malloc(0) # <<<<<<<<<<<<<< + * + * cdef void write_handle(self, FILE* f): + */ + __pyx_v_self->arr = ((int *)malloc(0)); + + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":157 + * self.arr = malloc(0) + * + * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< + * fwrite(&(self.len), sizeof(int), 1, f) + * fwrite(self.arr, sizeof(int), self.len, f) + */ + +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) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_handle", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":158 + * + * cdef void write_handle(self, FILE* f): + * fwrite(&(self.len), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * fwrite(self.arr, sizeof(int), self.len, f) + * + */ + fwrite((&__pyx_v_self->len), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * def write(self, char* filename): + */ + fwrite(__pyx_v_self->arr, (sizeof(int)), __pyx_v_self->len, __pyx_v_f); + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_32write(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write (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[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.IntList.write", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_31write(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":161 + * fwrite(self.arr, sizeof(int), self.len, f) + * + * def write(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_31write(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":163 + * def write(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "w") # <<<<<<<<<<<<<< + * self.write_handle(f) + * fclose(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":164 + * cdef FILE* f + * f = fopen(filename, "w") + * self.write_handle(f) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":165 + * f = fopen(filename, "w") + * self.write_handle(f) + * fclose(f) # <<<<<<<<<<<<<< + * + * cdef void read_handle(self, FILE* f): + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":167 + * fclose(f) + * + * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< + * (self.arr) + * fread(&(self.len), sizeof(int), 1, f) + */ + +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) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("read_handle", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":168 + * + * cdef void read_handle(self, FILE* f): + * (self.arr) # <<<<<<<<<<<<<< + * fread(&(self.len), sizeof(int), 1, f) + * self.arr = malloc(self.len * sizeof(int)) + */ + __pyx_v_self->arr; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":169 + * cdef void read_handle(self, FILE* f): + * (self.arr) + * fread(&(self.len), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * self.arr = malloc(self.len * sizeof(int)) + * self.size = self.len + */ + fread((&__pyx_v_self->len), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":170 + * (self.arr) + * fread(&(self.len), sizeof(int), 1, f) + * self.arr = malloc(self.len * sizeof(int)) # <<<<<<<<<<<<<< + * self.size = self.len + * fread(self.arr, sizeof(int), self.len, f) + */ + __pyx_v_self->arr = ((int *)malloc((__pyx_v_self->len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":171 + * fread(&(self.len), sizeof(int), 1, f) + * self.arr = malloc(self.len * sizeof(int)) + * self.size = self.len # <<<<<<<<<<<<<< + * fread(self.arr, sizeof(int), self.len, f) + * + */ + __pyx_t_1 = __pyx_v_self->len; + __pyx_v_self->size = __pyx_t_1; + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":172 + * self.arr = malloc(self.len * sizeof(int)) + * self.size = self.len + * fread(self.arr, sizeof(int), self.len, f) # <<<<<<<<<<<<<< + * + * def read(self, char* filename): + */ + fread(__pyx_v_self->arr, (sizeof(int)), __pyx_v_self->len, __pyx_v_f); + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7IntList_34read(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read (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[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.IntList.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7IntList_33read(((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":174 + * fread(self.arr, sizeof(int), self.len, f) + * + * def read(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7IntList_33read(struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":176 + * def read(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "r") # <<<<<<<<<<<<<< + * self.read_handle(f) + * fclose(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":177 + * cdef FILE* f + * f = fopen(filename, "r") + * self.read_handle(f) # <<<<<<<<<<<<<< + * fclose(f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/int_list.pxi":178 + * f = fopen(filename, "r") + * self.read_handle(f) + * fclose(f) # <<<<<<<<<<<<<< + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9StringMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __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_2sa_3_sa_9StringMap___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":13 + * cdef int index(self, char *s) + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.vocab = stringmap_new() + * + */ + +static int __pyx_pf_4cdec_2sa_3_sa_9StringMap___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":14 + * + * def __cinit__(self): + * self.vocab = stringmap_new() # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->vocab = stringmap_new(); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_4cdec_2sa_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_9StringMap_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":16 + * self.vocab = stringmap_new() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * stringmap_delete(self.vocab) + * + */ + +static void __pyx_pf_4cdec_2sa_3_sa_9StringMap_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":17 + * + * def __dealloc__(self): + * stringmap_delete(self.vocab) # <<<<<<<<<<<<<< + * + * cdef char *word(self, int i): + */ + stringmap_delete(__pyx_v_self->vocab); + + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":19 + * stringmap_delete(self.vocab) + * + * cdef char *word(self, int i): # <<<<<<<<<<<<<< + * return stringmap_word(self.vocab, i) + * + */ + +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) { + char *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("word", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":20 + * + * cdef char *word(self, int i): + * return stringmap_word(self.vocab, i) # <<<<<<<<<<<<<< + * + * cdef int index(self, char *s): + */ + __pyx_r = stringmap_word(__pyx_v_self->vocab, __pyx_v_i); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":22 + * return stringmap_word(self.vocab, i) + * + * cdef int index(self, char *s): # <<<<<<<<<<<<<< + * return stringmap_index(self.vocab, s) + */ + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("index", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/str_map.pxi":23 + * + * cdef int index(self, char *s): + * return stringmap_index(self.vocab, s) # <<<<<<<<<<<<<< + */ + __pyx_r = stringmap_index(__pyx_v_self->vocab, __pyx_v_s); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_from_binary = 0; + PyObject *__pyx_v_from_text = 0; + PyObject *__pyx_v_side = 0; + int __pyx_v_use_sent_id; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__side,&__pyx_n_s__use_sent_id,0}; + PyObject* values[4] = {0,0,0,0}; + + /* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< + * self.word2id = {"END_OF_FILE":0, "END_OF_LINE":1} + * self.id2word = ["END_OF_FILE", "END_OF_LINE"] + */ + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__from_binary); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_text); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_sent_id); + if (value) { values[3] = 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[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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_from_binary = values[0]; + __pyx_v_from_text = values[1]; + __pyx_v_side = values[2]; + if (values[3]) { + __pyx_v_use_sent_id = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_use_sent_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_use_sent_id = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_side, __pyx_v_use_sent_id); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side, int __pyx_v_use_sent_id) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + long __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/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} # <<<<<<<<<<<<<< + * self.id2word = ["END_OF_FILE", "END_OF_LINE"] + * self.data = IntList(1000,1000) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __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__END_OF_FILE), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__END_OF_LINE), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->word2id); + __Pyx_DECREF(__pyx_v_self->word2id); + __pyx_v_self->word2id = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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"] # <<<<<<<<<<<<<< + * self.data = IntList(1000,1000) + * self.sent_id = IntList(1000,1000) + */ + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__END_OF_FILE)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__END_OF_FILE)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__END_OF_FILE)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__END_OF_LINE)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__END_OF_LINE)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__END_OF_LINE)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->id2word); + __Pyx_DECREF(__pyx_v_self->id2word); + __pyx_v_self->id2word = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * self.sent_id = IntList(1000,1000) + * self.sent_index = IntList(1000,1000) + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); + __pyx_v_self->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * self.sent_index = IntList(1000,1000) + * self.use_sent_id = use_sent_id + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sent_id); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_id)); + __pyx_v_self->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":22 + * self.data = IntList(1000,1000) + * self.sent_id = IntList(1000,1000) + * self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<< + * self.use_sent_id = use_sent_id + * if from_binary: + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_13), 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_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sent_index); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); + __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * if from_binary: + * self.read_binary(from_binary) + */ + __pyx_v_self->use_sent_id = __pyx_v_use_sent_id; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":24 + * self.sent_index = IntList(1000,1000) + * self.use_sent_id = use_sent_id + * if from_binary: # <<<<<<<<<<<<<< + * self.read_binary(from_binary) + * elif from_text: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":26 + * if from_binary: + * self.read_binary(from_binary) + * elif from_text: # <<<<<<<<<<<<<< + * if side: + * self.read_bitext(from_text, (0 if side == 'source' else 1)) + */ + __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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":27 + * self.read_binary(from_binary) + * elif from_text: + * if side: # <<<<<<<<<<<<<< + * self.read_bitext(from_text, (0 if side == 'source' else 1)) + * else: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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 = PyObject_RichCompare(__pyx_v_side, ((PyObject *)__pyx_n_s__source), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 28; __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[3]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + __pyx_t_5 = 0; + } else { + __pyx_t_5 = 1; + } + __pyx_t_3 = PyInt_FromLong(__pyx_t_5); 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_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); + __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":30 + * self.read_bitext(from_text, (0 if side == 'source' else 1)) + * else: + * self.read_text(from_text) # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":32 + * self.read_text(from_text) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return len(self.data) + * + */ + +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_9DataArray_2__len__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":33 + * + * def __len__(self): + * return len(self.data) # <<<<<<<<<<<<<< + * + * def get_sentence_id(self, i): + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->data); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_5get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_5get_sentence_id(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sentence_id (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":35 + * return len(self.data) + * + * def get_sentence_id(self, i): # <<<<<<<<<<<<<< + * return self.sent_id.arr[i] + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4get_sentence_id(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_sentence_id", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":36 + * + * def get_sentence_id(self, i): + * return self.sent_id.arr[i] # <<<<<<<<<<<<<< + * + * def get_sentence(self, i): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->sent_id->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_sentence_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7get_sentence(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sentence (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":38 + * return self.sent_id.arr[i] + * + * def get_sentence(self, i): # <<<<<<<<<<<<<< + * cdef int j, start, stop + * sent = [] + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_6get_sentence(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_i) { + int __pyx_v_start; + int __pyx_v_stop; + PyObject *__pyx_v_sent = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __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("get_sentence", 0); + __Pyx_INCREF(__pyx_v_i); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":40 + * def get_sentence(self, i): + * cdef int j, start, stop + * sent = [] # <<<<<<<<<<<<<< + * start = self.sent_index.arr[i] + * stop = self.sent_index.arr[i+1] + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_sent = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":41 + * cdef int j, start, stop + * sent = [] + * start = self.sent_index.arr[i] # <<<<<<<<<<<<<< + * stop = self.sent_index.arr[i+1] + * for i from start <= i < stop: + */ + __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]); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":42 + * sent = [] + * start = self.sent_index.arr[i] + * stop = self.sent_index.arr[i+1] # <<<<<<<<<<<<<< + * for i from start <= i < stop: + * sent.append(self.id2word[self.data.arr[i]]) + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_stop = (__pyx_v_self->sent_index->arr[__pyx_t_2]); + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * sent.append(self.id2word[self.data.arr[i]]) + * return sent + */ + __pyx_t_3 = __pyx_v_stop; + for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { + __pyx_t_1 = PyInt_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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]]) # <<<<<<<<<<<<<< + * return sent + * + */ + __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 = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->id2word, (__pyx_v_self->data->arr[__pyx_t_2]), sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_sent, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_AsInt(__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;} + } + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * sent.append(self.id2word[self.data.arr[i]]) + * return sent + */ + __pyx_t_1 = PyInt_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":45 + * for i from start <= i < stop: + * sent.append(self.id2word[self.data.arr[i]]) + * return sent # <<<<<<<<<<<<<< + * + * def get_id(self, word): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_sent)); + __pyx_r = ((PyObject *)__pyx_v_sent); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_sentence", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_sent); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_9get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_9get_id(PyObject *__pyx_v_self, PyObject *__pyx_v_word) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_id (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_word)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":47 + * return sent + * + * def get_id(self, word): # <<<<<<<<<<<<<< + * if not word in self.word2id: + * self.word2id[word] = len(self.id2word) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_8get_id(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_word) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_id", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":48 + * + * def get_id(self, word): + * if not word in self.word2id: # <<<<<<<<<<<<<< + * self.word2id[word] = len(self.id2word) + * self.id2word.append(word) + */ + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_word, __pyx_v_self->word2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":49 + * def get_id(self, word): + * if not word in self.word2id: + * self.word2id[word] = len(self.id2word) # <<<<<<<<<<<<<< + * self.id2word.append(word) + * return self.word2id[word] + */ + __pyx_t_3 = __pyx_v_self->id2word; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (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; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":50 + * if not word in self.word2id: + * self.word2id[word] = len(self.id2word) + * self.id2word.append(word) # <<<<<<<<<<<<<< + * return self.word2id[word] + * + */ + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_self->id2word, __pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":51 + * self.word2id[word] = len(self.id2word) + * self.id2word.append(word) + * return self.word2id[word] # <<<<<<<<<<<<<< + * + * def __getitem__(self, loc): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetItem(__pyx_v_self->word2id, __pyx_v_word); if (!__pyx_t_3) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_11__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":53 + * return self.word2id[word] + * + * def __getitem__(self, loc): # <<<<<<<<<<<<<< + * return self.id2word[self.data.arr[loc]] + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":54 + * + * def __getitem__(self, loc): + * return self.id2word[self.data.arr[loc]] # <<<<<<<<<<<<<< + * + * def get_sentence_bounds(self, loc): + */ + __Pyx_XDECREF(__pyx_r); + __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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_self->id2word, (__pyx_v_self->data->arr[__pyx_t_1]), sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 54; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_13get_sentence_bounds(PyObject *__pyx_v_self, PyObject *__pyx_v_loc); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_13get_sentence_bounds(PyObject *__pyx_v_self, PyObject *__pyx_v_loc) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sentence_bounds (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_loc)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":56 + * return self.id2word[self.data.arr[loc]] + * + * 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]) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_12get_sentence_bounds(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_loc) { + int __pyx_v_sid; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + 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("get_sentence_bounds", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":57 + * + * 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]) + * + */ + __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]); + + /* "/home/mdenkows/cdec/python/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]) # <<<<<<<<<<<<<< + * + * def write_text(self, char* filename): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->sent_index->arr[__pyx_v_sid])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->sent_index->arr[(__pyx_v_sid + 1)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 58; __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[3]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.get_sentence_bounds", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_15write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[3]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":60 + * return (self.sent_index.arr[sid], self.sent_index.arr[sid+1]) + * + * def write_text(self, char* filename): # <<<<<<<<<<<<<< + * with open(filename, "w") as f: + * for w_id in self.data: + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_14write_text(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_v_w_id = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + 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_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_text", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61 + * + * def write_text(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * for w_id in self.data: + * if w_id > 1: + */ + /*with:*/ { + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __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__w)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); + __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/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; + } 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_GOTREF(__pyx_t_4); + __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + for (;;) { + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_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 + } else { + __pyx_t_1 = __pyx_t_9(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_w_id); + __pyx_v_w_id = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":63 + * 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 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __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(((PyObject *)__pyx_t_11)); + __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_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_16), 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_L19:; + } + __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; + 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_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61 + * + * def write_text(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * for w_id in self.data: + * if w_id > 1: + */ + /*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;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = PyTuple_New(3); 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_1); + __Pyx_INCREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_13 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_GIVEREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_GIVEREF(__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_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L22; + } + __pyx_L22:; + __Pyx_DECREF(((PyObject *)__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_11); __pyx_t_11 = 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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_3) { + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_17, 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_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L23; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L1_error; + __pyx_L23:; + } + + __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_12); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_w_id); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_17read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_17read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[3]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":68 + * f.write("\n") + * + * def read_text(self, char* filename): # <<<<<<<<<<<<<< + * with gzip_or_text(filename) as fp: + * self.read_text_data(fp) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_16read_text(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { + PyObject *__pyx_v_fp = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_text", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69 + * + * def read_text(self, char* filename): + * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< + * self.read_text_data(fp) + * + */ + /*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_GOTREF(((PyObject *)__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_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_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_4 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_1); + __pyx_v_fp = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":70 + * def read_text(self, char* filename): + * with gzip_or_text(filename) as fp: + * self.read_text_data(fp) # <<<<<<<<<<<<<< + * + * def read_bitext(self, char* filename, int side): + */ + __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69 + * + * def read_text(self, char* filename): + * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< + * self.read_text_data(fp) + * + */ + /*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;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(3); 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_INCREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_10 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0); + if (__pyx_t_11) { + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__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_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L18; + } + __pyx_L18:; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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_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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_4) { + __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_18, 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_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L19; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L1_error; + __pyx_L19:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_fp); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_19read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_19read_bitext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_filename; + int __pyx_v_side; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_bitext (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__side,0}; + PyObject* values[2] = {0,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__filename)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_bitext", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_bitext") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_filename = __Pyx_PyObject_AsString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_side = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_side == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read_bitext", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), __pyx_v_filename, __pyx_v_side); + __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 */ + +/* "/home/mdenkows/cdec/python/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) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_11read_bitext_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_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_2_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_2_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_1_read_bitext *) __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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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)) { + __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; + } + 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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_line); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_line); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_line = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __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_GetItemInt(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_side, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __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_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("genexpr", __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; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":72 + * self.read_text_data(fp) + * + * def read_bitext(self, char* filename, int side): # <<<<<<<<<<<<<< + * with gzip_or_text(filename) as fp: + * data = (line.split(' ||| ')[side] for line in fp) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_18read_bitext(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename, int __pyx_v_side) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *__pyx_cur_scope; + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_bitext", 0); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_side = __pyx_v_side; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73 + * + * 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) + */ + /*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_GOTREF(((PyObject *)__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_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_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_4 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_XGOTREF(__pyx_t_7); + /*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; + + /* "/home/mdenkows/cdec/python/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; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * def read_text_data(self, data): + */ + __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73 + * + * 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) + */ + /*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;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(3); 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_INCREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_10 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0); + if (__pyx_t_11) { + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__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_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L18; + } + __pyx_L18:; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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_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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_4) { + __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_21, 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_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L19; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L1_error; + __pyx_L19:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_bitext", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_data); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_21read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_21read_text_data(PyObject *__pyx_v_self, PyObject *__pyx_v_data) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_text_data (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_data)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":77 + * self.read_text_data(data) + * + * def read_text_data(self, data): # <<<<<<<<<<<<<< + * cdef int word_count = 0 + * for line_num, line in enumerate(data): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_20read_text_data(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_data) { + int __pyx_v_word_count; + PyObject *__pyx_v_line_num = NULL; + PyObject *__pyx_v_line = NULL; + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_r = NULL; + __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_6 = NULL; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_text_data", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":78 + * + * def read_text_data(self, data): + * cdef int word_count = 0 # <<<<<<<<<<<<<< + * for line_num, line in enumerate(data): + * self.sent_index.append(word_count) + */ + __pyx_v_word_count = 0; + + /* "/home/mdenkows/cdec/python/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_INCREF(__pyx_int_0); + __pyx_t_1 = __pyx_int_0; + if (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; + } + 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 + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_line_num); + __pyx_v_line_num = __pyx_t_1; + __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":80 + * cdef int word_count = 0 + * 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)) + */ + __pyx_t_5 = PyInt_FromLong(__pyx_v_word_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __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; + + /* "/home/mdenkows/cdec/python/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_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); 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_6); __pyx_t_6 = 0; + if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; 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_6, __pyx_t_7); __pyx_t_7++; 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_8 && PyTuple_CheckExact(__pyx_t_6)) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; 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_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_5 = __pyx_t_8(__pyx_t_6); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_word); + __pyx_v_word = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/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_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_id); 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_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_word); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_word); + __Pyx_GIVEREF(__pyx_v_word); + __pyx_t_10 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_9), NULL); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/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_11 = (__pyx_v_self->use_sent_id != 0); + if (__pyx_t_11) { + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":84 + * self.data.append(self.get_id(word)) + * if self.use_sent_id: + * self.sent_id.append(line_num) # <<<<<<<<<<<<<< + * word_count = word_count + 1 + * self.data.append(1) + */ + __pyx_t_9 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_id), __pyx_v_line_num); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":85 + * if self.use_sent_id: + * self.sent_id.append(line_num) + * word_count = word_count + 1 # <<<<<<<<<<<<<< + * self.data.append(1) + * if self.use_sent_id: + */ + __pyx_v_word_count = (__pyx_v_word_count + 1); + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":86 + * self.sent_id.append(line_num) + * word_count = word_count + 1 + * self.data.append(1) # <<<<<<<<<<<<<< + * if self.use_sent_id: + * self.sent_id.append(line_num) + */ + __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/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_11 = (__pyx_v_self->use_sent_id != 0); + if (__pyx_t_11) { + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":88 + * self.data.append(1) + * if self.use_sent_id: + * self.sent_id.append(line_num) # <<<<<<<<<<<<<< + * word_count = word_count + 1 + * self.data.append(0) + */ + __pyx_t_6 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_id), __pyx_v_line_num); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":89 + * if self.use_sent_id: + * self.sent_id.append(line_num) + * word_count = word_count + 1 # <<<<<<<<<<<<<< + * self.data.append(0) + * self.sent_index.append(word_count) + */ + __pyx_v_word_count = (__pyx_v_word_count + 1); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":90 + * self.sent_id.append(line_num) + * word_count = word_count + 1 + * self.data.append(0) # <<<<<<<<<<<<<< + * self.sent_index.append(word_count) + * + */ + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->data), __pyx_int_0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":91 + * word_count = word_count + 1 + * self.data.append(0) + * self.sent_index.append(word_count) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_word_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __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_2); __pyx_t_2 = 0; + + __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_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_text_data", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_line_num); + __Pyx_XDECREF(__pyx_v_line); + __Pyx_XDECREF(__pyx_v_word); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_23read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_23read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[3]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.DataArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":94 + * + * + * def read_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_22read_binary(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_binary", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":96 + * def read_binary(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "r") # <<<<<<<<<<<<<< + * self.read_handle(f) + * fclose(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":97 + * cdef FILE* f + * f = fopen(filename, "r") + * self.read_handle(f) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->read_handle(__pyx_v_self, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":98 + * f = fopen(filename, "r") + * self.read_handle(f) + * fclose(f) # <<<<<<<<<<<<<< + * + * cdef void read_handle(self, FILE* f): + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":100 + * fclose(f) + * + * cdef void read_handle(self, FILE* f): # <<<<<<<<<<<<<< + * cdef int num_words, word_len + * cdef unsigned i + */ + +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) { + int __pyx_v_num_words; + int __pyx_v_word_len; + CYTHON_UNUSED unsigned int __pyx_v_i; + char *__pyx_v_word; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + unsigned int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + 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_RefNannySetupContext("read_handle", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":105 + * cdef char* word + * + * self.data.read_handle(f) # <<<<<<<<<<<<<< + * self.sent_index.read_handle(f) + * self.sent_id.read_handle(f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->read_handle(__pyx_v_self->data, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":106 + * + * self.data.read_handle(f) + * self.sent_index.read_handle(f) # <<<<<<<<<<<<<< + * self.sent_id.read_handle(f) + * fread(&(num_words), sizeof(int), 1, f) + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":107 + * self.data.read_handle(f) + * self.sent_index.read_handle(f) + * self.sent_id.read_handle(f) # <<<<<<<<<<<<<< + * fread(&(num_words), sizeof(int), 1, f) + * for i in range(num_words): + */ + ((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); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * for i in range(num_words): + * fread(&(word_len), sizeof(int), 1, f) + */ + fread((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< + * fread(&(word_len), sizeof(int), 1, f) + * word = malloc (word_len * sizeof(char)) + */ + __pyx_t_1 = __pyx_v_num_words; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/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) # <<<<<<<<<<<<<< + * word = malloc (word_len * sizeof(char)) + * fread(word, sizeof(char), word_len, f) + */ + fread((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":111 + * for i in range(num_words): + * fread(&(word_len), sizeof(int), 1, f) + * word = malloc (word_len * sizeof(char)) # <<<<<<<<<<<<<< + * fread(word, sizeof(char), word_len, f) + * self.word2id[word] = len(self.id2word) + */ + __pyx_v_word = ((char *)malloc((__pyx_v_word_len * (sizeof(char))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":112 + * fread(&(word_len), sizeof(int), 1, f) + * word = malloc (word_len * sizeof(char)) + * fread(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< + * self.word2id[word] = len(self.id2word) + * self.id2word.append(word) + */ + fread(__pyx_v_word, (sizeof(char)), __pyx_v_word_len, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":113 + * word = malloc (word_len * sizeof(char)) + * fread(word, sizeof(char), word_len, f) + * self.word2id[word] = len(self.id2word) # <<<<<<<<<<<<<< + * self.id2word.append(word) + * free(word) + */ + __pyx_t_3 = __pyx_v_self->id2word; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_word); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + if (PyObject_SetItem(__pyx_v_self->word2id, ((PyObject *)__pyx_t_5), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":114 + * fread(word, sizeof(char), word_len, f) + * self.word2id[word] = len(self.id2word) + * self.id2word.append(word) # <<<<<<<<<<<<<< + * free(word) + * if len(self.sent_id) == 0: + */ + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->id2word, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":115 + * self.word2id[word] = len(self.id2word) + * self.id2word.append(word) + * free(word) # <<<<<<<<<<<<<< + * if len(self.sent_id) == 0: + * self.use_sent_id = False + */ + free(__pyx_v_word); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":116 + * self.id2word.append(word) + * free(word) + * if len(self.sent_id) == 0: # <<<<<<<<<<<<<< + * self.use_sent_id = False + * else: + */ + __pyx_t_5 = ((PyObject *)__pyx_v_self->sent_id); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_4 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = ((__pyx_t_4 == 0) != 0); + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":117 + * free(word) + * if len(self.sent_id) == 0: + * self.use_sent_id = False # <<<<<<<<<<<<<< + * else: + * self.use_sent_id = True + */ + __pyx_v_self->use_sent_id = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":119 + * self.use_sent_id = False + * else: + * self.use_sent_id = True # <<<<<<<<<<<<<< + * + * cdef void write_handle(self, FILE* f): + */ + __pyx_v_self->use_sent_id = 1; + } + __pyx_L5:; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("cdec.sa._sa.DataArray.read_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":121 + * self.use_sent_id = True + * + * cdef void write_handle(self, FILE* f): # <<<<<<<<<<<<<< + * cdef int word_len + * cdef int num_words + */ + +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) { + int __pyx_v_word_len; + int __pyx_v_num_words; + PyObject *__pyx_v_word = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *(*__pyx_t_4)(PyObject *); + Py_ssize_t __pyx_t_5; + char *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_handle", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":125 + * cdef int num_words + * + * self.data.write_handle(f) # <<<<<<<<<<<<<< + * self.sent_index.write_handle(f) + * self.sent_id.write_handle(f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->data->__pyx_vtab)->write_handle(__pyx_v_self->data, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":126 + * + * self.data.write_handle(f) + * self.sent_index.write_handle(f) # <<<<<<<<<<<<<< + * self.sent_id.write_handle(f) + * num_words = len(self.id2word) - 2 + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":127 + * self.data.write_handle(f) + * self.sent_index.write_handle(f) + * self.sent_id.write_handle(f) # <<<<<<<<<<<<<< + * num_words = len(self.id2word) - 2 + * fwrite(&(num_words), sizeof(int), 1, f) + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":128 + * self.sent_index.write_handle(f) + * self.sent_id.write_handle(f) + * num_words = len(self.id2word) - 2 # <<<<<<<<<<<<<< + * fwrite(&(num_words), sizeof(int), 1, f) + * for word in self.id2word[2:]: + */ + __pyx_t_1 = __pyx_v_self->id2word; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_num_words = (__pyx_t_2 - 2); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * for word in self.id2word[2:]: + * word_len = len(word) + 1 + */ + fwrite((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_self->id2word, 2, 0, NULL, NULL, &__pyx_k_slice_22, 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)) { + __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_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 + } 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(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_word); + __pyx_v_word = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":131 + * 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) + * fwrite(word, sizeof(char), word_len, f) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":132 + * for word in self.id2word[2:]: + * word_len = len(word) + 1 + * fwrite(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * fwrite(word, sizeof(char), word_len, f) + * + */ + fwrite((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":133 + * word_len = len(word) + 1 + * fwrite(&(word_len), sizeof(int), 1, f) + * fwrite(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< + * + * def write_binary(self, char* filename): + */ + __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); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("cdec.sa._sa.DataArray.write_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_word); + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_25write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_25write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[3]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":135 + * fwrite(word, sizeof(char), word_len, f) + * + * def write_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_24write_binary(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_binary", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":137 + * def write_binary(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "w") # <<<<<<<<<<<<<< + * self.write_handle(f) + * fclose(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":138 + * cdef FILE* f + * f = fopen(filename, "w") + * self.write_handle(f) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->__pyx_vtab)->write_handle(__pyx_v_self, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":139 + * f = fopen(filename, "w") + * self.write_handle(f) + * fclose(f) # <<<<<<<<<<<<<< + * + * def write_enhanced_handle(self, f): + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_27write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_27write_enhanced_handle(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_enhanced_handle (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_f)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":141 + * fclose(f) + * + * def write_enhanced_handle(self, f): # <<<<<<<<<<<<<< + * for i in self.data: + * f.write("%d " %i) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_26write_enhanced_handle(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_f) { + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_enhanced_handle", 0); + + /* "/home/mdenkows/cdec/python/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))) { + __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; + } + 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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_i); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__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(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":144 + * for i in self.data: + * f.write("%d " %i) + * f.write("\n") # <<<<<<<<<<<<<< + * for i in self.sent_index: + * f.write("%d " %i) + */ + __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_24), 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/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; + __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; + } + 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 + } else { + __pyx_t_1 = __pyx_t_3(__pyx_t_5); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_25), 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; + + /* "/home/mdenkows/cdec/python/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; + __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; + } + 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 + } else { + __pyx_t_5 = __pyx_t_3(__pyx_t_6); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":149 + * f.write("\n") + * for i in self.sent_id: + * f.write("%d " %i) # <<<<<<<<<<<<<< + * f.write("\n") + * for word in self.id2word: + */ + __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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__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_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_26), 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_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/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)) { + __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; + } + 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 + } else { + __pyx_t_6 = __pyx_t_3(__pyx_t_4); + if (unlikely(!__pyx_t_6)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[3]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_XDECREF(__pyx_v_word); + __pyx_v_word = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/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 (!__pyx_t_1) {__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_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_word); + PyTuple_SET_ITEM(__pyx_t_5, 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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_27), ((PyObject *)__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(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__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, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__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; + __Pyx_DECREF(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":153 + * for word in self.id2word: + * f.write("%s %d " % (word, self.word2id[word])) + * f.write("\n") # <<<<<<<<<<<<<< + * + * def write_enhanced(self, char* filename): + */ + __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 = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __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; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_enhanced_handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_word); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_29write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_29write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[3]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":155 + * f.write("\n") + * + * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< + * with open(filename, "w") as f: + * self.write_enhanced_handle(self, f) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_28write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, char *__pyx_v_filename) { + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_enhanced", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * self.write_enhanced_handle(self, f) + */ + /*with:*/ { + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __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__w)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); + __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/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_29); 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_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_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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; + 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * self.write_enhanced_handle(self, f) + */ + /*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); + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyTuple_New(3); 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_INCREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_10 = PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_9 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0); + if (__pyx_t_11) { + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GIVEREF(__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_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L18; + } + __pyx_L18:; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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; + 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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_3) { + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_30, 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_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L19; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L1_error; + __pyx_L19:; + } + + __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_AddTraceback("cdec.sa._sa.DataArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":10 + * + * cdef class DataArray: + * cdef public word2id # <<<<<<<<<<<<<< + * cdef public id2word + * cdef public IntList data + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->word2id); + __pyx_r = __pyx_v_self->word2id; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->word2id); + __Pyx_DECREF(__pyx_v_self->word2id); + __pyx_v_self->word2id = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7word2id_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->word2id); + __Pyx_DECREF(__pyx_v_self->word2id); + __pyx_v_self->word2id = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":11 + * cdef class DataArray: + * cdef public word2id + * cdef public id2word # <<<<<<<<<<<<<< + * cdef public IntList data + * cdef public IntList sent_id + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->id2word); + __pyx_r = __pyx_v_self->id2word; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->id2word); + __Pyx_DECREF(__pyx_v_self->id2word); + __pyx_v_self->id2word = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7id2word_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->id2word); + __Pyx_DECREF(__pyx_v_self->id2word); + __pyx_v_self->id2word = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":12 + * cdef public word2id + * cdef public id2word + * cdef public IntList data # <<<<<<<<<<<<<< + * cdef public IntList sent_id + * cdef public IntList sent_index + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_4data___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->data)); + __pyx_r = ((PyObject *)__pyx_v_self->data); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); + __pyx_v_self->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.DataArray.data.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_4data_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); + __pyx_v_self->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":13 + * cdef public id2word + * cdef public IntList data + * cdef public IntList sent_id # <<<<<<<<<<<<<< + * cdef public IntList sent_index + * cdef bint use_sent_id + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->sent_id)); + __pyx_r = ((PyObject *)__pyx_v_self->sent_id); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->sent_id); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_id)); + __pyx_v_self->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.DataArray.sent_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_7sent_id_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->sent_id); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_id)); + __pyx_v_self->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index___get__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":14 + * cdef public IntList data + * cdef public IntList sent_id + * cdef public IntList sent_index # <<<<<<<<<<<<<< + * cdef bint use_sent_id + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index___get__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->sent_index)); + __pyx_r = ((PyObject *)__pyx_v_self->sent_index); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->sent_index); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); + __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.DataArray.sent_index.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9DataArray_10sent_index_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->sent_index); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); + __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("link", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":16 + * cdef int link(self, int i, int j): + * """Integerizes an alignment link pair""" + * return i * ALIGNMENT_CODE + j # <<<<<<<<<<<<<< + * + * def unlink(self, link): + */ + __pyx_r = ((__pyx_v_i * __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE) + __pyx_v_j); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_9Alignment_unlink[] = "De-integerizes an alignment link pair"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_1unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_link) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unlink (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_link)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":18 + * return i * ALIGNMENT_CODE + j + * + * def unlink(self, link): # <<<<<<<<<<<<<< + * """De-integerizes an alignment link pair""" + * return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_unlink(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_link) { + 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("unlink", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":20 + * def unlink(self, link): + * """De-integerizes an alignment link pair""" + * return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE) # <<<<<<<<<<<<<< + * + * cdef _unlink(self, int link, int* f, int* e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_link, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Remainder(__pyx_v_link, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __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); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":22 + * return (link / ALIGNMENT_CODE, link % ALIGNMENT_CODE) + * + * cdef _unlink(self, int link, int* f, int* e): # <<<<<<<<<<<<<< + * f[0] = link / ALIGNMENT_CODE + * e[0] = link % ALIGNMENT_CODE + */ + +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_unlink", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":23 + * + * cdef _unlink(self, int link, int* f, int* e): + * f[0] = link / ALIGNMENT_CODE # <<<<<<<<<<<<<< + * e[0] = link % ALIGNMENT_CODE + * + */ + if (unlikely(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_link))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_f[0]) = __Pyx_div_int(__pyx_v_link, __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":24 + * cdef _unlink(self, int link, int* f, int* e): + * f[0] = link / ALIGNMENT_CODE + * e[0] = link % ALIGNMENT_CODE # <<<<<<<<<<<<<< + * + * def get_sent_links(self, int sent_id): + */ + if (unlikely(__pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_e[0]) = __Pyx_mod_int(__pyx_v_link, __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.Alignment._unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_3get_sent_links(PyObject *__pyx_v_self, PyObject *__pyx_arg_sent_id) { + int __pyx_v_sent_id; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_sent_links (wrapper)", 0); + assert(__pyx_arg_sent_id); { + __pyx_v_sent_id = __Pyx_PyInt_AsInt(__pyx_arg_sent_id); if (unlikely((__pyx_v_sent_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((int)__pyx_v_sent_id)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":26 + * e[0] = link % ALIGNMENT_CODE + * + * def get_sent_links(self, int sent_id): # <<<<<<<<<<<<<< + * cdef IntList sent_links + * cdef int* arr + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_2get_sent_links(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, int __pyx_v_sent_id) { + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_sent_links = 0; + int *__pyx_v_arr; + int __pyx_v_arr_len; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_sent_links", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":30 + * cdef int* arr + * cdef int arr_len + * sent_links = IntList() # <<<<<<<<<<<<<< + * arr = self._get_sent_links(sent_id, &arr_len) + * sent_links._extend_arr(arr, arr_len*2) + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_sent_links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":31 + * cdef int arr_len + * sent_links = IntList() + * arr = self._get_sent_links(sent_id, &arr_len) # <<<<<<<<<<<<<< + * sent_links._extend_arr(arr, arr_len*2) + * free(arr) + */ + __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)); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * free(arr) + * return sent_links + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":33 + * arr = self._get_sent_links(sent_id, &arr_len) + * sent_links._extend_arr(arr, arr_len*2) + * free(arr) # <<<<<<<<<<<<<< + * return sent_links + * + */ + free(__pyx_v_arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":34 + * sent_links._extend_arr(arr, arr_len*2) + * free(arr) + * return sent_links # <<<<<<<<<<<<<< + * + * cdef int* _get_sent_links(self, int sent_id, int* num_links): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_sent_links)); + __pyx_r = ((PyObject *)__pyx_v_sent_links); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_sent_links); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":36 + * return sent_links + * + * cdef int* _get_sent_links(self, int sent_id, int* num_links): # <<<<<<<<<<<<<< + * cdef int* sent_links + * cdef int i, start, end + */ + +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) { + int *__pyx_v_sent_links; + int __pyx_v_i; + int __pyx_v_start; + int __pyx_v_end; + int *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_sent_links", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":39 + * cdef int* sent_links + * cdef int i, start, end + * start = self.sent_index.arr[sent_id] # <<<<<<<<<<<<<< + * end = self.sent_index.arr[sent_id+1] + * num_links[0] = end - start + */ + __pyx_v_start = (__pyx_v_self->sent_index->arr[__pyx_v_sent_id]); + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * num_links[0] = end - start + * sent_links = malloc(2*num_links[0]*sizeof(int)) + */ + __pyx_v_end = (__pyx_v_self->sent_index->arr[(__pyx_v_sent_id + 1)]); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * sent_links = malloc(2*num_links[0]*sizeof(int)) + * for i from 0 <= i < num_links[0]: + */ + (__pyx_v_num_links[0]) = (__pyx_v_end - __pyx_v_start); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":42 + * end = self.sent_index.arr[sent_id+1] + * num_links[0] = end - start + * sent_links = 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) + */ + __pyx_v_sent_links = ((int *)malloc(((2 * (__pyx_v_num_links[0])) * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":43 + * num_links[0] = end - start + * sent_links = 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) + * return sent_links + */ + __pyx_t_1 = (__pyx_v_num_links[0]); + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":44 + * sent_links = 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) # <<<<<<<<<<<<<< + * return sent_links + * + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->_unlink(__pyx_v_self, (__pyx_v_self->links->arr[(__pyx_v_start + __pyx_v_i)]), (__pyx_v_sent_links + (2 * __pyx_v_i)), ((__pyx_v_sent_links + (2 * __pyx_v_i)) + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * + * def __cinit__(self, from_binary=None, from_text=None): + */ + __pyx_r = __pyx_v_sent_links; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("cdec.sa._sa.Alignment._get_sent_links", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9Alignment_5__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_from_binary = 0; + PyObject *__pyx_v_from_text = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,0}; + PyObject* values[2] = {0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":47 + * return sent_links + * + * def __cinit__(self, from_binary=None, from_text=None): # <<<<<<<<<<<<<< + * self.links = IntList(1000,1000) + * self.sent_index = IntList(1000,1000) + */ + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + 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__from_binary); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_text); + if (value) { values[1] = 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[4]; __pyx_lineno = 47; __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_from_binary = values[0]; + __pyx_v_from_text = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9Alignment_4__cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + 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("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":48 + * + * def __cinit__(self, from_binary=None, from_text=None): + * self.links = IntList(1000,1000) # <<<<<<<<<<<<<< + * self.sent_index = IntList(1000,1000) + * if from_binary: + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->links); + __Pyx_DECREF(((PyObject *)__pyx_v_self->links)); + __pyx_v_self->links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * if from_binary: + * self.read_binary(from_binary) + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sent_index); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sent_index)); + __pyx_v_self->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":50 + * self.links = IntList(1000,1000) + * self.sent_index = IntList(1000,1000) + * if from_binary: # <<<<<<<<<<<<<< + * self.read_binary(from_binary) + * elif from_text: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":52 + * if from_binary: + * self.read_binary(from_binary) + * elif from_text: # <<<<<<<<<<<<<< + * self.read_text(from_text) + * + */ + __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) { + + /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_7read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":55 + * self.read_text(from_text) + * + * def read_text(self, char* filename): # <<<<<<<<<<<<<< + * with gzip_or_text(filename) as f: + * for line in f: + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_6read_text(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_v_line = NULL; + PyObject *__pyx_v_pairs = NULL; + PyObject *__pyx_v_pair = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_j = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + 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 = NULL; + PyObject *(*__pyx_t_15)(PyObject *); + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + PyObject *__pyx_t_19 = NULL; + int __pyx_t_20; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_text", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56 + * + * def read_text(self, char* filename): + * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< + * for line in f: + * 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_GOTREF(((PyObject *)__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_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_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_4 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_1); + __pyx_v_f = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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; + } 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; + } + 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 + } else { + __pyx_t_2 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __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_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":59 + * for line in f: + * self.sent_index.append(len(self.links)) + * pairs = line.split() # <<<<<<<<<<<<<< + * for pair in pairs: + * (i, j) = map(int, pair.split('-')) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_line, __pyx_n_s__split); 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_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_pairs); + __pyx_v_pairs = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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_2 = __pyx_v_pairs; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pairs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + for (;;) { + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __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_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __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_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else { + __pyx_t_3 = __pyx_t_11(__pyx_t_2); + if (unlikely(!__pyx_t_3)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF(__pyx_v_pair); + __pyx_v_pair = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":61 + * pairs = line.split() + * for pair in pairs: + * (i, j) = map(int, pair.split('-')) # <<<<<<<<<<<<<< + * self.links.append(self.link(i, j)) + * self.sent_index.append(len(self.links)) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pair, __pyx_n_s__split); 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_t_12 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); 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_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_3 = PyList_GET_ITEM(sequence, 0); + __pyx_t_13 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_13); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); 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_t_13 = PySequence_ITEM(sequence, 1); 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); + #endif + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_14 = PyObject_GetIter(__pyx_t_12); 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_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_3)) goto __pyx_L20_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L20_unpacking_failed; + __Pyx_GOTREF(__pyx_t_13); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_15 = NULL; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + goto __pyx_L21_unpacking_done; + __pyx_L20_unpacking_failed:; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_15 = 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_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_13; + __pyx_t_13 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":62 + * for pair in pairs: + * (i, j) = map(int, pair.split('-')) + * self.links.append(self.link(i, j)) # <<<<<<<<<<<<<< + * self.sent_index.append(len(self.links)) + * + */ + __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_v_j); 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_12 = PyInt_FromLong(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment *)__pyx_v_self->__pyx_vtab)->link(__pyx_v_self, __pyx_t_16, __pyx_t_17)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->links), __pyx_t_12); 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_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->sent_index), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __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; + } + __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; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56 + * + * def read_text(self, char* filename): + * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< + * for line in f: + * self.sent_index.append(len(self.links)) + */ + /*except:*/ { + __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_19 = PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_18 = __Pyx_PyObject_IsTrue(__pyx_t_19); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + if (__pyx_t_18 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_20 = ((!(__pyx_t_18 != 0)) != 0); + if (__pyx_t_20) { + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_13); + __Pyx_ErrRestore(__pyx_t_2, __pyx_t_1, __pyx_t_13); + __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_13 = 0; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L24; + } + __pyx_L24:; + __Pyx_DECREF(((PyObject *)__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; + __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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_4) { + __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_35, 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_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_20 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L25; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L1_error; + __pyx_L25:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_line); + __Pyx_XDECREF(__pyx_v_pairs); + __Pyx_XDECREF(__pyx_v_pair); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_j); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_9read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[4]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Alignment.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":65 + * self.sent_index.append(len(self.links)) + * + * def read_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_8read_binary(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_binary", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":67 + * def read_binary(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "r") # <<<<<<<<<<<<<< + * self.links.read_handle(f) + * self.sent_index.read_handle(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":68 + * cdef FILE* f + * f = fopen(filename, "r") + * self.links.read_handle(f) # <<<<<<<<<<<<<< + * self.sent_index.read_handle(f) + * fclose(f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->read_handle(__pyx_v_self->links, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":69 + * f = fopen(filename, "r") + * self.links.read_handle(f) + * self.sent_index.read_handle(f) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":70 + * self.links.read_handle(f) + * self.sent_index.read_handle(f) + * fclose(f) # <<<<<<<<<<<<<< + * + * def write_text(self, char* filename): + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_11write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[4]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":72 + * fclose(f) + * + * def write_text(self, char* filename): # <<<<<<<<<<<<<< + * with open(filename, "w") as f: + * sent_num = 0 + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_10write_text(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_v_sent_num = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_link = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + 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; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73 + * + * def write_text(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * sent_num = 0 + * for i, link in enumerate(self.links): + */ + /*with:*/ { + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __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__w)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); + __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":74 + * def write_text(self, char* filename): + * with open(filename, "w") as f: + * sent_num = 0 # <<<<<<<<<<<<<< + * for i, link in enumerate(self.links): + * while i >= self.sent_index[sent_num]: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_sent_num = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/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_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; + } 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_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + 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 + } else { + __pyx_t_2 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF(__pyx_v_link); + __pyx_v_link = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); + __pyx_t_4 = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":76 + * sent_num = 0 + * for i, link in enumerate(self.links): + * while i >= self.sent_index[sent_num]: # <<<<<<<<<<<<<< + * f.write("\n") + * sent_num = sent_num + 1 + */ + while (1) { + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->sent_index), __pyx_v_sent_num); if (!__pyx_t_2) {__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_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; + if (!__pyx_t_11) break; + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_36), 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_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":78 + * while i >= self.sent_index[sent_num]: + * f.write("\n") + * sent_num = sent_num + 1 # <<<<<<<<<<<<<< + * f.write("%d-%d " % self.unlink(link)) + * f.write("\n") + */ + __pyx_t_2 = PyNumber_Add(__pyx_v_sent_num, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_sent_num); + __pyx_v_sent_num = __pyx_t_2; + __pyx_t_2 = 0; + } + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_10, ((PyObject *)__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_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), __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(((PyObject *)__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[4]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__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(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":80 + * sent_num = sent_num + 1 + * f.write("%d-%d " % self.unlink(link)) + * f.write("\n") # <<<<<<<<<<<<<< + * + * def write_binary(self, char* filename): + */ + __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 = 80; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 80; __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; + } + __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; + 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_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73 + * + * def write_text(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * sent_num = 0 + * for i, link in enumerate(self.links): + */ + /*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;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = PyTuple_New(3); 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_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_14 = PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; + 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_GIVEREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GIVEREF(__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_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L22; + } + __pyx_L22:; + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __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; + 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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_3) { + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_39, 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_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_15 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L23; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L1_error; + __pyx_L23:; + } + + __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_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_sent_num); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_link); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[4]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":82 + * f.write("\n") + * + * def write_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_12write_binary(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_binary", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":84 + * def write_binary(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "w") # <<<<<<<<<<<<<< + * self.links.write_handle(f) + * self.sent_index.write_handle(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":85 + * cdef FILE* f + * f = fopen(filename, "w") + * self.links.write_handle(f) # <<<<<<<<<<<<<< + * self.sent_index.write_handle(f) + * fclose(f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->links->__pyx_vtab)->write_handle(__pyx_v_self->links, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":86 + * f = fopen(filename, "w") + * self.links.write_handle(f) + * self.sent_index.write_handle(f) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":87 + * self.links.write_handle(f) + * self.sent_index.write_handle(f) + * fclose(f) # <<<<<<<<<<<<<< + * + * def write_enhanced(self, char* filename): + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[4]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":89 + * fclose(f) + * + * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< + * with open(filename, "w") as f: + * for link in self.links: + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_14write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, char *__pyx_v_filename) { + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_v_link = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + 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; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_enhanced", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * for link in self.links: + * f.write("%d " % link) + */ + /*with:*/ { + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __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__w)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); + __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/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; + } 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_GOTREF(__pyx_t_4); + __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + for (;;) { + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_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 + } else { + __pyx_t_1 = __pyx_t_9(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_link); + __pyx_v_link = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":93 + * for link in self.links: + * f.write("%d " % link) + * f.write("\n") # <<<<<<<<<<<<<< + * for i in self.sent_index: + * f.write("%d " % i) + */ + __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_40), 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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; + } 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; + } + 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 + } else { + __pyx_t_4 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[4]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_41), 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_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; + 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_10); __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * for link in self.links: + * f.write("%d " % link) + */ + /*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_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_13 = ((!(__pyx_t_11 != 0)) != 0); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__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; + {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L22; + } + __pyx_L22:; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_3) { + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_42, 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_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_13 < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L23; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L1_error; + __pyx_L23:; + } + + __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_10); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_link); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_9Alignment_16alignment[] = "Return all (e,f) pairs for sentence i"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9Alignment_17alignment(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("alignment (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":98 + * f.write("\n") + * + * def alignment(self, i): # <<<<<<<<<<<<<< + * """Return all (e,f) pairs for sentence i""" + * cdef int j, start, end + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9Alignment_16alignment(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_self, PyObject *__pyx_v_i) { + int __pyx_v_j; + int __pyx_v_start; + int __pyx_v_end; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("alignment", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":101 + * """Return all (e,f) pairs for sentence i""" + * cdef int j, start, end + * result = [] # <<<<<<<<<<<<<< + * start = self.sent_index.arr[i] + * end = self.sent_index.arr[i+1] + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":102 + * cdef int j, start, end + * result = [] + * start = self.sent_index.arr[i] # <<<<<<<<<<<<<< + * end = self.sent_index.arr[i+1] + * for j from start <= j < end: + */ + __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]); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":103 + * result = [] + * start = self.sent_index.arr[i] + * end = self.sent_index.arr[i+1] # <<<<<<<<<<<<<< + * for j from start <= j < end: + * result.append(self.unlink(self.links.arr[j])) + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_end = (__pyx_v_self->sent_index->arr[__pyx_t_2]); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":104 + * start = self.sent_index.arr[i] + * 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_3 = __pyx_v_end; + for (__pyx_v_j = __pyx_v_start; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { + + /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong((__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_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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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(((PyObject *)__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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":106 + * for j from start <= j < end: + * result.append(self.unlink(self.links.arr[j])) + * return result # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cdec.sa._sa.Alignment.alignment", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":15 + * int val + * + * cdef _node* new_node(int key): # <<<<<<<<<<<<<< + * cdef _node* n + * n = <_node*> malloc(sizeof(_node)) + */ + +static struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_f_4cdec_2sa_3_sa_new_node(int __pyx_v_key) { + struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_v_n; + struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("new_node", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":17 + * cdef _node* new_node(int key): + * cdef _node* n + * n = <_node*> malloc(sizeof(_node)) # <<<<<<<<<<<<<< + * n.smaller = NULL + * n.bigger = NULL + */ + __pyx_v_n = ((struct __pyx_t_4cdec_2sa_3_sa__node *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__node)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":18 + * cdef _node* n + * n = <_node*> malloc(sizeof(_node)) + * n.smaller = NULL # <<<<<<<<<<<<<< + * n.bigger = NULL + * n.key = key + */ + __pyx_v_n->smaller = NULL; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":19 + * n = <_node*> malloc(sizeof(_node)) + * n.smaller = NULL + * n.bigger = NULL # <<<<<<<<<<<<<< + * n.key = key + * n.val = 0 + */ + __pyx_v_n->bigger = NULL; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":20 + * n.smaller = NULL + * n.bigger = NULL + * n.key = key # <<<<<<<<<<<<<< + * n.val = 0 + * return n + */ + __pyx_v_n->key = __pyx_v_key; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":21 + * n.bigger = NULL + * n.key = key + * n.val = 0 # <<<<<<<<<<<<<< + * return n + * + */ + __pyx_v_n->val = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":22 + * n.key = key + * n.val = 0 + * return n # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_n; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":25 + * + * + * cdef del_node(_node* n): # <<<<<<<<<<<<<< + * if n.smaller != NULL: + * del_node(n.smaller) + */ + +static PyObject *__pyx_f_4cdec_2sa_3_sa_del_node(struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_v_n) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("del_node", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":26 + * + * cdef del_node(_node* n): + * if n.smaller != NULL: # <<<<<<<<<<<<<< + * del_node(n.smaller) + * if n.bigger != NULL: + */ + __pyx_t_1 = ((__pyx_v_n->smaller != NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":27 + * cdef del_node(_node* n): + * if n.smaller != NULL: + * del_node(n.smaller) # <<<<<<<<<<<<<< + * if n.bigger != NULL: + * del_node(n.bigger) + */ + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_del_node(__pyx_v_n->smaller); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 27; __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:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":28 + * if n.smaller != NULL: + * del_node(n.smaller) + * if n.bigger != NULL: # <<<<<<<<<<<<<< + * del_node(n.bigger) + * free(n) + */ + __pyx_t_1 = ((__pyx_v_n->bigger != NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":29 + * del_node(n.smaller) + * if n.bigger != NULL: + * del_node(n.bigger) # <<<<<<<<<<<<<< + * free(n) + * + */ + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_del_node(__pyx_v_n->bigger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 29; __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:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":30 + * if n.bigger != NULL: + * del_node(n.bigger) + * free(n) # <<<<<<<<<<<<<< + * + * cdef int* get_val(_node* n, int key): + */ + free(__pyx_v_n); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.del_node", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":32 + * free(n) + * + * cdef int* get_val(_node* n, int key): # <<<<<<<<<<<<<< + * if key == n.key: + * return &n.val + */ + +static int *__pyx_f_4cdec_2sa_3_sa_get_val(struct __pyx_t_4cdec_2sa_3_sa__node *__pyx_v_n, int __pyx_v_key) { + int *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_val", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":33 + * + * cdef int* get_val(_node* n, int key): + * if key == n.key: # <<<<<<<<<<<<<< + * return &n.val + * elif key < n.key: + */ + __pyx_t_1 = ((__pyx_v_key == __pyx_v_n->key) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":34 + * cdef int* get_val(_node* n, int key): + * if key == n.key: + * return &n.val # <<<<<<<<<<<<<< + * elif key < n.key: + * if n.smaller == NULL: + */ + __pyx_r = (&__pyx_v_n->val); + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":35 + * if key == n.key: + * return &n.val + * elif key < n.key: # <<<<<<<<<<<<<< + * if n.smaller == NULL: + * n.smaller = new_node(key) + */ + __pyx_t_1 = ((__pyx_v_key < __pyx_v_n->key) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":36 + * return &n.val + * elif key < n.key: + * if n.smaller == NULL: # <<<<<<<<<<<<<< + * n.smaller = new_node(key) + * return &(n.smaller.val) + */ + __pyx_t_1 = ((__pyx_v_n->smaller == NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":37 + * elif key < n.key: + * if n.smaller == NULL: + * n.smaller = new_node(key) # <<<<<<<<<<<<<< + * return &(n.smaller.val) + * return get_val(n.smaller, key) + */ + __pyx_v_n->smaller = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_key); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":38 + * if n.smaller == NULL: + * n.smaller = new_node(key) + * return &(n.smaller.val) # <<<<<<<<<<<<<< + * return get_val(n.smaller, key) + * else: + */ + __pyx_r = (&__pyx_v_n->smaller->val); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":39 + * n.smaller = new_node(key) + * return &(n.smaller.val) + * return get_val(n.smaller, key) # <<<<<<<<<<<<<< + * else: + * if n.bigger == NULL: + */ + __pyx_r = __pyx_f_4cdec_2sa_3_sa_get_val(__pyx_v_n->smaller, __pyx_v_key); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":41 + * return get_val(n.smaller, key) + * else: + * if n.bigger == NULL: # <<<<<<<<<<<<<< + * n.bigger = new_node(key) + * return &(n.bigger.val) + */ + __pyx_t_1 = ((__pyx_v_n->bigger == NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":42 + * else: + * if n.bigger == NULL: + * n.bigger = new_node(key) # <<<<<<<<<<<<<< + * return &(n.bigger.val) + * return get_val(n.bigger, key) + */ + __pyx_v_n->bigger = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_key); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":43 + * if n.bigger == NULL: + * n.bigger = new_node(key) + * return &(n.bigger.val) # <<<<<<<<<<<<<< + * return get_val(n.bigger, key) + * + */ + __pyx_r = (&__pyx_v_n->bigger->val); + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":44 + * n.bigger = new_node(key) + * return &(n.bigger.val) + * return get_val(n.bigger, key) # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_f_4cdec_2sa_3_sa_get_val(__pyx_v_n->bigger, __pyx_v_key); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_from_text = 0; + PyObject *__pyx_v_from_data = 0; + PyObject *__pyx_v_from_binary = 0; + PyObject *__pyx_v_earray = 0; + PyObject *__pyx_v_fsarray = 0; + PyObject *__pyx_v_alignment = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_text,&__pyx_n_s__from_data,&__pyx_n_s__from_binary,&__pyx_n_s__earray,&__pyx_n_s__fsarray,&__pyx_n_s__alignment,0}; + PyObject* values[6] = {0,0,0,0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54 + * cdef id2eword, id2fword, eword2id, fword2id + * + * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< + * earray=None, fsarray=None, alignment=None): + * self.id2eword = [] + */ + values[0] = ((PyObject *)Py_None); + values[1] = __pyx_k_43; + values[2] = ((PyObject *)Py_None); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":55 + * + * def __cinit__(self, from_text=None, from_data=False, from_binary=None, + * earray=None, fsarray=None, alignment=None): # <<<<<<<<<<<<<< + * self.id2eword = [] + * self.id2fword = [] + */ + values[3] = ((PyObject *)Py_None); + values[4] = ((PyObject *)Py_None); + values[5] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__from_text); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_data); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_binary); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__earray); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alignment); + if (value) { values[5] = 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 = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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_from_text = values[0]; + __pyx_v_from_data = values[1]; + __pyx_v_from_binary = values[2]; + __pyx_v_earray = values[3]; + __pyx_v_fsarray = values[4]; + __pyx_v_alignment = values[5]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __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); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54 + * cdef id2eword, id2fword, eword2id, fword2id + * + * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< + * earray=None, fsarray=None, alignment=None): + * self.id2eword = [] + */ + +static int __pyx_pf_4cdec_2sa_3_sa_5BiLex___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_from_text, PyObject *__pyx_v_from_data, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_earray, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_alignment) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + 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("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/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 = [] # <<<<<<<<<<<<<< + * self.id2fword = [] + * self.eword2id = {} + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->id2eword); + __Pyx_DECREF(__pyx_v_self->id2eword); + __pyx_v_self->id2eword = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":57 + * earray=None, fsarray=None, alignment=None): + * self.id2eword = [] + * self.id2fword = [] # <<<<<<<<<<<<<< + * self.eword2id = {} + * self.fword2id = {} + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->id2fword); + __Pyx_DECREF(__pyx_v_self->id2fword); + __pyx_v_self->id2fword = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":58 + * self.id2eword = [] + * self.id2fword = [] + * self.eword2id = {} # <<<<<<<<<<<<<< + * self.fword2id = {} + * self.e_index = IntList() + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->eword2id); + __Pyx_DECREF(__pyx_v_self->eword2id); + __pyx_v_self->eword2id = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":59 + * self.id2fword = [] + * self.eword2id = {} + * self.fword2id = {} # <<<<<<<<<<<<<< + * self.e_index = IntList() + * self.f_index = IntList() + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->fword2id); + __Pyx_DECREF(__pyx_v_self->fword2id); + __pyx_v_self->fword2id = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":60 + * self.eword2id = {} + * self.fword2id = {} + * self.e_index = IntList() # <<<<<<<<<<<<<< + * self.f_index = IntList() + * self.col1 = FloatList() + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((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_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __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_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":61 + * self.fword2id = {} + * self.e_index = IntList() + * self.f_index = IntList() # <<<<<<<<<<<<<< + * self.col1 = FloatList() + * self.col2 = FloatList() + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); 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_GIVEREF(__pyx_t_1); + __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_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":62 + * self.e_index = IntList() + * self.f_index = IntList() + * self.col1 = FloatList() # <<<<<<<<<<<<<< + * self.col2 = FloatList() + * if from_binary: + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), NULL); 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_GIVEREF(__pyx_t_1); + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":63 + * self.f_index = IntList() + * self.col1 = FloatList() + * self.col2 = FloatList() # <<<<<<<<<<<<<< + * if from_binary: + * self.read_binary(from_binary) + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__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_GIVEREF(__pyx_t_1); + __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_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":64 + * self.col1 = FloatList() + * self.col2 = FloatList() + * if from_binary: # <<<<<<<<<<<<<< + * self.read_binary(from_binary) + * elif from_data: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":66 + * if from_binary: + * self.read_binary(from_binary) + * elif from_data: # <<<<<<<<<<<<<< + * self.compute_from_data(fsarray, earray, alignment) + * else: + */ + __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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":67 + * self.read_binary(from_binary) + * elif from_data: + * self.compute_from_data(fsarray, earray, alignment) # <<<<<<<<<<<<<< + * else: + * self.read_text(from_text) + */ + 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; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/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 + */ + +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) { + int __pyx_v_sent_id; + int __pyx_v_num_links; + int __pyx_v_l; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_f_i; + int __pyx_v_e_j; + int __pyx_v_I; + int __pyx_v_J; + int __pyx_v_V_E; + int __pyx_v_V_F; + int __pyx_v_num_pairs; + int *__pyx_v_fsent; + int *__pyx_v_esent; + int *__pyx_v_links; + int *__pyx_v_ealigned; + int *__pyx_v_faligned; + struct __pyx_t_4cdec_2sa_3_sa__node **__pyx_v_dict; + int *__pyx_v_fmargin; + int *__pyx_v_emargin; + int *__pyx_v_count; + int __pyx_v_null_word; + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_v_id = NULL; + PyObject *__pyx_v_num_sents = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + 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("compute_from_data", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":79 + * cdef int null_word + * + * null_word = 0 # <<<<<<<<<<<<<< + * for word in fsa.darray.id2word: # I miss list comprehensions + * self.id2fword.append(word) + */ + __pyx_v_null_word = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":80 + * + * 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)) { + __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_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_word); + __pyx_v_word = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":81 + * 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_4 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_word); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":82 + * 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 (__Pyx_SetItemInt(__pyx_v_self->id2fword, __pyx_v_null_word, ((PyObject *)__pyx_n_s__NULL), sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":83 + * self.id2fword.append(word) + * self.id2fword[null_word] = "NULL" + * for id, word in enumerate(self.id2fword): # <<<<<<<<<<<<<< + * self.fword2id[word] = id + * + */ + __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_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_GOTREF(__pyx_t_4); + __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + 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_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __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_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__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_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __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_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_5 = __pyx_t_3(__pyx_t_4); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_word); + __pyx_v_word = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_id); + __pyx_v_id = __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 = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":84 + * self.id2fword[null_word] = "NULL" + * for id, word in enumerate(self.id2fword): + * self.fword2id[word] = id # <<<<<<<<<<<<<< + * + * for word in eda.id2word: + */ + if (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;} + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":86 + * 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)) { + __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_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_word); + __pyx_v_word = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":87 + * + * for word in eda.id2word: + * self.id2eword.append(word) # <<<<<<<<<<<<<< + * self.id2eword[null_word] = "NULL" + * for id, word in enumerate(self.id2eword): + */ + __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_word); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":88 + * 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 (__Pyx_SetItemInt(__pyx_v_self->id2eword, __pyx_v_null_word, ((PyObject *)__pyx_n_s__NULL), sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":89 + * self.id2eword.append(word) + * self.id2eword[null_word] = "NULL" + * for id, word in enumerate(self.id2eword): # <<<<<<<<<<<<<< + * self.eword2id[word] = id + * + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_1 = __pyx_int_0; + if (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_GOTREF(__pyx_t_4); + __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + 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_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __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_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__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_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __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_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_5 = __pyx_t_3(__pyx_t_4); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_word); + __pyx_v_word = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_id); + __pyx_v_id = __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":90 + * self.id2eword[null_word] = "NULL" + * for id, word in enumerate(self.id2eword): + * self.eword2id[word] = id # <<<<<<<<<<<<<< + * + * num_pairs = 0 + */ + if (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;} + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":92 + * self.eword2id[word] = id + * + * num_pairs = 0 # <<<<<<<<<<<<<< + * + * V_E = len(eda.id2word) + */ + __pyx_v_num_pairs = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":94 + * num_pairs = 0 + * + * V_E = len(eda.id2word) # <<<<<<<<<<<<<< + * V_F = len(fsa.darray.id2word) + * fmargin = malloc(V_F*sizeof(int)) + */ + __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_V_E = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":95 + * + * V_E = len(eda.id2word) + * V_F = len(fsa.darray.id2word) # <<<<<<<<<<<<<< + * fmargin = malloc(V_F*sizeof(int)) + * emargin = malloc(V_E*sizeof(int)) + */ + __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_V_F = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":96 + * V_E = len(eda.id2word) + * V_F = len(fsa.darray.id2word) + * fmargin = malloc(V_F*sizeof(int)) # <<<<<<<<<<<<<< + * emargin = malloc(V_E*sizeof(int)) + * memset(fmargin, 0, V_F*sizeof(int)) + */ + __pyx_v_fmargin = ((int *)malloc((__pyx_v_V_F * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":97 + * V_F = len(fsa.darray.id2word) + * fmargin = malloc(V_F*sizeof(int)) + * emargin = malloc(V_E*sizeof(int)) # <<<<<<<<<<<<<< + * memset(fmargin, 0, V_F*sizeof(int)) + * memset(emargin, 0, V_E*sizeof(int)) + */ + __pyx_v_emargin = ((int *)malloc((__pyx_v_V_E * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":98 + * fmargin = malloc(V_F*sizeof(int)) + * emargin = malloc(V_E*sizeof(int)) + * memset(fmargin, 0, V_F*sizeof(int)) # <<<<<<<<<<<<<< + * memset(emargin, 0, V_E*sizeof(int)) + * + */ + memset(__pyx_v_fmargin, 0, (__pyx_v_V_F * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":99 + * emargin = malloc(V_E*sizeof(int)) + * memset(fmargin, 0, V_F*sizeof(int)) + * memset(emargin, 0, V_E*sizeof(int)) # <<<<<<<<<<<<<< + * + * dict = <_node**> malloc(V_F*sizeof(_node*)) + */ + memset(__pyx_v_emargin, 0, (__pyx_v_V_E * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":101 + * memset(emargin, 0, V_E*sizeof(int)) + * + * dict = <_node**> malloc(V_F*sizeof(_node*)) # <<<<<<<<<<<<<< + * memset(dict, 0, V_F*sizeof(_node*)) + * + */ + __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 *))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":102 + * + * dict = <_node**> malloc(V_F*sizeof(_node*)) + * memset(dict, 0, V_F*sizeof(_node*)) # <<<<<<<<<<<<<< + * + * num_sents = len(fsa.darray.sent_index) + */ + memset(__pyx_v_dict, 0, (__pyx_v_V_F * (sizeof(struct __pyx_t_4cdec_2sa_3_sa__node *)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":104 + * memset(dict, 0, V_F*sizeof(_node*)) + * + * num_sents = len(fsa.darray.sent_index) # <<<<<<<<<<<<<< + * for sent_id from 0 <= sent_id < num_sents-1: + * + */ + __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_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_GOTREF(__pyx_t_1); + __pyx_v_num_sents = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":105 + * + * 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_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 105; __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_6; __pyx_v_sent_id++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":107 + * for sent_id from 0 <= sent_id < num_sents-1: + * + * 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 = malloc(I*sizeof(int)) + */ + __pyx_v_fsent = (__pyx_v_fsa->darray->data->arr + (__pyx_v_fsa->darray->sent_index->arr[__pyx_v_sent_id])); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":108 + * + * 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 = malloc(I*sizeof(int)) + * memset(faligned, 0, I*sizeof(int)) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":109 + * 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 = malloc(I*sizeof(int)) # <<<<<<<<<<<<<< + * memset(faligned, 0, I*sizeof(int)) + * + */ + __pyx_v_faligned = ((int *)malloc((__pyx_v_I * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":110 + * I = fsa.darray.sent_index.arr[sent_id+1] - fsa.darray.sent_index.arr[sent_id] - 1 + * faligned = malloc(I*sizeof(int)) + * memset(faligned, 0, I*sizeof(int)) # <<<<<<<<<<<<<< + * + * esent = eda.data.arr + eda.sent_index.arr[sent_id] + */ + memset(__pyx_v_faligned, 0, (__pyx_v_I * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":112 + * memset(faligned, 0, I*sizeof(int)) + * + * 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 = malloc(J*sizeof(int)) + */ + __pyx_v_esent = (__pyx_v_eda->data->arr + (__pyx_v_eda->sent_index->arr[__pyx_v_sent_id])); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":113 + * + * 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 = malloc(J*sizeof(int)) + * memset(ealigned, 0, J*sizeof(int)) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":114 + * 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 = malloc(J*sizeof(int)) # <<<<<<<<<<<<<< + * memset(ealigned, 0, J*sizeof(int)) + * + */ + __pyx_v_ealigned = ((int *)malloc((__pyx_v_J * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":115 + * J = eda.sent_index.arr[sent_id+1] - eda.sent_index.arr[sent_id] - 1 + * ealigned = malloc(J*sizeof(int)) + * memset(ealigned, 0, J*sizeof(int)) # <<<<<<<<<<<<<< + * + * links = aa._get_sent_links(sent_id, &num_links) + */ + memset(__pyx_v_ealigned, 0, (__pyx_v_J * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":117 + * memset(ealigned, 0, J*sizeof(int)) + * + * links = aa._get_sent_links(sent_id, &num_links) # <<<<<<<<<<<<<< + * + * for l from 0 <= l < num_links: + */ + __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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":119 + * links = aa._get_sent_links(sent_id, &num_links) + * + * for l from 0 <= l < num_links: # <<<<<<<<<<<<<< + * i = links[l*2] + * j = links[l*2+1] + */ + __pyx_t_7 = __pyx_v_num_links; + for (__pyx_v_l = 0; __pyx_v_l < __pyx_t_7; __pyx_v_l++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":120 + * + * for l from 0 <= l < num_links: + * i = links[l*2] # <<<<<<<<<<<<<< + * j = links[l*2+1] + * if i >= I or j >= J: + */ + __pyx_v_i = (__pyx_v_links[(__pyx_v_l * 2)]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":121 + * for l from 0 <= l < num_links: + * 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)) + */ + __pyx_v_j = (__pyx_v_links[((__pyx_v_l * 2) + 1)]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":122 + * 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_8 = ((__pyx_v_i >= __pyx_v_I) != 0); + if (!__pyx_t_8) { + __pyx_t_9 = ((__pyx_v_j >= __pyx_v_J) != 0); + __pyx_t_10 = __pyx_t_9; + } else { + __pyx_t_10 = __pyx_t_8; + } + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":123 + * 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 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyInt_FromLong(__pyx_v_I); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = PyInt_FromLong(__pyx_v_J); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyInt_FromLong((__pyx_v_sent_id + 1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = PyTuple_New(5); 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); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + 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); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_DECREF(((PyObject *)__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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __Pyx_Raise(__pyx_t_12, 0, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L15; + } + __pyx_L15:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":124 + * 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] + * fmargin[f_i] = fmargin[f_i]+1 + */ + __pyx_v_f_i = (__pyx_v_fsent[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":125 + * 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] # <<<<<<<<<<<<<< + * fmargin[f_i] = fmargin[f_i]+1 + * emargin[e_j] = emargin[e_j]+1 + */ + __pyx_v_e_j = (__pyx_v_esent[__pyx_v_j]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":126 + * f_i = fsent[i] + * e_j = esent[j] + * fmargin[f_i] = fmargin[f_i]+1 # <<<<<<<<<<<<<< + * emargin[e_j] = emargin[e_j]+1 + * if dict[f_i] == NULL: + */ + (__pyx_v_fmargin[__pyx_v_f_i]) = ((__pyx_v_fmargin[__pyx_v_f_i]) + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":127 + * e_j = esent[j] + * 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) + */ + (__pyx_v_emargin[__pyx_v_e_j]) = ((__pyx_v_emargin[__pyx_v_e_j]) + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":128 + * 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_10 = (((__pyx_v_dict[__pyx_v_f_i]) == NULL) != 0); + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":129 + * emargin[e_j] = emargin[e_j]+1 + * if dict[f_i] == NULL: + * dict[f_i] = new_node(e_j) # <<<<<<<<<<<<<< + * dict[f_i].val = 1 + * num_pairs = num_pairs + 1 + */ + (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_e_j); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":130 + * if dict[f_i] == NULL: + * dict[f_i] = new_node(e_j) + * dict[f_i].val = 1 # <<<<<<<<<<<<<< + * num_pairs = num_pairs + 1 + * else: + */ + (__pyx_v_dict[__pyx_v_f_i])->val = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":131 + * dict[f_i] = new_node(e_j) + * dict[f_i].val = 1 + * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< + * else: + * count = get_val(dict[f_i], e_j) + */ + __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); + goto __pyx_L16; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":133 + * num_pairs = num_pairs + 1 + * else: + * count = get_val(dict[f_i], e_j) # <<<<<<<<<<<<<< + * if count[0] == 0: + * num_pairs = num_pairs + 1 + */ + __pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_e_j); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":134 + * 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_10 = (((__pyx_v_count[0]) == 0) != 0); + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":135 + * count = get_val(dict[f_i], e_j) + * if count[0] == 0: + * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< + * count[0] = count[0] + 1 + * # add count + */ + __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":136 + * if count[0] == 0: + * num_pairs = num_pairs + 1 + * count[0] = count[0] + 1 # <<<<<<<<<<<<<< + * # add count + * faligned[i] = 1 + */ + (__pyx_v_count[0]) = ((__pyx_v_count[0]) + 1); + } + __pyx_L16:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":138 + * count[0] = count[0] + 1 + * # add count + * faligned[i] = 1 # <<<<<<<<<<<<<< + * ealigned[j] = 1 + * for i from 0 <= i < I: + */ + (__pyx_v_faligned[__pyx_v_i]) = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":139 + * # add count + * faligned[i] = 1 + * ealigned[j] = 1 # <<<<<<<<<<<<<< + * for i from 0 <= i < I: + * if faligned[i] == 0: + */ + (__pyx_v_ealigned[__pyx_v_j]) = 1; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":140 + * faligned[i] = 1 + * ealigned[j] = 1 + * for i from 0 <= i < I: # <<<<<<<<<<<<<< + * if faligned[i] == 0: + * f_i = fsent[i] + */ + __pyx_t_7 = __pyx_v_I; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":141 + * 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_10 = (((__pyx_v_faligned[__pyx_v_i]) == 0) != 0); + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":142 + * for i from 0 <= i < I: + * if faligned[i] == 0: + * f_i = fsent[i] # <<<<<<<<<<<<<< + * fmargin[f_i] = fmargin[f_i] + 1 + * emargin[null_word] = emargin[null_word] + 1 + */ + __pyx_v_f_i = (__pyx_v_fsent[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":143 + * if faligned[i] == 0: + * f_i = fsent[i] + * fmargin[f_i] = fmargin[f_i] + 1 # <<<<<<<<<<<<<< + * emargin[null_word] = emargin[null_word] + 1 + * if dict[f_i] == NULL: + */ + (__pyx_v_fmargin[__pyx_v_f_i]) = ((__pyx_v_fmargin[__pyx_v_f_i]) + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":144 + * f_i = fsent[i] + * 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) + */ + (__pyx_v_emargin[__pyx_v_null_word]) = ((__pyx_v_emargin[__pyx_v_null_word]) + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":145 + * 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_10 = (((__pyx_v_dict[__pyx_v_f_i]) == NULL) != 0); + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":146 + * emargin[null_word] = emargin[null_word] + 1 + * if dict[f_i] == NULL: + * dict[f_i] = new_node(null_word) # <<<<<<<<<<<<<< + * dict[f_i].val = 1 + * num_pairs = num_pairs + 1 + */ + (__pyx_v_dict[__pyx_v_f_i]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_null_word); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":147 + * if dict[f_i] == NULL: + * dict[f_i] = new_node(null_word) + * dict[f_i].val = 1 # <<<<<<<<<<<<<< + * num_pairs = num_pairs + 1 + * else: + */ + (__pyx_v_dict[__pyx_v_f_i])->val = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":148 + * dict[f_i] = new_node(null_word) + * dict[f_i].val = 1 + * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< + * else: + * count = get_val(dict[f_i], null_word) + */ + __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); + goto __pyx_L21; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":150 + * num_pairs = num_pairs + 1 + * else: + * count = get_val(dict[f_i], null_word) # <<<<<<<<<<<<<< + * if count[0] == 0: + * num_pairs = num_pairs + 1 + */ + __pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_f_i]), __pyx_v_null_word); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":151 + * 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_10 = (((__pyx_v_count[0]) == 0) != 0); + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":152 + * count = get_val(dict[f_i], null_word) + * if count[0] == 0: + * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< + * count[0] = count[0] + 1 + * for j from 0 <= j < J: + */ + __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); + goto __pyx_L22; + } + __pyx_L22:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":153 + * if count[0] == 0: + * num_pairs = num_pairs + 1 + * count[0] = count[0] + 1 # <<<<<<<<<<<<<< + * for j from 0 <= j < J: + * if ealigned[j] == 0: + */ + (__pyx_v_count[0]) = ((__pyx_v_count[0]) + 1); + } + __pyx_L21:; + goto __pyx_L20; + } + __pyx_L20:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":154 + * num_pairs = num_pairs + 1 + * count[0] = count[0] + 1 + * for j from 0 <= j < J: # <<<<<<<<<<<<<< + * if ealigned[j] == 0: + * e_j = esent[j] + */ + __pyx_t_7 = __pyx_v_J; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_7; __pyx_v_j++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":155 + * 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_10 = (((__pyx_v_ealigned[__pyx_v_j]) == 0) != 0); + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":156 + * for j from 0 <= j < J: + * if ealigned[j] == 0: + * e_j = esent[j] # <<<<<<<<<<<<<< + * fmargin[null_word] = fmargin[null_word] + 1 + * emargin[e_j] = emargin[e_j] + 1 + */ + __pyx_v_e_j = (__pyx_v_esent[__pyx_v_j]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":157 + * if ealigned[j] == 0: + * e_j = esent[j] + * fmargin[null_word] = fmargin[null_word] + 1 # <<<<<<<<<<<<<< + * emargin[e_j] = emargin[e_j] + 1 + * if dict[null_word] == NULL: + */ + (__pyx_v_fmargin[__pyx_v_null_word]) = ((__pyx_v_fmargin[__pyx_v_null_word]) + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":158 + * e_j = esent[j] + * 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) + */ + (__pyx_v_emargin[__pyx_v_e_j]) = ((__pyx_v_emargin[__pyx_v_e_j]) + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":159 + * 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_10 = (((__pyx_v_dict[__pyx_v_null_word]) == NULL) != 0); + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":160 + * emargin[e_j] = emargin[e_j] + 1 + * if dict[null_word] == NULL: + * dict[null_word] = new_node(e_j) # <<<<<<<<<<<<<< + * dict[null_word].val = 1 + * num_pairs = num_pairs + 1 + */ + (__pyx_v_dict[__pyx_v_null_word]) = __pyx_f_4cdec_2sa_3_sa_new_node(__pyx_v_e_j); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":161 + * if dict[null_word] == NULL: + * dict[null_word] = new_node(e_j) + * dict[null_word].val = 1 # <<<<<<<<<<<<<< + * num_pairs = num_pairs + 1 + * else: + */ + (__pyx_v_dict[__pyx_v_null_word])->val = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":162 + * dict[null_word] = new_node(e_j) + * dict[null_word].val = 1 + * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< + * else: + * count = get_val(dict[null_word], e_j) + */ + __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); + goto __pyx_L26; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":164 + * num_pairs = num_pairs + 1 + * else: + * count = get_val(dict[null_word], e_j) # <<<<<<<<<<<<<< + * if count[0] == 0: + * num_pairs = num_pairs + 1 + */ + __pyx_v_count = __pyx_f_4cdec_2sa_3_sa_get_val((__pyx_v_dict[__pyx_v_null_word]), __pyx_v_e_j); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":165 + * 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_10 = (((__pyx_v_count[0]) == 0) != 0); + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":166 + * count = get_val(dict[null_word], e_j) + * if count[0] == 0: + * num_pairs = num_pairs + 1 # <<<<<<<<<<<<<< + * count[0] = count[0] + 1 + * free(links) + */ + __pyx_v_num_pairs = (__pyx_v_num_pairs + 1); + goto __pyx_L27; + } + __pyx_L27:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":167 + * if count[0] == 0: + * num_pairs = num_pairs + 1 + * count[0] = count[0] + 1 # <<<<<<<<<<<<<< + * free(links) + * free(faligned) + */ + (__pyx_v_count[0]) = ((__pyx_v_count[0]) + 1); + } + __pyx_L26:; + goto __pyx_L25; + } + __pyx_L25:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":168 + * num_pairs = num_pairs + 1 + * count[0] = count[0] + 1 + * free(links) # <<<<<<<<<<<<<< + * free(faligned) + * free(ealigned) + */ + free(__pyx_v_links); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":169 + * count[0] = count[0] + 1 + * free(links) + * free(faligned) # <<<<<<<<<<<<<< + * free(ealigned) + * self.f_index = IntList(initial_len=V_F) + */ + free(__pyx_v_faligned); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":170 + * free(links) + * free(faligned) + * free(ealigned) # <<<<<<<<<<<<<< + * self.f_index = IntList(initial_len=V_F) + * self.e_index = IntList(initial_len=num_pairs) + */ + free(__pyx_v_ealigned); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":171 + * 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_13 = PyInt_FromLong(__pyx_v_V_F); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(((PyObject *)__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_13); + __pyx_t_13 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":172 + * 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_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __pyx_t_12 = PyInt_FromLong(__pyx_v_num_pairs); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":173 + * 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_13 = PyInt_FromLong(__pyx_v_num_pairs); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(((PyObject *)__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_13); + __pyx_t_13 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":174 + * 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_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __pyx_t_12 = PyInt_FromLong(__pyx_v_num_pairs); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":176 + * self.col2 = FloatList(initial_len=num_pairs) + * + * num_pairs = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < V_F: + * #self.f_index[i] = num_pairs + */ + __pyx_v_num_pairs = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":177 + * + * num_pairs = 0 + * for i from 0 <= i < V_F: # <<<<<<<<<<<<<< + * #self.f_index[i] = num_pairs + * self.f_index.set(i, num_pairs) + */ + __pyx_t_6 = __pyx_v_V_F; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":179 + * for i from 0 <= i < V_F: + * #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) + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":180 + * #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_10 = (((__pyx_v_dict[__pyx_v_i]) != NULL) != 0); + if (__pyx_t_10) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":181 + * 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_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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":182 + * 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_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 = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L30; + } + __pyx_L30:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":183 + * self._add_node(dict[i], &num_pairs, float(fmargin[i]), emargin) + * del_node(dict[i]) + * free(fmargin) # <<<<<<<<<<<<<< + * free(emargin) + * free(dict) + */ + free(__pyx_v_fmargin); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":184 + * del_node(dict[i]) + * free(fmargin) + * free(emargin) # <<<<<<<<<<<<<< + * free(dict) + * return + */ + free(__pyx_v_emargin); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":185 + * free(fmargin) + * free(emargin) + * free(dict) # <<<<<<<<<<<<<< + * return + * + */ + free(__pyx_v_dict); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":186 + * free(emargin) + * free(dict) + * return # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.compute_from_data", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_word); + __Pyx_XDECREF(__pyx_v_id); + __Pyx_XDECREF(__pyx_v_num_sents); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":189 + * + * + * cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin): # <<<<<<<<<<<<<< + * cdef int loc + * if n.smaller != NULL: + */ + +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) { + int __pyx_v_loc; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_add_node", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":191 + * cdef _add_node(self, _node* n, int* num_pairs, float fmargin, int* emargin): + * cdef int loc + * if n.smaller != NULL: # <<<<<<<<<<<<<< + * self._add_node(n.smaller, num_pairs, fmargin, emargin) + * loc = num_pairs[0] + */ + __pyx_t_1 = ((__pyx_v_n->smaller != NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":192 + * 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_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":193 + * if n.smaller != NULL: + * self._add_node(n.smaller, num_pairs, fmargin, emargin) + * loc = num_pairs[0] # <<<<<<<<<<<<<< + * self.e_index.set(loc, n.key) + * self.col1.set(loc, float(n.val)/fmargin) + */ + __pyx_v_loc = (__pyx_v_num_pairs[0]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":194 + * self._add_node(n.smaller, num_pairs, fmargin, emargin) + * loc = num_pairs[0] + * 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])) + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":195 + * loc = num_pairs[0] + * 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])) + * num_pairs[0] = loc + 1 + */ + if (unlikely(__pyx_v_fmargin == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 195; __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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":196 + * 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])) # <<<<<<<<<<<<<< + * num_pairs[0] = loc + 1 + * if n.bigger != NULL: + */ + if (unlikely(((double)(__pyx_v_emargin[__pyx_v_n->key])) == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 196; __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])))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":197 + * self.col1.set(loc, float(n.val)/fmargin) + * self.col2.set(loc, float(n.val)/float(emargin[n.key])) + * num_pairs[0] = loc + 1 # <<<<<<<<<<<<<< + * if n.bigger != NULL: + * self._add_node(n.bigger, num_pairs, fmargin, emargin) + */ + (__pyx_v_num_pairs[0]) = (__pyx_v_loc + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":198 + * self.col2.set(loc, float(n.val)/float(emargin[n.key])) + * num_pairs[0] = loc + 1 + * if n.bigger != NULL: # <<<<<<<<<<<<<< + * self._add_node(n.bigger, num_pairs, fmargin, emargin) + * + */ + __pyx_t_1 = ((__pyx_v_n->bigger != NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":199 + * 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_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.BiLex._add_node", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_3write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":202 + * + * + * def write_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_2write_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_binary", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":204 + * def write_binary(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "w") # <<<<<<<<<<<<<< + * self.f_index.write_handle(f) + * self.e_index.write_handle(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":205 + * cdef FILE* f + * f = fopen(filename, "w") + * self.f_index.write_handle(f) # <<<<<<<<<<<<<< + * self.e_index.write_handle(f) + * self.col1.write_handle(f) + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":206 + * f = fopen(filename, "w") + * self.f_index.write_handle(f) + * self.e_index.write_handle(f) # <<<<<<<<<<<<<< + * self.col1.write_handle(f) + * self.col2.write_handle(f) + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":207 + * self.f_index.write_handle(f) + * self.e_index.write_handle(f) + * self.col1.write_handle(f) # <<<<<<<<<<<<<< + * self.col2.write_handle(f) + * self.write_wordlist(self.id2fword, f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->write_handle(__pyx_v_self->col1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":208 + * self.e_index.write_handle(f) + * self.col1.write_handle(f) + * self.col2.write_handle(f) # <<<<<<<<<<<<<< + * self.write_wordlist(self.id2fword, f) + * self.write_wordlist(self.id2eword, f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->write_handle(__pyx_v_self->col2, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":209 + * self.col1.write_handle(f) + * self.col2.write_handle(f) + * self.write_wordlist(self.id2fword, f) # <<<<<<<<<<<<<< + * self.write_wordlist(self.id2eword, f) + * fclose(f) + */ + __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_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":210 + * self.col2.write_handle(f) + * self.write_wordlist(self.id2fword, f) + * self.write_wordlist(self.id2eword, f) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + __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_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":211 + * self.write_wordlist(self.id2fword, f) + * self.write_wordlist(self.id2eword, f) + * fclose(f) # <<<<<<<<<<<<<< + * + * + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":214 + * + * + * cdef write_wordlist(self, wordlist, FILE* f): # <<<<<<<<<<<<<< + * cdef int word_len + * cdef int num_words + */ + +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) { + int __pyx_v_word_len; + int __pyx_v_num_words; + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + char *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_wordlist", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":218 + * 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_v_num_words = __pyx_t_1; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":219 + * + * num_words = len(wordlist) + * fwrite(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * for word in wordlist: + * word_len = len(word) + 1 + */ + fwrite((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":220 + * 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)) { + __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_GOTREF(__pyx_t_2); + __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + 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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_word); + __pyx_v_word = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":221 + * fwrite(&(num_words), sizeof(int), 1, f) + * for word in wordlist: + * word_len = len(word) + 1 # <<<<<<<<<<<<<< + * fwrite(&(word_len), sizeof(int), 1, f) + * fwrite(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_v_word_len = (__pyx_t_5 + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":222 + * for word in wordlist: + * word_len = len(word) + 1 + * fwrite(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * fwrite(word, sizeof(char), word_len, f) + * + */ + fwrite((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":223 + * word_len = len(word) + 1 + * fwrite(&(word_len), sizeof(int), 1, f) + * fwrite(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;} + fwrite(((char *)__pyx_t_6), (sizeof(char)), __pyx_v_word_len, __pyx_v_f); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_word); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":226 + * + * + * cdef read_wordlist(self, word2id, id2word, FILE* f): # <<<<<<<<<<<<<< + * cdef int num_words + * cdef int word_len + */ + +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) { + int __pyx_v_num_words; + int __pyx_v_word_len; + char *__pyx_v_word; + CYTHON_UNUSED long __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + 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("read_wordlist", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":231 + * cdef char* word + * + * fread(&(num_words), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * for i from 0 <= i < num_words: + * fread(&(word_len), sizeof(int), 1, f) + */ + fread((&__pyx_v_num_words), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":232 + * + * fread(&(num_words), sizeof(int), 1, f) + * for i from 0 <= i < num_words: # <<<<<<<<<<<<<< + * fread(&(word_len), sizeof(int), 1, f) + * word = malloc (word_len * sizeof(char)) + */ + __pyx_t_1 = __pyx_v_num_words; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":233 + * fread(&(num_words), sizeof(int), 1, f) + * for i from 0 <= i < num_words: + * fread(&(word_len), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * word = malloc (word_len * sizeof(char)) + * fread(word, sizeof(char), word_len, f) + */ + fread((&__pyx_v_word_len), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":234 + * for i from 0 <= i < num_words: + * fread(&(word_len), sizeof(int), 1, f) + * word = malloc (word_len * sizeof(char)) # <<<<<<<<<<<<<< + * fread(word, sizeof(char), word_len, f) + * word2id[word] = len(id2word) + */ + __pyx_v_word = ((char *)malloc((__pyx_v_word_len * (sizeof(char))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":235 + * fread(&(word_len), sizeof(int), 1, f) + * word = malloc (word_len * sizeof(char)) + * fread(word, sizeof(char), word_len, f) # <<<<<<<<<<<<<< + * word2id[word] = len(id2word) + * id2word.append(word) + */ + fread(__pyx_v_word, (sizeof(char)), __pyx_v_word_len, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":236 + * word = 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_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_GOTREF(((PyObject *)__pyx_t_4)); + if (PyObject_SetItem(__pyx_v_word2id, ((PyObject *)__pyx_t_4), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":237 + * 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_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_id2word, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 237; __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_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":238 + * word2id[word] = len(id2word) + * id2word.append(word) + * free(word) # <<<<<<<<<<<<<< + * + * def read_binary(self, char* filename): + */ + free(__pyx_v_word); + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_wordlist", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_5read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":240 + * free(word) + * + * def read_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_4read_binary(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + 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("read_binary", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":242 + * def read_binary(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "r") # <<<<<<<<<<<<<< + * self.f_index.read_handle(f) + * self.e_index.read_handle(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":243 + * cdef FILE* f + * f = fopen(filename, "r") + * self.f_index.read_handle(f) # <<<<<<<<<<<<<< + * self.e_index.read_handle(f) + * self.col1.read_handle(f) + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":244 + * f = fopen(filename, "r") + * self.f_index.read_handle(f) + * self.e_index.read_handle(f) # <<<<<<<<<<<<<< + * self.col1.read_handle(f) + * self.col2.read_handle(f) + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":245 + * self.f_index.read_handle(f) + * self.e_index.read_handle(f) + * self.col1.read_handle(f) # <<<<<<<<<<<<<< + * self.col2.read_handle(f) + * self.read_wordlist(self.fword2id, self.id2fword, f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col1->__pyx_vtab)->read_handle(__pyx_v_self->col1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":246 + * self.e_index.read_handle(f) + * self.col1.read_handle(f) + * self.col2.read_handle(f) # <<<<<<<<<<<<<< + * self.read_wordlist(self.fword2id, self.id2fword, f) + * self.read_wordlist(self.eword2id, self.id2eword, f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList *)__pyx_v_self->col2->__pyx_vtab)->read_handle(__pyx_v_self->col2, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":247 + * self.col1.read_handle(f) + * self.col2.read_handle(f) + * self.read_wordlist(self.fword2id, self.id2fword, f) # <<<<<<<<<<<<<< + * self.read_wordlist(self.eword2id, self.id2eword, f) + * fclose(f) + */ + __pyx_t_1 = __pyx_v_self->fword2id; + __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_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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":248 + * self.col2.read_handle(f) + * self.read_wordlist(self.fword2id, self.id2fword, f) + * self.read_wordlist(self.eword2id, self.id2eword, f) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + __pyx_t_3 = __pyx_v_self->eword2id; + __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_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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":249 + * self.read_wordlist(self.fword2id, self.id2fword, f) + * self.read_wordlist(self.eword2id, self.id2eword, f) + * fclose(f) # <<<<<<<<<<<<<< + * + * + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id(PyObject *__pyx_v_self, PyObject *__pyx_v_eword) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_e_id (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_eword)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":252 + * + * + * def get_e_id(self, eword): # <<<<<<<<<<<<<< + * if eword not in self.eword2id: + * e_id = len(self.id2eword) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_6get_e_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_eword) { + PyObject *__pyx_v_e_id = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_e_id", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":253 + * + * 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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":254 + * def get_e_id(self, eword): + * if eword not in self.eword2id: + * e_id = len(self.id2eword) # <<<<<<<<<<<<<< + * self.id2eword.append(eword) + * self.eword2id[eword] = e_id + */ + __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 = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); 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_v_e_id = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":255 + * 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_3 = __Pyx_PyObject_Append(__pyx_v_self->id2eword, __pyx_v_eword); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":256 + * e_id = len(self.id2eword) + * self.id2eword.append(eword) + * self.eword2id[eword] = e_id # <<<<<<<<<<<<<< + * return self.eword2id[eword] + * + */ + if (PyObject_SetItem(__pyx_v_self->eword2id, __pyx_v_eword, __pyx_v_e_id) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":257 + * self.id2eword.append(eword) + * self.eword2id[eword] = e_id + * return self.eword2id[eword] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetItem(__pyx_v_self->eword2id, __pyx_v_eword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_e_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_e_id); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id(PyObject *__pyx_v_self, PyObject *__pyx_v_fword) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_f_id (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((PyObject *)__pyx_v_fword)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":260 + * + * + * def get_f_id(self, fword): # <<<<<<<<<<<<<< + * if fword not in self.fword2id: + * f_id = len(self.id2fword) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_8get_f_id(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword) { + PyObject *__pyx_v_f_id = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_f_id", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":261 + * + * 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 = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":262 + * def get_f_id(self, fword): + * if fword not in self.fword2id: + * f_id = len(self.id2fword) # <<<<<<<<<<<<<< + * self.id2fword.append(fword) + * self.fword2id[fword] = f_id + */ + __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 = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_f_id = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":263 + * 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_3 = __Pyx_PyObject_Append(__pyx_v_self->id2fword, __pyx_v_fword); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":264 + * f_id = len(self.id2fword) + * self.id2fword.append(fword) + * self.fword2id[fword] = f_id # <<<<<<<<<<<<<< + * return self.fword2id[fword] + * + */ + if (PyObject_SetItem(__pyx_v_self->fword2id, __pyx_v_fword, __pyx_v_f_id) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":265 + * self.id2fword.append(fword) + * self.fword2id[fword] = f_id + * return self.fword2id[fword] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetItem(__pyx_v_self->fword2id, __pyx_v_fword); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_f_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_f_id); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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 = 268; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":268 + * + * + * def read_text(self, char* filename): # <<<<<<<<<<<<<< + * cdef i, j, w, e_id, f_id, n_f, n_e, N + * cdef IntList fcount + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_10read_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { + PyObject *__pyx_v_i = 0; + PyObject *__pyx_v_j = 0; + PyObject *__pyx_v_e_id = 0; + PyObject *__pyx_v_f_id = 0; + PyObject *__pyx_v_n_f = 0; + PyObject *__pyx_v_N = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_fcount = 0; + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_v_line = NULL; + PyObject *__pyx_v_fword = NULL; + PyObject *__pyx_v_eword = NULL; + PyObject *__pyx_v_score1 = NULL; + PyObject *__pyx_v_score2 = NULL; + PyObject *__pyx_v_index = NULL; + PyObject *__pyx_v_b = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + 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_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *(*__pyx_t_14)(PyObject *); + Py_ssize_t __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + int __pyx_t_20; + double __pyx_t_21; + PyObject *__pyx_t_22 = NULL; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_text", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":272 + * cdef IntList fcount + * + * fcount = IntList() # <<<<<<<<<<<<<< + * with gzip_or_text(filename) as f: + * # first loop merely establishes size of array objects + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 272; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273 + * + * fcount = IntList() + * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< + * # first loop merely establishes size of array objects + * 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 = 273; __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 = 273; __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[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __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_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_1); + __pyx_v_f = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":275 + * 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; + } 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 = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + 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 = 275; __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 = 275; __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 = 275; __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 = 275; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else { + __pyx_t_2 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 275; __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_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":276 + * # 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 = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __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_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __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_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_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_12); + #else + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_10,&__pyx_t_11,&__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 = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(item); + *(temps[i]) = item; + } + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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 = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 276; __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:; + __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 = 276; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_L19_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_fword); + __pyx_v_fword = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_v_eword); + __pyx_v_eword = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_v_score1); + __pyx_v_score1 = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_v_score2); + __pyx_v_score2 = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":277 + * 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 = 277; __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 = 277; __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_v_f_id); + __pyx_v_f_id = __pyx_t_11; + __pyx_t_11 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":278 + * (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 = 278; __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 = 278; __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 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_v_e_id); + __pyx_v_e_id = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":279 + * f_id = self.get_f_id(fword) + * e_id = self.get_e_id(eword) + * while f_id >= len(fcount): # <<<<<<<<<<<<<< + * fcount.append(0) + * 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 = 279; __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 = 279; __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 = 279; __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (!__pyx_t_16) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":280 + * 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_12 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_fcount), __pyx_int_0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":281 + * 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 = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + (__pyx_v_fcount->arr[__pyx_t_17]) = ((__pyx_v_fcount->arr[__pyx_t_15]) + 1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":284 + * + * # Allocate space for dictionary in arrays + * N = 0 # <<<<<<<<<<<<<< + * n_f = len(fcount) + * self.f_index = IntList(initial_len=n_f+1) + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_N = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":285 + * # 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 = 285; __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 = 285; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_n_f = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":286 + * 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 = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__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 = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":287 + * 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_18 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19++) { + __pyx_t_12 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":288 + * 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_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 288; __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 = 288; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_20; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":289 + * 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 = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyInt_FromLong((__pyx_v_fcount->arr[__pyx_t_8])); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 289; __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 = 289; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_v_N); + __pyx_v_N = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":290 + * 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 = 290; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + (__pyx_v_fcount->arr[__pyx_t_8]) = 0; + __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":287 + * 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 = PyInt_FromLong(__pyx_t_19); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":291 + * 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_20 = __Pyx_PyInt_AsInt(__pyx_v_N); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 291; __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 = 291; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + (__pyx_v_self->f_index->arr[__pyx_t_8]) = __pyx_t_20; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":292 + * 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 = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); 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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":293 + * 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 = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); 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(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":294 + * 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 = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_v_N) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":297 + * + * # 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 = 297; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_45), NULL); 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_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":298 + * # 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; + } 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 = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + 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 = 298; __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 = 298; __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 = 298; __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 = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else { + __pyx_t_12 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_12)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_12); + } + __Pyx_XDECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":299 + * 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 = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __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; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __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_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_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_2); + #else + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__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 = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(item); + *(temps[i]) = item; + } + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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 = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 4) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 299; __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:; + __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 = 299; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_L27_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_fword); + __pyx_v_fword = __pyx_t_12; + __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_v_eword); + __pyx_v_eword = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_v_score1); + __pyx_v_score1 = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_v_score2); + __pyx_v_score2 = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":300 + * 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 = 300; __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 = 300; __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_v_f_id); + __pyx_v_f_id = __pyx_t_10; + __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":301 + * (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 = 301; __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 = 301; __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 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_v_e_id); + __pyx_v_e_id = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":302 + * 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 = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_3 = PyInt_FromLong(((__pyx_v_self->f_index->arr[__pyx_t_15]) + (__pyx_v_fcount->arr[__pyx_t_17]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_index); + __pyx_v_index = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":303 + * 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_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_f_id); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 303; __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 = 303; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + (__pyx_v_fcount->arr[__pyx_t_15]) = ((__pyx_v_fcount->arr[__pyx_t_17]) + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":304 + * 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 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_e_id); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_e_id); + __Pyx_GIVEREF(__pyx_v_e_id); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + (__pyx_v_self->e_index->arr[__pyx_t_17]) = __pyx_t_20; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":305 + * 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_21 = __Pyx_PyObject_AsDouble(__pyx_v_score1); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(((PyObject *)__pyx_v_self->col1), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":306 + * self.e_index.arr[index] = int(e_id) + * self.col1[index] = float(score1) + * self.col2[index] = float(score2) # <<<<<<<<<<<<<< + * + * # Sort buckets by eword + */ + __pyx_t_21 = __Pyx_PyObject_AsDouble(__pyx_v_score2); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(((PyObject *)__pyx_v_self->col2), __pyx_v_index, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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; + 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_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273 + * + * fcount = IntList() + * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< + * # first loop merely establishes size of array objects + * for line in f: + */ + /*except:*/ { + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_22 = PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_22); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + if (__pyx_t_16 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_23 = ((!(__pyx_t_16 != 0)) != 0); + if (__pyx_t_23) { + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_2, __pyx_t_3); + __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L30; + } + __pyx_L30:; + __Pyx_DECREF(((PyObject *)__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; + __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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_4) { + __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_k_tuple_46, NULL); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_23 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L31; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L1_error; + __pyx_L31:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":309 + * + * # 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 = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_19 = __Pyx_PyInt_AsLong(__pyx_v_n_f); if (unlikely((__pyx_t_19 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_19; __pyx_t_18++) { + __pyx_t_3 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_b); + __pyx_v_b = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":310 + * # 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 = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":311 + * 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_3 = PyNumber_Add(__pyx_v_b, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":312 + * i = self.f_index.arr[b] + * j = self.f_index.arr[b+1] + * self.qsort(i,j, "") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_24 = __Pyx_PyInt_AsInt(__pyx_v_j); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex *)__pyx_v_self->__pyx_vtab)->qsort(__pyx_v_self, __pyx_t_20, __pyx_t_24, ((PyObject *)__pyx_kp_s_47)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_18 = __Pyx_PyInt_AsLong(__pyx_v_b); if (unlikely((__pyx_t_18 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":309 + * + * # 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_3 = PyInt_FromLong(__pyx_t_18); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_b); + __pyx_v_b = __pyx_t_3; + __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_j); + __Pyx_XDECREF(__pyx_v_e_id); + __Pyx_XDECREF(__pyx_v_f_id); + __Pyx_XDECREF(__pyx_v_n_f); + __Pyx_XDECREF(__pyx_v_N); + __Pyx_XDECREF((PyObject *)__pyx_v_fcount); + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_line); + __Pyx_XDECREF(__pyx_v_fword); + __Pyx_XDECREF(__pyx_v_eword); + __Pyx_XDECREF(__pyx_v_score1); + __Pyx_XDECREF(__pyx_v_score2); + __Pyx_XDECREF(__pyx_v_index); + __Pyx_XDECREF(__pyx_v_b); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":315 + * + * + * cdef swap(self, int i, int j): # <<<<<<<<<<<<<< + * cdef int itmp + * cdef float ftmp + */ + +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) { + int __pyx_v_itmp; + float __pyx_v_ftmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("swap", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":319 + * cdef float ftmp + * + * if i == j: # <<<<<<<<<<<<<< + * return + * + */ + __pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":320 + * + * if i == j: + * return # <<<<<<<<<<<<<< + * + * itmp = self.e_index.arr[i] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":322 + * return + * + * itmp = self.e_index.arr[i] # <<<<<<<<<<<<<< + * self.e_index.arr[i] = self.e_index.arr[j] + * self.e_index.arr[j] = itmp + */ + __pyx_v_itmp = (__pyx_v_self->e_index->arr[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":323 + * + * itmp = self.e_index.arr[i] + * self.e_index.arr[i] = self.e_index.arr[j] # <<<<<<<<<<<<<< + * self.e_index.arr[j] = itmp + * + */ + (__pyx_v_self->e_index->arr[__pyx_v_i]) = (__pyx_v_self->e_index->arr[__pyx_v_j]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":324 + * itmp = self.e_index.arr[i] + * self.e_index.arr[i] = self.e_index.arr[j] + * self.e_index.arr[j] = itmp # <<<<<<<<<<<<<< + * + * ftmp = self.col1.arr[i] + */ + (__pyx_v_self->e_index->arr[__pyx_v_j]) = __pyx_v_itmp; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":326 + * self.e_index.arr[j] = itmp + * + * ftmp = self.col1.arr[i] # <<<<<<<<<<<<<< + * self.col1.arr[i] = self.col1.arr[j] + * self.col1.arr[j] = ftmp + */ + __pyx_v_ftmp = (__pyx_v_self->col1->arr[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":327 + * + * ftmp = self.col1.arr[i] + * self.col1.arr[i] = self.col1.arr[j] # <<<<<<<<<<<<<< + * self.col1.arr[j] = ftmp + * + */ + (__pyx_v_self->col1->arr[__pyx_v_i]) = (__pyx_v_self->col1->arr[__pyx_v_j]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":328 + * ftmp = self.col1.arr[i] + * self.col1.arr[i] = self.col1.arr[j] + * self.col1.arr[j] = ftmp # <<<<<<<<<<<<<< + * + * ftmp = self.col2.arr[i] + */ + (__pyx_v_self->col1->arr[__pyx_v_j]) = __pyx_v_ftmp; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":330 + * self.col1.arr[j] = ftmp + * + * ftmp = self.col2.arr[i] # <<<<<<<<<<<<<< + * self.col2.arr[i] = self.col2.arr[j] + * self.col2.arr[j] = ftmp + */ + __pyx_v_ftmp = (__pyx_v_self->col2->arr[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":331 + * + * ftmp = self.col2.arr[i] + * self.col2.arr[i] = self.col2.arr[j] # <<<<<<<<<<<<<< + * self.col2.arr[j] = ftmp + * + */ + (__pyx_v_self->col2->arr[__pyx_v_i]) = (__pyx_v_self->col2->arr[__pyx_v_j]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":332 + * ftmp = self.col2.arr[i] + * self.col2.arr[i] = self.col2.arr[j] + * self.col2.arr[j] = ftmp # <<<<<<<<<<<<<< + * + * + */ + (__pyx_v_self->col2->arr[__pyx_v_j]) = __pyx_v_ftmp; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":335 + * + * + * cdef qsort(self, int i, int j, pad): # <<<<<<<<<<<<<< + * cdef int pval, p + * + */ + +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) { + int __pyx_v_pval; + int __pyx_v_p; + long __pyx_v_k; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("qsort", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":338 + * cdef int pval, p + * + * if i > j: # <<<<<<<<<<<<<< + * raise Exception("Sort error in CLex") + * if i == j: #empty interval + */ + __pyx_t_1 = ((__pyx_v_i > __pyx_v_j) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":339 + * + * if i > j: + * raise Exception("Sort error in CLex") # <<<<<<<<<<<<<< + * if i == j: #empty interval + * return + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 339; __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 = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":340 + * if i > j: + * raise Exception("Sort error in CLex") + * if i == j: #empty interval # <<<<<<<<<<<<<< + * return + * if i == j-1: # singleton interval + */ + __pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":341 + * raise Exception("Sort error in CLex") + * if i == j: #empty interval + * return # <<<<<<<<<<<<<< + * if i == j-1: # singleton interval + * return + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":342 + * if i == j: #empty interval + * return + * if i == j-1: # singleton interval # <<<<<<<<<<<<<< + * return + * + */ + __pyx_t_1 = ((__pyx_v_i == (__pyx_v_j - 1)) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":343 + * return + * if i == j-1: # singleton interval + * return # <<<<<<<<<<<<<< + * + * p = (i+j)/2 + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":345 + * return + * + * p = (i+j)/2 # <<<<<<<<<<<<<< + * pval = self.e_index.arr[p] + * self.swap(i, p) + */ + __pyx_v_p = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":346 + * + * p = (i+j)/2 + * pval = self.e_index.arr[p] # <<<<<<<<<<<<<< + * self.swap(i, p) + * p = i + */ + __pyx_v_pval = (__pyx_v_self->e_index->arr[__pyx_v_p]); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":347 + * 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 = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":348 + * pval = self.e_index.arr[p] + * self.swap(i, p) + * p = i # <<<<<<<<<<<<<< + * for k from i+1 <= k < j: + * if pval >= self.e_index.arr[k]: + */ + __pyx_v_p = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":349 + * self.swap(i, p) + * p = i + * for k from i+1 <= k < j: # <<<<<<<<<<<<<< + * if pval >= self.e_index.arr[k]: + * self.swap(p+1, k) + */ + __pyx_t_3 = __pyx_v_j; + for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":350 + * p = i + * for k from i+1 <= k < j: + * if pval >= self.e_index.arr[k]: # <<<<<<<<<<<<<< + * self.swap(p+1, k) + * self.swap(p, p+1) + */ + __pyx_t_1 = ((__pyx_v_pval >= (__pyx_v_self->e_index->arr[__pyx_v_k])) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":351 + * 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 = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":352 + * 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 = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":353 + * self.swap(p+1, k) + * self.swap(p, p+1) + * p = p + 1 # <<<<<<<<<<<<<< + * self.qsort(i,p, pad+" ") + * self.qsort(p+1,j, pad+" ") + */ + __pyx_v_p = (__pyx_v_p + 1); + goto __pyx_L8; + } + __pyx_L8:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":354 + * 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, ((PyObject *)__pyx_kp_s_50)); 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_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 = 354; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":355 + * p = p + 1 + * self.qsort(i,p, pad+" ") + * self.qsort(p+1,j, pad+" ") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = PyNumber_Add(__pyx_v_pad, ((PyObject *)__pyx_kp_s_50)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 355; __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 = 355; __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; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.qsort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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 = 358; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":358 + * + * + * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< + * with open(filename, "w") as f: + * for i in self.f_index: + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_12write_enhanced(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_s1 = NULL; + PyObject *__pyx_v_s2 = NULL; + PyObject *__pyx_v_w = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + 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_12 = NULL; + PyObject *(*__pyx_t_13)(PyObject *); + int __pyx_t_14; + 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_enhanced", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * for i in self.f_index: + * 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 = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __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__w)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":360 + * 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; + } 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 = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + for (;;) { + if (!__pyx_t_9 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_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 = 360; __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 = 360; __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 = 360; __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 = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_9(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":361 + * 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 = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":362 + * 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 = 362; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __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_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":363 + * 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 = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_self->e_index)); + PyTuple_SET_ITEM(__pyx_t_2, 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)); + __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)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->col2)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__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; + } 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 = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + __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 = 363; __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 = 363; __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 = 363; __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 = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __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); + } 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_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_11); + #else + __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __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 = 363; __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 = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_11); + #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 = 363; __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_GOTREF(__pyx_t_11); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 3) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __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_t_13 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[5]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_L21_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_v_s1); + __pyx_v_s1 = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_s2); + __pyx_v_s2 = __pyx_t_11; + __pyx_t_11 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":364 + * 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 = 364; __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 = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + __Pyx_INCREF(__pyx_v_s1); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_s1); + __Pyx_GIVEREF(__pyx_v_s1); + __Pyx_INCREF(__pyx_v_s2); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_s2); + __Pyx_GIVEREF(__pyx_v_s2); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_52), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__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 = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":365 + * 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 = 365; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __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_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":366 + * 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_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; + } 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 = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + 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 = 366; __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 = 366; __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 = 366; __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 = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else { + __pyx_t_11 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_11)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_11); + } + __Pyx_XDECREF(__pyx_v_w); + __pyx_v_w = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_i); + __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 = 366; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":367 + * 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 = 367; __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 = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + __Pyx_INCREF(__pyx_v_w); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_w); + __Pyx_GIVEREF(__pyx_v_w); + __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __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[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":368 + * 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 = 368; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":369 + * 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_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; + } 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 = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + 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 = 369; __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 = 369; __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 = 369; __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 = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + #endif + } else { + __pyx_t_10 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_10)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[5]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_XDECREF(__pyx_v_w); + __pyx_v_w = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_i); + __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 = 369; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":370 + * 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 = 370; __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 = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + __Pyx_INCREF(__pyx_v_w); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_w); + __Pyx_GIVEREF(__pyx_v_w); + __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __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[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__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; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":371 + * 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 = 371; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_56), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 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; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __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_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * for i in self.f_index: + * f.write("%d " % i) + */ + /*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 = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_15 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_15); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_16 = ((!(__pyx_t_14 != 0)) != 0); + if (__pyx_t_16) { + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__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 = 359; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L28; + } + __pyx_L28:; + __Pyx_DECREF(((PyObject *)__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; + 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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_3) { + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_57, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __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[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L29; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L1_error; + __pyx_L29:; + } + + __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_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_s1); + __Pyx_XDECREF(__pyx_v_s2); + __Pyx_XDECREF(__pyx_v_w); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fword = 0; + PyObject *__pyx_v_eword = 0; + PyObject *__pyx_v_col = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_score (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fword,&__pyx_n_s__eword,&__pyx_n_s__col,0}; + PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__fword)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 374; __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 = 374; __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 = 374; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_fword = values[0]; + __pyx_v_eword = values[1]; + __pyx_v_col = values[2]; + } + 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 = 374; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), __pyx_v_fword, __pyx_v_eword, __pyx_v_col); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":374 + * + * + * def get_score(self, fword, eword, col): # <<<<<<<<<<<<<< + * cdef e_id, f_id, low, high, midpoint, val + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_14get_score(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, PyObject *__pyx_v_fword, PyObject *__pyx_v_eword, PyObject *__pyx_v_col) { + PyObject *__pyx_v_e_id = 0; + PyObject *__pyx_v_f_id = 0; + PyObject *__pyx_v_low = 0; + PyObject *__pyx_v_high = 0; + PyObject *__pyx_v_midpoint = 0; + PyObject *__pyx_v_val = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + 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("get_score", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":377 + * 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 = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":378 + * + * if eword not in self.eword2id: + * return None # <<<<<<<<<<<<<< + * if fword not in self.fword2id: + * return None + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":379 + * 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 = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":380 + * return None + * if fword not in self.fword2id: + * return None # <<<<<<<<<<<<<< + * f_id = self.fword2id[fword] + * e_id = self.eword2id[eword] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":381 + * 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 (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_f_id = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":382 + * 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 (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_e_id = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":383 + * 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 = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_low = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":384 + * 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 = 384; __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 = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_high = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":385 + * low = self.f_index.arr[f_id] + * high = self.f_index.arr[f_id+1] + * while high - low > 0: # <<<<<<<<<<<<<< + * midpoint = (low+high)/2 + * 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 = 385; __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 = 385; __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 = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!__pyx_t_1) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":386 + * 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 = 386; __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 = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_v_midpoint); + __pyx_v_midpoint = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":387 + * 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 = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->e_index->arr[__pyx_t_4])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_val); + __pyx_v_val = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":388 + * 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 = 388; __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 = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":389 + * 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 = 389; __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":390 + * if val == e_id: + * if col == 0: + * return self.col1.arr[midpoint] # <<<<<<<<<<<<<< + * if col == 1: + * 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 = 390; __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 = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":391 + * 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 = 391; __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 = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":392 + * return self.col1.arr[midpoint] + * if col == 1: + * return self.col2.arr[midpoint] # <<<<<<<<<<<<<< + * if val > e_id: + * 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 = 392; __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 = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":393 + * 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 = 393; __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 = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":394 + * return self.col2.arr[midpoint] + * if val > e_id: + * high = midpoint # <<<<<<<<<<<<<< + * if val < e_id: + * low = midpoint + 1 + */ + __Pyx_INCREF(__pyx_v_midpoint); + __Pyx_DECREF(__pyx_v_high); + __pyx_v_high = __pyx_v_midpoint; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":395 + * 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 = 395; __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 = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":396 + * 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 = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_low); + __pyx_v_low = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L11; + } + __pyx_L11:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":397 + * if val < e_id: + * low = midpoint + 1 + * return None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.get_score", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_e_id); + __Pyx_XDECREF(__pyx_v_f_id); + __Pyx_XDECREF(__pyx_v_low); + __Pyx_XDECREF(__pyx_v_high); + __Pyx_XDECREF(__pyx_v_midpoint); + __Pyx_XDECREF(__pyx_v_val); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_5BiLex_16write_text[] = "Note: does not guarantee writing the dictionary in the original order"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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 = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":400 + * + * + * def write_text(self, char* filename): # <<<<<<<<<<<<<< + * """Note: does not guarantee writing the dictionary in the original order""" + * cdef i, N, e_id, f_id + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_5BiLex_16write_text(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *__pyx_v_self, char *__pyx_v_filename) { + PyObject *__pyx_v_i = 0; + PyObject *__pyx_v_N = 0; + PyObject *__pyx_v_e_id = 0; + PyObject *__pyx_v_f_id = 0; + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_v_score1 = NULL; + PyObject *__pyx_v_score2 = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + long __pyx_t_9; + long __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_text", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404 + * cdef i, N, e_id, f_id + * + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * N = len(self.e_index) + * 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 = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __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__w)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":405 + * + * with open(filename, "w") as f: + * N = len(self.e_index) # <<<<<<<<<<<<<< + * f_id = 0 + * for i from 0 <= i < N: + */ + __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 = 405; __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 = 405; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_N = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":406 + * with open(filename, "w") as f: + * N = len(self.e_index) + * f_id = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < N: + * while self.f_index.arr[f_id+1] == i: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_f_id = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":407 + * 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_AsLong(__pyx_v_N); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10++) { + __pyx_t_4 = PyInt_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":408 + * f_id = 0 + * 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] + */ + 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 = 408; __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 = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromLong((__pyx_v_self->f_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 408; __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 = 408; __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 = 408; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_11) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":409 + * 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 = 409; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_f_id); + __pyx_v_f_id = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":410 + * 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 = 410; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_self->e_index->arr[__pyx_t_8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_e_id); + __pyx_v_e_id = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":411 + * 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 = 411; __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 = 411; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_score1); + __pyx_v_score1 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":412 + * 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 = 412; __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 = 412; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_score2); + __pyx_v_score2 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":413 + * 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 = 413; __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 (!__pyx_t_4) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __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 (!__pyx_t_2) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __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 = 413; __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_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_score1); + PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_v_score1); + __Pyx_GIVEREF(__pyx_v_score1); + __Pyx_INCREF(__pyx_v_score2); + PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_v_score2); + __Pyx_GIVEREF(__pyx_v_score2); + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_58), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__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 = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":407 + * 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 = PyInt_FromLong(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_2 = 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; + 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_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404 + * cdef i, N, e_id, f_id + * + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * N = len(self.e_index) + * f_id = 0 + */ + /*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 = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_13 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __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 = 404; __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_GIVEREF(__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 = 404; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L22; + } + __pyx_L22:; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __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; + 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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_3) { + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_59, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L23; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L1_error; + __pyx_L23:; + } + + __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_12); + __Pyx_AddTraceback("cdec.sa._sa.BiLex.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_N); + __Pyx_XDECREF(__pyx_v_e_id); + __Pyx_XDECREF(__pyx_v_f_id); + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_score1); + __Pyx_XDECREF(__pyx_v_score2); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":21 + * cdef int LOWER_MASK[32] + * + * cdef void _init_lower_mask(): # <<<<<<<<<<<<<< + * cdef unsigned i + * cdef int mask = 0 + */ + +static void __pyx_f_4cdec_2sa_3_sa__init_lower_mask(void) { + unsigned int __pyx_v_i; + int __pyx_v_mask; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + unsigned int __pyx_t_2; + __Pyx_RefNannySetupContext("_init_lower_mask", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":23 + * cdef void _init_lower_mask(): + * cdef unsigned i + * cdef int mask = 0 # <<<<<<<<<<<<<< + * for i in range(MIN_BOTTOM_SIZE): + * mask = (mask << 1) + 1 + */ + __pyx_v_mask = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":24 + * cdef unsigned i + * cdef int mask = 0 + * for i in range(MIN_BOTTOM_SIZE): # <<<<<<<<<<<<<< + * mask = (mask << 1) + 1 + * LOWER_MASK[i] = mask + */ + __pyx_t_1 = __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":25 + * cdef int mask = 0 + * for i in range(MIN_BOTTOM_SIZE): + * mask = (mask << 1) + 1 # <<<<<<<<<<<<<< + * LOWER_MASK[i] = mask + * + */ + __pyx_v_mask = ((__pyx_v_mask << 1) + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":26 + * for i in range(MIN_BOTTOM_SIZE): + * mask = (mask << 1) + 1 + * LOWER_MASK[i] = mask # <<<<<<<<<<<<<< + * + * _init_lower_mask() + */ + (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[__pyx_v_i]) = __pyx_v_mask; + } + + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":37 + * + * + * cdef _BitSet* new_BitSet(): # <<<<<<<<<<<<<< + * cdef _BitSet* b + * + */ + +static struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_f_4cdec_2sa_3_sa_new_BitSet(void) { + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b; + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("new_BitSet", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":40 + * cdef _BitSet* b + * + * b = <_BitSet*> malloc(sizeof(_BitSet)) # <<<<<<<<<<<<<< + * b.bitset = 0 + * b.min_val = -1 + */ + __pyx_v_b = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__BitSet)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":41 + * + * b = <_BitSet*> malloc(sizeof(_BitSet)) + * b.bitset = 0 # <<<<<<<<<<<<<< + * b.min_val = -1 + * b.max_val = -1 + */ + __pyx_v_b->bitset = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":42 + * b = <_BitSet*> malloc(sizeof(_BitSet)) + * b.bitset = 0 + * b.min_val = -1 # <<<<<<<<<<<<<< + * b.max_val = -1 + * b.size = 0 + */ + __pyx_v_b->min_val = -1; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":43 + * b.bitset = 0 + * b.min_val = -1 + * b.max_val = -1 # <<<<<<<<<<<<<< + * b.size = 0 + * return b + */ + __pyx_v_b->max_val = -1; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":44 + * b.min_val = -1 + * b.max_val = -1 + * b.size = 0 # <<<<<<<<<<<<<< + * return b + * + */ + __pyx_v_b->size = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":45 + * b.max_val = -1 + * b.size = 0 + * return b # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_b; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":48 + * + * + * cdef int bitset_findsucc(_BitSet* b, int i): # <<<<<<<<<<<<<< + * cdef int bitset, mask + * cdef int low, high, mid + */ + +static int __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { + int __pyx_v_bitset; + int __pyx_v_mask; + int __pyx_v_low; + int __pyx_v_high; + int __pyx_v_mid; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("bitset_findsucc", 0); + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":53 + * + * if b.max_val == -1 or i >= b.max_val: + * return -1 # <<<<<<<<<<<<<< + * if i < b.min_val: + * return b.min_val + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":55 + * return -1 + * if i < b.min_val: + * return b.min_val # <<<<<<<<<<<<<< + * + * bitset = b.bitset & ~LOWER_MASK[i] + */ + __pyx_r = __pyx_v_b->min_val; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":57 + * return b.min_val + * + * bitset = b.bitset & ~LOWER_MASK[i] # <<<<<<<<<<<<<< + * low = i+1 + * high = b.max_val+1 + */ + __pyx_v_bitset = (__pyx_v_b->bitset & (~(__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[__pyx_v_i]))); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":58 + * + * bitset = b.bitset & ~LOWER_MASK[i] + * low = i+1 # <<<<<<<<<<<<<< + * high = b.max_val+1 + * while low < high-1: + */ + __pyx_v_low = (__pyx_v_i + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":59 + * bitset = b.bitset & ~LOWER_MASK[i] + * low = i+1 + * high = b.max_val+1 # <<<<<<<<<<<<<< + * while low < high-1: + * mid = (high + low)/2 + */ + __pyx_v_high = (__pyx_v_b->max_val + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":60 + * low = i+1 + * high = b.max_val+1 + * while low < high-1: # <<<<<<<<<<<<<< + * mid = (high + low)/2 + * 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":61 + * high = b.max_val+1 + * while low < high-1: + * mid = (high + low)/2 # <<<<<<<<<<<<<< + * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) + * if bitset & mask == 0: + */ + __pyx_v_mid = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":62 + * while low < high-1: + * mid = (high + low)/2 + * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) # <<<<<<<<<<<<<< + * if bitset & mask == 0: + * low = mid + */ + __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)]))); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":64 + * mask = ~(LOWER_MASK[high-1] ^ LOWER_MASK[mid-1]) + * if bitset & mask == 0: + * low = mid # <<<<<<<<<<<<<< + * else: + * bitset = bitset & mask + */ + __pyx_v_low = __pyx_v_mid; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":66 + * low = mid + * else: + * bitset = bitset & mask # <<<<<<<<<<<<<< + * high = mid + * return low + */ + __pyx_v_bitset = (__pyx_v_bitset & __pyx_v_mask); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":67 + * else: + * bitset = bitset & mask + * high = mid # <<<<<<<<<<<<<< + * return low + * + */ + __pyx_v_high = __pyx_v_mid; + } + __pyx_L7:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":68 + * bitset = bitset & mask + * high = mid + * return low # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_low; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":71 + * + * + * cdef int bitset_insert(_BitSet* b, int i): # <<<<<<<<<<<<<< + * cdef int val + * + */ + +static int __pyx_f_4cdec_2sa_3_sa_bitset_insert(struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { + int __pyx_v_val; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("bitset_insert", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":74 + * cdef int val + * + * val = 1 << i # <<<<<<<<<<<<<< + * if b.bitset & val == 0: + * b.bitset = b.bitset | val + */ + __pyx_v_val = (1 << __pyx_v_i); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":75 + * + * val = 1 << i + * if b.bitset & val == 0: # <<<<<<<<<<<<<< + * b.bitset = b.bitset | val + * if b.size == 0: + */ + __pyx_t_1 = (((__pyx_v_b->bitset & __pyx_v_val) == 0) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":76 + * val = 1 << i + * if b.bitset & val == 0: + * b.bitset = b.bitset | val # <<<<<<<<<<<<<< + * if b.size == 0: + * b.min_val = i + */ + __pyx_v_b->bitset = (__pyx_v_b->bitset | __pyx_v_val); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":77 + * if b.bitset & val == 0: + * b.bitset = b.bitset | val + * if b.size == 0: # <<<<<<<<<<<<<< + * b.min_val = i + * b.max_val = i + */ + __pyx_t_1 = ((__pyx_v_b->size == 0) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":78 + * b.bitset = b.bitset | val + * if b.size == 0: + * b.min_val = i # <<<<<<<<<<<<<< + * b.max_val = i + * else: + */ + __pyx_v_b->min_val = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":79 + * if b.size == 0: + * b.min_val = i + * b.max_val = i # <<<<<<<<<<<<<< + * else: + * if i < b.min_val: + */ + __pyx_v_b->max_val = __pyx_v_i; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":81 + * b.max_val = i + * else: + * if i < b.min_val: # <<<<<<<<<<<<<< + * b.min_val = i + * if i > b.max_val: + */ + __pyx_t_1 = ((__pyx_v_i < __pyx_v_b->min_val) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":82 + * else: + * if i < b.min_val: + * b.min_val = i # <<<<<<<<<<<<<< + * if i > b.max_val: + * b.max_val = i + */ + __pyx_v_b->min_val = __pyx_v_i; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":83 + * if i < b.min_val: + * b.min_val = i + * if i > b.max_val: # <<<<<<<<<<<<<< + * b.max_val = i + * b.size = b.size + 1 + */ + __pyx_t_1 = ((__pyx_v_i > __pyx_v_b->max_val) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":84 + * b.min_val = i + * if i > b.max_val: + * b.max_val = i # <<<<<<<<<<<<<< + * b.size = b.size + 1 + * return 1 + */ + __pyx_v_b->max_val = __pyx_v_i; + goto __pyx_L6; + } + __pyx_L6:; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":85 + * if i > b.max_val: + * b.max_val = i + * b.size = b.size + 1 # <<<<<<<<<<<<<< + * return 1 + * return 0 + */ + __pyx_v_b->size = (__pyx_v_b->size + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":86 + * b.max_val = i + * b.size = b.size + 1 + * return 1 # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":87 + * b.size = b.size + 1 + * return 1 + * return 0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":90 + * + * + * cdef int bitset_contains(_BitSet* b, int i): # <<<<<<<<<<<<<< + * cdef int val + * + */ + +static int __pyx_f_4cdec_2sa_3_sa_bitset_contains(struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_b, int __pyx_v_i) { + int __pyx_v_val; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("bitset_contains", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":93 + * cdef int val + * + * val = 1 << i # <<<<<<<<<<<<<< + * if b.bitset & val == 0: + * return 0 + */ + __pyx_v_val = (1 << __pyx_v_i); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":94 + * + * val = 1 << i + * if b.bitset & val == 0: # <<<<<<<<<<<<<< + * return 0 + * else: + */ + __pyx_t_1 = (((__pyx_v_b->bitset & __pyx_v_val) == 0) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":95 + * val = 1 << i + * if b.bitset & val == 0: + * return 0 # <<<<<<<<<<<<<< + * else: + * return 1 + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":97 + * return 0 + * else: + * return 1 # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 1; + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":104 + * cdef int next_val + * + * def __next__(self): # <<<<<<<<<<<<<< + * cdef int ret_val + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14BitSetIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *__pyx_v_self) { + int __pyx_v_ret_val; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__next__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":107 + * cdef int ret_val + * + * if self.next_val == -1: # <<<<<<<<<<<<<< + * raise StopIteration() + * ret_val = self.next_val + */ + __pyx_t_1 = ((__pyx_v_self->next_val == -1) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_builtin_StopIteration, ((PyObject *)__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_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;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":109 + * if self.next_val == -1: + * raise StopIteration() + * ret_val = self.next_val # <<<<<<<<<<<<<< + * self.next_val = bitset_findsucc(self.b, ret_val) + * return ret_val + */ + __pyx_t_3 = __pyx_v_self->next_val; + __pyx_v_ret_val = __pyx_t_3; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":110 + * raise StopIteration() + * ret_val = self.next_val + * self.next_val = bitset_findsucc(self.b, ret_val) # <<<<<<<<<<<<<< + * return ret_val + * + */ + __pyx_v_self->next_val = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_v_ret_val); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":111 + * ret_val = self.next_val + * self.next_val = bitset_findsucc(self.b, ret_val) + * return ret_val # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_ret_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 111; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.BitSetIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __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_2sa_3_sa_6BitSet___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":122 + * cdef _BitSet* b + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.b = new_BitSet() + * + */ + +static int __pyx_pf_4cdec_2sa_3_sa_6BitSet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":123 + * + * def __cinit__(self): + * self.b = new_BitSet() # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->b = __pyx_f_4cdec_2sa_3_sa_new_BitSet(); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_4cdec_2sa_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_6BitSet_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":125 + * self.b = new_BitSet() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * free(self.b) + * + */ + +static void __pyx_pf_4cdec_2sa_3_sa_6BitSet_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":126 + * + * def __dealloc__(self): + * free(self.b) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + free(__pyx_v_self->b); + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":128 + * free(self.b) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef BitSetIterator it + * it = BitSetIterator() + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { + struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *__pyx_v_it = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":130 + * def __iter__(self): + * cdef BitSetIterator it + * it = BitSetIterator() # <<<<<<<<<<<<<< + * it.b = self.b + * it.next_val = self.b.min_val + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_BitSetIterator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_it = ((struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":131 + * cdef BitSetIterator it + * it = BitSetIterator() + * it.b = self.b # <<<<<<<<<<<<<< + * it.next_val = self.b.min_val + * return it + */ + __pyx_t_2 = __pyx_v_self->b; + __pyx_v_it->b = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":132 + * it = BitSetIterator() + * it.b = self.b + * it.next_val = self.b.min_val # <<<<<<<<<<<<<< + * return it + * + */ + __pyx_t_3 = __pyx_v_self->b->min_val; + __pyx_v_it->next_val = __pyx_t_3; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":133 + * it.b = self.b + * it.next_val = self.b.min_val + * return it # <<<<<<<<<<<<<< + * + * def insert(self, i): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_it)); + __pyx_r = ((PyObject *)__pyx_v_it); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_it); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("insert (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":135 + * return it + * + * def insert(self, i): # <<<<<<<<<<<<<< + * return bitset_insert(self.b, i) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_6insert(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("insert", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":136 + * + * def insert(self, i): + * return bitset_insert(self.b, i) # <<<<<<<<<<<<<< + * + * def findsucc(self, i): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_bitset_insert(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 136; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("findsucc (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":138 + * return bitset_insert(self.b, i) + * + * def findsucc(self, i): # <<<<<<<<<<<<<< + * return bitset_findsucc(self.b, i) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_8findsucc(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("findsucc", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":139 + * + * def findsucc(self, i): + * return bitset_findsucc(self.b, i) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 139; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_11__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":141 + * return bitset_findsucc(self.b, i) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return dec2bin(self.b.bitset)+" ("+str(self.b.size)+","+str(self.b.min_val)+","+str(self.b.max_val)+")" + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_10__str__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "/home/mdenkows/cdec/python/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)+")" # <<<<<<<<<<<<<< + * + * def min(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_4cdec_2sa_3_sa_dec2bin(__pyx_v_self->b->bitset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_60)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->b->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_2), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_3, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->b->min_val); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->b->max_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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[6]; __pyx_lineno = 142; __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*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __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_t_2 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_13min(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("min (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< + * return self.b.min_val + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_12min(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__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("min", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":145 + * + * def min(self): + * return self.b.min_val # <<<<<<<<<<<<<< + * + * def max(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->b->min_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.min", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6BitSet_15max(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("max (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":147 + * return self.b.min_val + * + * def max(self): # <<<<<<<<<<<<<< + * return self.b.max_val + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6BitSet_14max(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__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("max", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":148 + * + * def max(self): + * return self.b.max_val # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->b->max_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.max", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":150 + * return self.b.max_val + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.b.size + * + */ + +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6BitSet_16__len__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":151 + * + * def __len__(self): + * return self.b.size # <<<<<<<<<<<<<< + * + * def __contains__(self, i): + */ + __pyx_r = __pyx_v_self->b->size; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_6BitSet_19__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(((struct __pyx_obj_4cdec_2sa_3_sa_BitSet *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":153 + * return self.b.size + * + * def __contains__(self, i): # <<<<<<<<<<<<<< + * return bool(bitset_contains(self.b, i)) + * + */ + +static int __pyx_pf_4cdec_2sa_3_sa_6BitSet_18__contains__(struct __pyx_obj_4cdec_2sa_3_sa_BitSet *__pyx_v_self, PyObject *__pyx_v_i) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__contains__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":154 + * + * def __contains__(self, i): + * return bool(bitset_contains(self.b, i)) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_bitset_contains(__pyx_v_self->b, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = (!(!__pyx_t_3)); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.BitSet.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":157 + * + * + * cdef str dec2bin(long i): # <<<<<<<<<<<<<< + * cdef str result = "" + * cdef unsigned d + */ + +static PyObject *__pyx_f_4cdec_2sa_3_sa_dec2bin(long __pyx_v_i) { + PyObject *__pyx_v_result = 0; + CYTHON_UNUSED unsigned int __pyx_v_d; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + unsigned 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("dec2bin", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":158 + * + * cdef str dec2bin(long i): + * cdef str result = "" # <<<<<<<<<<<<<< + * cdef unsigned d + * for d in range(MIN_BOTTOM_SIZE): + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_47)); + __pyx_v_result = __pyx_kp_s_47; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":160 + * cdef str result = "" + * cdef unsigned d + * for d in range(MIN_BOTTOM_SIZE): # <<<<<<<<<<<<<< + * if i & LOWER_MASK[0] == 0: + * result = "0"+result + */ + __pyx_t_1 = __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_d = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":161 + * cdef unsigned d + * for d in range(MIN_BOTTOM_SIZE): + * if i & LOWER_MASK[0] == 0: # <<<<<<<<<<<<<< + * result = "0"+result + * else: + */ + __pyx_t_3 = (((__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[0])) == 0) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":162 + * for d in range(MIN_BOTTOM_SIZE): + * if i & LOWER_MASK[0] == 0: + * result = "0"+result # <<<<<<<<<<<<<< + * else: + * result = "1"+result + */ + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s__0), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":164 + * result = "0"+result + * else: + * result = "1"+result # <<<<<<<<<<<<<< + * i = i >> 1 + * return result + */ + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s__1), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":165 + * else: + * result = "1"+result + * i = i >> 1 # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_v_i = (__pyx_v_i >> 1); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":166 + * result = "1"+result + * i = i >> 1 + * return result # <<<<<<<<<<<<<< + * + * cdef struct _VEB: + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.dec2bin", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":177 + * void** bottom + * + * cdef _VEB* new_VEB(int n): # <<<<<<<<<<<<<< + * cdef _VEB* veb + * cdef int num_bits, num_top_bits, i + */ + +static struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_f_4cdec_2sa_3_sa_new_VEB(int __pyx_v_n) { + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb; + int __pyx_v_num_bits; + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_r; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + double __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("new_VEB", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":181 + * cdef int num_bits, num_top_bits, i + * + * veb = <_VEB*> malloc(sizeof(_VEB)) # <<<<<<<<<<<<<< + * + * num_bits = int(ceil(log(n) / log(2))) + */ + __pyx_v_veb = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__VEB)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":183 + * veb = <_VEB*> malloc(sizeof(_VEB)) + * + * num_bits = int(ceil(log(n) / log(2))) # <<<<<<<<<<<<<< + * veb.num_bottom_bits = num_bits/2 + * if veb.num_bottom_bits < MIN_BOTTOM_BITS: + */ + __pyx_t_1 = log(__pyx_v_n); + __pyx_t_2 = log(2.0); + if (unlikely(__pyx_t_2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[6]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_num_bits = ((int)ceil((__pyx_t_1 / __pyx_t_2))); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":184 + * + * num_bits = int(ceil(log(n) / log(2))) + * veb.num_bottom_bits = num_bits/2 # <<<<<<<<<<<<<< + * if veb.num_bottom_bits < MIN_BOTTOM_BITS: + * veb.num_bottom_bits = MIN_BOTTOM_BITS + */ + __pyx_v_veb->num_bottom_bits = __Pyx_div_long(__pyx_v_num_bits, 2); + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * veb.num_bottom_bits = MIN_BOTTOM_BITS + * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 + */ + __pyx_t_3 = ((__pyx_v_veb->num_bottom_bits < __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 + * + */ + __pyx_v_veb->num_bottom_bits = __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * + * veb.bottom = malloc(veb.top_universe_size * sizeof(void*)) + */ + __pyx_v_veb->top_universe_size = ((__pyx_v_n >> __pyx_v_veb->num_bottom_bits) + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":189 + * veb.top_universe_size = (n >> veb.num_bottom_bits) + 1 + * + * veb.bottom = malloc(veb.top_universe_size * sizeof(void*)) # <<<<<<<<<<<<<< + * memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) + * + */ + __pyx_v_veb->bottom = ((void **)malloc((__pyx_v_veb->top_universe_size * (sizeof(void *))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":190 + * + * veb.bottom = malloc(veb.top_universe_size * sizeof(void*)) + * memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) # <<<<<<<<<<<<<< + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + */ + memset(__pyx_v_veb->bottom, 0, (__pyx_v_veb->top_universe_size * (sizeof(void *)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":192 + * memset(veb.bottom, 0, veb.top_universe_size * sizeof(void*)) + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< + * veb.top = new_VEB(veb.top_universe_size) + * else: + */ + __pyx_t_3 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":193 + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + * veb.top = new_VEB(veb.top_universe_size) # <<<<<<<<<<<<<< + * else: + * veb.top = new_BitSet() + */ + __pyx_v_veb->top = __pyx_f_4cdec_2sa_3_sa_new_VEB(__pyx_v_veb->top_universe_size); + goto __pyx_L4; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":195 + * veb.top = new_VEB(veb.top_universe_size) + * else: + * veb.top = new_BitSet() # <<<<<<<<<<<<<< + * + * veb.max_val = -1 + */ + __pyx_v_veb->top = __pyx_f_4cdec_2sa_3_sa_new_BitSet(); + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":197 + * veb.top = new_BitSet() + * + * veb.max_val = -1 # <<<<<<<<<<<<<< + * veb.min_val = -1 + * veb.size = 0 + */ + __pyx_v_veb->max_val = -1; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":198 + * + * veb.max_val = -1 + * veb.min_val = -1 # <<<<<<<<<<<<<< + * veb.size = 0 + * return veb + */ + __pyx_v_veb->min_val = -1; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":199 + * veb.max_val = -1 + * veb.min_val = -1 + * veb.size = 0 # <<<<<<<<<<<<<< + * return veb + * + */ + __pyx_v_veb->size = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":200 + * veb.min_val = -1 + * veb.size = 0 + * return veb # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_veb; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("cdec.sa._sa.new_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":203 + * + * + * cdef int VEB_insert(_VEB* veb, int i): # <<<<<<<<<<<<<< + * cdef _VEB* subv + * cdef _BitSet* subb + */ + +static int __pyx_f_4cdec_2sa_3_sa_VEB_insert(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_subv; + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_subb; + int __pyx_v_a; + int __pyx_v_b; + int __pyx_v_tmp; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("VEB_insert", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":208 + * cdef int a, b, tmp + * + * if veb.size == 0: # <<<<<<<<<<<<<< + * veb.min_val = i + * veb.max_val = i + */ + __pyx_t_1 = ((__pyx_v_veb->size == 0) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":209 + * + * if veb.size == 0: + * veb.min_val = i # <<<<<<<<<<<<<< + * veb.max_val = i + * elif i == veb.min_val or i == veb.max_val: + */ + __pyx_v_veb->min_val = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":210 + * if veb.size == 0: + * veb.min_val = i + * veb.max_val = i # <<<<<<<<<<<<<< + * elif i == veb.min_val or i == veb.max_val: + * return 0 + */ + __pyx_v_veb->max_val = __pyx_v_i; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":212 + * veb.max_val = i + * elif i == veb.min_val or i == veb.max_val: + * return 0 # <<<<<<<<<<<<<< + * else: + * if i < veb.min_val: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":215 + * else: + * if i < veb.min_val: + * tmp = i # <<<<<<<<<<<<<< + * i = veb.min_val + * veb.min_val = tmp + */ + __pyx_v_tmp = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/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; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":217 + * tmp = i + * i = veb.min_val + * veb.min_val = tmp # <<<<<<<<<<<<<< + * a = i >> veb.num_bottom_bits + * b = i & LOWER_MASK[veb.num_bottom_bits-1] + */ + __pyx_v_veb->min_val = __pyx_v_tmp; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":218 + * i = veb.min_val + * veb.min_val = tmp + * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< + * b = i & LOWER_MASK[veb.num_bottom_bits-1] + * if veb.bottom[a] == NULL: + */ + __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":219 + * veb.min_val = tmp + * 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: + */ + __pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":222 + * if veb.bottom[a] == NULL: + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + * subv = <_VEB*> veb.top # <<<<<<<<<<<<<< + * VEB_insert(subv, a) + * else: + */ + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":223 + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + * subv = <_VEB*> veb.top + * VEB_insert(subv, a) # <<<<<<<<<<<<<< + * else: + * subb = <_BitSet*> veb.top + */ + __pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_subv, __pyx_v_a); + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":225 + * VEB_insert(subv, a) + * else: + * subb = <_BitSet*> veb.top # <<<<<<<<<<<<<< + * bitset_insert(subb, a) + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + */ + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":226 + * else: + * 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) + */ + __pyx_f_4cdec_2sa_3_sa_bitset_insert(__pyx_v_subb, __pyx_v_a); + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * else: + * 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; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":230 + * veb.bottom[a] = new_VEB(1 << veb.num_bottom_bits) + * else: + * veb.bottom[a] = new_BitSet() # <<<<<<<<<<<<<< + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + * subv = <_VEB*> veb.bottom[a] + */ + (__pyx_v_veb->bottom[__pyx_v_a]) = __pyx_f_4cdec_2sa_3_sa_new_BitSet(); + } + __pyx_L7:; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":232 + * veb.bottom[a] = new_BitSet() + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + * subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<< + * if VEB_insert(subv, b) == 0: + * return 0 + */ + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":234 + * subv = <_VEB*> veb.bottom[a] + * if VEB_insert(subv, b) == 0: + * return 0 # <<<<<<<<<<<<<< + * else: + * subb = <_BitSet*> veb.bottom[a] + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":236 + * return 0 + * else: + * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< + * if bitset_insert(subb, b) == 0: + * return 0 + */ + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":238 + * subb = <_BitSet*> veb.bottom[a] + * if bitset_insert(subb, b) == 0: + * return 0 # <<<<<<<<<<<<<< + * + * if i > veb.max_val: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L10; + } + __pyx_L10:; + } + __pyx_L8:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":241 + * + * if i > veb.max_val: + * veb.max_val = i # <<<<<<<<<<<<<< + * veb.size = veb.size + 1 + * return 1 + */ + __pyx_v_veb->max_val = __pyx_v_i; + goto __pyx_L11; + } + __pyx_L11:; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":242 + * if i > veb.max_val: + * veb.max_val = i + * veb.size = veb.size + 1 # <<<<<<<<<<<<<< + * return 1 + * + */ + __pyx_v_veb->size = (__pyx_v_veb->size + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":243 + * veb.max_val = i + * veb.size = veb.size + 1 + * return 1 # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":246 + * + * + * cdef del_VEB(_VEB* veb): # <<<<<<<<<<<<<< + * cdef int i + * + */ + +static PyObject *__pyx_f_4cdec_2sa_3_sa_del_VEB(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb) { + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("del_VEB", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":249 + * cdef int i + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< + * i = (<_VEB*> veb.top).min_val + * else: + */ + __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":250 + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + * i = (<_VEB*> veb.top).min_val # <<<<<<<<<<<<<< + * else: + * i = (<_BitSet*> veb.top).min_val + */ + __pyx_t_2 = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top)->min_val; + __pyx_v_i = __pyx_t_2; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":252 + * i = (<_VEB*> veb.top).min_val + * else: + * i = (<_BitSet*> veb.top).min_val # <<<<<<<<<<<<<< + * + * while i != -1: + */ + __pyx_t_2 = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top)->min_val; + __pyx_v_i = __pyx_t_2; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":254 + * i = (<_BitSet*> veb.top).min_val + * + * while i != -1: # <<<<<<<<<<<<<< + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + * del_VEB(<_VEB*> veb.bottom[i]) + */ + while (1) { + __pyx_t_1 = ((__pyx_v_i != -1) != 0); + if (!__pyx_t_1) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":255 + * + * while i != -1: + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: # <<<<<<<<<<<<<< + * del_VEB(<_VEB*> veb.bottom[i]) + * else: + */ + __pyx_t_1 = ((__pyx_v_veb->num_bottom_bits > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":256 + * while i != -1: + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + * del_VEB(<_VEB*> veb.bottom[i]) # <<<<<<<<<<<<<< + * else: + * free(<_BitSet*> veb.bottom[i]) + */ + __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_del_VEB(((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_i]))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":258 + * del_VEB(<_VEB*> veb.bottom[i]) + * else: + * free(<_BitSet*> veb.bottom[i]) # <<<<<<<<<<<<<< + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + */ + free(((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_i]))); + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":260 + * free(<_BitSet*> veb.bottom[i]) + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< + * i = VEB_findsucc(<_VEB*> veb.top, i) + * else: + */ + __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":261 + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + * i = VEB_findsucc(<_VEB*> veb.top, i) # <<<<<<<<<<<<<< + * else: + * i = bitset_findsucc(<_BitSet*> veb.top, i) + */ + __pyx_v_i = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top), __pyx_v_i); + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":263 + * i = VEB_findsucc(<_VEB*> veb.top, i) + * else: + * i = bitset_findsucc(<_BitSet*> veb.top, i) # <<<<<<<<<<<<<< + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + */ + __pyx_v_i = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top), __pyx_v_i); + } + __pyx_L7:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":265 + * i = bitset_findsucc(<_BitSet*> veb.top, i) + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: # <<<<<<<<<<<<<< + * del_VEB(<_VEB*> veb.top) + * else: + */ + __pyx_t_1 = ((__pyx_v_veb->top_universe_size > __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":266 + * + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + * del_VEB(<_VEB*> veb.top) # <<<<<<<<<<<<<< + * else: + * free(<_BitSet*> veb.top) + */ + __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_del_VEB(((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":268 + * del_VEB(<_VEB*> veb.top) + * else: + * free(<_BitSet*> veb.top) # <<<<<<<<<<<<<< + * free(veb.bottom) + * free(veb) + */ + free(((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top)); + } + __pyx_L8:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":269 + * else: + * free(<_BitSet*> veb.top) + * free(veb.bottom) # <<<<<<<<<<<<<< + * free(veb) + * + */ + free(__pyx_v_veb->bottom); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":270 + * free(<_BitSet*> veb.top) + * free(veb.bottom) + * free(veb) # <<<<<<<<<<<<<< + * + * + */ + free(__pyx_v_veb); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.del_VEB", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":273 + * + * + * cdef int VEB_findsucc(_VEB* veb, int i): # <<<<<<<<<<<<<< + * cdef _VEB* subv + * cdef _BitSet* subb + */ + +static int __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_subv; + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_subb; + int __pyx_v_a; + int __pyx_v_b; + int __pyx_v_j; + int __pyx_v_c; + int __pyx_v_found; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("VEB_findsucc", 0); + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":279 + * + * if veb.max_val == -1 or i>=veb.max_val: + * return -1 # <<<<<<<<<<<<<< + * if i < veb.min_val: + * return veb.min_val + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":281 + * return -1 + * if i < veb.min_val: + * return veb.min_val # <<<<<<<<<<<<<< + * + * a = i >> veb.num_bottom_bits + */ + __pyx_r = __pyx_v_veb->min_val; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":283 + * return veb.min_val + * + * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< + * b = i & LOWER_MASK[veb.num_bottom_bits-1] + * found = 0 + */ + __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":284 + * + * a = i >> veb.num_bottom_bits + * b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<< + * found = 0 + * if veb.bottom[a] != NULL: + */ + __pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":285 + * a = i >> veb.num_bottom_bits + * b = i & LOWER_MASK[veb.num_bottom_bits-1] + * found = 0 # <<<<<<<<<<<<<< + * if veb.bottom[a] != NULL: + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + */ + __pyx_v_found = 0; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":288 + * if veb.bottom[a] != NULL: + * 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) + */ + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * found = 1 + * else: + */ + __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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":291 + * if subv.max_val > b: + * j = (a << veb.num_bottom_bits) + VEB_findsucc(subv, b) + * found = 1 # <<<<<<<<<<<<<< + * else: + * subb = <_BitSet*> veb.bottom[a] + */ + __pyx_v_found = 1; + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":293 + * found = 1 + * else: + * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< + * if subb.max_val > b: + * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) + */ + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * found = 1 + * if found==0: + */ + __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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":296 + * if subb.max_val > b: + * j = (a << veb.num_bottom_bits) + bitset_findsucc(subb, b) + * found = 1 # <<<<<<<<<<<<<< + * if found==0: + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + */ + __pyx_v_found = 1; + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L6:; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":299 + * if found==0: + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + * subv = <_VEB*> veb.top # <<<<<<<<<<<<<< + * c = VEB_findsucc(subv, a) + * else: + */ + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)__pyx_v_veb->top); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":300 + * if veb.top_universe_size > MIN_BOTTOM_SIZE: + * subv = <_VEB*> veb.top + * c = VEB_findsucc(subv, a) # <<<<<<<<<<<<<< + * else: + * subb = <_BitSet*> veb.top + */ + __pyx_v_c = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_subv, __pyx_v_a); + goto __pyx_L10; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":302 + * c = VEB_findsucc(subv, a) + * else: + * subb = <_BitSet*> veb.top # <<<<<<<<<<<<<< + * c = bitset_findsucc(subb, a) + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + */ + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)__pyx_v_veb->top); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":303 + * else: + * subb = <_BitSet*> veb.top + * c = bitset_findsucc(subb, a) # <<<<<<<<<<<<<< + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + * subv = <_VEB*> veb.bottom[c] + */ + __pyx_v_c = __pyx_f_4cdec_2sa_3_sa_bitset_findsucc(__pyx_v_subb, __pyx_v_a); + } + __pyx_L10:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":305 + * 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 + * else: + */ + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_c])); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * else: + * 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; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":308 + * j = (c << veb.num_bottom_bits) + subv.min_val + * else: + * subb = <_BitSet*> veb.bottom[c] # <<<<<<<<<<<<<< + * j = (c << veb.num_bottom_bits) + subb.min_val + * return j + */ + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_c])); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":309 + * else: + * subb = <_BitSet*> veb.bottom[c] + * j = (c << veb.num_bottom_bits) + subb.min_val # <<<<<<<<<<<<<< + * return j + * + */ + __pyx_v_j = ((__pyx_v_c << __pyx_v_veb->num_bottom_bits) + __pyx_v_subb->min_val); + } + __pyx_L11:; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":310 + * subb = <_BitSet*> veb.bottom[c] + * j = (c << veb.num_bottom_bits) + subb.min_val + * return j # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_j; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":313 + * + * + * cdef int VEB_contains(_VEB* veb, int i): # <<<<<<<<<<<<<< + * cdef _VEB* subv + * cdef _BitSet* subb + */ + +static int __pyx_f_4cdec_2sa_3_sa_VEB_contains(struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_veb, int __pyx_v_i) { + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_v_subv; + struct __pyx_t_4cdec_2sa_3_sa__BitSet *__pyx_v_subb; + int __pyx_v_a; + int __pyx_v_b; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("VEB_contains", 0); + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":319 + * + * if veb.size == 0 or i < veb.min_val or i > veb.max_val: + * return 0 # <<<<<<<<<<<<<< + * + * if veb.min_val == i: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":322 + * + * if veb.min_val == i: + * return 1 # <<<<<<<<<<<<<< + * else: + * if veb.size == 1: + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":325 + * else: + * if veb.size == 1: + * return 0 # <<<<<<<<<<<<<< + * + * a = i >> veb.num_bottom_bits + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":327 + * return 0 + * + * a = i >> veb.num_bottom_bits # <<<<<<<<<<<<<< + * b = i & LOWER_MASK[veb.num_bottom_bits-1] + * if veb.bottom[a] == NULL: + */ + __pyx_v_a = (__pyx_v_i >> __pyx_v_veb->num_bottom_bits); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":328 + * + * a = i >> veb.num_bottom_bits + * b = i & LOWER_MASK[veb.num_bottom_bits-1] # <<<<<<<<<<<<<< + * if veb.bottom[a] == NULL: + * return 0 + */ + __pyx_v_b = (__pyx_v_i & (__pyx_v_4cdec_2sa_3_sa_LOWER_MASK[(__pyx_v_veb->num_bottom_bits - 1)])); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":330 + * b = i & LOWER_MASK[veb.num_bottom_bits-1] + * if veb.bottom[a] == NULL: + * return 0 # <<<<<<<<<<<<<< + * else: + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":333 + * else: + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + * subv = <_VEB*> veb.bottom[a] # <<<<<<<<<<<<<< + * return VEB_contains(subv, b) + * else: + */ + __pyx_v_subv = ((struct __pyx_t_4cdec_2sa_3_sa__VEB *)(__pyx_v_veb->bottom[__pyx_v_a])); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":334 + * if veb.num_bottom_bits > MIN_BOTTOM_BITS: + * subv = <_VEB*> veb.bottom[a] + * return VEB_contains(subv, b) # <<<<<<<<<<<<<< + * else: + * subb = <_BitSet*> veb.bottom[a] + */ + __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_contains(__pyx_v_subv, __pyx_v_b); + goto __pyx_L0; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":336 + * return VEB_contains(subv, b) + * else: + * subb = <_BitSet*> veb.bottom[a] # <<<<<<<<<<<<<< + * return bitset_contains(subb, b) + * + */ + __pyx_v_subb = ((struct __pyx_t_4cdec_2sa_3_sa__BitSet *)(__pyx_v_veb->bottom[__pyx_v_a])); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":337 + * else: + * subb = <_BitSet*> veb.bottom[a] + * return bitset_contains(subb, b) # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_f_4cdec_2sa_3_sa_bitset_contains(__pyx_v_subb, __pyx_v_b); + goto __pyx_L0; + } + __pyx_L7:; + } + __pyx_L6:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(((struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":344 + * cdef int next_val + * + * def __next__(self): # <<<<<<<<<<<<<< + * cdef int ret_val + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11VEBIterator___next__(struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *__pyx_v_self) { + int __pyx_v_ret_val; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__next__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":347 + * cdef int ret_val + * + * if self.next_val == -1: # <<<<<<<<<<<<<< + * raise StopIteration() + * ret_val = self.next_val + */ + __pyx_t_1 = ((__pyx_v_self->next_val == -1) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_builtin_StopIteration, ((PyObject *)__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_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;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":349 + * if self.next_val == -1: + * raise StopIteration() + * ret_val = self.next_val # <<<<<<<<<<<<<< + * self.next_val = VEB_findsucc(self.v, ret_val) + * return ret_val + */ + __pyx_t_3 = __pyx_v_self->next_val; + __pyx_v_ret_val = __pyx_t_3; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":350 + * raise StopIteration() + * ret_val = self.next_val + * self.next_val = VEB_findsucc(self.v, ret_val) # <<<<<<<<<<<<<< + * return ret_val + * + */ + __pyx_v_self->next_val = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->v, __pyx_v_ret_val); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":351 + * ret_val = self.next_val + * self.next_val = VEB_findsucc(self.v, ret_val) + * return ret_val # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_ret_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 351; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.VEBIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_3VEB_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_size; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,0}; + PyObject* values[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 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__size)) != 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[6]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[6]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.VEB.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), __pyx_v_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":360 + * cdef int _first(self) + * + * def __cinit__(self, int size): # <<<<<<<<<<<<<< + * self.veb = new_VEB(size) + * + */ + +static int __pyx_pf_4cdec_2sa_3_sa_3VEB___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, int __pyx_v_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":361 + * + * def __cinit__(self, int size): + * self.veb = new_VEB(size) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->veb = __pyx_f_4cdec_2sa_3_sa_new_VEB(__pyx_v_size); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_4cdec_2sa_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_3VEB_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":363 + * self.veb = new_VEB(size) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * del_VEB(self.veb) + * + */ + +static void __pyx_pf_4cdec_2sa_3_sa_3VEB_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":364 + * + * def __dealloc__(self): + * del_VEB(self.veb) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_1 = __pyx_f_4cdec_2sa_3_sa_del_VEB(__pyx_v_self->veb); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.VEB.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":366 + * del_VEB(self.veb) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef VEBIterator it + * it = VEBIterator() + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_4__iter__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { + struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *__pyx_v_it = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_t_4cdec_2sa_3_sa__VEB *__pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":368 + * def __iter__(self): + * cdef VEBIterator it + * it = VEBIterator() # <<<<<<<<<<<<<< + * it.v = self.veb + * it.next_val = self.veb.min_val + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_VEBIterator)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_it = ((struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":369 + * cdef VEBIterator it + * it = VEBIterator() + * it.v = self.veb # <<<<<<<<<<<<<< + * it.next_val = self.veb.min_val + * return it + */ + __pyx_t_2 = __pyx_v_self->veb; + __pyx_v_it->v = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":370 + * it = VEBIterator() + * it.v = self.veb + * it.next_val = self.veb.min_val # <<<<<<<<<<<<<< + * return it + * + */ + __pyx_t_3 = __pyx_v_self->veb->min_val; + __pyx_v_it->next_val = __pyx_t_3; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":371 + * it.v = self.veb + * it.next_val = self.veb.min_val + * return it # <<<<<<<<<<<<<< + * + * def insert(self, i): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_it)); + __pyx_r = ((PyObject *)__pyx_v_it); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.VEB.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_it); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_7insert(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("insert (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":373 + * return it + * + * def insert(self, i): # <<<<<<<<<<<<<< + * return VEB_insert(self.veb, i) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_6insert(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("insert", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":374 + * + * def insert(self, i): + * return VEB_insert(self.veb, i) # <<<<<<<<<<<<<< + * + * cdef int _insert(self, int i): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 374; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.VEB.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":376 + * return VEB_insert(self.veb, i) + * + * cdef int _insert(self, int i): # <<<<<<<<<<<<<< + * return VEB_insert(self.veb, i) + * + */ + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_insert", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":377 + * + * cdef int _insert(self, int i): + * return VEB_insert(self.veb, i) # <<<<<<<<<<<<<< + * + * def findsucc(self, i): + */ + __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_insert(__pyx_v_self->veb, __pyx_v_i); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3VEB_9findsucc(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("findsucc (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":379 + * return VEB_insert(self.veb, i) + * + * def findsucc(self, i): # <<<<<<<<<<<<<< + * return VEB_findsucc(self.veb, i) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3VEB_8findsucc(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("findsucc", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":380 + * + * def findsucc(self, i): + * return VEB_findsucc(self.veb, i) # <<<<<<<<<<<<<< + * + * cdef int _first(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 380; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.VEB.findsucc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":382 + * return VEB_findsucc(self.veb, i) + * + * cdef int _first(self): # <<<<<<<<<<<<<< + * return self.veb.min_val + * + */ + +static int __pyx_f_4cdec_2sa_3_sa_3VEB__first(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_first", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":383 + * + * cdef int _first(self): + * return self.veb.min_val # <<<<<<<<<<<<<< + * + * cdef int _findsucc(self, int i): + */ + __pyx_r = __pyx_v_self->veb->min_val; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":385 + * return self.veb.min_val + * + * cdef int _findsucc(self, int i): # <<<<<<<<<<<<<< + * return VEB_findsucc(self.veb, i) + * + */ + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_findsucc", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":386 + * + * cdef int _findsucc(self, int i): + * return VEB_findsucc(self.veb, i) # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_findsucc(__pyx_v_self->veb, __pyx_v_i); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":388 + * return VEB_findsucc(self.veb, i) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.veb.size + * + */ + +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_3VEB_10__len__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":389 + * + * def __len__(self): + * return self.veb.size # <<<<<<<<<<<<<< + * + * def __contains__(self, i): + */ + __pyx_r = __pyx_v_self->veb->size; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_3VEB_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":391 + * return self.veb.size + * + * def __contains__(self, i): # <<<<<<<<<<<<<< + * return VEB_contains(self.veb, i) + */ + +static int __pyx_pf_4cdec_2sa_3_sa_3VEB_12__contains__(struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_self, PyObject *__pyx_v_i) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__contains__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":392 + * + * def __contains__(self, i): + * return VEB_contains(self.veb, i) # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_f_4cdec_2sa_3_sa_VEB_contains(__pyx_v_self->veb, __pyx_t_1); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.VEB.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_3LCP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sa = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sa,0}; + PyObject* values[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 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__sa)) != 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[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_sa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.LCP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sa), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "sa", 0))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_LCP *)__pyx_v_self), __pyx_v_sa); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":9 + * cdef IntList lcp + * + * def __cinit__(self, SuffixArray sa): # <<<<<<<<<<<<<< + * cdef int i, k, j, h, n + * cdef IntList rank + */ + +static int __pyx_pf_4cdec_2sa_3_sa_3LCP___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_LCP *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sa) { + int __pyx_v_i; + int __pyx_v_k; + int __pyx_v_j; + int __pyx_v_h; + int __pyx_v_n; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_rank = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":13 + * cdef IntList rank + * + * logger.info("Constructing LCP array") # <<<<<<<<<<<<<< + * self.sa = sa + * n = self.sa.sa.len + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 13; __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[9]; __pyx_lineno = 13; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 13; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":14 + * + * logger.info("Constructing LCP array") + * self.sa = sa # <<<<<<<<<<<<<< + * n = self.sa.sa.len + * self.lcp = IntList(initial_len=n) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_sa)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_sa)); + __Pyx_GOTREF(__pyx_v_self->sa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); + __pyx_v_self->sa = __pyx_v_sa; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":15 + * logger.info("Constructing LCP array") + * self.sa = sa + * n = self.sa.sa.len # <<<<<<<<<<<<<< + * self.lcp = IntList(initial_len=n) + * + */ + __pyx_t_3 = __pyx_v_self->sa->sa->len; + __pyx_v_n = __pyx_t_3; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":16 + * self.sa = sa + * n = self.sa.sa.len + * self.lcp = IntList(initial_len=n) # <<<<<<<<<<<<<< + * + * rank = IntList(initial_len=n) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->lcp); + __Pyx_DECREF(((PyObject *)__pyx_v_self->lcp)); + __pyx_v_self->lcp = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":18 + * self.lcp = IntList(initial_len=n) + * + * rank = IntList(initial_len=n) # <<<<<<<<<<<<<< + * for i from 0 <= i < n: + * rank.arr[sa.sa.arr[i]] = i + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":19 + * + * rank = IntList(initial_len=n) + * for i from 0 <= i < n: # <<<<<<<<<<<<<< + * rank.arr[sa.sa.arr[i]] = i + * + */ + __pyx_t_3 = __pyx_v_n; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":20 + * rank = IntList(initial_len=n) + * for i from 0 <= i < n: + * rank.arr[sa.sa.arr[i]] = i # <<<<<<<<<<<<<< + * + * h = 0 + */ + (__pyx_v_rank->arr[(__pyx_v_sa->sa->arr[__pyx_v_i])]) = __pyx_v_i; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":22 + * rank.arr[sa.sa.arr[i]] = i + * + * h = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < n: + * k = rank.arr[i] + */ + __pyx_v_h = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":23 + * + * h = 0 + * for i from 0 <= i < n: # <<<<<<<<<<<<<< + * k = rank.arr[i] + * if k == 0: + */ + __pyx_t_3 = __pyx_v_n; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":24 + * h = 0 + * for i from 0 <= i < n: + * k = rank.arr[i] # <<<<<<<<<<<<<< + * if k == 0: + * self.lcp.arr[k] = -1 + */ + __pyx_v_k = (__pyx_v_rank->arr[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":25 + * for i from 0 <= i < n: + * k = rank.arr[i] + * if k == 0: # <<<<<<<<<<<<<< + * self.lcp.arr[k] = -1 + * else: + */ + __pyx_t_4 = ((__pyx_v_k == 0) != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":26 + * k = rank.arr[i] + * if k == 0: + * self.lcp.arr[k] = -1 # <<<<<<<<<<<<<< + * else: + * j = sa.sa.arr[k-1] + */ + (__pyx_v_self->lcp->arr[__pyx_v_k]) = -1; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":28 + * self.lcp.arr[k] = -1 + * 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]: + * h = h+1 + */ + __pyx_v_j = (__pyx_v_sa->sa->arr[(__pyx_v_k - 1)]); + + /* "/home/mdenkows/cdec/python/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]: # <<<<<<<<<<<<<< + * h = h+1 + * 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; + } else { + __pyx_t_5 = __pyx_t_4; + } + if (!__pyx_t_5) break; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * self.lcp.arr[k] = h + * if h > 0: + */ + __pyx_v_h = (__pyx_v_h + 1); + } + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * if h > 0: + * h = h-1 + */ + (__pyx_v_self->lcp->arr[__pyx_v_k]) = __pyx_v_h; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":33 + * self.lcp.arr[k] = h + * if h > 0: + * h = h-1 # <<<<<<<<<<<<<< + * logger.info("LCP array completed") + * + */ + __pyx_v_h = (__pyx_v_h - 1); + goto __pyx_L10; + } + __pyx_L10:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":34 + * if h > 0: + * h = h-1 + * logger.info("LCP array completed") # <<<<<<<<<<<<<< + * + * def compute_stats(self, int max_n): + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 34; __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[9]; __pyx_lineno = 34; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 34; __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; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.LCP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_rank); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_3LCP_2compute_stats[] = "Note: the output of this function is not exact. In\n particular, the frequency associated with each word is \n not guaranteed to be correct. This is due to a bit of\n laxness in the design; the function is intended only to\n obtain a list of the most frequent words; for this \n purpose it is perfectly fine"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_3LCP_3compute_stats(PyObject *__pyx_v_self, PyObject *__pyx_arg_max_n) { + int __pyx_v_max_n; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("compute_stats (wrapper)", 0); + assert(__pyx_arg_max_n); { + __pyx_v_max_n = __Pyx_PyInt_AsInt(__pyx_arg_max_n); if (unlikely((__pyx_v_max_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.LCP.compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_3LCP_2compute_stats(((struct __pyx_obj_4cdec_2sa_3_sa_LCP *)__pyx_v_self), ((int)__pyx_v_max_n)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":36 + * logger.info("LCP array completed") + * + * def compute_stats(self, int max_n): # <<<<<<<<<<<<<< + * """Note: the output of this function is not exact. In + * particular, the frequency associated with each word is + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_3LCP_2compute_stats(struct __pyx_obj_4cdec_2sa_3_sa_LCP *__pyx_v_self, int __pyx_v_max_n) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("compute_stats", 0); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, __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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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(); + return __pyx_r; +} + +static PyObject *__pyx_gb_4cdec_2sa_3_sa_3LCP_4generator1(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + 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; + 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_L26_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[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":48 + * cdef VEB veb + * + * N = self.sa.sa.len # <<<<<<<<<<<<<< + * + * ngram_starts = [] + */ + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->sa->sa->len; + __pyx_cur_scope->__pyx_v_N = __pyx_t_1; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":50 + * N = self.sa.sa.len + * + * ngram_starts = [] # <<<<<<<<<<<<<< + * for n from 0 <= n < max_n: + * ngram_starts.append(IntList(initial_len=N)) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_cur_scope->__pyx_v_ngram_starts = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":51 + * + * ngram_starts = [] + * for n from 0 <= n < max_n: # <<<<<<<<<<<<<< + * ngram_starts.append(IntList(initial_len=N)) + * + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":52 + * ngram_starts = [] + * for n from 0 <= n < max_n: + * ngram_starts.append(IntList(initial_len=N)) # <<<<<<<<<<<<<< + * + * run_start = IntList(initial_len=max_n) + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_ngram_starts, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":54 + * ngram_starts.append(IntList(initial_len=N)) + * + * run_start = IntList(initial_len=max_n) # <<<<<<<<<<<<<< + * veb = VEB(N) + * + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_max_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_run_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":55 + * + * run_start = IntList(initial_len=max_n) + * veb = VEB(N) # <<<<<<<<<<<<<< + * + * for i from 0 <= i < N: + */ + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __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[9]; __pyx_lineno = 55; __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_2sa_3_sa_VEB)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":57 + * veb = VEB(N) + * + * for i from 0 <= i < N: # <<<<<<<<<<<<<< + * h = self.lcp.arr[i] + * if h < 0: + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":58 + * + * for i from 0 <= i < N: + * h = self.lcp.arr[i] # <<<<<<<<<<<<<< + * if h < 0: + * h = 0 + */ + __pyx_cur_scope->__pyx_v_h = (__pyx_cur_scope->__pyx_v_self->lcp->arr[__pyx_cur_scope->__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":59 + * for i from 0 <= i < N: + * h = self.lcp.arr[i] + * if h < 0: # <<<<<<<<<<<<<< + * h = 0 + * for n from h <= n < max_n: + */ + __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_h < 0) != 0); + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":60 + * h = self.lcp.arr[i] + * if h < 0: + * h = 0 # <<<<<<<<<<<<<< + * for n from h <= n < max_n: + * rs = run_start.arr[n] + */ + __pyx_cur_scope->__pyx_v_h = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":61 + * if h < 0: + * h = 0 + * for n from h <= n < max_n: # <<<<<<<<<<<<<< + * rs = run_start.arr[n] + * run_start.arr[n] = i + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":62 + * h = 0 + * for n from h <= n < max_n: + * rs = run_start.arr[n] # <<<<<<<<<<<<<< + * run_start.arr[n] = i + * freq = i - rs + */ + __pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_run_start->arr[__pyx_cur_scope->__pyx_v_n]); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":63 + * for n from h <= n < max_n: + * rs = run_start.arr[n] + * run_start.arr[n] = i # <<<<<<<<<<<<<< + * freq = i - rs + * if freq > 1000: # arbitrary, but see note below + */ + (__pyx_cur_scope->__pyx_v_run_start->arr[__pyx_cur_scope->__pyx_v_n]) = __pyx_cur_scope->__pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":64 + * rs = run_start.arr[n] + * run_start.arr[n] = i + * freq = i - rs # <<<<<<<<<<<<<< + * if freq > 1000: # arbitrary, but see note below + * veb._insert(freq) + */ + __pyx_cur_scope->__pyx_v_freq = (__pyx_cur_scope->__pyx_v_i - __pyx_cur_scope->__pyx_v_rs); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":65 + * run_start.arr[n] = i + * freq = i - rs + * if freq > 1000: # arbitrary, but see note below # <<<<<<<<<<<<<< + * veb._insert(freq) + * ngram_start = ngram_starts[n] + */ + __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_freq > 1000) != 0); + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":66 + * freq = i - rs + * if freq > 1000: # arbitrary, but see note below + * veb._insert(freq) # <<<<<<<<<<<<<< + * ngram_start = ngram_starts[n] + * while ngram_start.arr[freq] > 0: + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":67 + * if freq > 1000: # arbitrary, but see note below + * veb._insert(freq) + * ngram_start = ngram_starts[n] # <<<<<<<<<<<<<< + * while ngram_start.arr[freq] > 0: + * freq = freq + 1 # cheating a bit, should be ok for sparse histogram + */ + __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_starts), __pyx_cur_scope->__pyx_v_n, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":68 + * veb._insert(freq) + * ngram_start = ngram_starts[n] + * while ngram_start.arr[freq] > 0: # <<<<<<<<<<<<<< + * freq = freq + 1 # cheating a bit, should be ok for sparse histogram + * ngram_start.arr[freq] = rs + */ + while (1) { + __pyx_t_5 = (((__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_freq]) > 0) != 0); + if (!__pyx_t_5) break; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * ngram_start.arr[freq] = rs + * i = veb.veb.min_val + */ + __pyx_cur_scope->__pyx_v_freq = (__pyx_cur_scope->__pyx_v_freq + 1); + } + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * i = veb.veb.min_val + * while i != -1: + */ + (__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_freq]) = __pyx_cur_scope->__pyx_v_rs; + goto __pyx_L11; + } + __pyx_L11:; + } + } + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * while i != -1: + * ii = veb._findsucc(i) + */ + __pyx_t_1 = __pyx_cur_scope->__pyx_v_veb->veb->min_val; + __pyx_cur_scope->__pyx_v_i = __pyx_t_1; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":72 + * ngram_start.arr[freq] = rs + * i = veb.veb.min_val + * while i != -1: # <<<<<<<<<<<<<< + * ii = veb._findsucc(i) + * for n from 0 <= n < max_n: + */ + while (1) { + __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_i != -1) != 0); + if (!__pyx_t_5) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":73 + * i = veb.veb.min_val + * while i != -1: + * ii = veb._findsucc(i) # <<<<<<<<<<<<<< + * for n from 0 <= n < max_n: + * ngram_start = ngram_starts[n] + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":74 + * while i != -1: + * ii = veb._findsucc(i) + * for n from 0 <= n < max_n: # <<<<<<<<<<<<<< + * ngram_start = ngram_starts[n] + * iii = i + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":75 + * ii = veb._findsucc(i) + * for n from 0 <= n < max_n: + * ngram_start = ngram_starts[n] # <<<<<<<<<<<<<< + * iii = i + * rs = ngram_start.arr[iii] + */ + __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_starts), __pyx_cur_scope->__pyx_v_n, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram_start)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":76 + * for n from 0 <= n < max_n: + * ngram_start = ngram_starts[n] + * iii = i # <<<<<<<<<<<<<< + * rs = ngram_start.arr[iii] + * while (ii==-1 or iii < ii) and rs != 0: + */ + __pyx_cur_scope->__pyx_v_iii = __pyx_cur_scope->__pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":77 + * ngram_start = ngram_starts[n] + * iii = i + * rs = ngram_start.arr[iii] # <<<<<<<<<<<<<< + * while (ii==-1 or iii < ii) and rs != 0: + * j = self.sa.sa.arr[rs] + */ + __pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_iii]); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":78 + * iii = i + * rs = ngram_start.arr[iii] + * while (ii==-1 or iii < ii) and rs != 0: # <<<<<<<<<<<<<< + * j = self.sa.sa.arr[rs] + * 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; + } else { + __pyx_t_8 = __pyx_t_5; + } + if (__pyx_t_8) { + __pyx_t_5 = ((__pyx_cur_scope->__pyx_v_rs != 0) != 0); + __pyx_t_7 = __pyx_t_5; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (!__pyx_t_7) break; + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * valid = 1 + * for k from 0 <= k < n+1: + */ + __pyx_cur_scope->__pyx_v_j = (__pyx_cur_scope->__pyx_v_self->sa->sa->arr[__pyx_cur_scope->__pyx_v_rs]); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":80 + * while (ii==-1 or iii < ii) and rs != 0: + * j = self.sa.sa.arr[rs] + * valid = 1 # <<<<<<<<<<<<<< + * for k from 0 <= k < n+1: + * if self.sa.darray.data.arr[j+k] < 2: + */ + __pyx_cur_scope->__pyx_v_valid = 1; + + /* "/home/mdenkows/cdec/python/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++) { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":83 + * for k from 0 <= k < n+1: + * 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)]) + */ + __pyx_cur_scope->__pyx_v_valid = 0; + goto __pyx_L22; + } + __pyx_L22:; + } + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":85 + * valid = 0 + * if valid: + * ngram = tuple([self.sa.darray.data.arr[j+k] for k in range(n+1)]) # <<<<<<<<<<<<<< + * yield i, n+1, ngram + * iii = iii + 1 + */ + __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_cur_scope->__pyx_v_k = __pyx_t_6; + __pyx_t_3 = PyInt_FromLong((__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); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_3 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_cur_scope->__pyx_v_ngram = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * iii = iii + 1 + * rs = ngram_start.arr[iii] + */ + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyInt_FromLong((__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_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram)); + PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_cur_scope->__pyx_v_ngram)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_ngram)); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_10); + __pyx_t_10 = 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_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; + } + __pyx_L23:; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * rs = ngram_start.arr[iii] + * i = ii + */ + __pyx_cur_scope->__pyx_v_iii = (__pyx_cur_scope->__pyx_v_iii + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":88 + * yield i, n+1, ngram + * iii = iii + 1 + * rs = ngram_start.arr[iii] # <<<<<<<<<<<<<< + * i = ii + */ + __pyx_cur_scope->__pyx_v_rs = (__pyx_cur_scope->__pyx_v_ngram_start->arr[__pyx_cur_scope->__pyx_v_iii]); + } + } + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":89 + * iii = iii + 1 + * rs = ngram_start.arr[iii] + * i = ii # <<<<<<<<<<<<<< + */ + __pyx_cur_scope->__pyx_v_i = __pyx_cur_scope->__pyx_v_ii; + } + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("compute_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_8Alphabet_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __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_2sa_3_sa_8Alphabet___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":12 + * cdef dict id2sym + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.terminals = StringMap() + * self.nonterminals = StringMap() + */ + +static int __pyx_pf_4cdec_2sa_3_sa_8Alphabet___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { + 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("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":13 + * + * def __cinit__(self): + * self.terminals = StringMap() # <<<<<<<<<<<<<< + * self.nonterminals = StringMap() + * self.id2sym = {} + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->terminals); + __Pyx_DECREF(((PyObject *)__pyx_v_self->terminals)); + __pyx_v_self->terminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":14 + * def __cinit__(self): + * self.terminals = StringMap() + * self.nonterminals = StringMap() # <<<<<<<<<<<<<< + * self.id2sym = {} + * self.first_nonterminal = -1 + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_StringMap)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->nonterminals); + __Pyx_DECREF(((PyObject *)__pyx_v_self->nonterminals)); + __pyx_v_self->nonterminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":15 + * self.terminals = StringMap() + * self.nonterminals = StringMap() + * self.id2sym = {} # <<<<<<<<<<<<<< + * self.first_nonterminal = -1 + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->id2sym); + __Pyx_DECREF(((PyObject *)__pyx_v_self->id2sym)); + __pyx_v_self->id2sym = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":16 + * self.nonterminals = StringMap() + * self.id2sym = {} + * self.first_nonterminal = -1 # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_self->first_nonterminal = -1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.Alphabet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_4cdec_2sa_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_8Alphabet_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_4cdec_2sa_3_sa_8Alphabet_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":18 + * self.first_nonterminal = -1 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * pass + * + */ + +static void __pyx_pf_4cdec_2sa_3_sa_8Alphabet_2__dealloc__(CYTHON_UNUSED struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":21 + * pass + * + * cdef int isvar(self, int sym): # <<<<<<<<<<<<<< + * return sym < 0 + * + */ + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("isvar", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":22 + * + * cdef int isvar(self, int sym): + * return sym < 0 # <<<<<<<<<<<<<< + * + * cdef int isword(self, int sym): + */ + __pyx_r = (__pyx_v_sym < 0); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":24 + * return sym < 0 + * + * cdef int isword(self, int sym): # <<<<<<<<<<<<<< + * return sym >= 0 + * + */ + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("isword", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":25 + * + * cdef int isword(self, int sym): + * return sym >= 0 # <<<<<<<<<<<<<< + * + * cdef int getindex(self, int sym): + */ + __pyx_r = (__pyx_v_sym >= 0); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":27 + * return sym >= 0 + * + * cdef int getindex(self, int sym): # <<<<<<<<<<<<<< + * return -sym & INDEX_MASK + * + */ + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getindex", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":28 + * + * cdef int getindex(self, int sym): + * return -sym & INDEX_MASK # <<<<<<<<<<<<<< + * + * cdef int setindex(self, int sym, int ind): + */ + __pyx_r = ((-__pyx_v_sym) & __pyx_v_4cdec_2sa_3_sa_INDEX_MASK); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":30 + * return -sym & INDEX_MASK + * + * cdef int setindex(self, int sym, int ind): # <<<<<<<<<<<<<< + * return -(-sym & ~INDEX_MASK | ind) + * + */ + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("setindex", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":31 + * + * cdef int setindex(self, int sym, int ind): + * return -(-sym & ~INDEX_MASK | ind) # <<<<<<<<<<<<<< + * + * cdef int clearindex(self, int sym): + */ + __pyx_r = (-(((-__pyx_v_sym) & (~__pyx_v_4cdec_2sa_3_sa_INDEX_MASK)) | __pyx_v_ind)); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":33 + * return -(-sym & ~INDEX_MASK | ind) + * + * cdef int clearindex(self, int sym): # <<<<<<<<<<<<<< + * return -(-sym& ~INDEX_MASK) + * + */ + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clearindex", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":34 + * + * cdef int clearindex(self, int sym): + * return -(-sym& ~INDEX_MASK) # <<<<<<<<<<<<<< + * + * cdef int match(self, int sym1, int sym2): + */ + __pyx_r = (-((-__pyx_v_sym) & (~__pyx_v_4cdec_2sa_3_sa_INDEX_MASK))); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":36 + * return -(-sym& ~INDEX_MASK) + * + * cdef int match(self, int sym1, int sym2): # <<<<<<<<<<<<<< + * return self.clearindex(sym1) == self.clearindex(sym2); + * + */ + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("match", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":37 + * + * cdef int match(self, int sym1, int sym2): + * return self.clearindex(sym1) == self.clearindex(sym2); # <<<<<<<<<<<<<< + * + * cdef char* tocat(self, int sym): + */ + __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; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":39 + * return self.clearindex(sym1) == self.clearindex(sym2); + * + * cdef char* tocat(self, int sym): # <<<<<<<<<<<<<< + * return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) + * + */ + +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) { + char *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("tocat", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":40 + * + * cdef char* tocat(self, int sym): + * return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) # <<<<<<<<<<<<<< + * + * cdef int fromcat(self, char *s): + */ + __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; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":42 + * return self.nonterminals.word((-sym >> INDEX_SHIFT)-1) + * + * cdef int fromcat(self, char *s): # <<<<<<<<<<<<<< + * cdef int i + * i = self.nonterminals.index(s) + */ + +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) { + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("fromcat", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":44 + * cdef int fromcat(self, char *s): + * cdef int i + * i = self.nonterminals.index(s) # <<<<<<<<<<<<<< + * if self.first_nonterminal == -1: + * self.first_nonterminal = i + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":45 + * cdef int i + * i = self.nonterminals.index(s) + * if self.first_nonterminal == -1: # <<<<<<<<<<<<<< + * self.first_nonterminal = i + * if i > self.last_nonterminal: + */ + __pyx_t_1 = ((__pyx_v_self->first_nonterminal == -1) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":46 + * i = self.nonterminals.index(s) + * if self.first_nonterminal == -1: + * self.first_nonterminal = i # <<<<<<<<<<<<<< + * if i > self.last_nonterminal: + * self.last_nonterminal = i + */ + __pyx_v_self->first_nonterminal = __pyx_v_i; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":47 + * if self.first_nonterminal == -1: + * self.first_nonterminal = i + * if i > self.last_nonterminal: # <<<<<<<<<<<<<< + * self.last_nonterminal = i + * return -(i+1 << INDEX_SHIFT) + */ + __pyx_t_1 = ((__pyx_v_i > __pyx_v_self->last_nonterminal) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":48 + * self.first_nonterminal = i + * if i > self.last_nonterminal: + * self.last_nonterminal = i # <<<<<<<<<<<<<< + * return -(i+1 << INDEX_SHIFT) + * + */ + __pyx_v_self->last_nonterminal = __pyx_v_i; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":49 + * if i > self.last_nonterminal: + * self.last_nonterminal = i + * return -(i+1 << INDEX_SHIFT) # <<<<<<<<<<<<<< + * + * cdef char* tostring(self, int sym): + */ + __pyx_r = (-((__pyx_v_i + 1) << __pyx_v_4cdec_2sa_3_sa_INDEX_SHIFT)); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":51 + * return -(i+1 << INDEX_SHIFT) + * + * cdef char* tostring(self, int sym): # <<<<<<<<<<<<<< + * cdef int ind + * if self.isvar(sym): + */ + +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) { + int __pyx_v_ind; + char *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + char *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("tostring", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":53 + * cdef char* tostring(self, int sym): + * cdef int ind + * if self.isvar(sym): # <<<<<<<<<<<<<< + * if sym in self.id2sym: + * return self.id2sym[sym] + */ + __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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":54 + * cdef int ind + * if self.isvar(sym): + * if sym in self.id2sym: # <<<<<<<<<<<<<< + * return self.id2sym[sym] + * ind = self.getindex(sym) + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_sym); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = (__Pyx_PyDict_Contains(__pyx_t_2, ((PyObject *)__pyx_v_self->id2sym), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = (__pyx_t_1 != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":55 + * if self.isvar(sym): + * if sym in self.id2sym: + * return self.id2sym[sym] # <<<<<<<<<<<<<< + * ind = self.getindex(sym) + * if ind > 0: + */ + if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":56 + * if sym in self.id2sym: + * return self.id2sym[sym] + * ind = self.getindex(sym) # <<<<<<<<<<<<<< + * if ind > 0: + * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) + */ + __pyx_v_ind = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->getindex(__pyx_v_self, __pyx_v_sym); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":57 + * return self.id2sym[sym] + * ind = self.getindex(sym) + * if ind > 0: # <<<<<<<<<<<<<< + * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) + * else: + */ + __pyx_t_3 = ((__pyx_v_ind > 0) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":58 + * ind = self.getindex(sym) + * if ind > 0: + * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) # <<<<<<<<<<<<<< + * else: + * self.id2sym[sym] = "[%s]" % self.tocat(sym) + */ + __pyx_t_2 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->tocat(__pyx_v_self, __pyx_v_sym)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_5 = PyInt_FromLong(__pyx_v_ind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __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[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_2 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_66), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, ((PyObject *)__pyx_t_5), sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":60 + * self.id2sym[sym] = "[%s,%d]" % (self.tocat(sym), ind) + * else: + * self.id2sym[sym] = "[%s]" % self.tocat(sym) # <<<<<<<<<<<<<< + * return self.id2sym[sym] + * else: + */ + __pyx_t_5 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->tocat(__pyx_v_self, __pyx_v_sym)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, ((PyObject *)__pyx_t_6), sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":61 + * else: + * self.id2sym[sym] = "[%s]" % self.tocat(sym) + * return self.id2sym[sym] # <<<<<<<<<<<<<< + * else: + * return self.terminals.word(sym) + */ + if (unlikely(((PyObject *)__pyx_v_self->id2sym) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->id2sym), __pyx_v_sym, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_6); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_4; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":63 + * return self.id2sym[sym] + * else: + * return self.terminals.word(sym) # <<<<<<<<<<<<<< + * + * cdef int fromstring(self, char *s, bint terminal): + */ + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->word(__pyx_v_self->terminals, __pyx_v_sym); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_WriteUnraisable("cdec.sa._sa.Alphabet.tostring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":65 + * return self.terminals.word(sym) + * + * cdef int fromstring(self, char *s, bint terminal): # <<<<<<<<<<<<<< + * """Warning: this method is allowed to alter s.""" + * cdef char *comma + */ + +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) { + char *__pyx_v_comma; + int __pyx_v_n; + char *__pyx_v_sep; + PyObject *__pyx_v_s1 = NULL; + int __pyx_r; + __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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fromstring", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":69 + * cdef char *comma + * cdef int n + * n = strlen(s) # <<<<<<<<<<<<<< + * cdef char *sep + * sep = strstr(s,"_SEP_") + */ + __pyx_v_n = strlen(__pyx_v_s); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":71 + * n = strlen(s) + * cdef char *sep + * sep = strstr(s,"_SEP_") # <<<<<<<<<<<<<< + * if n >= 3 and s[0] == c'[' and s[n-1] == c']' and sep == NULL: + * if terminal: + */ + __pyx_v_sep = strstr(__pyx_v_s, __pyx_k___SEP_); + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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(((PyObject *)__pyx_t_6)); + __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_kp_s_68), ((PyObject *)__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(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_v_s1 = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/home/mdenkows/cdec/python/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); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":76 + * s1 = "\\"+s + * return self.terminals.index(s1) + * s[n-1] = c'\0' # <<<<<<<<<<<<<< + * s = s + 1 + * comma = strrchr(s, c',') + */ + (__pyx_v_s[(__pyx_v_n - 1)]) = '\x00'; + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":77 + * return self.terminals.index(s1) + * s[n-1] = c'\0' + * s = s + 1 # <<<<<<<<<<<<<< + * comma = strrchr(s, c',') + * if comma != NULL: + */ + __pyx_v_s = (__pyx_v_s + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":78 + * s[n-1] = c'\0' + * s = s + 1 + * comma = strrchr(s, c',') # <<<<<<<<<<<<<< + * if comma != NULL: + * comma[0] = c'\0' + */ + __pyx_v_comma = strrchr(__pyx_v_s, ','); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":80 + * comma = strrchr(s, c',') + * if comma != NULL: + * comma[0] = c'\0' # <<<<<<<<<<<<<< + * return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) + * else: + */ + (__pyx_v_comma[0]) = '\x00'; + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":81 + * if comma != NULL: + * comma[0] = c'\0' + * return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) # <<<<<<<<<<<<<< + * else: + * return self.fromcat(s) + */ + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->setindex(__pyx_v_self, ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->fromcat(__pyx_v_self, __pyx_v_s), strtol((__pyx_v_comma + 1), NULL, 10)); + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":83 + * return self.setindex(self.fromcat(s), strtol(comma+1, NULL, 10)) + * else: + * return self.fromcat(s) # <<<<<<<<<<<<<< + * else: + * return self.terminals.index(s) + */ + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self->__pyx_vtab)->fromcat(__pyx_v_self, __pyx_v_s); + goto __pyx_L0; + } + __pyx_L5:; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":85 + * return self.fromcat(s) + * else: + * return self.terminals.index(s) # <<<<<<<<<<<<<< + * + * cdef Alphabet ALPHABET = Alphabet() + */ + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_self->terminals->__pyx_vtab)->index(__pyx_v_self->terminals, __pyx_v_s); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_WriteUnraisable("cdec.sa._sa.Alphabet.fromstring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_s1); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_9terminals_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8Alphabet_9terminals___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":8 + * + * cdef class Alphabet: + * cdef readonly StringMap terminals, nonterminals # <<<<<<<<<<<<<< + * cdef int first_nonterminal, last_nonterminal + * cdef dict id2sym + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_9terminals___get__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->terminals)); + __pyx_r = ((PyObject *)__pyx_v_self->terminals); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8Alphabet_12nonterminals_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8Alphabet_12nonterminals___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8Alphabet_12nonterminals___get__(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->nonterminals)); + __pyx_r = ((PyObject *)__pyx_v_self->nonterminals); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":89 + * cdef Alphabet ALPHABET = Alphabet() + * + * cdef char* sym_tostring(int sym): # <<<<<<<<<<<<<< + * return ALPHABET.tostring(sym) + * + */ + +static char *__pyx_f_4cdec_2sa_3_sa_sym_tostring(int __pyx_v_sym) { + char *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sym_tostring", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":90 + * + * cdef char* sym_tostring(int sym): + * return ALPHABET.tostring(sym) # <<<<<<<<<<<<<< + * + * cdef char* sym_tocat(int 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; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":92 + * return ALPHABET.tostring(sym) + * + * cdef char* sym_tocat(int sym): # <<<<<<<<<<<<<< + * return ALPHABET.tocat(sym) + * + */ + +static char *__pyx_f_4cdec_2sa_3_sa_sym_tocat(int __pyx_v_sym) { + char *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sym_tocat", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":93 + * + * cdef char* sym_tocat(int sym): + * return ALPHABET.tocat(sym) # <<<<<<<<<<<<<< + * + * cdef int sym_isvar(int 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; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":95 + * return ALPHABET.tocat(sym) + * + * cdef int sym_isvar(int sym): # <<<<<<<<<<<<<< + * return ALPHABET.isvar(sym) + * + */ + +static int __pyx_f_4cdec_2sa_3_sa_sym_isvar(int __pyx_v_sym) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sym_isvar", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":96 + * + * cdef int sym_isvar(int sym): + * return ALPHABET.isvar(sym) # <<<<<<<<<<<<<< + * + * cdef int sym_getindex(int 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; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":98 + * return ALPHABET.isvar(sym) + * + * cdef int sym_getindex(int sym): # <<<<<<<<<<<<<< + * return ALPHABET.getindex(sym) + * + */ + +static int __pyx_f_4cdec_2sa_3_sa_sym_getindex(int __pyx_v_sym) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sym_getindex", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":99 + * + * cdef int sym_getindex(int sym): + * return ALPHABET.getindex(sym) # <<<<<<<<<<<<<< + * + * cdef int sym_setindex(int sym, int id): + */ + __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; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":101 + * return ALPHABET.getindex(sym) + * + * cdef int sym_setindex(int sym, int id): # <<<<<<<<<<<<<< + * return ALPHABET.setindex(sym, id) + * + */ + +static int __pyx_f_4cdec_2sa_3_sa_sym_setindex(int __pyx_v_sym, int __pyx_v_id) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sym_setindex", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":102 + * + * cdef int sym_setindex(int sym, int id): + * return ALPHABET.setindex(sym, id) # <<<<<<<<<<<<<< + * + * cdef int sym_fromstring(char* string, bint terminal): + */ + __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; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":104 + * return ALPHABET.setindex(sym, id) + * + * cdef int sym_fromstring(char* string, bint terminal): # <<<<<<<<<<<<<< + * return ALPHABET.fromstring(string, terminal) + * + */ + +static int __pyx_f_4cdec_2sa_3_sa_sym_fromstring(char *__pyx_v_string, int __pyx_v_terminal) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sym_fromstring", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":105 + * + * cdef int sym_fromstring(char* string, bint terminal): + * return ALPHABET.fromstring(string, terminal) # <<<<<<<<<<<<<< + * + * def isvar(sym): + */ + __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; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* 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 PyObject *__pyx_pw_4cdec_2sa_3_sa_5isvar(PyObject *__pyx_self, PyObject *__pyx_v_sym) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("isvar (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4isvar(__pyx_self, ((PyObject *)__pyx_v_sym)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107 + * return ALPHABET.fromstring(string, terminal) + * + * def isvar(sym): # <<<<<<<<<<<<<< + * return sym_isvar(sym) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4isvar(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sym) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("isvar", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":108 + * + * def isvar(sym): + * return sym_isvar(sym) # <<<<<<<<<<<<<< + * + * def make_lattice(words): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_sym); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 108; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.isvar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_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 PyObject *__pyx_pw_4cdec_2sa_3_sa_7make_lattice(PyObject *__pyx_self, PyObject *__pyx_v_words) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_lattice (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6make_lattice(__pyx_self, ((PyObject *)__pyx_v_words)); + __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 */ + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111 + * + * def make_lattice(words): + * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< + * return tuple(((word, None, 1), ) for word in word_ids) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_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_5_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_5_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_4_make_lattice *) __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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + 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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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)) { + __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; + } + 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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_word = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_cur_scope->__pyx_v_word); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("genexpr", __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_2sa_3_sa_12make_lattice_5generator8(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * def decode_lattice(lattice): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12make_lattice_3genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_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_6_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_6_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_4_make_lattice *) __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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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)) { + __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; + } + 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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_word = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_word); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_word); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __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)); + __pyx_t_4 = 0; + __pyx_r = ((PyObject *)__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; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("genexpr", __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; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110 + * return sym_isvar(sym) + * + * def make_lattice(words): # <<<<<<<<<<<<<< + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6make_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_lattice", 0); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_words = __pyx_v_words; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_words); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_words); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":111 + * + * def make_lattice(words): + * word_ids = (sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< + * return tuple(((word, None, 1), ) for word in word_ids) + * + */ + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12make_lattice_genexpr(((PyObject*)__pyx_cur_scope)); 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_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_word_ids = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * def decode_lattice(lattice): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12make_lattice_3genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __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*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.make_lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_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 PyObject *__pyx_pw_4cdec_2sa_3_sa_9decode_lattice(PyObject *__pyx_self, PyObject *__pyx_v_lattice) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("decode_lattice (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8decode_lattice(__pyx_self, ((PyObject *)__pyx_v_lattice)); + __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 */ + +/* "/home/mdenkows/cdec/python/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) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_lattice_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_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_8_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_8_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_7_decode_lattice *) __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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + Py_ssize_t __pyx_t_12; + PyObject *(*__pyx_t_13)(PyObject *); + int __pyx_t_14; + 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_L12_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[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/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): + */ + 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;} } + if (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; + } + for (;;) { + + /* "/home/mdenkows/cdec/python/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 (!__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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + __pyx_t_7 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L7_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_cur_scope->__pyx_v_sym = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_weight); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_weight); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_v_weight = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_dist); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_dist); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_cur_scope->__pyx_v_dist = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/home/mdenkows/cdec/python/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): + */ + 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)) { + __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; + } + 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 + } else { + __pyx_t_7 = __pyx_t_11(__pyx_t_4); + if (unlikely(!__pyx_t_7)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_arc); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_arc); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_cur_scope->__pyx_v_arc = __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)) { + __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; + } + 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 + } else { + __pyx_t_6 = __pyx_t_13(__pyx_t_7); + if (unlikely(!__pyx_t_6)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_v_node = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/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_t_14 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_14)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __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_INCREF(__pyx_cur_scope->__pyx_v_weight); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_cur_scope->__pyx_v_weight); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_weight); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_dist); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_cur_scope->__pyx_v_dist); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_dist); + __pyx_t_6 = 0; + __pyx_r = ((PyObject *)__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; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_t_3 = __pyx_t_4; + __Pyx_XGIVEREF(__pyx_t_7); + __pyx_cur_scope->__pyx_t_4 = __pyx_t_7; + __pyx_cur_scope->__pyx_t_5 = __pyx_t_10; + __pyx_cur_scope->__pyx_t_6 = __pyx_t_11; + __pyx_cur_scope->__pyx_t_7 = __pyx_t_12; + __pyx_cur_scope->__pyx_t_8 = __pyx_t_13; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L12_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + __pyx_t_4 = __pyx_cur_scope->__pyx_t_3; + __pyx_cur_scope->__pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_t_4); + __pyx_t_7 = __pyx_cur_scope->__pyx_t_4; + __pyx_cur_scope->__pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_t_7); + __pyx_t_10 = __pyx_cur_scope->__pyx_t_5; + __pyx_t_11 = __pyx_cur_scope->__pyx_t_6; + __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;} + } + __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; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_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); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114 + * return tuple(((word, None, 1), ) for word in word_ids) + * + * 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) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8decode_lattice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decode_lattice", 0); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_lattice = __pyx_v_lattice; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lattice); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lattice); + + /* "/home/mdenkows/cdec/python/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_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_14decode_lattice_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __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*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.decode_lattice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_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 PyObject *__pyx_pw_4cdec_2sa_3_sa_11decode_sentence(PyObject *__pyx_self, PyObject *__pyx_v_lattice) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("decode_sentence (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_10decode_sentence(__pyx_self, ((PyObject *)__pyx_v_lattice)); + __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 */ + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119 + * + * def decode_sentence(lattice): + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< + * + * def encode_words(words): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_15decode_sentence_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_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_10_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_10_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_9_decode_sentence *) __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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + 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_L10_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[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)) { + __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; + } + 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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 1)) { + if (size > 1) __Pyx_RaiseTooManyValuesError(1); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + } + __Pyx_INCREF(__pyx_t_5); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; + index = 0; __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), 1) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __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; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L7_unpacking_done:; + } + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __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_8 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_6 = PyList_GET_ITEM(sequence, 0); + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + __pyx_t_9 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + #else + __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 1; __pyx_t_8 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 2; __pyx_t_9 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L9_unpacking_done; + __pyx_L8_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L9_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_v_sym = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v__); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v__); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_v__ = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v__); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v__); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v__ = __pyx_t_9; + __pyx_t_9 = 0; + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_11)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L10_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("genexpr", __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; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118 + * for arc in node for node in lattice) + * + * def decode_sentence(lattice): # <<<<<<<<<<<<<< + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_10decode_sentence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lattice) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decode_sentence", 0); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_lattice = __pyx_v_lattice; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lattice); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lattice); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":119 + * + * def decode_sentence(lattice): + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) # <<<<<<<<<<<<<< + * + * def encode_words(words): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_15decode_sentence_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __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*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.decode_sentence", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_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 PyObject *__pyx_pw_4cdec_2sa_3_sa_13encode_words(PyObject *__pyx_self, PyObject *__pyx_v_words) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("encode_words (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_12encode_words(__pyx_self, ((PyObject *)__pyx_v_words)); + __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 */ + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122 + * + * def encode_words(words): + * return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< + * + * def decode_words(syms): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_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_12_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_12_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_11_encode_words *) __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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + 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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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)) { + __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; + } + 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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_word = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_cur_scope->__pyx_v_word); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_t_5, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("genexpr", __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; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121 + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) + * + * def encode_words(words): # <<<<<<<<<<<<<< + * return tuple(sym_fromstring(word, True) for word in words) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12encode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_words) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("encode_words", 0); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_words = __pyx_v_words; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_words); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_words); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":122 + * + * def encode_words(words): + * return tuple(sym_fromstring(word, True) for word in words) # <<<<<<<<<<<<<< + * + * def decode_words(syms): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12encode_words_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __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*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.encode_words", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_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 PyObject *__pyx_pw_4cdec_2sa_3_sa_15decode_words(PyObject *__pyx_self, PyObject *__pyx_v_syms) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("decode_words (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14decode_words(__pyx_self, ((PyObject *)__pyx_v_syms)); + __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 */ + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":125 + * + * def decode_words(syms): + * return tuple(sym_tostring(sym) for sym in syms) # <<<<<<<<<<<<<< + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_12decode_words_genexpr(PyObject *__pyx_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_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_14_genexpr *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_14_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_13_decode_words *) __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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + 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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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)) { + __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; + } + 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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sym); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sym); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_sym = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_sym); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("genexpr", __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; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124 + * return tuple(sym_fromstring(word, True) for word in words) + * + * def decode_words(syms): # <<<<<<<<<<<<<< + * return tuple(sym_tostring(sym) for sym in syms) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14decode_words(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_syms) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decode_words", 0); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_syms = __pyx_v_syms; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_syms); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_syms); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":125 + * + * def decode_words(syms): + * return tuple(sym_tostring(sym) for sym in syms) # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_pf_4cdec_2sa_3_sa_12decode_words_genexpr(((PyObject*)__pyx_cur_scope)); 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __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*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.decode_words", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_words = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__words,0}; + PyObject* values[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 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__words)) != 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[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_words = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), __pyx_v_words); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":6 + * cdef class Phrase: + * + * def __cinit__(self, words): # <<<<<<<<<<<<<< + * cdef int i, j, n, n_vars + * n_vars = 0 + */ + +static int __pyx_pf_4cdec_2sa_3_sa_6Phrase___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_words) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_n; + int __pyx_v_n_vars; + int __pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":8 + * def __cinit__(self, words): + * cdef int i, j, n, n_vars + * n_vars = 0 # <<<<<<<<<<<<<< + * n = len(words) + * self.syms = malloc(n*sizeof(int)) + */ + __pyx_v_n_vars = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":9 + * cdef int i, j, n, n_vars + * n_vars = 0 + * n = len(words) # <<<<<<<<<<<<<< + * self.syms = malloc(n*sizeof(int)) + * for i from 0 <= i < n: + */ + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":10 + * n_vars = 0 + * n = len(words) + * self.syms = malloc(n*sizeof(int)) # <<<<<<<<<<<<<< + * for i from 0 <= i < n: + * self.syms[i] = words[i] + */ + __pyx_v_self->syms = ((int *)malloc((__pyx_v_n * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":11 + * n = len(words) + * self.syms = malloc(n*sizeof(int)) + * for i from 0 <= i < n: # <<<<<<<<<<<<<< + * self.syms[i] = words[i] + * if sym_isvar(self.syms[i]): + */ + __pyx_t_2 = __pyx_v_n; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":12 + * self.syms = malloc(n*sizeof(int)) + * for i from 0 <= i < n: + * self.syms[i] = words[i] # <<<<<<<<<<<<<< + * if sym_isvar(self.syms[i]): + * n_vars += 1 + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_words, __pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + (__pyx_v_self->syms[__pyx_v_i]) = __pyx_t_4; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":13 + * for i from 0 <= i < n: + * self.syms[i] = words[i] + * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< + * n_vars += 1 + * self.n = n + */ + __pyx_t_5 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":14 + * self.syms[i] = words[i] + * if sym_isvar(self.syms[i]): + * n_vars += 1 # <<<<<<<<<<<<<< + * self.n = n + * self.n_vars = n_vars + */ + __pyx_v_n_vars = (__pyx_v_n_vars + 1); + goto __pyx_L5; + } + __pyx_L5:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":15 + * if sym_isvar(self.syms[i]): + * n_vars += 1 + * self.n = n # <<<<<<<<<<<<<< + * self.n_vars = n_vars + * self.varpos = malloc(n_vars*sizeof(int)) + */ + __pyx_v_self->n = __pyx_v_n; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":16 + * n_vars += 1 + * self.n = n + * self.n_vars = n_vars # <<<<<<<<<<<<<< + * self.varpos = malloc(n_vars*sizeof(int)) + * j = 0 + */ + __pyx_v_self->n_vars = __pyx_v_n_vars; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":17 + * self.n = n + * self.n_vars = n_vars + * self.varpos = malloc(n_vars*sizeof(int)) # <<<<<<<<<<<<<< + * j = 0 + * for i from 0 <= i < n: + */ + __pyx_v_self->varpos = ((int *)malloc((__pyx_v_n_vars * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":18 + * self.n_vars = n_vars + * self.varpos = malloc(n_vars*sizeof(int)) + * j = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < n: + * if sym_isvar(self.syms[i]): + */ + __pyx_v_j = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":19 + * self.varpos = malloc(n_vars*sizeof(int)) + * j = 0 + * for i from 0 <= i < n: # <<<<<<<<<<<<<< + * if sym_isvar(self.syms[i]): + * self.varpos[j] = i + */ + __pyx_t_2 = __pyx_v_n; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":20 + * j = 0 + * for i from 0 <= i < n: + * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< + * self.varpos[j] = i + * j = j + 1 + */ + __pyx_t_5 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":21 + * for i from 0 <= i < n: + * if sym_isvar(self.syms[i]): + * self.varpos[j] = i # <<<<<<<<<<<<<< + * j = j + 1 + * + */ + (__pyx_v_self->varpos[__pyx_v_j]) = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":22 + * if sym_isvar(self.syms[i]): + * self.varpos[j] = i + * j = j + 1 # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_v_j = (__pyx_v_j + 1); + goto __pyx_L8; + } + __pyx_L8:; + } + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_4cdec_2sa_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_6Phrase_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":24 + * j = j + 1 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * free(self.syms) + * free(self.varpos) + */ + +static void __pyx_pf_4cdec_2sa_3_sa_6Phrase_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":25 + * + * def __dealloc__(self): + * free(self.syms) # <<<<<<<<<<<<<< + * free(self.varpos) + * + */ + free(__pyx_v_self->syms); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":26 + * def __dealloc__(self): + * free(self.syms) + * free(self.varpos) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + free(__pyx_v_self->varpos); + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":28 + * free(self.varpos) + * + * def __str__(self): # <<<<<<<<<<<<<< + * strs = [] + * cdef int i, s + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_4__str__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { + PyObject *__pyx_v_strs = NULL; + int __pyx_v_i; + int __pyx_v_s; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":29 + * + * def __str__(self): + * strs = [] # <<<<<<<<<<<<<< + * cdef int i, s + * for i from 0 <= i < self.n: + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_strs = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":31 + * strs = [] + * cdef int i, s + * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< + * s = self.syms[i] + * strs.append(sym_tostring(s)) + */ + __pyx_t_2 = __pyx_v_self->n; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":32 + * cdef int i, s + * for i from 0 <= i < self.n: + * s = self.syms[i] # <<<<<<<<<<<<<< + * strs.append(sym_tostring(s)) + * return ' '.join(strs) + */ + __pyx_v_s = (__pyx_v_self->syms[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":33 + * for i from 0 <= i < self.n: + * s = self.syms[i] + * strs.append(sym_tostring(s)) # <<<<<<<<<<<<<< + * return ' '.join(strs) + * + */ + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_strs, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":34 + * s = self.syms[i] + * strs.append(sym_tostring(s)) + * return ' '.join(strs) # <<<<<<<<<<<<<< + * + * def handle(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 34; __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[7]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_strs)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_strs)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_strs)); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_strs); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_6Phrase_6handle[] = "return a hashable representation that normalizes the ordering\n of the nonterminal indices"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_7handle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("handle (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":36 + * return ' '.join(strs) + * + * def handle(self): # <<<<<<<<<<<<<< + * """return a hashable representation that normalizes the ordering + * of the nonterminal indices""" + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_6handle(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { + PyObject *__pyx_v_norm = NULL; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_s; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":39 + * """return a hashable representation that normalizes the ordering + * of the nonterminal indices""" + * norm = [] # <<<<<<<<<<<<<< + * cdef int i, j, s + * i = 1 + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_norm = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":41 + * norm = [] + * cdef int i, j, s + * i = 1 # <<<<<<<<<<<<<< + * j = 0 + * for j from 0 <= j < self.n: + */ + __pyx_v_i = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":42 + * cdef int i, j, s + * i = 1 + * j = 0 # <<<<<<<<<<<<<< + * for j from 0 <= j < self.n: + * s = self.syms[j] + */ + __pyx_v_j = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":43 + * i = 1 + * j = 0 + * for j from 0 <= j < self.n: # <<<<<<<<<<<<<< + * s = self.syms[j] + * if sym_isvar(s): + */ + __pyx_t_2 = __pyx_v_self->n; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":44 + * j = 0 + * for j from 0 <= j < self.n: + * s = self.syms[j] # <<<<<<<<<<<<<< + * if sym_isvar(s): + * s = sym_setindex(s,i) + */ + __pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":45 + * for j from 0 <= j < self.n: + * s = self.syms[j] + * if sym_isvar(s): # <<<<<<<<<<<<<< + * s = sym_setindex(s,i) + * i = i + 1 + */ + __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_s) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":46 + * s = self.syms[j] + * if sym_isvar(s): + * s = sym_setindex(s,i) # <<<<<<<<<<<<<< + * i = i + 1 + * norm.append(s) + */ + __pyx_v_s = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":47 + * if sym_isvar(s): + * s = sym_setindex(s,i) + * i = i + 1 # <<<<<<<<<<<<<< + * norm.append(s) + * return tuple(norm) + */ + __pyx_v_i = (__pyx_v_i + 1); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":48 + * s = sym_setindex(s,i) + * i = i + 1 + * norm.append(s) # <<<<<<<<<<<<<< + * return tuple(norm) + * + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_norm, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":49 + * i = i + 1 + * norm.append(s) + * return tuple(norm) # <<<<<<<<<<<<<< + * + * def strhandle(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)PyList_AsTuple(__pyx_v_norm)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.handle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_norm); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_9strhandle(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("strhandle (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":51 + * return tuple(norm) + * + * def strhandle(self): # <<<<<<<<<<<<<< + * norm = [] + * cdef int i, j, s + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_8strhandle(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { + PyObject *__pyx_v_norm = NULL; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_s; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("strhandle", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":52 + * + * def strhandle(self): + * norm = [] # <<<<<<<<<<<<<< + * cdef int i, j, s + * i = 1 + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_norm = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":54 + * norm = [] + * cdef int i, j, s + * i = 1 # <<<<<<<<<<<<<< + * j = 0 + * for j from 0 <= j < self.n: + */ + __pyx_v_i = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":55 + * cdef int i, j, s + * i = 1 + * j = 0 # <<<<<<<<<<<<<< + * for j from 0 <= j < self.n: + * s = self.syms[j] + */ + __pyx_v_j = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":56 + * i = 1 + * j = 0 + * for j from 0 <= j < self.n: # <<<<<<<<<<<<<< + * s = self.syms[j] + * if sym_isvar(s): + */ + __pyx_t_2 = __pyx_v_self->n; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":57 + * j = 0 + * for j from 0 <= j < self.n: + * s = self.syms[j] # <<<<<<<<<<<<<< + * if sym_isvar(s): + * s = sym_setindex(s,i) + */ + __pyx_v_s = (__pyx_v_self->syms[__pyx_v_j]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":58 + * for j from 0 <= j < self.n: + * s = self.syms[j] + * if sym_isvar(s): # <<<<<<<<<<<<<< + * s = sym_setindex(s,i) + * i = i + 1 + */ + __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_s) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":59 + * s = self.syms[j] + * if sym_isvar(s): + * s = sym_setindex(s,i) # <<<<<<<<<<<<<< + * i = i + 1 + * norm.append(sym_tostring(s)) + */ + __pyx_v_s = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_s, __pyx_v_i); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":60 + * if sym_isvar(s): + * s = sym_setindex(s,i) + * i = i + 1 # <<<<<<<<<<<<<< + * norm.append(sym_tostring(s)) + * return ' '.join(norm) + */ + __pyx_v_i = (__pyx_v_i + 1); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":61 + * s = sym_setindex(s,i) + * i = i + 1 + * norm.append(sym_tostring(s)) # <<<<<<<<<<<<<< + * return ' '.join(norm) + * + */ + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_norm, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":62 + * i = i + 1 + * norm.append(sym_tostring(s)) + * return ' '.join(norm) # <<<<<<<<<<<<<< + * + * def arity(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __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[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_norm)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_norm)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_norm)); + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.strhandle", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_norm); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_11arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arity (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_10arity(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":64 + * return ' '.join(norm) + * + * def arity(self): # <<<<<<<<<<<<<< + * return self.n_vars + * + */ + +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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":65 + * + * def arity(self): + * return self.n_vars # <<<<<<<<<<<<<< + * + * def getvarpos(self, i): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__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; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_13getvarpos(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getvarpos (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":67 + * return self.n_vars + * + * def getvarpos(self, i): # <<<<<<<<<<<<<< + * if 0 <= i < self.n_vars: + * return self.varpos[i] + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_12getvarpos(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { + 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_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("getvarpos", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":68 + * + * def getvarpos(self, i): + * if 0 <= i < self.n_vars: # <<<<<<<<<<<<<< + * return self.varpos[i] + * else: + */ + __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 = PyInt_FromLong(__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_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":69 + * def getvarpos(self, i): + * if 0 <= i < self.n_vars: + * return self.varpos[i] # <<<<<<<<<<<<<< + * else: + * 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 = PyInt_FromLong((__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_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":71 + * return self.varpos[i] + * else: + * raise IndexError # <<<<<<<<<<<<<< + * + * def getvar(self, i): + */ + __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.getvarpos", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_15getvar(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getvar (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":73 + * raise IndexError + * + * def getvar(self, i): # <<<<<<<<<<<<<< + * if 0 <= i < self.n_vars: + * return self.syms[self.varpos[i]] + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_14getvar(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { + 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_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("getvar", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":74 + * + * def getvar(self, i): + * if 0 <= i < self.n_vars: # <<<<<<<<<<<<<< + * return self.syms[self.varpos[i]] + * else: + */ + __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 = PyInt_FromLong(__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_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":75 + * def getvar(self, i): + * if 0 <= i < self.n_vars: + * return self.syms[self.varpos[i]] # <<<<<<<<<<<<<< + * else: + * 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 = PyInt_FromLong((__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_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":77 + * return self.syms[self.varpos[i]] + * else: + * raise IndexError # <<<<<<<<<<<<<< + * + * cdef int chunkpos(self, int k): + */ + __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); + {__pyx_filename = __pyx_f[7]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.getvar", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":79 + * raise IndexError + * + * cdef int chunkpos(self, int k): # <<<<<<<<<<<<<< + * if k == 0: + * return 0 + */ + +int __pyx_f_4cdec_2sa_3_sa_6Phrase_chunkpos(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, int __pyx_v_k) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("chunkpos", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":80 + * + * cdef int chunkpos(self, int k): + * if k == 0: # <<<<<<<<<<<<<< + * return 0 + * else: + */ + __pyx_t_1 = ((__pyx_v_k == 0) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":81 + * cdef int chunkpos(self, int k): + * if k == 0: + * return 0 # <<<<<<<<<<<<<< + * else: + * return self.varpos[k-1]+1 + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":83 + * return 0 + * else: + * return self.varpos[k-1]+1 # <<<<<<<<<<<<<< + * + * cdef int chunklen(self, int k): + */ + __pyx_r = ((__pyx_v_self->varpos[(__pyx_v_k - 1)]) + 1); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":85 + * return self.varpos[k-1]+1 + * + * cdef int chunklen(self, int k): # <<<<<<<<<<<<<< + * if self.n_vars == 0: + * return self.n + */ + +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; + __Pyx_RefNannySetupContext("chunklen", 0); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":87 + * cdef int chunklen(self, int k): + * if self.n_vars == 0: + * return self.n # <<<<<<<<<<<<<< + * elif k == 0: + * return self.varpos[0] + */ + __pyx_r = __pyx_v_self->n; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":89 + * return self.n + * elif k == 0: + * return self.varpos[0] # <<<<<<<<<<<<<< + * elif k == self.n_vars: + * return self.n-self.varpos[k-1]-1 + */ + __pyx_r = (__pyx_v_self->varpos[0]); + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":91 + * return self.varpos[0] + * elif k == self.n_vars: + * return self.n-self.varpos[k-1]-1 # <<<<<<<<<<<<<< + * else: + * return self.varpos[k]-self.varpos[k-1]-1 + */ + __pyx_r = ((__pyx_v_self->n - (__pyx_v_self->varpos[(__pyx_v_k - 1)])) - 1); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":93 + * return self.n-self.varpos[k-1]-1 + * else: + * return self.varpos[k]-self.varpos[k-1]-1 # <<<<<<<<<<<<<< + * + * def clen(self, k): + */ + __pyx_r = (((__pyx_v_self->varpos[__pyx_v_k]) - (__pyx_v_self->varpos[(__pyx_v_k - 1)])) - 1); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_17clen(PyObject *__pyx_v_self, PyObject *__pyx_v_k) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clen (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_k)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":95 + * return self.varpos[k]-self.varpos[k-1]-1 + * + * def clen(self, k): # <<<<<<<<<<<<<< + * return self.chunklen(k) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_16clen(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_k) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("clen", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":96 + * + * def clen(self, k): + * return self.chunklen(k) # <<<<<<<<<<<<<< + * + * def getchunk(self, ci): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_k); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase *)__pyx_v_self->__pyx_vtab)->chunklen(__pyx_v_self, __pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 96; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.clen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_19getchunk(PyObject *__pyx_v_self, PyObject *__pyx_v_ci) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getchunk (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_ci)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":98 + * return self.chunklen(k) + * + * def getchunk(self, ci): # <<<<<<<<<<<<<< + * cdef int start, stop + * start = self.chunkpos(ci) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_18getchunk(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_ci) { + int __pyx_v_start; + int __pyx_v_stop; + PyObject *__pyx_v_chunk = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("getchunk", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":100 + * def getchunk(self, ci): + * cdef int start, stop + * start = self.chunkpos(ci) # <<<<<<<<<<<<<< + * stop = start+self.chunklen(ci) + * chunk = [] + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":101 + * cdef int start, stop + * start = self.chunkpos(ci) + * stop = start+self.chunklen(ci) # <<<<<<<<<<<<<< + * chunk = [] + * for i from start <= i < stop: + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":102 + * start = self.chunkpos(ci) + * stop = start+self.chunklen(ci) + * chunk = [] # <<<<<<<<<<<<<< + * for i from start <= i < stop: + * chunk.append(self.syms[i]) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_chunk = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":103 + * stop = start+self.chunklen(ci) + * chunk = [] + * for i from start <= i < stop: # <<<<<<<<<<<<<< + * chunk.append(self.syms[i]) + * return chunk + */ + __pyx_t_1 = __pyx_v_stop; + for (__pyx_v_i = __pyx_v_start; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":104 + * chunk = [] + * for i from start <= i < stop: + * chunk.append(self.syms[i]) # <<<<<<<<<<<<<< + * return chunk + * + */ + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_chunk, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":105 + * for i from start <= i < stop: + * chunk.append(self.syms[i]) + * return chunk # <<<<<<<<<<<<<< + * + * def __cmp__(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_chunk)); + __pyx_r = ((PyObject *)__pyx_v_chunk); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.getchunk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chunk); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#if PY_MAJOR_VERSION < 3 +static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_6Phrase_21__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cmp__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +#endif /*!(#if PY_MAJOR_VERSION < 3)*/ + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":107 + * return chunk + * + * def __cmp__(self, other): # <<<<<<<<<<<<<< + * cdef Phrase otherp + * cdef int i + */ + +#if PY_MAJOR_VERSION < 3 +static int __pyx_pf_4cdec_2sa_3_sa_6Phrase_20__cmp__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_other) { + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_otherp = 0; + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cmp__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":110 + * cdef Phrase otherp + * cdef int i + * otherp = other # <<<<<<<<<<<<<< + * for i from 0 <= i < min(self.n, otherp.n): + * if self.syms[i] < otherp.syms[i]: + */ + if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_4cdec_2sa_3_sa_Phrase))))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_other); + __pyx_v_otherp = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_other); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":111 + * cdef int i + * otherp = other + * for i from 0 <= i < min(self.n, otherp.n): # <<<<<<<<<<<<<< + * if self.syms[i] < otherp.syms[i]: + * return -1 + */ + __pyx_t_1 = __pyx_v_otherp->n; + __pyx_t_2 = __pyx_v_self->n; + if (((__pyx_t_1 < __pyx_t_2) != 0)) { + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_2; + } + __pyx_t_1 = __pyx_t_3; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":112 + * otherp = other + * for i from 0 <= i < min(self.n, otherp.n): + * if self.syms[i] < otherp.syms[i]: # <<<<<<<<<<<<<< + * return -1 + * elif self.syms[i] > otherp.syms[i]: + */ + __pyx_t_4 = (((__pyx_v_self->syms[__pyx_v_i]) < (__pyx_v_otherp->syms[__pyx_v_i])) != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":113 + * for i from 0 <= i < min(self.n, otherp.n): + * if self.syms[i] < otherp.syms[i]: + * return -1 # <<<<<<<<<<<<<< + * elif self.syms[i] > otherp.syms[i]: + * return 1 + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":114 + * if self.syms[i] < otherp.syms[i]: + * return -1 + * elif self.syms[i] > otherp.syms[i]: # <<<<<<<<<<<<<< + * return 1 + * if self.n < otherp.n: + */ + __pyx_t_4 = (((__pyx_v_self->syms[__pyx_v_i]) > (__pyx_v_otherp->syms[__pyx_v_i])) != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":115 + * return -1 + * elif self.syms[i] > otherp.syms[i]: + * return 1 # <<<<<<<<<<<<<< + * if self.n < otherp.n: + * return -1 + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":116 + * elif self.syms[i] > otherp.syms[i]: + * return 1 + * if self.n < otherp.n: # <<<<<<<<<<<<<< + * return -1 + * elif self.n > otherp.n: + */ + __pyx_t_4 = ((__pyx_v_self->n < __pyx_v_otherp->n) != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":117 + * return 1 + * if self.n < otherp.n: + * return -1 # <<<<<<<<<<<<<< + * elif self.n > otherp.n: + * return 1 + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L6; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":118 + * if self.n < otherp.n: + * return -1 + * elif self.n > otherp.n: # <<<<<<<<<<<<<< + * return 1 + * else: + */ + __pyx_t_4 = ((__pyx_v_self->n > __pyx_v_otherp->n) != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":119 + * return -1 + * elif self.n > otherp.n: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":121 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * def __hash__(self): + */ + __pyx_r = 0; + goto __pyx_L0; + } + __pyx_L6:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_otherp); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +#endif /*!(#if PY_MAJOR_VERSION < 3)*/ + +/* Python wrapper */ +static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self); /*proto*/ +static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_23__hash__(PyObject *__pyx_v_self) { + Py_hash_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":123 + * return 0 + * + * def __hash__(self): # <<<<<<<<<<<<<< + * cdef int i + * cdef unsigned h + */ + +static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_22__hash__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { + int __pyx_v_i; + unsigned int __pyx_v_h; + Py_hash_t __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__hash__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":126 + * cdef int i + * cdef unsigned h + * h = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < self.n: + * if self.syms[i] > 0: + */ + __pyx_v_h = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":127 + * cdef unsigned h + * h = 0 + * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< + * if self.syms[i] > 0: + * h = (h << 1) + self.syms[i] + */ + __pyx_t_1 = __pyx_v_self->n; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":128 + * h = 0 + * for i from 0 <= i < self.n: + * if self.syms[i] > 0: # <<<<<<<<<<<<<< + * h = (h << 1) + self.syms[i] + * else: + */ + __pyx_t_2 = (((__pyx_v_self->syms[__pyx_v_i]) > 0) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":129 + * for i from 0 <= i < self.n: + * if self.syms[i] > 0: + * h = (h << 1) + self.syms[i] # <<<<<<<<<<<<<< + * else: + * h = (h << 1) + -self.syms[i] + */ + __pyx_v_h = ((__pyx_v_h << 1) + (__pyx_v_self->syms[__pyx_v_i])); + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":131 + * h = (h << 1) + self.syms[i] + * else: + * h = (h << 1) + -self.syms[i] # <<<<<<<<<<<<<< + * return h + * + */ + __pyx_v_h = ((__pyx_v_h << 1) + (-(__pyx_v_self->syms[__pyx_v_i]))); + } + __pyx_L5:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":132 + * else: + * h = (h << 1) + -self.syms[i] + * return h # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __pyx_r = __pyx_v_h; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":134 + * return h + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.n + * + */ + +static Py_ssize_t __pyx_pf_4cdec_2sa_3_sa_6Phrase_24__len__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":135 + * + * def __len__(self): + * return self.n # <<<<<<<<<<<<<< + * + * def __getitem__(self, i): + */ + __pyx_r = __pyx_v_self->n; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_27__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":137 + * return self.n + * + * def __getitem__(self, i): # <<<<<<<<<<<<<< + * return self.syms[i] + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_26__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":138 + * + * def __getitem__(self, i): + * return self.syms[i] # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->syms[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 138; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.__getitem__", __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_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_29__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_28__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":140 + * return self.syms[i] + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i from 0 <= i < self.n: + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_28__iter__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + __pyx_cur_scope = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *)__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(__pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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(); + return __pyx_r; +} + +static PyObject *__pyx_gb_4cdec_2sa_3_sa_6Phrase_30generator2(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *__pyx_cur_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = 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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":142 + * def __iter__(self): + * cdef int i + * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< + * yield self.syms[i] + * + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":143 + * cdef int i + * for i from 0 <= i < self.n: + * yield self.syms[i] # <<<<<<<<<<<<<< + * + * def subst(self, start, children): + */ + __pyx_t_2 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_self->syms[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 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_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_32subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_children = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("subst (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__children,0}; + PyObject* values[2] = {0,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__start)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__children)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subst") < 0)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_start = values[0]; + __pyx_v_children = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_31subst(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self), __pyx_v_start, __pyx_v_children); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":145 + * yield self.syms[i] + * + * def subst(self, start, children): # <<<<<<<<<<<<<< + * cdef int i + * for i from 0 <= i < self.n: + */ + +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) { + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + long __pyx_t_3; + 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("subst", 0); + __Pyx_INCREF(__pyx_v_start); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":147 + * def subst(self, start, children): + * cdef int i + * for i from 0 <= i < self.n: # <<<<<<<<<<<<<< + * if sym_isvar(self.syms[i]): + * start = start + children[sym_getindex(self.syms[i])-1] + */ + __pyx_t_1 = __pyx_v_self->n; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":148 + * cdef int i + * for i from 0 <= i < self.n: + * if sym_isvar(self.syms[i]): # <<<<<<<<<<<<<< + * start = start + children[sym_getindex(self.syms[i])-1] + * else: + */ + __pyx_t_2 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_self->syms[__pyx_v_i])) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * else: + * start = start + (self.syms[i],) + */ + __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_getindex((__pyx_v_self->syms[__pyx_v_i])) - 1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_children, __pyx_t_3, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":151 + * start = start + children[sym_getindex(self.syms[i])-1] + * else: + * start = start + (self.syms[i],) # <<<<<<<<<<<<<< + * return start + * + */ + __pyx_t_5 = PyInt_FromLong((__pyx_v_self->syms[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 151; __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[7]; __pyx_lineno = 151; __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 = PyNumber_Add(__pyx_v_start, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_t_5; + __pyx_t_5 = 0; + } + __pyx_L5:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":152 + * else: + * start = start + (self.syms[i],) + * return start # <<<<<<<<<<<<<< + * + * property words: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_start); + __pyx_r = __pyx_v_start; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.subst", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_start); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_6Phrase_5words_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":155 + * + * property words: + * def __get__(self): # <<<<<<<<<<<<<< + * return [sym_tostring(w) for w in self if not sym_isvar(w)] + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_6Phrase_5words___get__(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_self) { + PyObject *__pyx_v_w = NULL; + PyObject *__pyx_r = NULL; + __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; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "/home/mdenkows/cdec/python/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: + */ + __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))) { + __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; + } + 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 + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_w); + __pyx_v_w = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_6) != 0)) != 0); + if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + goto __pyx_L5; + } + __pyx_L5:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cdec.sa._sa.Phrase.words.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_w); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_lhs; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_f = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_e = 0; + PyObject *__pyx_v_scores = 0; + PyObject *__pyx_v_word_alignments = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (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__word_alignments,0}; + PyObject* values[5] = {0,0,0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":160 + * cdef class Rule: + * + * 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 + */ + values[3] = ((PyObject *)Py_None); + values[4] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__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--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[7]; __pyx_lineno = 160; __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;} + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scores); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word_alignments); + if (value) { values[4] = 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[7]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_lhs = __Pyx_PyInt_AsInt(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_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]; + __pyx_v_word_alignments = values[4]; + } + 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_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;} + __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); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + 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("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":161 + * + * 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 + * self.f = f + */ + __pyx_t_1 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_v_lhs) != 0)) != 0); + if (__pyx_t_1) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_lhs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_70), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__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_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__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_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__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;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":162 + * 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 # <<<<<<<<<<<<<< + * self.f = f + * self.e = e + */ + __pyx_v_self->lhs = __pyx_v_lhs; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":163 + * if not sym_isvar(lhs): raise Exception('Invalid LHS symbol: %d' % lhs) + * self.lhs = lhs + * self.f = f # <<<<<<<<<<<<<< + * self.e = e + * self.word_alignments = word_alignments + */ + __Pyx_INCREF(((PyObject *)__pyx_v_f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); + __Pyx_GOTREF(__pyx_v_self->f); + __Pyx_DECREF(((PyObject *)__pyx_v_self->f)); + __pyx_v_self->f = __pyx_v_f; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":164 + * self.lhs = lhs + * self.f = f + * self.e = e # <<<<<<<<<<<<<< + * self.word_alignments = word_alignments + * self.scores = scores + */ + __Pyx_INCREF(((PyObject *)__pyx_v_e)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_e)); + __Pyx_GOTREF(__pyx_v_self->e); + __Pyx_DECREF(((PyObject *)__pyx_v_self->e)); + __pyx_v_self->e = __pyx_v_e; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":165 + * self.f = f + * self.e = e + * self.word_alignments = word_alignments # <<<<<<<<<<<<<< + * self.scores = scores + * + */ + __Pyx_INCREF(__pyx_v_word_alignments); + __Pyx_GIVEREF(__pyx_v_word_alignments); + __Pyx_GOTREF(__pyx_v_self->word_alignments); + __Pyx_DECREF(__pyx_v_self->word_alignments); + __pyx_v_self->word_alignments = __pyx_v_word_alignments; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":166 + * 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;} + __Pyx_INCREF(__pyx_v_scores); + __Pyx_GIVEREF(__pyx_v_scores); + __Pyx_GOTREF(__pyx_v_self->scores); + __Pyx_DECREF(((PyObject *)__pyx_v_self->scores)); + __pyx_v_self->scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_scores); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.Rule.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self); /*proto*/ +static Py_hash_t __pyx_pw_4cdec_2sa_3_sa_4Rule_3__hash__(PyObject *__pyx_v_self) { + Py_hash_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_2__hash__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":168 + * self.scores = scores + * + * def __hash__(self): # <<<<<<<<<<<<<< + * return hash((self.lhs, self.f, self.e)) + * + */ + +static Py_hash_t __pyx_pf_4cdec_2sa_3_sa_4Rule_2__hash__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { + Py_hash_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_hash_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__hash__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":169 + * + * def __hash__(self): + * return hash((self.lhs, self.f, self.e)) # <<<<<<<<<<<<<< + * + * def __cmp__(self, Rule other): + */ + __pyx_t_1 = PyInt_FromLong(__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_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_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self->f)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->f)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->e)); + 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(((PyObject *)__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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.Rule.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +#if PY_MAJOR_VERSION < 3 +static int __pyx_pw_4cdec_2sa_3_sa_4Rule_5__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_4Rule_5__cmp__(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; + 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;} + __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)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +#endif /*!(#if PY_MAJOR_VERSION < 3)*/ + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":171 + * return hash((self.lhs, self.f, self.e)) + * + * 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)) + */ + +#if PY_MAJOR_VERSION < 3 +static int __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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cmp__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":172 + * + * 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 = PyInt_FromLong(__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_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_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self->f)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->f)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->e)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_self->e)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->e)); + __Pyx_INCREF(__pyx_v_self->word_alignments); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_self->word_alignments); + __Pyx_GIVEREF(__pyx_v_self->word_alignments); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":173 + * 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 = PyInt_FromLong(__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_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_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_other->f)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_other->f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_other->f)); + __Pyx_INCREF(((PyObject *)__pyx_v_other->e)); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_other->e)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_other->e)); + __Pyx_INCREF(__pyx_v_self->word_alignments); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_self->word_alignments); + __Pyx_GIVEREF(__pyx_v_self->word_alignments); + __pyx_t_1 = 0; + __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_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__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_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_AsInt(__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.Rule.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +#endif /*!(#if PY_MAJOR_VERSION < 3)*/ + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_7fmerge(PyObject *__pyx_v_self, PyObject *__pyx_v_f) { + 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("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;} + __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)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":175 + * (other.lhs, other.f, other.e, self.word_alignments)) + * + * def fmerge(self, Phrase f): # <<<<<<<<<<<<<< + * if self.f == f: + * self.f = f + */ + +static PyObject *__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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fmerge", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":176 + * + * 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":177 + * def fmerge(self, Phrase f): + * if self.f == f: + * self.f = f # <<<<<<<<<<<<<< + * + * def arity(self): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); + __Pyx_GOTREF(__pyx_v_self->f); + __Pyx_DECREF(((PyObject *)__pyx_v_self->f)); + __pyx_v_self->f = __pyx_v_f; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.Rule.fmerge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_9arity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("arity (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":179 + * self.f = f + * + * def arity(self): # <<<<<<<<<<<<<< + * return self.f.arity() + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_8arity(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("arity", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":180 + * + * def arity(self): + * return self.f.arity() # <<<<<<<<<<<<<< + * + * 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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.Rule.arity", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_11__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_10__str__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__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 */ + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186 + * 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) + * + */ + +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; + 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); + 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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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); + 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 *); + 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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; + #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 + } else { + __pyx_t_2 = __pyx_t_4(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_a); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_a); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_a = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_71), __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(((PyObject *)__pyx_t_2)); + __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_1 = __pyx_t_3; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_cur_scope->__pyx_t_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("genexpr", __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; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":182 + * return self.f.arity() + * + * def __str__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * fields = [sym_tostring(self.lhs), str(self.f), str(self.e), str(self.scores)] + */ + +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; + PyObject *__pyx_v_fields = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + 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); + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":184 + * 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_GOTREF(((PyObject *)__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_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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__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_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__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_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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__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_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__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_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 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__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_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__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_GOTREF(__pyx_t_2); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyList_SET_ITEM(__pyx_t_2, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_v_fields = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":185 + * 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())) + * return ' ||| '.join(fields) + */ + __pyx_t_6 = (__pyx_cur_scope->__pyx_v_self->word_alignments != Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":186 + * 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_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); 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_t_5 = __pyx_pf_4cdec_2sa_3_sa_4Rule_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __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[7]; __pyx_lineno = 186; __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_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":187 + * if self.word_alignments is not None: + * fields.append(' '.join('%d-%d' % a for a in self.alignments())) + * return ' ||| '.join(fields) # <<<<<<<<<<<<<< + * + * def alignments(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_19), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __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[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_fields)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_fields)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_fields)); + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cdec.sa._sa.Rule.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_fields); + __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); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_13alignments(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("alignments (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_12alignments(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":189 + * return ' ||| '.join(fields) + * + * def alignments(self): # <<<<<<<<<<<<<< + * for point in self.word_alignments: + * yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE + */ + +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; + 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); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = 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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":190 + * + * 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)) { + __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_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[7]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_point); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_point); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_point = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rule.pxi":191 + * def alignments(self): + * for point in self.word_alignments: + * yield point / ALIGNMENT_CODE, point % ALIGNMENT_CODE # <<<<<<<<<<<<<< + */ + __pyx_t_4 = PyInt_FromLong(__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_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_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromLong(__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_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_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_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1f_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_1f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cdec/sa/_sa.pxd":37 + * cdef class Rule: + * cdef int lhs + * cdef readonly Phrase f, e # <<<<<<<<<<<<<< + * cdef FeatureVector scores + * cdef int n_scores + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1f___get__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->f)); + __pyx_r = ((PyObject *)__pyx_v_self->f); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_4Rule_1e_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_4Rule_1e___get__(((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_4Rule_1e___get__(struct __pyx_obj_4cdec_2sa_3_sa_Rule *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->e)); + __pyx_r = ((PyObject *)__pyx_v_self->e); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":21 + * int arr_len + * + * cdef _Trie_Node* new_trie_node(): # <<<<<<<<<<<<<< + * cdef _Trie_Node* node + * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) + */ + +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_new_trie_node(void) { + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("new_trie_node", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":23 + * cdef _Trie_Node* new_trie_node(): + * cdef _Trie_Node* node + * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) # <<<<<<<<<<<<<< + * node.root = NULL + * node.arr_len = 0 + */ + __pyx_v_node = ((struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":24 + * cdef _Trie_Node* node + * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) + * node.root = NULL # <<<<<<<<<<<<<< + * node.arr_len = 0 + * node.arr = malloc(sizeof(0*sizeof(int))) + */ + __pyx_v_node->root = NULL; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":25 + * node = <_Trie_Node*> malloc(sizeof(_Trie_Node)) + * node.root = NULL + * node.arr_len = 0 # <<<<<<<<<<<<<< + * node.arr = malloc(sizeof(0*sizeof(int))) + * return node + */ + __pyx_v_node->arr_len = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":26 + * node.root = NULL + * node.arr_len = 0 + * node.arr = malloc(sizeof(0*sizeof(int))) # <<<<<<<<<<<<<< + * return node + * + */ + __pyx_v_node->arr = ((int *)malloc((sizeof((0 * (sizeof(int))))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":27 + * node.arr_len = 0 + * node.arr = malloc(sizeof(0*sizeof(int))) + * return node # <<<<<<<<<<<<<< + * + * cdef _Trie_Edge* new_trie_edge(int val): + */ + __pyx_r = __pyx_v_node; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":29 + * return node + * + * cdef _Trie_Edge* new_trie_edge(int val): # <<<<<<<<<<<<<< + * cdef _Trie_Edge* edge + * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) + */ + +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_f_4cdec_2sa_3_sa_new_trie_edge(int __pyx_v_val) { + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_edge; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("new_trie_edge", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":31 + * cdef _Trie_Edge* new_trie_edge(int val): + * cdef _Trie_Edge* edge + * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) # <<<<<<<<<<<<<< + * edge.node = new_trie_node() + * edge.bigger = NULL + */ + __pyx_v_edge = ((struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *)malloc((sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":32 + * cdef _Trie_Edge* edge + * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) + * edge.node = new_trie_node() # <<<<<<<<<<<<<< + * edge.bigger = NULL + * edge.smaller = NULL + */ + __pyx_v_edge->node = __pyx_f_4cdec_2sa_3_sa_new_trie_node(); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":33 + * edge = <_Trie_Edge*> malloc(sizeof(_Trie_Edge)) + * edge.node = new_trie_node() + * edge.bigger = NULL # <<<<<<<<<<<<<< + * edge.smaller = NULL + * edge.val = val + */ + __pyx_v_edge->bigger = NULL; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":34 + * edge.node = new_trie_node() + * edge.bigger = NULL + * edge.smaller = NULL # <<<<<<<<<<<<<< + * edge.val = val + * return edge + */ + __pyx_v_edge->smaller = NULL; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":35 + * edge.bigger = NULL + * edge.smaller = NULL + * edge.val = val # <<<<<<<<<<<<<< + * return edge + * + */ + __pyx_v_edge->val = __pyx_v_val; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":36 + * edge.smaller = NULL + * edge.val = val + * return edge # <<<<<<<<<<<<<< + * + * cdef free_trie_node(_Trie_Node* node): + */ + __pyx_r = __pyx_v_edge; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":38 + * return edge + * + * cdef free_trie_node(_Trie_Node* node): # <<<<<<<<<<<<<< + * if node != NULL: + * free_trie_edge(node.root) + */ + +static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_node(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("free_trie_node", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":39 + * + * cdef free_trie_node(_Trie_Node* node): + * if node != NULL: # <<<<<<<<<<<<<< + * free_trie_edge(node.root) + * free(node.arr) + */ + __pyx_t_1 = ((__pyx_v_node != NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":40 + * cdef free_trie_node(_Trie_Node* node): + * if node != NULL: + * free_trie_edge(node.root) # <<<<<<<<<<<<<< + * free(node.arr) + * + */ + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_edge(__pyx_v_node->root); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":41 + * if node != NULL: + * free_trie_edge(node.root) + * free(node.arr) # <<<<<<<<<<<<<< + * + * cdef free_trie_edge(_Trie_Edge* edge): + */ + free(__pyx_v_node->arr); + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.free_trie_node", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":43 + * free(node.arr) + * + * cdef free_trie_edge(_Trie_Edge* edge): # <<<<<<<<<<<<<< + * if edge != NULL: + * free_trie_node(edge.node) + */ + +static PyObject *__pyx_f_4cdec_2sa_3_sa_free_trie_edge(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_edge) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("free_trie_edge", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":44 + * + * cdef free_trie_edge(_Trie_Edge* edge): + * if edge != NULL: # <<<<<<<<<<<<<< + * free_trie_node(edge.node) + * free_trie_edge(edge.bigger) + */ + __pyx_t_1 = ((__pyx_v_edge != NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":45 + * cdef free_trie_edge(_Trie_Edge* edge): + * if edge != NULL: + * free_trie_node(edge.node) # <<<<<<<<<<<<<< + * free_trie_edge(edge.bigger) + * free_trie_edge(edge.smaller) + */ + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_node(__pyx_v_edge->node); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":46 + * if edge != NULL: + * free_trie_node(edge.node) + * free_trie_edge(edge.bigger) # <<<<<<<<<<<<<< + * free_trie_edge(edge.smaller) + * + */ + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_edge(__pyx_v_edge->bigger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":47 + * free_trie_node(edge.node) + * free_trie_edge(edge.bigger) + * free_trie_edge(edge.smaller) # <<<<<<<<<<<<<< + * + * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): + */ + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_free_trie_edge(__pyx_v_edge->smaller); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 47; __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:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.free_trie_edge", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":49 + * free_trie_edge(edge.smaller) + * + * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): # <<<<<<<<<<<<<< + * cdef _Trie_Edge* cur + * cur = node.root + */ + +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_find(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_cur; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; + __Pyx_RefNannyDeclarations + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":51 + * cdef _Trie_Node* trie_find(_Trie_Node* node, int val): + * cdef _Trie_Edge* cur + * cur = node.root # <<<<<<<<<<<<<< + * while cur != NULL and cur.val != val: + * if val > cur.val: + */ + __pyx_t_1 = __pyx_v_node->root; + __pyx_v_cur = __pyx_t_1; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":52 + * cdef _Trie_Edge* cur + * cur = node.root + * while cur != NULL and cur.val != val: # <<<<<<<<<<<<<< + * if val > cur.val: + * 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; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (!__pyx_t_4) break; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":54 + * while cur != NULL and cur.val != val: + * if val > cur.val: + * cur = cur.bigger # <<<<<<<<<<<<<< + * elif val < cur.val: + * cur = cur.smaller + */ + __pyx_t_1 = __pyx_v_cur->bigger; + __pyx_v_cur = __pyx_t_1; + goto __pyx_L5; + } + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":56 + * cur = cur.bigger + * elif val < cur.val: + * cur = cur.smaller # <<<<<<<<<<<<<< + * if cur == NULL: + * return NULL + */ + __pyx_t_1 = __pyx_v_cur->smaller; + __pyx_v_cur = __pyx_t_1; + goto __pyx_L5; + } + __pyx_L5:; + } + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":58 + * cur = cur.smaller + * if cur == NULL: + * return NULL # <<<<<<<<<<<<<< + * else: + * return cur.node + */ + __pyx_r = NULL; + goto __pyx_L0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":60 + * return NULL + * else: + * return cur.node # <<<<<<<<<<<<<< + * + * cdef trie_node_data_append(_Trie_Node* node, int val): + */ + __pyx_r = __pyx_v_cur->node; + goto __pyx_L0; + } + __pyx_L6:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":62 + * return cur.node + * + * cdef trie_node_data_append(_Trie_Node* node, int val): # <<<<<<<<<<<<<< + * cdef int new_len + * new_len = node.arr_len + 1 + */ + +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_append(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { + int __pyx_v_new_len; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("trie_node_data_append", 0); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * node.arr = realloc(node.arr, new_len*sizeof(int)) + * node.arr[node.arr_len] = val + */ + __pyx_v_new_len = (__pyx_v_node->arr_len + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":65 + * cdef int new_len + * new_len = node.arr_len + 1 + * node.arr = realloc(node.arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< + * node.arr[node.arr_len] = val + * node.arr_len = new_len + */ + __pyx_v_node->arr = ((int *)realloc(__pyx_v_node->arr, (__pyx_v_new_len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":66 + * new_len = node.arr_len + 1 + * node.arr = realloc(node.arr, new_len*sizeof(int)) + * node.arr[node.arr_len] = val # <<<<<<<<<<<<<< + * node.arr_len = new_len + * + */ + (__pyx_v_node->arr[__pyx_v_node->arr_len]) = __pyx_v_val; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":67 + * node.arr = realloc(node.arr, new_len*sizeof(int)) + * node.arr[node.arr_len] = val + * node.arr_len = new_len # <<<<<<<<<<<<<< + * + * cdef trie_node_data_extend(_Trie_Node* node, int* vals, int num_vals): + */ + __pyx_v_node->arr_len = __pyx_v_new_len; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":69 + * node.arr_len = new_len + * + * cdef trie_node_data_extend(_Trie_Node* node, int* vals, int num_vals): # <<<<<<<<<<<<<< + * cdef int new_len + * new_len = node.arr_len + num_vals + */ + +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_data_extend(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int *__pyx_v_vals, int __pyx_v_num_vals) { + int __pyx_v_new_len; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("trie_node_data_extend", 0); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * node.arr = realloc(node.arr, new_len*sizeof(int)) + * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) + */ + __pyx_v_new_len = (__pyx_v_node->arr_len + __pyx_v_num_vals); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":72 + * cdef int new_len + * new_len = node.arr_len + num_vals + * node.arr = realloc(node.arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< + * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) + * node.arr_len = new_len + */ + __pyx_v_node->arr = ((int *)realloc(__pyx_v_node->arr, (__pyx_v_new_len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":73 + * new_len = node.arr_len + num_vals + * node.arr = realloc(node.arr, new_len*sizeof(int)) + * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) # <<<<<<<<<<<<<< + * node.arr_len = new_len + * + */ + memcpy((__pyx_v_node->arr + __pyx_v_node->arr_len), __pyx_v_vals, (__pyx_v_num_vals * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":74 + * node.arr = realloc(node.arr, new_len*sizeof(int)) + * memcpy(node.arr + node.arr_len, vals, num_vals*sizeof(int)) + * node.arr_len = new_len # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_node->arr_len = __pyx_v_new_len; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":77 + * + * + * cdef _Trie_Node* trie_insert(_Trie_Node* node, int val): # <<<<<<<<<<<<<< + * cdef _Trie_Edge** cur + * cur = &node.root + */ + +static struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_f_4cdec_2sa_3_sa_trie_insert(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, int __pyx_v_val) { + struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge **__pyx_v_cur; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("trie_insert", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":79 + * cdef _Trie_Node* trie_insert(_Trie_Node* node, int val): + * cdef _Trie_Edge** cur + * cur = &node.root # <<<<<<<<<<<<<< + * while cur[0] != NULL and cur[0].val != val: + * if val > cur[0].val: + */ + __pyx_v_cur = (&__pyx_v_node->root); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":80 + * cdef _Trie_Edge** cur + * cur = &node.root + * while cur[0] != NULL and cur[0].val != val: # <<<<<<<<<<<<<< + * if val > cur[0].val: + * 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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (!__pyx_t_3) break; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":82 + * while cur[0] != NULL and cur[0].val != val: + * if val > cur[0].val: + * cur = &cur[0].bigger # <<<<<<<<<<<<<< + * elif val < cur[0].val: + * cur = &cur[0].smaller + */ + __pyx_v_cur = (&(__pyx_v_cur[0])->bigger); + goto __pyx_L5; + } + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":84 + * cur = &cur[0].bigger + * elif val < cur[0].val: + * cur = &cur[0].smaller # <<<<<<<<<<<<<< + * if cur[0] == NULL: + * cur[0] = new_trie_edge(val) + */ + __pyx_v_cur = (&(__pyx_v_cur[0])->smaller); + goto __pyx_L5; + } + __pyx_L5:; + } + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":86 + * cur = &cur[0].smaller + * if cur[0] == NULL: + * cur[0] = new_trie_edge(val) # <<<<<<<<<<<<<< + * return cur[0].node + * + */ + (__pyx_v_cur[0]) = __pyx_f_4cdec_2sa_3_sa_new_trie_edge(__pyx_v_val); + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":87 + * if cur[0] == NULL: + * cur[0] = new_trie_edge(val) + * return cur[0].node # <<<<<<<<<<<<<< + * + * cdef trie_node_to_map(_Trie_Node* node, result, prefix, int include_zeros): + */ + __pyx_r = (__pyx_v_cur[0])->node; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":89 + * return cur[0].node + * + * cdef trie_node_to_map(_Trie_Node* node, result, prefix, int include_zeros): # <<<<<<<<<<<<<< + * cdef IntList arr + * + */ + +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_node_to_map(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node, PyObject *__pyx_v_result, PyObject *__pyx_v_prefix, int __pyx_v_include_zeros) { + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("trie_node_to_map", 0); + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_2 = (__pyx_v_include_zeros != 0); + } + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":93 + * + * if include_zeros or node.arr_len > 0: + * arr = IntList() # <<<<<<<<<<<<<< + * free(arr.arr) + * arr.arr = malloc(node.arr_len * sizeof(int)) + */ + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":94 + * if include_zeros or node.arr_len > 0: + * arr = IntList() + * free(arr.arr) # <<<<<<<<<<<<<< + * arr.arr = malloc(node.arr_len * sizeof(int)) + * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) + */ + free(__pyx_v_arr->arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":95 + * arr = IntList() + * free(arr.arr) + * arr.arr = malloc(node.arr_len * sizeof(int)) # <<<<<<<<<<<<<< + * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) + * arr.len = node.arr_len + */ + __pyx_v_arr->arr = ((int *)malloc((__pyx_v_node->arr_len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":96 + * free(arr.arr) + * arr.arr = malloc(node.arr_len * sizeof(int)) + * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) # <<<<<<<<<<<<<< + * arr.len = node.arr_len + * arr.size = node.arr_len + */ + memcpy(__pyx_v_arr->arr, __pyx_v_node->arr, (__pyx_v_node->arr_len * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":97 + * arr.arr = malloc(node.arr_len * sizeof(int)) + * memcpy(arr.arr, node.arr, node.arr_len * sizeof(int)) + * arr.len = node.arr_len # <<<<<<<<<<<<<< + * arr.size = node.arr_len + * result[prefix] = arr + */ + __pyx_t_4 = __pyx_v_node->arr_len; + __pyx_v_arr->len = __pyx_t_4; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * result[prefix] = arr + * trie_edge_to_map(node.root, result, prefix, include_zeros) + */ + __pyx_t_4 = __pyx_v_node->arr_len; + __pyx_v_arr->size = __pyx_t_4; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":99 + * arr.len = node.arr_len + * arr.size = node.arr_len + * result[prefix] = arr # <<<<<<<<<<<<<< + * trie_edge_to_map(node.root, result, prefix, include_zeros) + * + */ + if (PyObject_SetItem(__pyx_v_result, __pyx_v_prefix, ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":100 + * arr.size = node.arr_len + * result[prefix] = arr + * trie_edge_to_map(node.root, result, prefix, include_zeros) # <<<<<<<<<<<<<< + * + * cdef trie_edge_to_map(_Trie_Edge* edge, result, prefix, int include_zeros): + */ + __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(__pyx_v_node->root, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.trie_node_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_arr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< + * if edge != NULL: + * trie_edge_to_map(edge.smaller, result, prefix, include_zeros) + */ + +static PyObject *__pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(struct __pyx_t_4cdec_2sa_3_sa__Trie_Edge *__pyx_v_edge, PyObject *__pyx_v_result, PyObject *__pyx_v_prefix, int __pyx_v_include_zeros) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + 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("trie_edge_to_map", 0); + __Pyx_INCREF(__pyx_v_prefix); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":103 + * + * 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) + * trie_edge_to_map(edge.bigger, result, prefix, include_zeros) + */ + __pyx_t_1 = ((__pyx_v_edge != NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * trie_edge_to_map(edge.bigger, result, prefix, include_zeros) + * prefix = prefix + (edge.val,) + */ + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(__pyx_v_edge->smaller, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * prefix = prefix + (edge.val,) + * trie_node_to_map(edge.node, result, prefix, include_zeros) + */ + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_edge_to_map(__pyx_v_edge->bigger, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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,) # <<<<<<<<<<<<<< + * trie_node_to_map(edge.node, result, prefix, include_zeros) + * + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_edge->val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 106; __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[11]; __pyx_lineno = 106; __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 = PyNumber_Add(__pyx_v_prefix, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 106; __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_v_prefix); + __pyx_v_prefix = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * cdef class TrieMap: + */ + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_node_to_map(__pyx_v_edge->node, __pyx_v_result, __pyx_v_prefix, __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 107; __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:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.trie_edge_to_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_prefix); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_7TrieMap_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_alphabet_size; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alphabet_size,0}; + PyObject* values[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 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__alphabet_size)) != 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[11]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_alphabet_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_alphabet_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.TrieMap.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), __pyx_v_alphabet_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":114 + * cdef int V + * + * def __cinit__(self, int alphabet_size): # <<<<<<<<<<<<<< + * self.V = alphabet_size + * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) + */ + +static int __pyx_pf_4cdec_2sa_3_sa_7TrieMap___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, int __pyx_v_alphabet_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":115 + * + * def __cinit__(self, int alphabet_size): + * self.V = alphabet_size # <<<<<<<<<<<<<< + * self.root = <_Trie_Node**> malloc(self.V * sizeof(_Trie_Node*)) + * memset(self.root, 0, self.V * sizeof(_Trie_Node*)) + */ + __pyx_v_self->V = __pyx_v_alphabet_size; + + /* "/home/mdenkows/cdec/python/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*)) # <<<<<<<<<<<<<< + * memset(self.root, 0, self.V * sizeof(_Trie_Node*)) + * + */ + __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 *))))); + + /* "/home/mdenkows/cdec/python/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*)) # <<<<<<<<<<<<<< + * + * + */ + memset(__pyx_v_self->root, 0, (__pyx_v_self->V * (sizeof(struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *)))); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_4cdec_2sa_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_4cdec_2sa_3_sa_7TrieMap_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":120 + * + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * cdef int i + * for i from 0 <= i < self.V: + */ + +static void __pyx_pf_4cdec_2sa_3_sa_7TrieMap_2__dealloc__(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self) { + int __pyx_v_i; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__dealloc__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":122 + * def __dealloc__(self): + * cdef int i + * for i from 0 <= i < self.V: # <<<<<<<<<<<<<< + * if self.root[i] != NULL: + * free_trie_node(self.root[i]) + */ + __pyx_t_1 = __pyx_v_self->V; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":123 + * cdef int i + * for i from 0 <= i < self.V: + * if self.root[i] != NULL: # <<<<<<<<<<<<<< + * free_trie_node(self.root[i]) + * free(self.root) + */ + __pyx_t_2 = (((__pyx_v_self->root[__pyx_v_i]) != NULL) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":124 + * for i from 0 <= i < self.V: + * if self.root[i] != NULL: + * free_trie_node(self.root[i]) # <<<<<<<<<<<<<< + * free(self.root) + * + */ + __pyx_t_3 = __pyx_f_4cdec_2sa_3_sa_free_trie_node((__pyx_v_self->root[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L5; + } + __pyx_L5:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":125 + * if self.root[i] != NULL: + * free_trie_node(self.root[i]) + * free(self.root) # <<<<<<<<<<<<<< + * + * + */ + free(__pyx_v_self->root); + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.TrieMap.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_5insert(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("insert (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":128 + * + * + * def insert(self, pattern): # <<<<<<<<<<<<<< + * cdef int* p + * cdef int i, l + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_4insert(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { + int *__pyx_v_p; + int __pyx_v_i; + int __pyx_v_l; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("insert", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":131 + * cdef int* p + * cdef int i, l + * l = len(pattern) # <<<<<<<<<<<<<< + * p = malloc(l*sizeof(int)) + * for i from 0 <= i < l: + */ + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":132 + * cdef int i, l + * l = len(pattern) + * p = malloc(l*sizeof(int)) # <<<<<<<<<<<<<< + * for i from 0 <= i < l: + * p[i] = pattern[i] + */ + __pyx_v_p = ((int *)malloc((__pyx_v_l * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":133 + * l = len(pattern) + * p = malloc(l*sizeof(int)) + * for i from 0 <= i < l: # <<<<<<<<<<<<<< + * p[i] = pattern[i] + * self._insert(p,l) + */ + __pyx_t_2 = __pyx_v_l; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":134 + * p = malloc(l*sizeof(int)) + * for i from 0 <= i < l: + * p[i] = pattern[i] # <<<<<<<<<<<<<< + * self._insert(p,l) + * free(p) + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pattern, __pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + (__pyx_v_p[__pyx_v_i]) = __pyx_t_4; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":135 + * for i from 0 <= i < l: + * p[i] = pattern[i] + * self._insert(p,l) # <<<<<<<<<<<<<< + * free(p) + * + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self->__pyx_vtab)->_insert(__pyx_v_self, __pyx_v_p, __pyx_v_l); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":136 + * p[i] = pattern[i] + * self._insert(p,l) + * free(p) # <<<<<<<<<<<<<< + * + * + */ + free(__pyx_v_p); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.TrieMap.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":139 + * + * + * cdef _Trie_Node* _insert(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<< + * cdef int i + * cdef _Trie_Node* node + */ + +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) { + int __pyx_v_i; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("_insert", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":142 + * cdef int i + * cdef _Trie_Node* node + * if self.root[pattern[0]] == NULL: # <<<<<<<<<<<<<< + * self.root[pattern[0]] = new_trie_node() + * node = self.root[pattern[0]] + */ + __pyx_t_1 = (((__pyx_v_self->root[(__pyx_v_pattern[0])]) == NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":143 + * cdef _Trie_Node* node + * if self.root[pattern[0]] == NULL: + * self.root[pattern[0]] = new_trie_node() # <<<<<<<<<<<<<< + * node = self.root[pattern[0]] + * for i from 1 <= i < pattern_len: + */ + (__pyx_v_self->root[(__pyx_v_pattern[0])]) = __pyx_f_4cdec_2sa_3_sa_new_trie_node(); + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":144 + * if self.root[pattern[0]] == NULL: + * self.root[pattern[0]] = new_trie_node() + * node = self.root[pattern[0]] # <<<<<<<<<<<<<< + * for i from 1 <= i < pattern_len: + * node = trie_insert(node, pattern[i]) + */ + __pyx_v_node = (__pyx_v_self->root[(__pyx_v_pattern[0])]); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":145 + * self.root[pattern[0]] = new_trie_node() + * node = self.root[pattern[0]] + * for i from 1 <= i < pattern_len: # <<<<<<<<<<<<<< + * node = trie_insert(node, pattern[i]) + * return node + */ + __pyx_t_2 = __pyx_v_pattern_len; + for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":146 + * node = self.root[pattern[0]] + * for i from 1 <= i < pattern_len: + * node = trie_insert(node, pattern[i]) # <<<<<<<<<<<<<< + * return node + * + */ + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":147 + * for i from 1 <= i < pattern_len: + * node = trie_insert(node, pattern[i]) + * return node # <<<<<<<<<<<<<< + * + * def contains(self, pattern): + */ + __pyx_r = __pyx_v_node; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_7contains(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("contains (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":149 + * return node + * + * def contains(self, pattern): # <<<<<<<<<<<<<< + * cdef int* p + * cdef int i, l + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_6contains(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_pattern) { + int *__pyx_v_p; + int __pyx_v_i; + int __pyx_v_l; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("contains", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":153 + * cdef int i, l + * cdef _Trie_Node* node + * l = len(pattern) # <<<<<<<<<<<<<< + * p = malloc(l*sizeof(int)) + * for i from 0 <= i < l: + */ + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":154 + * cdef _Trie_Node* node + * l = len(pattern) + * p = malloc(l*sizeof(int)) # <<<<<<<<<<<<<< + * for i from 0 <= i < l: + * p[i] = pattern[i] + */ + __pyx_v_p = ((int *)malloc((__pyx_v_l * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":155 + * l = len(pattern) + * p = malloc(l*sizeof(int)) + * for i from 0 <= i < l: # <<<<<<<<<<<<<< + * p[i] = pattern[i] + * node = self._contains(p,l) + */ + __pyx_t_2 = __pyx_v_l; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":156 + * p = malloc(l*sizeof(int)) + * for i from 0 <= i < l: + * p[i] = pattern[i] # <<<<<<<<<<<<<< + * node = self._contains(p,l) + * free(p) + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pattern, __pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + (__pyx_v_p[__pyx_v_i]) = __pyx_t_4; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":157 + * for i from 0 <= i < l: + * p[i] = pattern[i] + * node = self._contains(p,l) # <<<<<<<<<<<<<< + * free(p) + * if node == NULL: + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":158 + * p[i] = pattern[i] + * node = self._contains(p,l) + * free(p) # <<<<<<<<<<<<<< + * if node == NULL: + * return False + */ + free(__pyx_v_p); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":159 + * node = self._contains(p,l) + * free(p) + * if node == NULL: # <<<<<<<<<<<<<< + * return False + * else: + */ + __pyx_t_5 = ((__pyx_v_node == NULL) != 0); + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":160 + * free(p) + * if node == NULL: + * return False # <<<<<<<<<<<<<< + * else: + * return True + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":162 + * return False + * else: + * return True # <<<<<<<<<<<<<< + * + * cdef _Trie_Node* _contains(self, int* pattern, int pattern_len): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.TrieMap.contains", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":164 + * return True + * + * cdef _Trie_Node* _contains(self, int* pattern, int pattern_len): # <<<<<<<<<<<<<< + * cdef int i + * cdef _Trie_Node* node + */ + +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) { + int __pyx_v_i; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("_contains", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":167 + * cdef int i + * cdef _Trie_Node* node + * node = self.root[pattern[0]] # <<<<<<<<<<<<<< + * i = 1 + * while node != NULL and i < pattern_len: + */ + __pyx_v_node = (__pyx_v_self->root[(__pyx_v_pattern[0])]); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":168 + * cdef _Trie_Node* node + * node = self.root[pattern[0]] + * i = 1 # <<<<<<<<<<<<<< + * while node != NULL and i < pattern_len: + * node = trie_find(node, pattern[i]) + */ + __pyx_v_i = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":169 + * node = self.root[pattern[0]] + * i = 1 + * while node != NULL and i < pattern_len: # <<<<<<<<<<<<<< + * node = trie_find(node, pattern[i]) + * 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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (!__pyx_t_3) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":170 + * i = 1 + * while node != NULL and i < pattern_len: + * node = trie_find(node, pattern[i]) # <<<<<<<<<<<<<< + * i = i+1 + * return node + */ + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_find(__pyx_v_node, (__pyx_v_pattern[__pyx_v_i])); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":171 + * while node != NULL and i < pattern_len: + * node = trie_find(node, pattern[i]) + * i = i+1 # <<<<<<<<<<<<<< + * return node + * + */ + __pyx_v_i = (__pyx_v_i + 1); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":172 + * node = trie_find(node, pattern[i]) + * i = i+1 + * return node # <<<<<<<<<<<<<< + * + * def toMap(self, flag): + */ + __pyx_r = __pyx_v_node; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7TrieMap_9toMap(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("toMap (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_v_self), ((PyObject *)__pyx_v_flag)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":174 + * return node + * + * def toMap(self, flag): # <<<<<<<<<<<<<< + * cdef int i, include_zeros + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7TrieMap_8toMap(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_self, PyObject *__pyx_v_flag) { + int __pyx_v_i; + int __pyx_v_include_zeros; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("toMap", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":177 + * cdef int i, include_zeros + * + * if flag: # <<<<<<<<<<<<<< + * include_zeros=1 + * else: + */ + __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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":178 + * + * if flag: + * include_zeros=1 # <<<<<<<<<<<<<< + * else: + * include_zeros=0 + */ + __pyx_v_include_zeros = 1; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":180 + * include_zeros=1 + * else: + * include_zeros=0 # <<<<<<<<<<<<<< + * result = {} + * for i from 0 <= i < self.V: + */ + __pyx_v_include_zeros = 0; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":181 + * else: + * include_zeros=0 + * result = {} # <<<<<<<<<<<<<< + * for i from 0 <= i < self.V: + * if self.root[i] != NULL: + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_v_result = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":182 + * include_zeros=0 + * result = {} + * for i from 0 <= i < self.V: # <<<<<<<<<<<<<< + * if self.root[i] != NULL: + * trie_node_to_map(self.root[i], result, (i,), include_zeros) + */ + __pyx_t_3 = __pyx_v_self->V; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":183 + * result = {} + * for i from 0 <= i < self.V: + * if self.root[i] != NULL: # <<<<<<<<<<<<<< + * trie_node_to_map(self.root[i], result, (i,), include_zeros) + * return result + */ + __pyx_t_1 = (((__pyx_v_self->root[__pyx_v_i]) != NULL) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __pyx_f_4cdec_2sa_3_sa_trie_node_to_map((__pyx_v_self->root[__pyx_v_i]), ((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_4), __pyx_v_include_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6; + } + __pyx_L6:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":185 + * if self.root[i] != NULL: + * trie_node_to_map(self.root[i], result, (i,), include_zeros) + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.TrieMap.toMap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_14Precomputation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fsarray = 0; + PyObject *__pyx_v_from_stats = 0; + PyObject *__pyx_v_from_binary = 0; + PyObject *__pyx_v_precompute_rank = 0; + PyObject *__pyx_v_precompute_secondary_rank = 0; + PyObject *__pyx_v_max_length = 0; + PyObject *__pyx_v_max_nonterminals = 0; + PyObject *__pyx_v_train_max_initial_size = 0; + PyObject *__pyx_v_train_min_gap_size = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__from_stats,&__pyx_n_s__from_binary,&__pyx_n_s__precompute_rank,&__pyx_n_s_72,&__pyx_n_s__max_length,&__pyx_n_s__max_nonterminals,&__pyx_n_s_73,&__pyx_n_s__train_min_gap_size,0}; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":200 + * cdef write_map(self, m, FILE* f) + * + * def __cinit__(self, fsarray=None, from_stats=None, from_binary=None, # <<<<<<<<<<<<<< + * precompute_rank=1000, precompute_secondary_rank=20, + * max_length=5, max_nonterminals=2, + */ + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); + values[3] = ((PyObject *)__pyx_int_1000); + values[4] = ((PyObject *)__pyx_int_20); + values[5] = ((PyObject *)__pyx_int_5); + values[6] = ((PyObject *)__pyx_int_2); + values[7] = ((PyObject *)__pyx_int_10); + values[8] = ((PyObject *)__pyx_int_2); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__fsarray); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_stats); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_binary); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__precompute_rank); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_72); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_length); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_nonterminals); + if (value) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_73); + if (value) { values[7] = value; kw_args--; } + } + case 8: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__train_min_gap_size); + if (value) { values[8] = 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[11]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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_fsarray = values[0]; + __pyx_v_from_stats = values[1]; + __pyx_v_from_binary = values[2]; + __pyx_v_precompute_rank = values[3]; + __pyx_v_precompute_secondary_rank = values[4]; + __pyx_v_max_length = values[5]; + __pyx_v_max_nonterminals = values[6]; + __pyx_v_train_max_initial_size = values[7]; + __pyx_v_train_min_gap_size = values[8]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_from_stats, __pyx_v_from_binary, __pyx_v_precompute_rank, __pyx_v_precompute_secondary_rank, __pyx_v_max_length, __pyx_v_max_nonterminals, __pyx_v_train_max_initial_size, __pyx_v_train_min_gap_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_14Precomputation___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_fsarray, PyObject *__pyx_v_from_stats, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_precompute_rank, PyObject *__pyx_v_precompute_secondary_rank, PyObject *__pyx_v_max_length, PyObject *__pyx_v_max_nonterminals, PyObject *__pyx_v_train_max_initial_size, PyObject *__pyx_v_train_min_gap_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + 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); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * self.precompute_secondary_rank = precompute_secondary_rank + * self.max_length = max_length + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__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; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * self.max_length = max_length + * self.max_nonterminals = max_nonterminals + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":206 + * self.precompute_rank = precompute_rank + * self.precompute_secondary_rank = precompute_secondary_rank + * self.max_length = max_length # <<<<<<<<<<<<<< + * self.max_nonterminals = max_nonterminals + * self.train_max_initial_size = train_max_initial_size + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":207 + * self.precompute_secondary_rank = precompute_secondary_rank + * self.max_length = max_length + * self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<< + * self.train_max_initial_size = train_max_initial_size + * self.train_min_gap_size = train_min_gap_size + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":208 + * self.max_length = max_length + * self.max_nonterminals = max_nonterminals + * self.train_max_initial_size = train_max_initial_size # <<<<<<<<<<<<<< + * self.train_min_gap_size = train_min_gap_size + * if from_binary: + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__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; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * if from_binary: + * self.read_binary(from_binary) + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__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; + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * self.read_binary(from_binary) + * elif from_stats: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":212 + * if from_binary: + * self.read_binary(from_binary) + * elif from_stats: # <<<<<<<<<<<<<< + * self.precompute(from_stats, fsarray) + * + */ + __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) { + + /* "/home/mdenkows/cdec/python/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_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_from_stats); + PyTuple_SET_ITEM(__pyx_t_4, 0, __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); + __Pyx_GIVEREF(__pyx_v_fsarray); + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__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_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + __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_AddTraceback("cdec.sa._sa.Precomputation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_3read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[11]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":216 + * + * + * def read_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_2read_binary(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + 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("read_binary", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":218 + * def read_binary(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "r") # <<<<<<<<<<<<<< + * fread(&(self.precompute_rank), sizeof(int), 1, f) + * fread(&(self.precompute_secondary_rank), sizeof(int), 1, f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":219 + * cdef FILE* f + * f = fopen(filename, "r") + * 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) + */ + fread((&__pyx_v_self->precompute_rank), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * fread(&(self.max_length), sizeof(int), 1, f) + * fread(&(self.max_nonterminals), sizeof(int), 1, f) + */ + fread((&__pyx_v_self->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * fread(&(self.max_nonterminals), sizeof(int), 1, f) + * fread(&(self.train_max_initial_size), sizeof(int), 1, f) + */ + fread((&__pyx_v_self->max_length), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * fread(&(self.train_max_initial_size), sizeof(int), 1, f) + * fread(&(self.train_min_gap_size), sizeof(int), 1, f) + */ + fread((&__pyx_v_self->max_nonterminals), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * fread(&(self.train_min_gap_size), sizeof(int), 1, f) + * self.precomputed_index = self.read_map(f) + */ + fread((&__pyx_v_self->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * self.precomputed_index = self.read_map(f) + * self.precomputed_collocations = self.read_map(f) + */ + fread((&__pyx_v_self->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * self.precomputed_collocations = self.read_map(f) + * fclose(f) + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->read_map(__pyx_v_self, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __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; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->read_map(__pyx_v_self, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->precomputed_collocations); + __Pyx_DECREF(__pyx_v_self->precomputed_collocations); + __pyx_v_self->precomputed_collocations = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":227 + * self.precomputed_index = self.read_map(f) + * self.precomputed_collocations = self.read_map(f) + * fclose(f) # <<<<<<<<<<<<<< + * + * + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_5write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[11]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":230 + * + * + * def write_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_4write_binary(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_binary", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":232 + * def write_binary(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "w") # <<<<<<<<<<<<<< + * fwrite(&(self.precompute_rank), sizeof(int), 1, f) + * fwrite(&(self.precompute_secondary_rank), sizeof(int), 1, f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":233 + * cdef FILE* f + * f = fopen(filename, "w") + * 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) + */ + fwrite((&__pyx_v_self->precompute_rank), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * fwrite(&(self.max_length), sizeof(int), 1, f) + * fwrite(&(self.max_nonterminals), sizeof(int), 1, f) + */ + fwrite((&__pyx_v_self->precompute_secondary_rank), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * fwrite(&(self.max_nonterminals), sizeof(int), 1, f) + * fwrite(&(self.train_max_initial_size), sizeof(int), 1, f) + */ + fwrite((&__pyx_v_self->max_length), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * fwrite(&(self.train_max_initial_size), sizeof(int), 1, f) + * fwrite(&(self.train_min_gap_size), sizeof(int), 1, f) + */ + fwrite((&__pyx_v_self->max_nonterminals), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * fwrite(&(self.train_min_gap_size), sizeof(int), 1, f) + * self.write_map(self.precomputed_index, f) + */ + fwrite((&__pyx_v_self->train_max_initial_size), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * self.write_map(self.precomputed_index, f) + * self.write_map(self.precomputed_collocations, f) + */ + fwrite((&__pyx_v_self->train_min_gap_size), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * self.write_map(self.precomputed_collocations, f) + * fclose(f) + */ + __pyx_t_1 = __pyx_v_self->precomputed_index; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->write_map(__pyx_v_self, __pyx_t_1, __pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 239; __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; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + __pyx_t_2 = __pyx_v_self->precomputed_collocations; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self->__pyx_vtab)->write_map(__pyx_v_self, __pyx_t_2, __pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 240; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":241 + * self.write_map(self.precomputed_index, f) + * self.write_map(self.precomputed_collocations, f) + * fclose(f) # <<<<<<<<<<<<<< + * + * + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":244 + * + * + * cdef write_map(self, m, FILE* f): # <<<<<<<<<<<<<< + * cdef int i, N + * cdef IntList arr + */ + +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) { + int __pyx_v_i; + int __pyx_v_N; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr = 0; + PyObject *__pyx_v_pattern = NULL; + PyObject *__pyx_v_val = NULL; + PyObject *__pyx_v_word_id = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_map", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":248 + * cdef IntList arr + * + * N = len(m) # <<<<<<<<<<<<<< + * fwrite(&(N), sizeof(int), 1, f) + * for pattern, val in m.iteritems(): + */ + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":249 + * + * N = len(m) + * fwrite(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * for pattern, val in m.iteritems(): + * N = len(pattern) + */ + fwrite((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":250 + * N = len(m) + * fwrite(&(N), sizeof(int), 1, f) + * for pattern, val in m.iteritems(): # <<<<<<<<<<<<<< + * N = len(pattern) + * fwrite(&(N), sizeof(int), 1, f) + */ + __pyx_t_1 = 0; + if (unlikely(__pyx_v_m == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); + {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_m, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + while (1) { + __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_3, &__pyx_t_1, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4); + if (unlikely(__pyx_t_7 == 0)) break; + if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_v_pattern); + __pyx_v_pattern = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_v_val); + __pyx_v_val = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":251 + * fwrite(&(N), sizeof(int), 1, f) + * for pattern, val in m.iteritems(): + * N = len(pattern) # <<<<<<<<<<<<<< + * fwrite(&(N), sizeof(int), 1, f) + * for word_id in pattern: + */ + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":252 + * for pattern, val in m.iteritems(): + * N = len(pattern) + * fwrite(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * for word_id in pattern: + * i = word_id + */ + fwrite((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/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)) { + __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; + } + 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 + } else { + __pyx_t_5 = __pyx_t_9(__pyx_t_6); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_word_id); + __pyx_v_word_id = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":254 + * fwrite(&(N), sizeof(int), 1, f) + * for word_id in pattern: + * i = word_id # <<<<<<<<<<<<<< + * fwrite(&(i), sizeof(int), 1, f) + * arr = val + */ + __pyx_t_7 = __Pyx_PyInt_AsInt(__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":255 + * for word_id in pattern: + * i = word_id + * fwrite(&(i), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * arr = val + * arr.write_handle(f) + */ + fwrite((&__pyx_v_i), (sizeof(int)), 1, __pyx_v_f); + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":256 + * i = word_id + * fwrite(&(i), sizeof(int), 1, f) + * arr = val # <<<<<<<<<<<<<< + * arr.write_handle(f) + * + */ + if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_val); + __Pyx_XDECREF(((PyObject *)__pyx_v_arr)); + __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_val); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":257 + * fwrite(&(i), sizeof(int), 1, f) + * arr = val + * arr.write_handle(f) # <<<<<<<<<<<<<< + * + * + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_arr->__pyx_vtab)->write_handle(__pyx_v_arr, __pyx_v_f); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.write_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_arr); + __Pyx_XDECREF(__pyx_v_pattern); + __Pyx_XDECREF(__pyx_v_val); + __Pyx_XDECREF(__pyx_v_word_id); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":260 + * + * + * cdef read_map(self, FILE* f): # <<<<<<<<<<<<<< + * cdef int i, j, k, word_id, N + * cdef IntList arr + */ + +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) { + int __pyx_v_i; + CYTHON_UNUSED int __pyx_v_j; + CYTHON_UNUSED int __pyx_v_k; + int __pyx_v_word_id; + int __pyx_v_N; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr = 0; + PyObject *__pyx_v_m = NULL; + PyObject *__pyx_v_key = NULL; + 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("read_map", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":264 + * cdef IntList arr + * + * m = {} # <<<<<<<<<<<<<< + * fread(&(N), sizeof(int), 1, f) + * for j from 0 <= j < N: + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_m = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":265 + * + * m = {} + * fread(&(N), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * for j from 0 <= j < N: + * fread(&(i), sizeof(int), 1, f) + */ + fread((&__pyx_v_N), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":266 + * m = {} + * fread(&(N), sizeof(int), 1, f) + * for j from 0 <= j < N: # <<<<<<<<<<<<<< + * fread(&(i), sizeof(int), 1, f) + * key = () + */ + __pyx_t_2 = __pyx_v_N; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":267 + * fread(&(N), sizeof(int), 1, f) + * for j from 0 <= j < N: + * fread(&(i), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * key = () + * for k from 0 <= k < i: + */ + fread((&__pyx_v_i), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":268 + * for j from 0 <= j < N: + * fread(&(i), sizeof(int), 1, f) + * key = () # <<<<<<<<<<<<<< + * for k from 0 <= k < i: + * fread(&(word_id), sizeof(int), 1, f) + */ + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + __Pyx_XDECREF(((PyObject *)__pyx_v_key)); + __pyx_v_key = __pyx_empty_tuple; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":269 + * fread(&(i), sizeof(int), 1, f) + * key = () + * for k from 0 <= k < i: # <<<<<<<<<<<<<< + * fread(&(word_id), sizeof(int), 1, f) + * key = key + (word_id,) + */ + __pyx_t_3 = __pyx_v_i; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":270 + * key = () + * for k from 0 <= k < i: + * fread(&(word_id), sizeof(int), 1, f) # <<<<<<<<<<<<<< + * key = key + (word_id,) + * arr = IntList() + */ + fread((&__pyx_v_word_id), (sizeof(int)), 1, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":271 + * for k from 0 <= k < i: + * fread(&(word_id), sizeof(int), 1, f) + * key = key + (word_id,) # <<<<<<<<<<<<<< + * arr = IntList() + * arr.read_handle(f) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_word_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 271; __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[11]; __pyx_lineno = 271; __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 = PyNumber_Add(((PyObject *)__pyx_v_key), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_key)); + __pyx_v_key = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":272 + * fread(&(word_id), sizeof(int), 1, f) + * key = key + (word_id,) + * arr = IntList() # <<<<<<<<<<<<<< + * arr.read_handle(f) + * m[key] = arr + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(((PyObject *)__pyx_v_arr)); + __pyx_v_arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":273 + * key = key + (word_id,) + * arr = IntList() + * arr.read_handle(f) # <<<<<<<<<<<<<< + * m[key] = arr + * return m + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_arr->__pyx_vtab)->read_handle(__pyx_v_arr, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":274 + * arr = IntList() + * arr.read_handle(f) + * m[key] = arr # <<<<<<<<<<<<<< + * return m + * + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_m), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":275 + * arr.read_handle(f) + * m[key] = arr + * return m # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_m)); + __pyx_r = ((PyObject *)__pyx_v_m); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.read_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_arr); + __Pyx_XDECREF(__pyx_v_m); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_14Precomputation_7precompute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_stats = 0; + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sarray = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("precompute (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__stats,&__pyx_n_s__sarray,0}; + PyObject* values[2] = {0,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__stats)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sarray)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("precompute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "precompute") < 0)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_stats = values[0]; + __pyx_v_sarray = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("precompute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sarray), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "sarray", 0))) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)__pyx_v_self), __pyx_v_stats, __pyx_v_sarray); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":278 + * + * + * 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 + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_14Precomputation_6precompute(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_self, PyObject *__pyx_v_stats, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_sarray) { + int __pyx_v_i; + int __pyx_v_l; + int __pyx_v_N; + int __pyx_v_max_pattern_len; + int __pyx_v_i1; + int __pyx_v_l1; + int __pyx_v_i2; + int __pyx_v_l2; + int __pyx_v_i3; + int __pyx_v_l3; + int __pyx_v_ptr1; + int __pyx_v_ptr2; + int __pyx_v_ptr3; + int __pyx_v_is_super; + int __pyx_v_sent_count; + int __pyx_v_max_rank; + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_darray = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_data = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_queue = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_cost_by_rank = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_count_by_rank = 0; + struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_frequent_patterns = 0; + struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_super_frequent_patterns = 0; + struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *__pyx_v_collocations = 0; + struct __pyx_t_4cdec_2sa_3_sa__Trie_Node *__pyx_v_node; + PyObject *__pyx_v_I_set = NULL; + PyObject *__pyx_v_J_set = NULL; + PyObject *__pyx_v_J2_set = NULL; + PyObject *__pyx_v_IJ_set = NULL; + PyObject *__pyx_v_pattern_rank = NULL; + float __pyx_v_start_time; + PyObject *__pyx_v_rank = NULL; + CYTHON_UNUSED PyObject *__pyx_v__ = NULL; + PyObject *__pyx_v_phrase = NULL; + int __pyx_v_sa_word_id; + PyObject *__pyx_v_x = NULL; + PyObject *__pyx_v_pattern1 = NULL; + PyObject *__pyx_v_pattern2 = NULL; + PyObject *__pyx_v_combined_pattern = NULL; + PyObject *__pyx_v_pattern = NULL; + PyObject *__pyx_v_arr = NULL; + PyObject *__pyx_v_s = NULL; + PyObject *__pyx_v_word_id = NULL; + PyObject *__pyx_v_chunk = NULL; + PyObject *__pyx_v_arity = NULL; + PyObject *__pyx_v_cumul_cost = NULL; + PyObject *__pyx_v_cumul_count = NULL; + PyObject *__pyx_v_num_found_patterns = NULL; + float __pyx_v_stop_time; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + 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_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + int __pyx_t_12; + Py_ssize_t __pyx_t_13; + int __pyx_t_14; + Py_ssize_t __pyx_t_15; + 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 *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("precompute", 0); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * cdef IntList data, queue, cost_by_rank, count_by_rank + * cdef TrieMap frequent_patterns, super_frequent_patterns, collocations + */ + __pyx_t_1 = ((PyObject *)__pyx_v_sarray->darray); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":285 + * cdef _Trie_Node* node + * + * data = darray.data # <<<<<<<<<<<<<< + * + * frequent_patterns = TrieMap(len(darray.id2word)) + */ + __pyx_t_1 = ((PyObject *)__pyx_v_darray->data); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":287 + * data = darray.data + * + * frequent_patterns = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< + * super_frequent_patterns = TrieMap(len(darray.id2word)) + * collocations = TrieMap(len(darray.id2word)) + */ + __pyx_t_1 = __pyx_v_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[11]; __pyx_lineno = 287; __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[11]; __pyx_lineno = 287; __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[11]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_frequent_patterns = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":288 + * + * frequent_patterns = TrieMap(len(darray.id2word)) + * super_frequent_patterns = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< + * collocations = TrieMap(len(darray.id2word)) + * + */ + __pyx_t_1 = __pyx_v_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[11]; __pyx_lineno = 288; __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[11]; __pyx_lineno = 288; __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[11]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_super_frequent_patterns = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":289 + * frequent_patterns = TrieMap(len(darray.id2word)) + * super_frequent_patterns = TrieMap(len(darray.id2word)) + * collocations = TrieMap(len(darray.id2word)) # <<<<<<<<<<<<<< + * + * I_set = set() + */ + __pyx_t_1 = __pyx_v_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[11]; __pyx_lineno = 289; __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[11]; __pyx_lineno = 289; __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[11]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieMap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_collocations = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":291 + * collocations = TrieMap(len(darray.id2word)) + * + * I_set = set() # <<<<<<<<<<<<<< + * J_set = set() + * J2_set = set() + */ + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_I_set = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":292 + * + * I_set = set() + * J_set = set() # <<<<<<<<<<<<<< + * J2_set = set() + * IJ_set = set() + */ + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_J_set = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":293 + * I_set = set() + * J_set = set() + * J2_set = set() # <<<<<<<<<<<<<< + * IJ_set = set() + * pattern_rank = {} + */ + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_J2_set = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":294 + * J_set = set() + * J2_set = set() + * IJ_set = set() # <<<<<<<<<<<<<< + * pattern_rank = {} + * + */ + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_IJ_set = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":295 + * J2_set = set() + * IJ_set = set() + * pattern_rank = {} # <<<<<<<<<<<<<< + * + * logger.info("Precomputing frequent intersections") + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_pattern_rank = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":297 + * pattern_rank = {} + * + * logger.info("Precomputing frequent intersections") # <<<<<<<<<<<<<< + * cdef float start_time = monitor_cpu() + * + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 297; __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 = 297; __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_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 297; __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; + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_start_time = __pyx_t_4; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":300 + * cdef float start_time = monitor_cpu() + * + * max_pattern_len = 0 # <<<<<<<<<<<<<< + * for rank, (_, _, phrase) in enumerate(stats): + * if rank >= self.precompute_rank: + */ + __pyx_v_max_pattern_len = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":301 + * + * max_pattern_len = 0 + * for rank, (_, _, phrase) in enumerate(stats): # <<<<<<<<<<<<<< + * if rank >= self.precompute_rank: + * 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; + } 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; + } + 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 + } else { + __pyx_t_6 = __pyx_t_5(__pyx_t_1); + if (unlikely(!__pyx_t_6)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_7 = PyList_GET_ITEM(sequence, 0); + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + __pyx_t_9 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + #else + __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __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; + } 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_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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); + index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[11]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v__); + __pyx_v__ = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v__); + __pyx_v__ = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_v_phrase); + __pyx_v_phrase = __pyx_t_9; + __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_rank); + __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; + + /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__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_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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":303 + * for rank, (_, _, phrase) in enumerate(stats): + * if rank >= self.precompute_rank: + * break # <<<<<<<<<<<<<< + * max_pattern_len = max(max_pattern_len, len(phrase)) + * frequent_patterns.insert(phrase) + */ + goto __pyx_L4_break; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":304 + * if rank >= self.precompute_rank: + * break + * max_pattern_len = max(max_pattern_len, len(phrase)) # <<<<<<<<<<<<<< + * frequent_patterns.insert(phrase) + * I_set.add(phrase) + */ + __pyx_t_13 = PyObject_Length(__pyx_v_phrase); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __pyx_v_max_pattern_len; + if (((__pyx_t_13 > __pyx_t_14) != 0)) { + __pyx_t_15 = __pyx_t_13; + } else { + __pyx_t_15 = __pyx_t_14; + } + __pyx_v_max_pattern_len = __pyx_t_15; + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_9, ((PyObject *)__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_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":306 + * max_pattern_len = max(max_pattern_len, len(phrase)) + * frequent_patterns.insert(phrase) + * I_set.add(phrase) # <<<<<<<<<<<<<< + * pattern_rank[phrase] = rank + * if rank < self.precompute_secondary_rank: + */ + __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;} + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":307 + * frequent_patterns.insert(phrase) + * I_set.add(phrase) + * pattern_rank[phrase] = rank # <<<<<<<<<<<<<< + * if rank < self.precompute_secondary_rank: + * super_frequent_patterns.insert(phrase) + */ + if (PyDict_SetItem(((PyObject *)__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;} + + /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__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; + if (__pyx_t_12) { + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_6, ((PyObject *)__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_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":310 + * if rank < self.precompute_secondary_rank: + * super_frequent_patterns.insert(phrase) + * J_set.add(phrase) # <<<<<<<<<<<<<< + * + * queue = IntList(increment=1000) + */ + __pyx_t_16 = PySet_Add(__pyx_v_J_set, __pyx_v_phrase); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/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(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); 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(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/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_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_77), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":315 + * + * logger.info(" Computing inverted indexes...") + * N = len(data) # <<<<<<<<<<<<<< + * for i from 0 <= i < N: + * sa_word_id = data.arr[i] + */ + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":316 + * logger.info(" Computing inverted indexes...") + * N = len(data) + * for i from 0 <= i < N: # <<<<<<<<<<<<<< + * sa_word_id = data.arr[i] + * if sa_word_id == 1: + */ + __pyx_t_14 = __pyx_v_N; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_14; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":317 + * N = len(data) + * for i from 0 <= i < N: + * sa_word_id = data.arr[i] # <<<<<<<<<<<<<< + * if sa_word_id == 1: + * queue._append(-1) + */ + __pyx_v_sa_word_id = (__pyx_v_data->arr[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":318 + * for i from 0 <= i < N: + * sa_word_id = data.arr[i] + * if sa_word_id == 1: # <<<<<<<<<<<<<< + * queue._append(-1) + * else: + */ + __pyx_t_12 = ((__pyx_v_sa_word_id == 1) != 0); + if (__pyx_t_12) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":319 + * sa_word_id = data.arr[i] + * if sa_word_id == 1: + * queue._append(-1) # <<<<<<<<<<<<<< + * else: + * for l from 1 <= l <= max_pattern_len: + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, -1); + goto __pyx_L11; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":321 + * queue._append(-1) + * else: + * for l from 1 <= l <= max_pattern_len: # <<<<<<<<<<<<<< + * node = frequent_patterns._contains(data.arr+i, l) + * if node == NULL: + */ + __pyx_t_17 = __pyx_v_max_pattern_len; + for (__pyx_v_l = 1; __pyx_v_l <= __pyx_t_17; __pyx_v_l++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":322 + * else: + * for l from 1 <= l <= max_pattern_len: + * node = frequent_patterns._contains(data.arr+i, l) # <<<<<<<<<<<<<< + * if node == NULL: + * break + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":323 + * for l from 1 <= l <= max_pattern_len: + * node = frequent_patterns._contains(data.arr+i, l) + * if node == NULL: # <<<<<<<<<<<<<< + * break + * queue._append(i) + */ + __pyx_t_12 = ((__pyx_v_node == NULL) != 0); + if (__pyx_t_12) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":324 + * node = frequent_patterns._contains(data.arr+i, l) + * if node == NULL: + * break # <<<<<<<<<<<<<< + * queue._append(i) + * queue._append(l) + */ + goto __pyx_L13_break; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":325 + * if node == NULL: + * break + * queue._append(i) # <<<<<<<<<<<<<< + * queue._append(l) + * trie_node_data_append(node, i) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_i); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":326 + * break + * queue._append(i) + * queue._append(l) # <<<<<<<<<<<<<< + * trie_node_data_append(node, i) + * + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_queue->__pyx_vtab)->_append(__pyx_v_queue, __pyx_v_l); + + /* "/home/mdenkows/cdec/python/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_L13_break:; + } + __pyx_L11:; + } + + /* "/home/mdenkows/cdec/python/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_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_79), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":330 + * + * logger.info(" Computing collocations...") + * N = len(queue) # <<<<<<<<<<<<<< + * ptr1 = 0 + * sent_count = 0 + */ + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":331 + * logger.info(" Computing collocations...") + * N = len(queue) + * ptr1 = 0 # <<<<<<<<<<<<<< + * sent_count = 0 + * while ptr1 < N: # main loop + */ + __pyx_v_ptr1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":332 + * N = len(queue) + * ptr1 = 0 + * sent_count = 0 # <<<<<<<<<<<<<< + * while ptr1 < N: # main loop + * i1 = queue.arr[ptr1] + */ + __pyx_v_sent_count = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":333 + * ptr1 = 0 + * sent_count = 0 + * while ptr1 < N: # main loop # <<<<<<<<<<<<<< + * i1 = queue.arr[ptr1] + * if i1 > -1: + */ + while (1) { + __pyx_t_12 = ((__pyx_v_ptr1 < __pyx_v_N) != 0); + if (!__pyx_t_12) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":334 + * sent_count = 0 + * while ptr1 < N: # main loop + * i1 = queue.arr[ptr1] # <<<<<<<<<<<<<< + * if i1 > -1: + * l1 = queue.arr[ptr1+1] + */ + __pyx_v_i1 = (__pyx_v_queue->arr[__pyx_v_ptr1]); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":335 + * while ptr1 < N: # main loop + * i1 = queue.arr[ptr1] + * if i1 > -1: # <<<<<<<<<<<<<< + * l1 = queue.arr[ptr1+1] + * ptr2 = ptr1 + 2 + */ + __pyx_t_12 = ((__pyx_v_i1 > -1) != 0); + if (__pyx_t_12) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":336 + * i1 = queue.arr[ptr1] + * if i1 > -1: + * l1 = queue.arr[ptr1+1] # <<<<<<<<<<<<<< + * ptr2 = ptr1 + 2 + * while ptr2 < N: + */ + __pyx_v_l1 = (__pyx_v_queue->arr[(__pyx_v_ptr1 + 1)]); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":337 + * if i1 > -1: + * l1 = queue.arr[ptr1+1] + * ptr2 = ptr1 + 2 # <<<<<<<<<<<<<< + * while ptr2 < N: + * i2 = queue.arr[ptr2] + */ + __pyx_v_ptr2 = (__pyx_v_ptr1 + 2); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":338 + * l1 = queue.arr[ptr1+1] + * ptr2 = ptr1 + 2 + * while ptr2 < N: # <<<<<<<<<<<<<< + * i2 = queue.arr[ptr2] + * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: + */ + while (1) { + __pyx_t_12 = ((__pyx_v_ptr2 < __pyx_v_N) != 0); + if (!__pyx_t_12) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":339 + * ptr2 = ptr1 + 2 + * while ptr2 < N: + * i2 = queue.arr[ptr2] # <<<<<<<<<<<<<< + * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: + * break + */ + __pyx_v_i2 = (__pyx_v_queue->arr[__pyx_v_ptr2]); + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_19 = __pyx_t_12; + } + if (__pyx_t_19) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":341 + * i2 = queue.arr[ptr2] + * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: + * break # <<<<<<<<<<<<<< + * l2 = queue.arr[ptr2+1] + * if (i2 - i1 - l1 >= self.train_min_gap_size and + */ + goto __pyx_L19_break; + goto __pyx_L20; + } + __pyx_L20:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":342 + * if i2 == -1 or i2 - i1 >= self.train_max_initial_size: + * 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 + */ + __pyx_v_l2 = (__pyx_v_queue->arr[(__pyx_v_ptr2 + 1)]); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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; + } + if (__pyx_t_12) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * node = trie_insert(node, -1) + * for i from i2 <= i < i2+l2: + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":347 + * l1+l2+1 <= self.max_length): + * node = collocations._insert(data.arr+i1, l1) + * node = trie_insert(node, -1) # <<<<<<<<<<<<<< + * for i from i2 <= i < i2+l2: + * node = trie_insert(node, data.arr[i]) + */ + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":348 + * node = collocations._insert(data.arr+i1, l1) + * node = trie_insert(node, -1) + * for i from i2 <= i < i2+l2: # <<<<<<<<<<<<<< + * node = trie_insert(node, data.arr[i]) + * trie_node_data_append(node, i1) + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":349 + * node = trie_insert(node, -1) + * 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) + */ + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); + } + + /* "/home/mdenkows/cdec/python/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; + + /* "/home/mdenkows/cdec/python/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; + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * if super_frequent_patterns._contains(data.arr+i1, l1) != NULL: + * is_super = 1 + */ + __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) { + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * is_super = 1 + * else: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * else: + * is_super = 0 + */ + __pyx_v_is_super = 1; + goto __pyx_L25; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":356 + * is_super = 1 + * else: + * is_super = 0 # <<<<<<<<<<<<<< + * ptr3 = ptr2 + 2 + * while ptr3 < N: + */ + __pyx_v_is_super = 0; + } + __pyx_L25:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":357 + * else: + * is_super = 0 + * ptr3 = ptr2 + 2 # <<<<<<<<<<<<<< + * while ptr3 < N: + * i3 = queue.arr[ptr3] + */ + __pyx_v_ptr3 = (__pyx_v_ptr2 + 2); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":358 + * is_super = 0 + * ptr3 = ptr2 + 2 + * while ptr3 < N: # <<<<<<<<<<<<<< + * i3 = queue.arr[ptr3] + * if i3 == -1 or i3 - i1 >= self.train_max_initial_size: + */ + while (1) { + __pyx_t_12 = ((__pyx_v_ptr3 < __pyx_v_N) != 0); + if (!__pyx_t_12) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":359 + * ptr3 = ptr2 + 2 + * while ptr3 < N: + * i3 = queue.arr[ptr3] # <<<<<<<<<<<<<< + * if i3 == -1 or i3 - i1 >= self.train_max_initial_size: + * break + */ + __pyx_v_i3 = (__pyx_v_queue->arr[__pyx_v_ptr3]); + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_20 = __pyx_t_12; + } + if (__pyx_t_20) { + + /* "/home/mdenkows/cdec/python/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_L28; + } + __pyx_L28:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":362 + * 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 + * i3 + l3 - i1 <= self.train_max_initial_size and + */ + __pyx_v_l3 = (__pyx_v_queue->arr[(__pyx_v_ptr3 + 1)]); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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; + } + if (__pyx_t_12) { + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_20 = (__pyx_v_is_super != 0); + } + if (__pyx_t_20) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * node = trie_insert(node, -1) + * for i from i2 <= i < i2+l2: + */ + __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); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * for i from i2 <= i < i2+l2: + * node = trie_insert(node, data.arr[i]) + */ + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":369 + * node = collocations._insert(data.arr+i1, l1) + * node = trie_insert(node, -1) + * for i from i2 <= i < i2+l2: # <<<<<<<<<<<<<< + * node = trie_insert(node, data.arr[i]) + * node = trie_insert(node, -1) + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":370 + * node = trie_insert(node, -1) + * for i from i2 <= i < i2+l2: + * node = trie_insert(node, data.arr[i]) # <<<<<<<<<<<<<< + * node = trie_insert(node, -1) + * for i from i3 <= i < i3+l3: + */ + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":371 + * for i from i2 <= i < i2+l2: + * node = trie_insert(node, data.arr[i]) + * node = trie_insert(node, -1) # <<<<<<<<<<<<<< + * for i from i3 <= i < i3+l3: + * node = trie_insert(node, data.arr[i]) + */ + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, -1); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":372 + * node = trie_insert(node, data.arr[i]) + * node = trie_insert(node, -1) + * for i from i3 <= i < i3+l3: # <<<<<<<<<<<<<< + * node = trie_insert(node, data.arr[i]) + * trie_node_data_append(node, i1) + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":373 + * node = trie_insert(node, -1) + * 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) + */ + __pyx_v_node = __pyx_f_4cdec_2sa_3_sa_trie_insert(__pyx_v_node, (__pyx_v_data->arr[__pyx_v_i])); + } + + /* "/home/mdenkows/cdec/python/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; + + /* "/home/mdenkows/cdec/python/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; + + /* "/home/mdenkows/cdec/python/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_L30:; + goto __pyx_L29; + } + __pyx_L29:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":377 + * trie_node_data_append(node, i2) + * trie_node_data_append(node, i3) + * ptr3 = ptr3 + 2 # <<<<<<<<<<<<<< + * ptr2 = ptr2 + 2 + * ptr1 = ptr1 + 2 + */ + __pyx_v_ptr3 = (__pyx_v_ptr3 + 2); + } + __pyx_L27_break:; + goto __pyx_L24; + } + __pyx_L24:; + goto __pyx_L21; + } + __pyx_L21:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":378 + * trie_node_data_append(node, i3) + * ptr3 = ptr3 + 2 + * ptr2 = ptr2 + 2 # <<<<<<<<<<<<<< + * ptr1 = ptr1 + 2 + * else: + */ + __pyx_v_ptr2 = (__pyx_v_ptr2 + 2); + } + __pyx_L19_break:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":379 + * ptr3 = ptr3 + 2 + * ptr2 = ptr2 + 2 + * ptr1 = ptr1 + 2 # <<<<<<<<<<<<<< + * else: + * sent_count = sent_count + 1 + */ + __pyx_v_ptr1 = (__pyx_v_ptr1 + 2); + goto __pyx_L17; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":381 + * ptr1 = ptr1 + 2 + * else: + * sent_count = sent_count + 1 # <<<<<<<<<<<<<< + * if sent_count % 10000 == 0: + * logger.debug(" %d sentences", sent_count) + */ + __pyx_v_sent_count = (__pyx_v_sent_count + 1); + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":383 + * sent_count = sent_count + 1 + * if sent_count % 10000 == 0: + * logger.debug(" %d sentences", sent_count) # <<<<<<<<<<<<<< + * ptr1 = ptr1 + 1 + * + */ + __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__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_INCREF(((PyObject *)__pyx_kp_s_80)); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_80)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_80)); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L35; + } + __pyx_L35:; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":384 + * if sent_count % 10000 == 0: + * logger.debug(" %d sentences", sent_count) + * ptr1 = ptr1 + 1 # <<<<<<<<<<<<<< + * + * self.precomputed_collocations = collocations.toMap(False) + */ + __pyx_v_ptr1 = (__pyx_v_ptr1 + 1); + } + __pyx_L17:; + } + + /* "/home/mdenkows/cdec/python/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_PyBool_FromLong(0); 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_t_3 = PyTuple_New(1); 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); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_9); + __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; + + /* "/home/mdenkows/cdec/python/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_3 = __Pyx_PyBool_FromLong(1); 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_t_1 = PyTuple_New(1); 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); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), 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_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":389 + * self.precomputed_index = frequent_patterns.toMap(True) + * + * x = 0 # <<<<<<<<<<<<<< + * for pattern1 in J_set: + * for pattern2 in J_set: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_x = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/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_3 = PyObject_GetIter(((PyObject *)__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_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + for (;;) { + { + __pyx_t_1 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_pattern1); + __pyx_v_pattern1 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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_1 = PyObject_GetIter(((PyObject *)__pyx_v_J_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_21 = Py_TYPE(__pyx_t_1)->tp_iternext; + for (;;) { + { + __pyx_t_9 = __pyx_t_21(__pyx_t_1); + if (unlikely(!__pyx_t_9)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_XDECREF(__pyx_v_pattern2); + __pyx_v_pattern2 = __pyx_t_9; + __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":392 + * for pattern1 in J_set: + * 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_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) { + + /* "/home/mdenkows/cdec/python/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_9 = PyNumber_Add(__pyx_v_pattern1, ((PyObject *)__pyx_k_tuple_81)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = PyNumber_Add(__pyx_t_9, __pyx_v_pattern2); 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_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_v_combined_pattern); + __pyx_v_combined_pattern = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":394 + * if len(pattern1) + len(pattern2) + 1 < self.max_length: + * combined_pattern = pattern1 + (-1,) + pattern2 + * J2_set.add(combined_pattern) # <<<<<<<<<<<<<< + * + * 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; + } + __pyx_L40:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/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_3 = PyObject_GetIter(((PyObject *)__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_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + for (;;) { + { + __pyx_t_1 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_pattern1); + __pyx_v_pattern1 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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_1 = PyObject_GetIter(((PyObject *)__pyx_v_I_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_21 = Py_TYPE(__pyx_t_1)->tp_iternext; + for (;;) { + { + __pyx_t_8 = __pyx_t_21(__pyx_t_1); + if (unlikely(!__pyx_t_8)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_XDECREF(__pyx_v_pattern2); + __pyx_v_pattern2 = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/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(__pyx_v_x); + __pyx_v_x = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":399 + * for pattern2 in I_set: + * x = x+1 + * if len(pattern1) + len(pattern2) + 1 <= self.max_length: # <<<<<<<<<<<<<< + * combined_pattern = pattern1 + (-1,) + pattern2 + * IJ_set.add(combined_pattern) + */ + __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) { + + /* "/home/mdenkows/cdec/python/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, ((PyObject *)__pyx_k_tuple_82)); 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_9 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_v_combined_pattern); + __pyx_v_combined_pattern = __pyx_t_9; + __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":401 + * if len(pattern1) + len(pattern2) + 1 <= self.max_length: + * combined_pattern = pattern1 + (-1,) + pattern2 + * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< + * + * 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; + } + __pyx_L45:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/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_3 = PyObject_GetIter(((PyObject *)__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_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + for (;;) { + { + __pyx_t_1 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_pattern1); + __pyx_v_pattern1 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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_1 = PyObject_GetIter(((PyObject *)__pyx_v_J2_set)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_21 = Py_TYPE(__pyx_t_1)->tp_iternext; + for (;;) { + { + __pyx_t_9 = __pyx_t_21(__pyx_t_1); + if (unlikely(!__pyx_t_9)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_XDECREF(__pyx_v_pattern2); + __pyx_v_pattern2 = __pyx_t_9; + __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/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_9 = PyNumber_Add(__pyx_v_x, __pyx_int_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_9; + __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":406 + * for pattern2 in J2_set: + * x = x+2 + * if len(pattern1) + len(pattern2) + 1<= self.max_length: # <<<<<<<<<<<<<< + * combined_pattern = pattern1 + (-1,) + pattern2 + * IJ_set.add(combined_pattern) + */ + __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) { + + /* "/home/mdenkows/cdec/python/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_9 = PyNumber_Add(__pyx_v_pattern1, ((PyObject *)__pyx_k_tuple_83)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = PyNumber_Add(__pyx_t_9, __pyx_v_pattern2); 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_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_v_combined_pattern); + __pyx_v_combined_pattern = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":408 + * if len(pattern1) + len(pattern2) + 1<= self.max_length: + * combined_pattern = pattern1 + (-1,) + pattern2 + * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< + * combined_pattern = pattern2 + (-1,) + pattern1 + * IJ_set.add(combined_pattern) + */ + __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;} + + /* "/home/mdenkows/cdec/python/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, ((PyObject *)__pyx_k_tuple_84)); 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_9 = PyNumber_Add(__pyx_t_8, __pyx_v_pattern1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_combined_pattern); + __pyx_v_combined_pattern = __pyx_t_9; + __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":410 + * IJ_set.add(combined_pattern) + * combined_pattern = pattern2 + (-1,) + pattern1 + * IJ_set.add(combined_pattern) # <<<<<<<<<<<<<< + * + * 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; + } + __pyx_L50:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":412 + * IJ_set.add(combined_pattern) + * + * N = len(pattern_rank) # <<<<<<<<<<<<<< + * cost_by_rank = IntList(initial_len=N) + * count_by_rank = IntList(initial_len=N) + */ + __pyx_t_15 = PyDict_Size(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/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_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(((PyObject *)__pyx_t_3)); + __pyx_t_1 = PyInt_FromLong(__pyx_v_N); 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); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_cost_by_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyInt_FromLong(__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_1, ((PyObject *)__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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); 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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_count_by_rank = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/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(): # <<<<<<<<<<<<<< + * if pattern not in IJ_set: + * s = "" + */ + __pyx_t_15 = 0; + if (unlikely(__pyx_v_self->precomputed_collocations == Py_None)) { + 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_1 = __Pyx_dict_iterator(__pyx_v_self->precomputed_collocations, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_2), (&__pyx_t_14)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + while (1) { + __pyx_t_17 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_2, &__pyx_t_15, &__pyx_t_1, &__pyx_t_9, 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_1); + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_v_pattern); + __pyx_v_pattern = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_arr); + __pyx_v_arr = __pyx_t_9; + __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/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, ((PyObject *)__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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":417 + * for pattern, arr in self.precomputed_collocations.iteritems(): + * if pattern not in IJ_set: + * s = "" # <<<<<<<<<<<<<< + * for word_id in pattern: + * if word_id == -1: + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_47)); + __Pyx_XDECREF(__pyx_v_s); + __pyx_v_s = ((PyObject *)__pyx_kp_s_47); + + /* "/home/mdenkows/cdec/python/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_9 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_9); __pyx_t_13 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_13 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = Py_TYPE(__pyx_t_9)->tp_iternext; + } + for (;;) { + if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_9)) { + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_9)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __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_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__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_9)) { + if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __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_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_9); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_word_id); + __pyx_v_word_id = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":419 + * s = "" + * for word_id in pattern: + * if word_id == -1: # <<<<<<<<<<<<<< + * s = s + "X " + * else: + */ + __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 = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); 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_1); __pyx_t_1 = 0; + if (__pyx_t_12) { + + /* "/home/mdenkows/cdec/python/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_1 = PyNumber_Add(__pyx_v_s, ((PyObject *)__pyx_kp_s_85)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_s); + __pyx_v_s = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L56; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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_1 = PyObject_GetItem(__pyx_v_darray->id2word, __pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyNumber_Add(__pyx_v_s, __pyx_t_1); 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_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_8, ((PyObject *)__pyx_kp_s_69)); 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_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_s); + __pyx_v_s = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_L56:; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/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_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __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_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); 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_INCREF(((PyObject *)__pyx_kp_s_86)); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_86)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_86)); + __Pyx_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_s); + __Pyx_GIVEREF(__pyx_v_s); + __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L53; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":425 + * logger.warn("ERROR: unexpected pattern %s in set of precomputed collocations", s) + * else: + * chunk = () # <<<<<<<<<<<<<< + * max_rank = 0 + * arity = 0 + */ + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + __Pyx_XDECREF(((PyObject *)__pyx_v_chunk)); + __pyx_v_chunk = __pyx_empty_tuple; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":426 + * else: + * chunk = () + * max_rank = 0 # <<<<<<<<<<<<<< + * arity = 0 + * for word_id in pattern: + */ + __pyx_v_max_rank = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":427 + * chunk = () + * max_rank = 0 + * arity = 0 # <<<<<<<<<<<<<< + * for word_id in pattern: + * if word_id == -1: + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_XDECREF(__pyx_v_arity); + __pyx_v_arity = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/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)) { + __pyx_t_8 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_8); __pyx_t_13 = 0; + __pyx_t_5 = 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; + } + 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_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __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_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__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_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __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_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_9 = __pyx_t_5(__pyx_t_8); + if (unlikely(!__pyx_t_9)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_XDECREF(__pyx_v_word_id); + __pyx_v_word_id = __pyx_t_9; + __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/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_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 = 429; __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 = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_12) { + + /* "/home/mdenkows/cdec/python/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_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_17 = __pyx_v_max_rank; + __pyx_t_6 = PyInt_FromLong(__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_9, __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_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_12) { + __Pyx_INCREF(__pyx_t_9); + __pyx_t_1 = __pyx_t_9; + } else { + __pyx_t_7 = PyInt_FromLong(__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_1 = __pyx_t_7; + __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_1); 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_1); __pyx_t_1 = 0; + __pyx_v_max_rank = __pyx_t_17; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":431 + * if word_id == -1: + * max_rank = max(max_rank, pattern_rank[chunk]) + * arity = arity + 1 # <<<<<<<<<<<<<< + * chunk = () + * else: + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_arity); + __pyx_v_arity = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":432 + * max_rank = max(max_rank, pattern_rank[chunk]) + * arity = arity + 1 + * chunk = () # <<<<<<<<<<<<<< + * else: + * chunk = chunk + (word_id,) + */ + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + __Pyx_DECREF(((PyObject *)__pyx_v_chunk)); + __pyx_v_chunk = __pyx_empty_tuple; + goto __pyx_L59; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":434 + * chunk = () + * else: + * 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)) + */ + __pyx_t_1 = PyTuple_New(1); 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_INCREF(__pyx_v_word_id); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_word_id); + __Pyx_GIVEREF(__pyx_v_word_id); + __pyx_t_9 = PyNumber_Add(((PyObject *)__pyx_v_chunk), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_chunk)); + __pyx_v_chunk = ((PyObject*)__pyx_t_9); + __pyx_t_9 = 0; + } + __pyx_L59:; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":435 + * else: + * 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)) + * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) + */ + __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_pattern_rank), ((PyObject *)__pyx_v_chunk)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_17 = __pyx_v_max_rank; + __pyx_t_1 = PyInt_FromLong(__pyx_t_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_t_1, 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_1); __pyx_t_1 = 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_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_12) { + __Pyx_INCREF(__pyx_t_8); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_7 = PyInt_FromLong(__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_9 = __pyx_t_7; + __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_9); 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_9); __pyx_t_9 = 0; + __pyx_v_max_rank = __pyx_t_17; + + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< + * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) + * + */ + __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)); + + /* "/home/mdenkows/cdec/python/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_9 = PyInt_FromLong((__pyx_v_count_by_rank->arr[__pyx_v_max_rank])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __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); + __pyx_t_7 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); 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_t_1 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_7); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Add(__pyx_t_9, __pyx_t_1); 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_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_17 = __Pyx_PyInt_AsInt(__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":439 + * count_by_rank.arr[max_rank] = count_by_rank.arr[max_rank] + (len(arr)/(arity+1)) + * + * cumul_cost = 0 # <<<<<<<<<<<<<< + * cumul_count = 0 + * for i from 0 <= i < N: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_cumul_cost = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":440 + * + * cumul_cost = 0 + * cumul_count = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < N: + * cumul_cost = cumul_cost + cost_by_rank.arr[i] + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_cumul_count = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":441 + * cumul_cost = 0 + * 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] + */ + __pyx_t_14 = __pyx_v_N; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_14; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/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_3 = PyInt_FromLong((__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_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_cumul_cost); + __pyx_v_cumul_cost = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * 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_7 = PyInt_FromLong((__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_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(__pyx_v_cumul_count); + __pyx_v_cumul_count = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __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_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(__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_1 = PyInt_FromLong((__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_9 = PyInt_FromLong((__pyx_v_cost_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_GOTREF(__pyx_t_9); + __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_GOTREF(__pyx_t_8); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_87)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_87)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_87)); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_cumul_count); + PyTuple_SET_ITEM(__pyx_t_8, 4, __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); + __Pyx_GIVEREF(__pyx_v_cumul_cost); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); 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_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * for pattern in IJ_set: + * if pattern not in self.precomputed_collocations: + */ + __pyx_t_9 = __pyx_v_self->precomputed_collocations; + __Pyx_INCREF(__pyx_t_9); + __pyx_t_2 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_v_num_found_patterns = __pyx_t_9; + __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/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_t_9 = PyObject_GetIter(((PyObject *)__pyx_v_IJ_set)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = Py_TYPE(__pyx_t_9)->tp_iternext; + for (;;) { + { + __pyx_t_8 = __pyx_t_5(__pyx_t_9); + if (unlikely(!__pyx_t_8)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[11]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_XDECREF(__pyx_v_pattern); + __pyx_v_pattern = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__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 (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_L64:; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "/home/mdenkows/cdec/python/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_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_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__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_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; + + /* "/home/mdenkows/cdec/python/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_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__info); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __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_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 = PyTuple_New(4); 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_INCREF(((PyObject *)__pyx_kp_s_88)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_88)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_88)); + __Pyx_INCREF(__pyx_v_num_found_patterns); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_num_found_patterns); + __Pyx_GIVEREF(__pyx_v_num_found_patterns); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_7), NULL); 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_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __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_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __pyx_v_self->precomputed_index; + __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 = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(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_INCREF(((PyObject *)__pyx_kp_s_89)); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_s_89)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_89)); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __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_8); __pyx_t_8 = 0; + __pyx_t_8 = PyFloat_FromDouble((__pyx_v_stop_time - __pyx_v_start_time)); 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); + __pyx_t_7 = PyTuple_New(2); 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_INCREF(((PyObject *)__pyx_kp_s_90)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_90)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_90)); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_7), NULL); 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); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("cdec.sa._sa.Precomputation.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_darray); + __Pyx_XDECREF((PyObject *)__pyx_v_data); + __Pyx_XDECREF((PyObject *)__pyx_v_queue); + __Pyx_XDECREF((PyObject *)__pyx_v_cost_by_rank); + __Pyx_XDECREF((PyObject *)__pyx_v_count_by_rank); + __Pyx_XDECREF((PyObject *)__pyx_v_frequent_patterns); + __Pyx_XDECREF((PyObject *)__pyx_v_super_frequent_patterns); + __Pyx_XDECREF((PyObject *)__pyx_v_collocations); + __Pyx_XDECREF(__pyx_v_I_set); + __Pyx_XDECREF(__pyx_v_J_set); + __Pyx_XDECREF(__pyx_v_J2_set); + __Pyx_XDECREF(__pyx_v_IJ_set); + __Pyx_XDECREF(__pyx_v_pattern_rank); + __Pyx_XDECREF(__pyx_v_rank); + __Pyx_XDECREF(__pyx_v__); + __Pyx_XDECREF(__pyx_v_phrase); + __Pyx_XDECREF(__pyx_v_x); + __Pyx_XDECREF(__pyx_v_pattern1); + __Pyx_XDECREF(__pyx_v_pattern2); + __Pyx_XDECREF(__pyx_v_combined_pattern); + __Pyx_XDECREF(__pyx_v_pattern); + __Pyx_XDECREF(__pyx_v_arr); + __Pyx_XDECREF(__pyx_v_s); + __Pyx_XDECREF(__pyx_v_word_id); + __Pyx_XDECREF(__pyx_v_chunk); + __Pyx_XDECREF(__pyx_v_arity); + __Pyx_XDECREF(__pyx_v_cumul_cost); + __Pyx_XDECREF(__pyx_v_cumul_count); + __Pyx_XDECREF(__pyx_v_num_found_patterns); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11SuffixArray_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_from_binary = 0; + PyObject *__pyx_v_from_text = 0; + PyObject *__pyx_v_side = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__from_binary,&__pyx_n_s__from_text,&__pyx_n_s__side,0}; + PyObject* values[3] = {0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":11 + * cdef IntList ha + * + * def __cinit__(self, from_binary=None, from_text=None, side=None): # <<<<<<<<<<<<<< + * self.darray = DataArray() + * self.sa = IntList() + */ + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__from_binary); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__from_text); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side); + if (value) { values[2] = 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[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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_from_binary = values[0]; + __pyx_v_from_text = values[1]; + __pyx_v_side = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_from_binary, __pyx_v_from_text, __pyx_v_side); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11SuffixArray___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_from_binary, PyObject *__pyx_v_from_text, PyObject *__pyx_v_side) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + 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("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":12 + * + * def __cinit__(self, from_binary=None, from_text=None, side=None): + * self.darray = DataArray() # <<<<<<<<<<<<<< + * self.sa = IntList() + * self.ha = IntList() + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->darray); + __Pyx_DECREF(((PyObject *)__pyx_v_self->darray)); + __pyx_v_self->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":13 + * def __cinit__(self, from_binary=None, from_text=None, side=None): + * self.darray = DataArray() + * self.sa = IntList() # <<<<<<<<<<<<<< + * self.ha = IntList() + * if from_binary: + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); + __pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":14 + * self.darray = DataArray() + * self.sa = IntList() + * self.ha = IntList() # <<<<<<<<<<<<<< + * if from_binary: + * self.read_binary(from_binary) + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->ha); + __Pyx_DECREF(((PyObject *)__pyx_v_self->ha)); + __pyx_v_self->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":15 + * self.sa = IntList() + * self.ha = IntList() + * if from_binary: # <<<<<<<<<<<<<< + * self.read_binary(from_binary) + * elif from_text: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":17 + * if from_binary: + * self.read_binary(from_binary) + * elif from_text: # <<<<<<<<<<<<<< + * self.read_text(from_text, side) + * + */ + __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) { + + /* "/home/mdenkows/cdec/python/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_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_INCREF(__pyx_v_side); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_side); + __Pyx_GIVEREF(__pyx_v_side); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":20 + * self.read_text(from_text, side) + * + * def __getitem__(self, i): # <<<<<<<<<<<<<< + * return self.sa.arr[i] + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_2__getitem__(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":21 + * + * def __getitem__(self, i): + * return self.sa.arr[i] # <<<<<<<<<<<<<< + * + * def read_text(self, filename, side): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->sa->arr[__pyx_t_1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 21; __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; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_11SuffixArray_4read_text[] = "Constructs suffix array using the algorithm\n of Larsson & Sadahkane (1999)"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_5read_text(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_filename = 0; + PyObject *__pyx_v_side = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_text (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__side,0}; + PyObject* values[2] = {0,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__filename)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__side)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read_text", 1, 2, 2, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_text") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_filename = values[0]; + __pyx_v_side = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read_text", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_filename, __pyx_v_side); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":23 + * return self.sa.arr[i] + * + * def read_text(self, filename, side): # <<<<<<<<<<<<<< + * '''Constructs suffix array using the algorithm + * of Larsson & Sadahkane (1999)''' + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_4read_text(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_side) { + int __pyx_v_V; + int __pyx_v_N; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_h; + int __pyx_v_a_i; + int __pyx_v_n; + int __pyx_v_current_run; + int __pyx_v_skip; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_word_count = 0; + float __pyx_v_sort_start_time; + float __pyx_v_start_time; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + 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; + int __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_text", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":29 + * cdef IntList isa, word_count + * + * self.darray = DataArray(from_text=filename, side=side, use_sent_id=True) # <<<<<<<<<<<<<< + * N = len(self.darray) + * V = len(self.darray.id2word) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__from_text), __pyx_v_filename) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__side), __pyx_v_side) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__use_sent_id), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_DataArray)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->darray); + __Pyx_DECREF(((PyObject *)__pyx_v_self->darray)); + __pyx_v_self->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":30 + * + * self.darray = DataArray(from_text=filename, side=side, use_sent_id=True) + * N = len(self.darray) # <<<<<<<<<<<<<< + * V = len(self.darray.id2word) + * + */ + __pyx_t_2 = ((PyObject *)__pyx_v_self->darray); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_N = __pyx_t_3; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * self.sa = IntList(initial_len=N) + */ + __pyx_t_2 = __pyx_v_self->darray->id2word; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_V = __pyx_t_3; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":33 + * V = len(self.darray.id2word) + * + * self.sa = IntList(initial_len=N) # <<<<<<<<<<<<<< + * self.ha = IntList(initial_len=V+1) + * + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); + __pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":34 + * + * self.sa = IntList(initial_len=N) + * self.ha = IntList(initial_len=V+1) # <<<<<<<<<<<<<< + * + * isa = IntList(initial_len=N) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyInt_FromLong((__pyx_v_V + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->ha); + __Pyx_DECREF(((PyObject *)__pyx_v_self->ha)); + __pyx_v_self->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":36 + * self.ha = IntList(initial_len=V+1) + * + * isa = IntList(initial_len=N) # <<<<<<<<<<<<<< + * word_count = IntList(initial_len=V+1) + * + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_isa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":37 + * + * isa = IntList(initial_len=N) + * word_count = IntList(initial_len=V+1) # <<<<<<<<<<<<<< + * + * '''Step 1: bucket sort data''' + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyInt_FromLong((__pyx_v_V + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_word_count = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_sort_start_time = __pyx_t_4; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * for i from 0 <= i < N: + * a_i = self.darray.data.arr[i] + */ + __pyx_v_start_time = __pyx_v_sort_start_time; + + /* "/home/mdenkows/cdec/python/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++) { + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * word_count.arr[a_i] = word_count.arr[a_i] + 1 + * + */ + __pyx_v_a_i = (__pyx_v_self->darray->data->arr[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * + * n = 0 + */ + (__pyx_v_word_count->arr[__pyx_v_a_i]) = ((__pyx_v_word_count->arr[__pyx_v_a_i]) + 1); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":46 + * word_count.arr[a_i] = word_count.arr[a_i] + 1 + * + * n = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < V+1: + * self.ha.arr[i] = n + */ + __pyx_v_n = 0; + + /* "/home/mdenkows/cdec/python/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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":48 + * n = 0 + * for i from 0 <= i < V+1: + * self.ha.arr[i] = n # <<<<<<<<<<<<<< + * n = n + word_count.arr[i] + * word_count.arr[i] = 0 + */ + (__pyx_v_self->ha->arr[__pyx_v_i]) = __pyx_v_n; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":49 + * for i from 0 <= i < V+1: + * self.ha.arr[i] = n + * n = n + word_count.arr[i] # <<<<<<<<<<<<<< + * word_count.arr[i] = 0 + * + */ + __pyx_v_n = (__pyx_v_n + (__pyx_v_word_count->arr[__pyx_v_i])); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":50 + * self.ha.arr[i] = n + * n = n + word_count.arr[i] + * word_count.arr[i] = 0 # <<<<<<<<<<<<<< + * + * for i from 0 <= i < N: + */ + (__pyx_v_word_count->arr[__pyx_v_i]) = 0; + } + + /* "/home/mdenkows/cdec/python/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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":53 + * + * 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 + * isa.arr[i] = self.ha.arr[a_i + 1] - 1 # bucket pointer is last index in bucket + */ + __pyx_v_a_i = (__pyx_v_self->darray->data->arr[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * 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 + */ + (__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; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * word_count.arr[a_i] = word_count.arr[a_i] + 1 + * + */ + (__pyx_v_isa->arr[__pyx_v_i]) = ((__pyx_v_self->ha->arr[(__pyx_v_a_i + 1)]) - 1); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * + * '''Determine size of initial runs''' + */ + (__pyx_v_word_count->arr[__pyx_v_a_i]) = ((__pyx_v_word_count->arr[__pyx_v_a_i]) + 1); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":59 + * + * '''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: + */ + __pyx_v_current_run = 0; + + /* "/home/mdenkows/cdec/python/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++) { + + /* "/home/mdenkows/cdec/python/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; + } else { + __pyx_t_9 = __pyx_t_7; + } + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * else: + * if current_run > 0: + */ + __pyx_v_current_run = (__pyx_v_current_run + 1); + goto __pyx_L11; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":65 + * else: + * if current_run > 0: + * self.sa.arr[self.ha.arr[i] - current_run] = -current_run # <<<<<<<<<<<<<< + * current_run = 0 + * + */ + (__pyx_v_self->sa->arr[((__pyx_v_self->ha->arr[__pyx_v_i]) - __pyx_v_current_run)]) = (-__pyx_v_current_run); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":66 + * if current_run > 0: + * self.sa.arr[self.ha.arr[i] - current_run] = -current_run + * current_run = 0 # <<<<<<<<<<<<<< + * + * logger.info(" Bucket sort took %f seconds", (monitor_cpu() - sort_start_time)) + */ + __pyx_v_current_run = 0; + goto __pyx_L12; + } + __pyx_L12:; + } + __pyx_L11:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":68 + * current_run = 0 + * + * logger.info(" Bucket sort took %f seconds", (monitor_cpu() - sort_start_time)) # <<<<<<<<<<<<<< + * + * '''Step 2: prefix-doubling sort''' + */ + __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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_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_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_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_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_91)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_91)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_91)); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":71 + * + * '''Step 2: prefix-doubling sort''' + * h = 1 # <<<<<<<<<<<<<< + * while self.sa.arr[0] != -N: + * sort_start_time = monitor_cpu() + */ + __pyx_v_h = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":72 + * '''Step 2: prefix-doubling sort''' + * h = 1 + * while self.sa.arr[0] != -N: # <<<<<<<<<<<<<< + * sort_start_time = monitor_cpu() + * 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; + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_11, ((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__pyx_v_h); 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_INCREF(((PyObject *)__pyx_kp_s_92)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_92)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__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(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":75 + * sort_start_time = monitor_cpu() + * logger.debug(" Refining, sort depth = %d", h) + * i = 0 # <<<<<<<<<<<<<< + * skip = 0 + * while i < N: + */ + __pyx_v_i = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":76 + * logger.debug(" Refining, sort depth = %d", h) + * i = 0 + * skip = 0 # <<<<<<<<<<<<<< + * while i < N: + * if self.sa.arr[i] < 0: + */ + __pyx_v_skip = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":77 + * i = 0 + * skip = 0 + * while i < N: # <<<<<<<<<<<<<< + * if self.sa.arr[i] < 0: + * skip = skip + self.sa.arr[i] + */ + while (1) { + __pyx_t_9 = ((__pyx_v_i < __pyx_v_N) != 0); + if (!__pyx_t_9) break; + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":79 + * while i < N: + * if self.sa.arr[i] < 0: + * skip = skip + self.sa.arr[i] # <<<<<<<<<<<<<< + * i = i - self.sa.arr[i] + * else: + */ + __pyx_v_skip = (__pyx_v_skip + (__pyx_v_self->sa->arr[__pyx_v_i])); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":80 + * if self.sa.arr[i] < 0: + * skip = skip + self.sa.arr[i] + * i = i - self.sa.arr[i] # <<<<<<<<<<<<<< + * else: + * if skip < 0: + */ + __pyx_v_i = (__pyx_v_i - (__pyx_v_self->sa->arr[__pyx_v_i])); + goto __pyx_L17; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":83 + * else: + * if skip < 0: + * self.sa.arr[i+skip] = skip # <<<<<<<<<<<<<< + * skip = 0 + * j = isa.arr[self.sa.arr[i]] + */ + (__pyx_v_self->sa->arr[(__pyx_v_i + __pyx_v_skip)]) = __pyx_v_skip; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":84 + * if skip < 0: + * self.sa.arr[i+skip] = skip + * skip = 0 # <<<<<<<<<<<<<< + * j = isa.arr[self.sa.arr[i]] + * self.q3sort(i, j, h, isa) + */ + __pyx_v_skip = 0; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":85 + * self.sa.arr[i+skip] = skip + * skip = 0 + * j = isa.arr[self.sa.arr[i]] # <<<<<<<<<<<<<< + * self.q3sort(i, j, h, isa) + * i = j+1 + */ + __pyx_v_j = (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_i])]); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":86 + * skip = 0 + * j = isa.arr[self.sa.arr[i]] + * self.q3sort(i, j, h, isa) # <<<<<<<<<<<<<< + * i = j+1 + * if skip < 0: + */ + __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 = PyInt_FromLong(__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 = PyInt_FromLong(__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 = PyInt_FromLong(__pyx_v_h); 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_GIVEREF(__pyx_t_10); + __Pyx_INCREF(((PyObject *)__pyx_v_isa)); + PyTuple_SET_ITEM(__pyx_t_12, 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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":87 + * j = isa.arr[self.sa.arr[i]] + * self.q3sort(i, j, h, isa) + * i = j+1 # <<<<<<<<<<<<<< + * if skip < 0: + * self.sa.arr[i+skip] = skip + */ + __pyx_v_i = (__pyx_v_j + 1); + } + __pyx_L17:; + } + + /* "/home/mdenkows/cdec/python/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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":89 + * i = j+1 + * if skip < 0: + * self.sa.arr[i+skip] = skip # <<<<<<<<<<<<<< + * h = h * 2 + * 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; + } + __pyx_L19:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":90 + * if skip < 0: + * self.sa.arr[i+skip] = skip + * h = h * 2 # <<<<<<<<<<<<<< + * logger.debug(" Refinement took %f seconds", (monitor_cpu() - sort_start_time)) + * + */ + __pyx_v_h = (__pyx_v_h * 2); + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_10, ((PyObject *)__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_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_GOTREF(__pyx_t_11); + __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_INCREF(((PyObject *)__pyx_kp_s_93)); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_kp_s_93)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_93)); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__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(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_95), 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; + + /* "/home/mdenkows/cdec/python/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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":96 + * logger.info(" Finalizing sort...") + * for i from 0 <= i < N: + * j = isa.arr[i] # <<<<<<<<<<<<<< + * self.sa.arr[j] = i + * logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time)) + */ + __pyx_v_j = (__pyx_v_isa->arr[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":97 + * for i from 0 <= i < N: + * j = isa.arr[i] + * self.sa.arr[j] = i # <<<<<<<<<<<<<< + * logger.info("Suffix array construction took %f seconds", (monitor_cpu() - start_time)) + * + */ + (__pyx_v_self->sa->arr[__pyx_v_j]) = __pyx_v_i; + } + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_11, ((PyObject *)__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_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_GOTREF(__pyx_t_11); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_96)); + PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_kp_s_96)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_96)); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__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(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __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_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.read_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_isa); + __Pyx_XDECREF((PyObject *)__pyx_v_word_count); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_11SuffixArray_6q3sort[] = "This is a ternary quicksort. It divides the array into\n three partitions: items less than the pivot, items equal\n to pivot, and items greater than pivot. The first and last\n of these partitions are then recursively sorted"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_7q3sort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_h; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa = 0; + PyObject *__pyx_v_pad = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("q3sort (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__i,&__pyx_n_s__j,&__pyx_n_s__h,&__pyx_n_s__isa,&__pyx_n_s__pad,0}; + PyObject* values[5] = {0,0,0,0,0}; + values[4] = ((PyObject *)__pyx_kp_s_47); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__i)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 2); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__isa)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, 3); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pad); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "q3sort") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_i = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_j = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_j == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_h = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_isa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)values[3]); + __pyx_v_pad = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("q3sort", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_isa), __pyx_ptype_4cdec_2sa_3_sa_IntList, 1, "isa", 0))) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_i, __pyx_v_j, __pyx_v_h, __pyx_v_isa, __pyx_v_pad); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/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=""): # <<<<<<<<<<<<<< + * '''This is a ternary quicksort. It divides the array into + * three partitions: items less than the pivot, items equal + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_6q3sort(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, int __pyx_v_h, struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_isa, PyObject *__pyx_v_pad) { + int __pyx_v_k; + int __pyx_v_midpoint; + int __pyx_v_pval; + int __pyx_v_phead; + int __pyx_v_ptail; + int __pyx_v_tmp; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + long __pyx_t_5; + 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("q3sort", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":107 + * cdef int k, midpoint, pval, phead, ptail, tmp + * + * 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 + */ + __pyx_t_1 = (((__pyx_v_j - __pyx_v_i) < -1) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":108 + * + * 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 + * return + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __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[12]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_97), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__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[12]; __pyx_lineno = 108; __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_Exception, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __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); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[12]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * return + * if (j-i == 0): # recursive base case -- singleton interval + */ + __pyx_t_1 = (((__pyx_v_j - __pyx_v_i) == -1) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * if (j-i == 0): # recursive base case -- singleton interval + * isa.arr[self.sa.arr[i]] = i + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * isa.arr[self.sa.arr[i]] = i + * self.sa.arr[i] = -1 + */ + __pyx_t_1 = (((__pyx_v_j - __pyx_v_i) == 0) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":112 + * return + * if (j-i == 0): # recursive base case -- singleton interval + * isa.arr[self.sa.arr[i]] = i # <<<<<<<<<<<<<< + * self.sa.arr[i] = -1 + * return + */ + (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_i])]) = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * return + * + */ + (__pyx_v_self->sa->arr[__pyx_v_i]) = -1; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":114 + * isa.arr[self.sa.arr[i]] = i + * self.sa.arr[i] = -1 + * return # <<<<<<<<<<<<<< + * + * # NOTE: choosing the first item as a pivot value resulted in + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * pval = isa.arr[self.sa.arr[midpoint] + h] + * if i != midpoint: + */ + __pyx_v_midpoint = __Pyx_div_long((__pyx_v_i + __pyx_v_j), 2); + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * if i != midpoint: + * tmp = self.sa.arr[midpoint] + */ + __pyx_v_pval = (__pyx_v_isa->arr[((__pyx_v_self->sa->arr[__pyx_v_midpoint]) + __pyx_v_h)]); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":125 + * midpoint = (i+j)/2 + * pval = isa.arr[self.sa.arr[midpoint] + h] + * if i != midpoint: # <<<<<<<<<<<<<< + * tmp = self.sa.arr[midpoint] + * self.sa.arr[midpoint] = self.sa.arr[i] + */ + __pyx_t_1 = ((__pyx_v_i != __pyx_v_midpoint) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":126 + * pval = isa.arr[self.sa.arr[midpoint] + h] + * if i != midpoint: + * tmp = self.sa.arr[midpoint] # <<<<<<<<<<<<<< + * self.sa.arr[midpoint] = self.sa.arr[i] + * self.sa.arr[i] = tmp + */ + __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_midpoint]); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":127 + * if i != midpoint: + * tmp = self.sa.arr[midpoint] + * self.sa.arr[midpoint] = self.sa.arr[i] # <<<<<<<<<<<<<< + * self.sa.arr[i] = tmp + * phead = i + */ + (__pyx_v_self->sa->arr[__pyx_v_midpoint]) = (__pyx_v_self->sa->arr[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":128 + * tmp = self.sa.arr[midpoint] + * self.sa.arr[midpoint] = self.sa.arr[i] + * self.sa.arr[i] = tmp # <<<<<<<<<<<<<< + * phead = i + * ptail = i + */ + (__pyx_v_self->sa->arr[__pyx_v_i]) = __pyx_v_tmp; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":129 + * self.sa.arr[midpoint] = self.sa.arr[i] + * self.sa.arr[i] = tmp + * phead = i # <<<<<<<<<<<<<< + * ptail = i + * + */ + __pyx_v_phead = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":130 + * self.sa.arr[i] = tmp + * phead = i + * ptail = i # <<<<<<<<<<<<<< + * + * # find the three partitions. phead marks the first element + */ + __pyx_v_ptail = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * if isa.arr[self.sa.arr[k] + h] < pval: + * if k > ptail+1: + */ + __pyx_t_5 = (__pyx_v_j + 1); + for (__pyx_v_k = (__pyx_v_i + 1); __pyx_v_k < __pyx_t_5; __pyx_v_k++) { + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * if k > ptail+1: + * tmp = self.sa.arr[phead] + */ + __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) { + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * tmp = self.sa.arr[phead] + * self.sa.arr[phead] = self.sa.arr[k] + */ + __pyx_t_1 = ((__pyx_v_k > (__pyx_v_ptail + 1)) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":137 + * if isa.arr[self.sa.arr[k] + h] < pval: + * if k > ptail+1: + * tmp = self.sa.arr[phead] # <<<<<<<<<<<<<< + * self.sa.arr[phead] = self.sa.arr[k] + * self.sa.arr[k] = self.sa.arr[ptail+1] + */ + __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_phead]); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":138 + * if k > ptail+1: + * tmp = self.sa.arr[phead] + * self.sa.arr[phead] = self.sa.arr[k] # <<<<<<<<<<<<<< + * self.sa.arr[k] = self.sa.arr[ptail+1] + * self.sa.arr[ptail+1] = tmp + */ + (__pyx_v_self->sa->arr[__pyx_v_phead]) = (__pyx_v_self->sa->arr[__pyx_v_k]); + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * self.sa.arr[ptail+1] = tmp + * else: # k == ptail+1 + */ + (__pyx_v_self->sa->arr[__pyx_v_k]) = (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * else: # k == ptail+1 + * tmp = self.sa.arr[phead] + */ + (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]) = __pyx_v_tmp; + goto __pyx_L10; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":142 + * self.sa.arr[ptail+1] = tmp + * else: # k == ptail+1 + * tmp = self.sa.arr[phead] # <<<<<<<<<<<<<< + * self.sa.arr[phead] = self.sa.arr[k] + * self.sa.arr[k] = tmp + */ + __pyx_v_tmp = (__pyx_v_self->sa->arr[__pyx_v_phead]); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":143 + * else: # k == ptail+1 + * tmp = self.sa.arr[phead] + * self.sa.arr[phead] = self.sa.arr[k] # <<<<<<<<<<<<<< + * self.sa.arr[k] = tmp + * phead = phead + 1 + */ + (__pyx_v_self->sa->arr[__pyx_v_phead]) = (__pyx_v_self->sa->arr[__pyx_v_k]); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":144 + * tmp = self.sa.arr[phead] + * self.sa.arr[phead] = self.sa.arr[k] + * self.sa.arr[k] = tmp # <<<<<<<<<<<<<< + * phead = phead + 1 + * ptail = ptail + 1 + */ + (__pyx_v_self->sa->arr[__pyx_v_k]) = __pyx_v_tmp; + } + __pyx_L10:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":145 + * self.sa.arr[phead] = self.sa.arr[k] + * self.sa.arr[k] = tmp + * phead = phead + 1 # <<<<<<<<<<<<<< + * ptail = ptail + 1 + * else: + */ + __pyx_v_phead = (__pyx_v_phead + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":146 + * self.sa.arr[k] = tmp + * phead = phead + 1 + * ptail = ptail + 1 # <<<<<<<<<<<<<< + * else: + * if isa.arr[self.sa.arr[k] + h] == pval: + */ + __pyx_v_ptail = (__pyx_v_ptail + 1); + goto __pyx_L9; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":148 + * ptail = ptail + 1 + * else: + * if isa.arr[self.sa.arr[k] + h] == pval: # <<<<<<<<<<<<<< + * if k > ptail+1: + * tmp = self.sa.arr[ptail+1] + */ + __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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":149 + * else: + * if isa.arr[self.sa.arr[k] + h] == pval: + * if k > ptail+1: # <<<<<<<<<<<<<< + * tmp = self.sa.arr[ptail+1] + * self.sa.arr[ptail+1] = self.sa.arr[k] + */ + __pyx_t_1 = ((__pyx_v_k > (__pyx_v_ptail + 1)) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * self.sa.arr[ptail+1] = self.sa.arr[k] + * self.sa.arr[k] = tmp + */ + __pyx_v_tmp = (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]); + + /* "/home/mdenkows/cdec/python/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] # <<<<<<<<<<<<<< + * self.sa.arr[k] = tmp + * ptail = ptail + 1 + */ + (__pyx_v_self->sa->arr[(__pyx_v_ptail + 1)]) = (__pyx_v_self->sa->arr[__pyx_v_k]); + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * ptail = ptail + 1 + * + */ + (__pyx_v_self->sa->arr[__pyx_v_k]) = __pyx_v_tmp; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":153 + * self.sa.arr[ptail+1] = self.sa.arr[k] + * self.sa.arr[k] = tmp + * ptail = ptail + 1 # <<<<<<<<<<<<<< + * + * # recursively sort smaller suffixes + */ + __pyx_v_ptail = (__pyx_v_ptail + 1); + goto __pyx_L11; + } + __pyx_L11:; + } + __pyx_L9:; + } + + /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong(__pyx_v_i); 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 = PyInt_FromLong((__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_GOTREF(__pyx_t_2); + __pyx_t_6 = PyInt_FromLong(__pyx_v_h); 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, ((PyObject *)__pyx_kp_s_50)); 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_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_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_INCREF(((PyObject *)__pyx_v_isa)); + PyTuple_SET_ITEM(__pyx_t_8, 3, ((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; + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * isa.arr[self.sa.arr[k]] = ptail + * if phead == ptail: + */ + __pyx_t_5 = (__pyx_v_ptail + 1); + for (__pyx_v_k = __pyx_v_phead; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { + + /* "/home/mdenkows/cdec/python/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 # <<<<<<<<<<<<<< + * if phead == ptail: + * self.sa.arr[phead] = -1 + */ + (__pyx_v_isa->arr[(__pyx_v_self->sa->arr[__pyx_v_k])]) = __pyx_v_ptail; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":162 + * for k from phead <= k < ptail+1: + * isa.arr[self.sa.arr[k]] = ptail + * if phead == ptail: # <<<<<<<<<<<<<< + * self.sa.arr[phead] = -1 + * + */ + __pyx_t_1 = ((__pyx_v_phead == __pyx_v_ptail) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":163 + * isa.arr[self.sa.arr[k]] = ptail + * if phead == ptail: + * self.sa.arr[phead] = -1 # <<<<<<<<<<<<<< + * + * # recursively sort larger suffixes + */ + (__pyx_v_self->sa->arr[__pyx_v_phead]) = -1; + goto __pyx_L15; + } + __pyx_L15:; + + /* "/home/mdenkows/cdec/python/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 = PyInt_FromLong((__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_GOTREF(__pyx_t_8); + __pyx_t_3 = PyInt_FromLong(__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 = PyInt_FromLong(__pyx_v_h); 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, ((PyObject *)__pyx_kp_s_50)); 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_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); + __Pyx_INCREF(((PyObject *)__pyx_v_isa)); + PyTuple_SET_ITEM(__pyx_t_4, 3, ((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); + __pyx_t_8 = 0; + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.q3sort", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_9write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_9write_text(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[12]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":169 + * + * + * def write_text(self, char* filename): # <<<<<<<<<<<<<< + * self.darray.write_text(filename) + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_8write_text(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { + 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("write_text", 0); + + /* "/home/mdenkows/cdec/python/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_GOTREF(((PyObject *)__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_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_text", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_11read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_11read_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[12]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.read_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":172 + * self.darray.write_text(filename) + * + * def read_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE *f + * f = fopen(filename, "r") + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11SuffixArray_10read_binary(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_self, char *__pyx_v_filename) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("read_binary", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":174 + * def read_binary(self, char* filename): + * cdef FILE *f + * f = fopen(filename, "r") # <<<<<<<<<<<<<< + * self.darray.read_handle(f) + * self.sa.read_handle(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__r); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":175 + * cdef FILE *f + * f = fopen(filename, "r") + * self.darray.read_handle(f) # <<<<<<<<<<<<<< + * self.sa.read_handle(f) + * self.ha.read_handle(f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->read_handle(__pyx_v_self->darray, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":176 + * f = fopen(filename, "r") + * self.darray.read_handle(f) + * self.sa.read_handle(f) # <<<<<<<<<<<<<< + * self.ha.read_handle(f) + * fclose(f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->read_handle(__pyx_v_self->sa, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":177 + * self.darray.read_handle(f) + * self.sa.read_handle(f) + * self.ha.read_handle(f) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->read_handle(__pyx_v_self->ha, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":178 + * self.sa.read_handle(f) + * self.ha.read_handle(f) + * fclose(f) # <<<<<<<<<<<<<< + * + * def write_binary(self, char* filename): + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_13write_binary(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[12]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_binary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_12write_binary(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":180 + * fclose(f) + * + * def write_binary(self, char* filename): # <<<<<<<<<<<<<< + * cdef FILE* f + * f = fopen(filename, "w") + */ + +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) { + FILE *__pyx_v_f; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("write_binary", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":182 + * def write_binary(self, char* filename): + * cdef FILE* f + * f = fopen(filename, "w") # <<<<<<<<<<<<<< + * self.darray.write_handle(f) + * self.sa.write_handle(f) + */ + __pyx_v_f = fopen(__pyx_v_filename, __pyx_k__w); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":183 + * cdef FILE* f + * f = fopen(filename, "w") + * self.darray.write_handle(f) # <<<<<<<<<<<<<< + * self.sa.write_handle(f) + * self.ha.write_handle(f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray *)__pyx_v_self->darray->__pyx_vtab)->write_handle(__pyx_v_self->darray, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":184 + * f = fopen(filename, "w") + * self.darray.write_handle(f) + * self.sa.write_handle(f) # <<<<<<<<<<<<<< + * self.ha.write_handle(f) + * fclose(f) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->sa->__pyx_vtab)->write_handle(__pyx_v_self->sa, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":185 + * self.darray.write_handle(f) + * self.sa.write_handle(f) + * self.ha.write_handle(f) # <<<<<<<<<<<<<< + * fclose(f) + * + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_self->ha->__pyx_vtab)->write_handle(__pyx_v_self->ha, __pyx_v_f); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":186 + * self.sa.write_handle(f) + * self.ha.write_handle(f) + * fclose(f) # <<<<<<<<<<<<<< + * + * def write_enhanced(self, char* filename): + */ + fclose(__pyx_v_f); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_15write_enhanced(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __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[12]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_14write_enhanced(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), ((char *)__pyx_v_filename)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":188 + * fclose(f) + * + * def write_enhanced(self, char* filename): # <<<<<<<<<<<<<< + * with open(filename, "w") as f: + * self.darray.write_enhanced_handle(f) + */ + +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) { + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_v_a_i = NULL; + PyObject *__pyx_v_w_i = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + 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; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("write_enhanced", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * self.darray.write_enhanced_handle(f) + * for a_i in self.sa: + */ + /*with:*/ { + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __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__w)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__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_GetAttrStr(__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 = PyObject_Call(__pyx_t_2, ((PyObject *)__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_GOTREF(__pyx_t_4); + __Pyx_DECREF(__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_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_4); + __pyx_v_f = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/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_29); 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_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 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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; + } 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; + } + 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 + } else { + __pyx_t_1 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_a_i); + __pyx_v_a_i = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_98), NULL); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/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; + } 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; + } + 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 + } else { + __pyx_t_2 = __pyx_t_9(__pyx_t_4); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[12]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF(__pyx_v_w_i); + __pyx_v_w_i = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __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(((PyObject *)__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, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__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(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/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_GOTREF(__pyx_t_4); + __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_99), 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_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; + 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_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * self.darray.write_enhanced_handle(f) + * for a_i in self.sa: + */ + /*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); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(3); 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_INCREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_12 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_11 < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_13 = ((!(__pyx_t_11 != 0)) != 0); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GIVEREF(__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_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L22; + } + __pyx_L22:; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __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; + 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); + 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_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_3) { + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_100, 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_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_13 < 0) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L23; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L1_error; + __pyx_L23:; + } + + __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_10); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.write_enhanced", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_a_i); + __Pyx_XDECREF(__pyx_v_w_i); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":198 + * f.write("\n") + * + * cdef int __search_high(self, int word_id, int offset, int low, int high): # <<<<<<<<<<<<<< + * cdef int midpoint + * + */ + +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) { + int __pyx_v_midpoint; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__search_high", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":201 + * cdef int midpoint + * + * if low >= high: # <<<<<<<<<<<<<< + * return high + * midpoint = (high + low) / 2 + */ + __pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":202 + * + * if low >= high: + * return high # <<<<<<<<<<<<<< + * midpoint = (high + low) / 2 + * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: + */ + __pyx_r = __pyx_v_high; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":203 + * if low >= high: + * return high + * 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) + */ + __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":204 + * return high + * 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) + * else: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * else: + * return self.__search_high(word_id, offset, low, midpoint) + */ + __pyx_r = ((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 + 1), __pyx_v_high); + goto __pyx_L0; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * cdef int __search_low(self, int word_id, int offset, int low, int high): + */ + __pyx_r = ((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_low, __pyx_v_midpoint); + goto __pyx_L0; + } + __pyx_L4:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< + * cdef int midpoint + * + */ + +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) { + int __pyx_v_midpoint; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__search_low", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":212 + * cdef int midpoint + * + * if low >= high: # <<<<<<<<<<<<<< + * return high + * midpoint = (high + low) / 2 + */ + __pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":213 + * + * if low >= high: + * return high # <<<<<<<<<<<<<< + * midpoint = (high + low) / 2 + * if self.darray.data.arr[self.sa.arr[midpoint] + offset] == word_id: + */ + __pyx_r = __pyx_v_high; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":214 + * if low >= high: + * return high + * 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) + */ + __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":215 + * return high + * 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) + * else: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * else: + * return self.__search_low(word_id, offset, midpoint+1, high) + */ + __pyx_r = ((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); + goto __pyx_L0; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * cdef __get_range(self, int word_id, int offset, int low, int high, int midpoint): + */ + __pyx_r = ((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_midpoint + 1), __pyx_v_high); + goto __pyx_L0; + } + __pyx_L4:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< + * return (self.__search_low(word_id, offset, low, midpoint), + * self.__search_high(word_id, offset, midpoint, high)) + */ + +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) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get_range", 0); + + /* "/home/mdenkows/cdec/python/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), # <<<<<<<<<<<<<< + * self.__search_high(word_id, offset, midpoint, high)) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((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); + + /* "/home/mdenkows/cdec/python/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)) # <<<<<<<<<<<<<< + * + * cdef __lookup_helper(self, int word_id, int offset, int low, int high): + */ + __pyx_t_2 = PyInt_FromLong(((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); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__get_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< + * cdef int midpoint + * + */ + +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) { + int __pyx_v_midpoint; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + 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("__lookup_helper", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":227 + * cdef int midpoint + * + * if offset == 0: # <<<<<<<<<<<<<< + * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) + * if low >= high: + */ + __pyx_t_1 = ((__pyx_v_offset == 0) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":228 + * + * if offset == 0: + * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) # <<<<<<<<<<<<<< + * if low >= high: + * return None + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong((__pyx_v_self->ha->arr[__pyx_v_word_id])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong((__pyx_v_self->ha->arr[(__pyx_v_word_id + 1)])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 228; __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[12]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":229 + * if offset == 0: + * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) + * if low >= high: # <<<<<<<<<<<<<< + * return None + * + */ + __pyx_t_1 = ((__pyx_v_low >= __pyx_v_high) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":230 + * return (self.ha.arr[word_id], self.ha.arr[word_id+1]) + * if low >= high: + * return None # <<<<<<<<<<<<<< + * + * midpoint = (high + low) / 2 + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":232 + * return None + * + * 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) + */ + __pyx_v_midpoint = __Pyx_div_long((__pyx_v_high + __pyx_v_low), 2); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":233 + * + * 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) + * if self.darray.data.arr[self.sa.arr[midpoint] + offset] > word_id: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * if self.darray.data.arr[self.sa.arr[midpoint] + offset] > word_id: + * return self.__lookup_helper(word_id, offset, low, midpoint) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___get_range(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_high, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/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: # <<<<<<<<<<<<<< + * return self.__lookup_helper(word_id, offset, low, midpoint) + * else: + */ + __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) { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * else: + * return self.__lookup_helper(word_id, offset, midpoint+1, high) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, __pyx_v_low, __pyx_v_midpoint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * + * def lookup(self, word, int offset, int low, int high): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_v_word_id, __pyx_v_offset, (__pyx_v_midpoint + 1), __pyx_v_high); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 238; __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_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.__lookup_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_17lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_17lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_word = 0; + int __pyx_v_offset; + int __pyx_v_low; + int __pyx_v_high; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lookup (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__offset,&__pyx_n_s__low,&__pyx_n_s__high,0}; + PyObject* values[4] = {0,0,0,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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__word)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 1); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__low)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 2); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__high)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, 3); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lookup") < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_word = values[0]; + __pyx_v_offset = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_low = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_high = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lookup", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[12]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11SuffixArray_16lookup(((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self), __pyx_v_word, __pyx_v_offset, __pyx_v_low, __pyx_v_high); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/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): # <<<<<<<<<<<<<< + * cdef int wordid + * if low == -1: + */ + +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) { + PyObject *__pyx_v_word_id = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __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("lookup", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":242 + * def lookup(self, word, int offset, int low, int high): + * cdef int wordid + * if low == -1: # <<<<<<<<<<<<<< + * low = 0 + * if high == -1: + */ + __pyx_t_1 = ((__pyx_v_low == -1) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":243 + * cdef int wordid + * if low == -1: + * low = 0 # <<<<<<<<<<<<<< + * if high == -1: + * high = len(self.sa) + */ + __pyx_v_low = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":244 + * if low == -1: + * low = 0 + * if high == -1: # <<<<<<<<<<<<<< + * high = len(self.sa) + * if word in self.darray.word2id: + */ + __pyx_t_1 = ((__pyx_v_high == -1) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":245 + * low = 0 + * if high == -1: + * high = len(self.sa) # <<<<<<<<<<<<<< + * if word in self.darray.word2id: + * word_id = self.darray.word2id[word] + */ + __pyx_t_2 = ((PyObject *)__pyx_v_self->sa); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_high = __pyx_t_3; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":246 + * if high == -1: + * high = len(self.sa) + * if word in self.darray.word2id: # <<<<<<<<<<<<<< + * word_id = self.darray.word2id[word] + * return self.__lookup_helper(word_id, offset, low, high) + */ + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_word, __pyx_v_self->darray->word2id, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_1 != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":247 + * high = len(self.sa) + * if word in self.darray.word2id: + * word_id = self.darray.word2id[word] # <<<<<<<<<<<<<< + * return self.__lookup_helper(word_id, offset, low, high) + * else: + */ + __pyx_t_2 = PyObject_GetItem(__pyx_v_self->darray->word2id, __pyx_v_word); if (!__pyx_t_2) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_word_id = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * else: + * return None + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_word_id); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray *)__pyx_v_self->__pyx_vtab)->__pyx___lookup_helper(__pyx_v_self, __pyx_t_5, __pyx_v_offset, __pyx_v_low, __pyx_v_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":250 + * return self.__lookup_helper(word_id, offset, low, high) + * else: + * return None # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.SuffixArray.lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_word_id); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __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_2sa_3_sa_11OnlineStats___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* 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) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":56 + * self.phrases_f = defaultdict(int) + * self.phrases_e = defaultdict(int) + * self.phrases_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< + * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) + * + */ + +static PyObject *__pyx_lambda_funcdef_lambda1(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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda1", 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 = 56; __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 = 56; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __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; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_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) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":57 + * self.phrases_e = defaultdict(int) + * self.phrases_fe = defaultdict(lambda: defaultdict(int)) + * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) # <<<<<<<<<<<<<< + * + * # Bilexical counts + */ + +static PyObject *__pyx_lambda_funcdef_lambda2(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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda2", 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 = 57; __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 = 57; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3 = {__Pyx_NAMESTR("lambda3"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3(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_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":62 + * self.bilex_f = defaultdict(int) + * self.bilex_e = defaultdict(int) + * self.bilex_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< + * + * cdef int PRECOMPUTE = 0 + */ + +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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 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 = 62; __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 = 62; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __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; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":49 + * cdef public bilex_fe + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * # Keep track of everything that can be sampled: + * self.samples_f = defaultdict(int) + */ + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __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("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":51 + * 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 = 51; __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 = 51; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 51; __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_GIVEREF(__pyx_t_3); + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":54 + * + * # 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 = 54; __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 = 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_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), 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_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->phrases_f); + __Pyx_DECREF(__pyx_v_self->phrases_f); + __pyx_v_self->phrases_f = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":55 + * # 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 = 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_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 = PyObject_Call(__pyx_t_1, ((PyObject *)__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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":56 + * 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 = 56; __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_101, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __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 = 56; __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(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":57 + * self.phrases_e = defaultdict(int) + * self.phrases_fe = defaultdict(lambda: defaultdict(int)) + * self.phrases_al = defaultdict(lambda: defaultdict(tuple)) # <<<<<<<<<<<<<< + * + * # Bilexical counts + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __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_101, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __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 = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":60 + * + * # Bilexical counts + * self.bilex_f = defaultdict(int) # <<<<<<<<<<<<<< + * self.bilex_e = defaultdict(int) + * self.bilex_fe = defaultdict(lambda: defaultdict(int)) + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 60; __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 60; __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_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->bilex_f); + __Pyx_DECREF(__pyx_v_self->bilex_f); + __pyx_v_self->bilex_f = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":61 + * # Bilexical counts + * self.bilex_f = defaultdict(int) + * self.bilex_e = defaultdict(int) # <<<<<<<<<<<<<< + * self.bilex_fe = defaultdict(lambda: defaultdict(int)) + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 61; __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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->bilex_e); + __Pyx_DECREF(__pyx_v_self->bilex_e); + __pyx_v_self->bilex_e = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":62 + * self.bilex_f = defaultdict(int) + * self.bilex_e = defaultdict(int) + * self.bilex_fe = defaultdict(lambda: defaultdict(int)) # <<<<<<<<<<<<<< + * + * cdef int PRECOMPUTE = 0 + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_11OnlineStats_9__cinit___2lambda3, 0, __pyx_n_s_101, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __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 = 62; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 62; __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_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->bilex_fe); + __Pyx_DECREF(__pyx_v_self->bilex_fe); + __pyx_v_self->bilex_fe = __pyx_t_3; + __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.OnlineStats.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":40 + * + * cdef class OnlineStats: + * cdef public samples_f # <<<<<<<<<<<<<< + * cdef public phrases_f + * cdef public phrases_e + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->samples_f); + __pyx_r = __pyx_v_self->samples_f; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __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)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->samples_f); + __Pyx_DECREF(__pyx_v_self->samples_f); + __pyx_v_self->samples_f = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9samples_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->samples_f); + __Pyx_DECREF(__pyx_v_self->samples_f); + __pyx_v_self->samples_f = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":41 + * cdef class OnlineStats: + * cdef public samples_f + * cdef public phrases_f # <<<<<<<<<<<<<< + * cdef public phrases_e + * cdef public phrases_fe + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->phrases_f); + __pyx_r = __pyx_v_self->phrases_f; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->phrases_f); + __Pyx_DECREF(__pyx_v_self->phrases_f); + __pyx_v_self->phrases_f = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->phrases_f); + __Pyx_DECREF(__pyx_v_self->phrases_f); + __pyx_v_self->phrases_f = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":42 + * cdef public samples_f + * cdef public phrases_f + * cdef public phrases_e # <<<<<<<<<<<<<< + * cdef public phrases_fe + * cdef public phrases_al + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->phrases_e); + __pyx_r = __pyx_v_self->phrases_e; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->phrases_e); + __Pyx_DECREF(__pyx_v_self->phrases_e); + __pyx_v_self->phrases_e = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->phrases_e); + __Pyx_DECREF(__pyx_v_self->phrases_e); + __pyx_v_self->phrases_e = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":43 + * cdef public phrases_f + * cdef public phrases_e + * cdef public phrases_fe # <<<<<<<<<<<<<< + * cdef public phrases_al + * cdef public bilex_f + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->phrases_fe); + __pyx_r = __pyx_v_self->phrases_fe; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->phrases_fe); + __Pyx_DECREF(__pyx_v_self->phrases_fe); + __pyx_v_self->phrases_fe = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->phrases_fe); + __Pyx_DECREF(__pyx_v_self->phrases_fe); + __pyx_v_self->phrases_fe = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":44 + * cdef public phrases_e + * cdef public phrases_fe + * cdef public phrases_al # <<<<<<<<<<<<<< + * cdef public bilex_f + * cdef public bilex_e + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->phrases_al); + __pyx_r = __pyx_v_self->phrases_al; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->phrases_al); + __Pyx_DECREF(__pyx_v_self->phrases_al); + __pyx_v_self->phrases_al = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->phrases_al); + __Pyx_DECREF(__pyx_v_self->phrases_al); + __pyx_v_self->phrases_al = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":45 + * cdef public phrases_fe + * cdef public phrases_al + * cdef public bilex_f # <<<<<<<<<<<<<< + * cdef public bilex_e + * cdef public bilex_fe + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->bilex_f); + __pyx_r = __pyx_v_self->bilex_f; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->bilex_f); + __Pyx_DECREF(__pyx_v_self->bilex_f); + __pyx_v_self->bilex_f = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->bilex_f); + __Pyx_DECREF(__pyx_v_self->bilex_f); + __pyx_v_self->bilex_f = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":46 + * cdef public phrases_al + * cdef public bilex_f + * cdef public bilex_e # <<<<<<<<<<<<<< + * cdef public bilex_fe + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->bilex_e); + __pyx_r = __pyx_v_self->bilex_e; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->bilex_e); + __Pyx_DECREF(__pyx_v_self->bilex_e); + __pyx_v_self->bilex_e = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->bilex_e); + __Pyx_DECREF(__pyx_v_self->bilex_e); + __pyx_v_self->bilex_e = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe___get__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":47 + * cdef public bilex_f + * cdef public bilex_e + * cdef public bilex_fe # <<<<<<<<<<<<<< + * + * def __cinit__(self): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe___get__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->bilex_fe); + __pyx_r = __pyx_v_self->bilex_fe; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->bilex_fe); + __Pyx_DECREF(__pyx_v_self->bilex_fe); + __pyx_v_self->bilex_fe = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->bilex_fe); + __Pyx_DECREF(__pyx_v_self->bilex_fe); + __pyx_v_self->bilex_fe = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __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_2sa_3_sa_8TrieNode___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":74 + * cdef public children + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.children = {} + * + */ + +static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self) { + 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("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":75 + * + * def __cinit__(self): + * self.children = {} # <<<<<<<<<<<<<< + * + * cdef class ExtendedTrieNode(TrieNode): + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(__pyx_v_self->children); + __pyx_v_self->children = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.TrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":72 + * + * cdef class TrieNode: + * cdef public children # <<<<<<<<<<<<<< + * + * def __cinit__(self): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->children); + __pyx_r = __pyx_v_self->children; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(__pyx_v_self->children); + __pyx_v_self->children = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_8TrieNode_8children_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(__pyx_v_self->children); + __pyx_v_self->children = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_phrase = 0; + PyObject *__pyx_v_phrase_location = 0; + PyObject *__pyx_v_suffix_link = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__phrase,&__pyx_n_s__phrase_location,&__pyx_n_s__suffix_link,0}; + PyObject* values[3] = {0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":82 + * cdef public suffix_link + * + * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): # <<<<<<<<<<<<<< + * self.phrase = phrase + * self.phrase_location = phrase_location + */ + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__phrase); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__phrase_location); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__suffix_link); + if (value) { values[2] = 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[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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_phrase = values[0]; + __pyx_v_phrase_location = values[1]; + __pyx_v_suffix_link = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.ExtendedTrieNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), __pyx_v_phrase, __pyx_v_phrase_location, __pyx_v_suffix_link); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_phrase, PyObject *__pyx_v_phrase_location, PyObject *__pyx_v_suffix_link) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":83 + * + * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): + * self.phrase = phrase # <<<<<<<<<<<<<< + * self.phrase_location = phrase_location + * self.suffix_link = suffix_link + */ + __Pyx_INCREF(__pyx_v_phrase); + __Pyx_GIVEREF(__pyx_v_phrase); + __Pyx_GOTREF(__pyx_v_self->phrase); + __Pyx_DECREF(__pyx_v_self->phrase); + __pyx_v_self->phrase = __pyx_v_phrase; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":84 + * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): + * self.phrase = phrase + * self.phrase_location = phrase_location # <<<<<<<<<<<<<< + * self.suffix_link = suffix_link + * + */ + __Pyx_INCREF(__pyx_v_phrase_location); + __Pyx_GIVEREF(__pyx_v_phrase_location); + __Pyx_GOTREF(__pyx_v_self->phrase_location); + __Pyx_DECREF(__pyx_v_self->phrase_location); + __pyx_v_self->phrase_location = __pyx_v_phrase_location; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":85 + * self.phrase = phrase + * self.phrase_location = phrase_location + * self.suffix_link = suffix_link # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF(__pyx_v_suffix_link); + __Pyx_GIVEREF(__pyx_v_suffix_link); + __Pyx_GOTREF(__pyx_v_self->suffix_link); + __Pyx_DECREF(__pyx_v_self->suffix_link); + __pyx_v_self->suffix_link = __pyx_v_suffix_link; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase___get__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":78 + * + * cdef class ExtendedTrieNode(TrieNode): + * cdef public phrase # <<<<<<<<<<<<<< + * cdef public phrase_location + * cdef public suffix_link + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->phrase); + __pyx_r = __pyx_v_self->phrase; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->phrase); + __Pyx_DECREF(__pyx_v_self->phrase); + __pyx_v_self->phrase = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->phrase); + __Pyx_DECREF(__pyx_v_self->phrase); + __pyx_v_self->phrase = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location___get__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":79 + * cdef class ExtendedTrieNode(TrieNode): + * cdef public phrase + * cdef public phrase_location # <<<<<<<<<<<<<< + * cdef public suffix_link + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->phrase_location); + __pyx_r = __pyx_v_self->phrase_location; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->phrase_location); + __Pyx_DECREF(__pyx_v_self->phrase_location); + __pyx_v_self->phrase_location = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->phrase_location); + __Pyx_DECREF(__pyx_v_self->phrase_location); + __pyx_v_self->phrase_location = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link___get__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":80 + * cdef public phrase + * cdef public phrase_location + * cdef public suffix_link # <<<<<<<<<<<<<< + * + * def __cinit__(self, phrase=None, phrase_location=None, suffix_link=None): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link___get__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->suffix_link); + __pyx_r = __pyx_v_self->suffix_link; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->suffix_link); + __Pyx_DECREF(__pyx_v_self->suffix_link); + __pyx_v_self->suffix_link = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->suffix_link); + __Pyx_DECREF(__pyx_v_self->suffix_link); + __pyx_v_self->suffix_link = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_extended = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__extended,0}; + PyObject* values[1] = {0}; + values[0] = __pyx_k_103; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + 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__extended); + 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[8]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_extended = values[0]; + } + 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[8]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), __pyx_v_extended); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":92 + * cdef public int count + * cdef public root + * def __cinit__(self, extended=False): # <<<<<<<<<<<<<< + * self.count = 0 + * self.extended = extended + */ + +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_extended) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":93 + * cdef public root + * def __cinit__(self, extended=False): + * self.count = 0 # <<<<<<<<<<<<<< + * self.extended = extended + * if extended: + */ + __pyx_v_self->count = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":94 + * def __cinit__(self, extended=False): + * self.count = 0 + * self.extended = extended # <<<<<<<<<<<<<< + * if extended: + * self.root = ExtendedTrieNode() + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_extended); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->extended = __pyx_t_1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":95 + * self.count = 0 + * self.extended = extended + * if extended: # <<<<<<<<<<<<<< + * self.root = ExtendedTrieNode() + * else: + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_extended); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":96 + * self.extended = extended + * if extended: + * self.root = ExtendedTrieNode() # <<<<<<<<<<<<<< + * else: + * self.root = TrieNode() + */ + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":98 + * self.root = ExtendedTrieNode() + * else: + * self.root = TrieNode() # <<<<<<<<<<<<<< + * + * # linked list structure for storing matches in BaselineRuleFactory + */ + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_TrieNode)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":89 + * + * cdef class TrieTable: + * cdef public int extended # <<<<<<<<<<<<<< + * cdef public int count + * cdef public root + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->extended); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.extended.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_8extended_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->extended = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.extended.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":90 + * cdef class TrieTable: + * cdef public int extended + * cdef public int count # <<<<<<<<<<<<<< + * cdef public root + * def __cinit__(self, extended=False): + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_5count_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); 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->count = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.TrieTable.count.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root___get__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":91 + * cdef public int extended + * cdef public int count + * cdef public root # <<<<<<<<<<<<<< + * def __cinit__(self, extended=False): + * self.count = 0 + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root___get__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->root); + __pyx_r = __pyx_v_self->root; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_2__set__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_2__set__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_4__del__(((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_4cdec_2sa_3_sa_9TrieTable_4root_4__del__(struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->root); + __Pyx_DECREF(__pyx_v_self->root); + __pyx_v_self->root = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":118 + * + * # returns true if sent_id is contained + * cdef int contains(self, int sent_id): # <<<<<<<<<<<<<< + * return 1 + * + */ + +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) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("contains", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":119 + * # returns true if sent_id is contained + * cdef int contains(self, int sent_id): + * return 1 # <<<<<<<<<<<<<< + * + * def __cinit__(self, int sa_low=-1, int sa_high=-1, int arr_low=-1, int arr_high=-1, + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_sa_low; + int __pyx_v_sa_high; + int __pyx_v_arr_low; + int __pyx_v_arr_high; + PyObject *__pyx_v_arr = 0; + int __pyx_v_num_subpatterns; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + 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}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":122 + * + * 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 + * self.sa_high = sa_high + */ + values[4] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__sa_low); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sa_high); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr_low); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr_high); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_subpatterns); + if (value) { values[5] = 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[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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; + } + } + if (values[0]) { + __pyx_v_sa_low = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_sa_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_sa_low = ((int)-1); + } + if (values[1]) { + __pyx_v_sa_high = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_sa_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_sa_high = ((int)-1); + } + if (values[2]) { + __pyx_v_arr_low = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_arr_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_arr_low = ((int)-1); + } + if (values[3]) { + __pyx_v_arr_high = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_arr_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_arr_high = ((int)-1); + } + __pyx_v_arr = values[4]; + if (values[5]) { + __pyx_v_num_subpatterns = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_num_subpatterns == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_num_subpatterns = ((int)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __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); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":121 + * return 1 + * + * 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 + */ + +static int __pyx_pf_4cdec_2sa_3_sa_14PhraseLocation___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_self, int __pyx_v_sa_low, int __pyx_v_sa_high, int __pyx_v_arr_low, int __pyx_v_arr_high, PyObject *__pyx_v_arr, int __pyx_v_num_subpatterns) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":123 + * 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 # <<<<<<<<<<<<<< + * self.sa_high = sa_high + * self.arr_low = arr_low + */ + __pyx_v_self->sa_low = __pyx_v_sa_low; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":124 + * arr=None, int num_subpatterns=1): + * self.sa_low = sa_low + * self.sa_high = sa_high # <<<<<<<<<<<<<< + * self.arr_low = arr_low + * self.arr_high = arr_high + */ + __pyx_v_self->sa_high = __pyx_v_sa_high; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":125 + * self.sa_low = sa_low + * self.sa_high = sa_high + * self.arr_low = arr_low # <<<<<<<<<<<<<< + * self.arr_high = arr_high + * self.arr = arr + */ + __pyx_v_self->arr_low = __pyx_v_arr_low; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":126 + * self.sa_high = sa_high + * self.arr_low = arr_low + * self.arr_high = arr_high # <<<<<<<<<<<<<< + * self.arr = arr + * self.num_subpatterns = num_subpatterns + */ + __pyx_v_self->arr_high = __pyx_v_arr_high; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":127 + * self.arr_low = arr_low + * self.arr_high = arr_high + * self.arr = arr # <<<<<<<<<<<<<< + * self.num_subpatterns = num_subpatterns + * + */ + if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_arr); + __Pyx_GIVEREF(__pyx_v_arr); + __Pyx_GOTREF(__pyx_v_self->arr); + __Pyx_DECREF(((PyObject *)__pyx_v_self->arr)); + __pyx_v_self->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":128 + * self.arr_high = arr_high + * self.arr = arr + * self.num_subpatterns = num_subpatterns # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->num_subpatterns = __pyx_v_num_subpatterns; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.sa._sa.PhraseLocation.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_7Sampler_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_sample_size; + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sample_size,&__pyx_n_s__fsarray,0}; + PyObject* values[2] = {0,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__sample_size)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fsarray)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_sample_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_sample_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_fsarray = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)__pyx_v_self), __pyx_v_sample_size, __pyx_v_fsarray); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":138 + * cdef IntList sa + * + * def __cinit__(self, int sample_size, SuffixArray fsarray): # <<<<<<<<<<<<<< + * self.sample_size = sample_size + * self.sa = fsarray.sa + */ + +static int __pyx_pf_4cdec_2sa_3_sa_7Sampler___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_self, int __pyx_v_sample_size, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + 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("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":139 + * + * def __cinit__(self, int sample_size, SuffixArray fsarray): + * self.sample_size = sample_size # <<<<<<<<<<<<<< + * self.sa = fsarray.sa + * if sample_size > 0: + */ + __pyx_v_self->sample_size = __pyx_v_sample_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":140 + * def __cinit__(self, int sample_size, SuffixArray fsarray): + * self.sample_size = sample_size + * self.sa = fsarray.sa # <<<<<<<<<<<<<< + * if sample_size > 0: + * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) + */ + __pyx_t_1 = ((PyObject *)__pyx_v_fsarray->sa); + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sa)); + __pyx_v_self->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":141 + * self.sample_size = sample_size + * self.sa = fsarray.sa + * if sample_size > 0: # <<<<<<<<<<<<<< + * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) + * else: + */ + __pyx_t_2 = ((__pyx_v_sample_size > 0) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":142 + * 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 = 142; __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_sample_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 142; __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_104)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_104)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_104)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __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[8]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":144 + * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) + * else: + * logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<< + * + * def sample(self, PhraseLocation phrase_location): + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __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_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __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; + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.Sampler.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_7Sampler_2sample[] = "Returns a sample of the locations for\n the phrase. If there are less than self.sample_size\n locations, return all of them; otherwise, return\n up to self.sample_size locations. In the latter case,\n we choose to sample UNIFORMLY -- that is, the locations\n are chosen at uniform intervals over the entire set, rather\n than randomly. This makes the algorithm deterministic, which\n is good for things like MERT"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_7Sampler_3sample(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase_location) { + 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("sample (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_phrase_location), __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation, 1, "phrase_location", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)__pyx_v_self), ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_v_phrase_location)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":146 + * logger.info("Sampling strategy: no sampling") + * + * def sample(self, PhraseLocation phrase_location): # <<<<<<<<<<<<<< + * '''Returns a sample of the locations for + * the phrase. If there are less than self.sample_size + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_7Sampler_2sample(struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_phrase_location) { + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_sample = 0; + double __pyx_v_i; + double __pyx_v_stepsize; + int __pyx_v_num_locations; + int __pyx_v_val; + int __pyx_v_j; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":159 + * cdef int num_locations, val, j + * + * sample = IntList() # <<<<<<<<<<<<<< + * if phrase_location.arr is None: + * num_locations = phrase_location.sa_high - phrase_location.sa_low + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":160 + * + * sample = IntList() + * 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: + */ + __pyx_t_2 = (((PyObject *)__pyx_v_phrase_location->arr) == Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":161 + * sample = IntList() + * 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) + */ + __pyx_v_num_locations = (__pyx_v_phrase_location->sa_high - __pyx_v_phrase_location->sa_low); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":162 + * 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; + } else { + __pyx_t_4 = __pyx_t_3; + } + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":163 + * 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: + * stepsize = float(num_locations)/float(self.sample_size) + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_sample->__pyx_vtab)->_extend_arr(__pyx_v_sample, (__pyx_v_self->sa->arr + __pyx_v_phrase_location->sa_low), __pyx_v_num_locations); + goto __pyx_L4; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":165 + * sample._extend_arr(self.sa.arr + phrase_location.sa_low, num_locations) + * 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: + */ + if (unlikely(((double)__pyx_v_self->sample_size) == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":166 + * 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":167 + * 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 + * 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; + } else { + __pyx_t_2 = __pyx_t_4; + } + if (!__pyx_t_2) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":170 + * '''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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":171 + * effect, according to the python documentation''' + * if fmod(i,1.0) > 0.5: + * val = int(ceil(i)) # <<<<<<<<<<<<<< + * else: + * val = int(floor(i)) + */ + __pyx_v_val = ((int)ceil(__pyx_v_i)); + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":173 + * val = int(ceil(i)) + * else: + * val = int(floor(i)) # <<<<<<<<<<<<<< + * sample._append(self.sa.arr[val]) + * i = i + stepsize + */ + __pyx_v_val = ((int)floor(__pyx_v_i)); + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":174 + * else: + * val = int(floor(i)) + * sample._append(self.sa.arr[val]) # <<<<<<<<<<<<<< + * i = i + stepsize + * else: + */ + ((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])); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":175 + * val = int(floor(i)) + * sample._append(self.sa.arr[val]) + * i = i + stepsize # <<<<<<<<<<<<<< + * else: + * num_locations = (phrase_location.arr_high - phrase_location.arr_low) / phrase_location.num_subpatterns + */ + __pyx_v_i = (__pyx_v_i + __pyx_v_stepsize); + } + } + __pyx_L4:; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":177 + * 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); + if (unlikely(__pyx_v_phrase_location->num_subpatterns == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_phrase_location->num_subpatterns == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_num_locations = __Pyx_div_int(__pyx_t_5, __pyx_v_phrase_location->num_subpatterns); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":178 + * 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 + * else: + */ + __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; + } else { + __pyx_t_3 = __pyx_t_2; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":179 + * 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 # <<<<<<<<<<<<<< + * else: + * stepsize = float(num_locations)/float(self.sample_size) + */ + __pyx_t_1 = ((PyObject *)__pyx_v_phrase_location->arr); + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_v_sample)); + __pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":181 + * sample = phrase_location.arr + * 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: + */ + if (unlikely(((double)__pyx_v_self->sample_size) == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_stepsize = (((double)__pyx_v_num_locations) / ((double)__pyx_v_self->sample_size)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":182 + * 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":183 + * 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 + * 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; + } else { + __pyx_t_4 = __pyx_t_3; + } + if (!__pyx_t_4) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":186 + * '''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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":187 + * effect, according to the python documentation''' + * if fmod(i,1.0) > 0.5: + * val = int(ceil(i)) # <<<<<<<<<<<<<< + * else: + * val = int(floor(i)) + */ + __pyx_v_val = ((int)ceil(__pyx_v_i)); + goto __pyx_L11; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":189 + * val = int(ceil(i)) + * else: + * 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) + */ + __pyx_v_val = ((int)floor(__pyx_v_i)); + } + __pyx_L11:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":190 + * else: + * 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) + * i = i + stepsize + */ + __pyx_v_j = (__pyx_v_phrase_location->arr_low + (__pyx_v_val * __pyx_v_phrase_location->num_subpatterns)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":191 + * 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) # <<<<<<<<<<<<<< + * i = i + stepsize + * return sample + */ + ((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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":192 + * 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 # <<<<<<<<<<<<<< + * return sample + * + */ + __pyx_v_i = (__pyx_v_i + __pyx_v_stepsize); + } + } + __pyx_L8:; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":193 + * sample._extend_arr(phrase_location.arr.arr + j, phrase_location.num_subpatterns) + * i = i + stepsize + * return sample # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_sample)); + __pyx_r = ((PyObject *)__pyx_v_sample); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.Sampler.sample", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_sample); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":205 + * + * + * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): # <<<<<<<<<<<<<< + * m.arr = arr + * m.start = start + */ + +static void __pyx_f_4cdec_2sa_3_sa_assign_matching(struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_m, int *__pyx_v_arr, int __pyx_v_start, int __pyx_v_step, int *__pyx_v_sent_id_arr) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("assign_matching", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":206 + * + * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): + * m.arr = arr # <<<<<<<<<<<<<< + * m.start = start + * m.end = start + step + */ + __pyx_v_m->arr = __pyx_v_arr; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":207 + * cdef void assign_matching(Matching* m, int* arr, int start, int step, int* sent_id_arr): + * m.arr = arr + * m.start = start # <<<<<<<<<<<<<< + * m.end = start + step + * m.sent_id = sent_id_arr[arr[start]] + */ + __pyx_v_m->start = __pyx_v_start; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":208 + * m.arr = arr + * m.start = start + * m.end = start + step # <<<<<<<<<<<<<< + * m.sent_id = sent_id_arr[arr[start]] + * m.size = step + */ + __pyx_v_m->end = (__pyx_v_start + __pyx_v_step); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":209 + * m.start = start + * m.end = start + step + * m.sent_id = sent_id_arr[arr[start]] # <<<<<<<<<<<<<< + * m.size = step + * + */ + __pyx_v_m->sent_id = (__pyx_v_sent_id_arr[(__pyx_v_arr[__pyx_v_start])]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":210 + * m.end = start + step + * m.sent_id = sent_id_arr[arr[start]] + * m.size = step # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_m->size = __pyx_v_step; + + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":213 + * + * + * cdef int* append_combined_matching(int* arr, Matching* loc1, Matching* loc2, # <<<<<<<<<<<<<< + * int offset_by_one, int num_subpatterns, int* result_len): + * cdef int i, new_len + */ + +static int *__pyx_f_4cdec_2sa_3_sa_append_combined_matching(int *__pyx_v_arr, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc1, struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc2, CYTHON_UNUSED int __pyx_v_offset_by_one, int __pyx_v_num_subpatterns, int *__pyx_v_result_len) { + int __pyx_v_i; + int __pyx_v_new_len; + int *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("append_combined_matching", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":217 + * cdef int i, new_len + * + * new_len = result_len[0] + num_subpatterns # <<<<<<<<<<<<<< + * arr = realloc(arr, new_len*sizeof(int)) + * + */ + __pyx_v_new_len = ((__pyx_v_result_len[0]) + __pyx_v_num_subpatterns); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":218 + * + * new_len = result_len[0] + num_subpatterns + * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< + * + * for i from 0 <= i < loc1.size: + */ + __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":220 + * arr = realloc(arr, new_len*sizeof(int)) + * + * for i from 0 <= i < loc1.size: # <<<<<<<<<<<<<< + * arr[result_len[0]+i] = loc1.arr[loc1.start+i] + * if num_subpatterns > loc1.size: + */ + __pyx_t_1 = __pyx_v_loc1->size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":221 + * + * for i from 0 <= i < loc1.size: + * arr[result_len[0]+i] = loc1.arr[loc1.start+i] # <<<<<<<<<<<<<< + * if num_subpatterns > loc1.size: + * arr[new_len-1] = loc2.arr[loc2.end-1] + */ + (__pyx_v_arr[((__pyx_v_result_len[0]) + __pyx_v_i)]) = (__pyx_v_loc1->arr[(__pyx_v_loc1->start + __pyx_v_i)]); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":222 + * for i from 0 <= i < loc1.size: + * arr[result_len[0]+i] = loc1.arr[loc1.start+i] + * if num_subpatterns > loc1.size: # <<<<<<<<<<<<<< + * arr[new_len-1] = loc2.arr[loc2.end-1] + * result_len[0] = new_len + */ + __pyx_t_2 = ((__pyx_v_num_subpatterns > __pyx_v_loc1->size) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":223 + * arr[result_len[0]+i] = loc1.arr[loc1.start+i] + * if num_subpatterns > loc1.size: + * arr[new_len-1] = loc2.arr[loc2.end-1] # <<<<<<<<<<<<<< + * result_len[0] = new_len + * return arr + */ + (__pyx_v_arr[(__pyx_v_new_len - 1)]) = (__pyx_v_loc2->arr[(__pyx_v_loc2->end - 1)]); + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":224 + * if num_subpatterns > loc1.size: + * arr[new_len-1] = loc2.arr[loc2.end-1] + * result_len[0] = new_len # <<<<<<<<<<<<<< + * return arr + * + */ + (__pyx_v_result_len[0]) = __pyx_v_new_len; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":225 + * arr[new_len-1] = loc2.arr[loc2.end-1] + * result_len[0] = new_len + * return arr # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_arr; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":228 + * + * + * cdef int* extend_arr(int* arr, int* arr_len, int* appendix, int appendix_len): # <<<<<<<<<<<<<< + * cdef int new_len + * + */ + +static int *__pyx_f_4cdec_2sa_3_sa_extend_arr(int *__pyx_v_arr, int *__pyx_v_arr_len, int *__pyx_v_appendix, int __pyx_v_appendix_len) { + int __pyx_v_new_len; + int *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("extend_arr", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":231 + * cdef int new_len + * + * new_len = arr_len[0] + appendix_len # <<<<<<<<<<<<<< + * arr = realloc(arr, new_len*sizeof(int)) + * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) + */ + __pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_appendix_len); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":232 + * + * new_len = arr_len[0] + appendix_len + * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< + * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) + * arr_len[0] = new_len + */ + __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":233 + * new_len = arr_len[0] + appendix_len + * arr = realloc(arr, new_len*sizeof(int)) + * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) # <<<<<<<<<<<<<< + * arr_len[0] = new_len + * return arr + */ + memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_appendix, (__pyx_v_appendix_len * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":234 + * arr = realloc(arr, new_len*sizeof(int)) + * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) + * arr_len[0] = new_len # <<<<<<<<<<<<<< + * return arr + * + */ + (__pyx_v_arr_len[0]) = __pyx_v_new_len; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":235 + * memcpy(arr+arr_len[0], appendix, appendix_len*sizeof(int)) + * arr_len[0] = new_len + * return arr # <<<<<<<<<<<<<< + * + * cdef int median(int low, int high, int step): + */ + __pyx_r = __pyx_v_arr; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":237 + * return arr + * + * cdef int median(int low, int high, int step): # <<<<<<<<<<<<<< + * return low + (((high - low)/step)/2)*step + * + */ + +static int __pyx_f_4cdec_2sa_3_sa_median(int __pyx_v_low, int __pyx_v_high, int __pyx_v_step) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("median", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":238 + * + * cdef int median(int low, int high, int step): + * return low + (((high - low)/step)/2)*step # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = (__pyx_v_high - __pyx_v_low); + if (unlikely(__pyx_v_step == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_step == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_1))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_r = (__pyx_v_low + (__Pyx_div_long(__Pyx_div_int(__pyx_t_1, __pyx_v_step), 2) * __pyx_v_step)); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("cdec.sa._sa.median", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":241 + * + * + * cdef void find_comparable_matchings(int low, int high, int* arr, int step, int loc, int* loc_minus, int* loc_plus): # <<<<<<<<<<<<<< + * # Returns (minus, plus) indices for the portion of the array + * # in which all matchings have the same first index as the one + */ + +static void __pyx_f_4cdec_2sa_3_sa_find_comparable_matchings(int __pyx_v_low, int __pyx_v_high, int *__pyx_v_arr, int __pyx_v_step, int __pyx_v_loc, int *__pyx_v_loc_minus, int *__pyx_v_loc_plus) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("find_comparable_matchings", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":245 + * # in which all matchings have the same first index as the one + * # starting at loc + * loc_plus[0] = loc + step # <<<<<<<<<<<<<< + * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: + * loc_plus[0] = loc_plus[0] + step + */ + (__pyx_v_loc_plus[0]) = (__pyx_v_loc + __pyx_v_step); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":246 + * # starting at loc + * loc_plus[0] = loc + step + * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: # <<<<<<<<<<<<<< + * loc_plus[0] = loc_plus[0] + step + * 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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (!__pyx_t_3) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":247 + * loc_plus[0] = loc + step + * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: + * 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]: + */ + (__pyx_v_loc_plus[0]) = ((__pyx_v_loc_plus[0]) + __pyx_v_step); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":248 + * while loc_plus[0] < high and arr[loc_plus[0]] == arr[loc]: + * 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]: + * loc_minus[0] = loc_minus[0] - step + */ + (__pyx_v_loc_minus[0]) = __pyx_v_loc; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":249 + * 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]: # <<<<<<<<<<<<<< + * loc_minus[0] = loc_minus[0] - step + * + */ + 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; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (!__pyx_t_2) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":250 + * 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 # <<<<<<<<<<<<<< + * + * + */ + (__pyx_v_loc_minus[0]) = ((__pyx_v_loc_minus[0]) - __pyx_v_step); + } + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_alignment = 0; + float __pyx_v_by_slack_factor; + char *__pyx_v_category; + PyObject *__pyx_v_max_chunks = 0; + unsigned int __pyx_v_max_initial_size; + unsigned int __pyx_v_max_length; + unsigned int __pyx_v_max_nonterminals; + PyObject *__pyx_v_max_target_chunks = 0; + PyObject *__pyx_v_max_target_length = 0; + unsigned int __pyx_v_min_gap_size; + PyObject *__pyx_v_precompute_file = 0; + unsigned int __pyx_v_precompute_secondary_rank; + unsigned int __pyx_v_precompute_rank; + int __pyx_v_require_aligned_terminal; + int __pyx_v_require_aligned_chunks; + unsigned int __pyx_v_train_max_initial_size; + unsigned int __pyx_v_train_min_gap_size; + int __pyx_v_tight_phrases; + int __pyx_v_use_baeza_yates; + int __pyx_v_use_collocations; + int __pyx_v_use_index; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alignment,&__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_72,&__pyx_n_s__precompute_rank,&__pyx_n_s_107,&__pyx_n_s_108,&__pyx_n_s_73,&__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[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":314 + * 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, # <<<<<<<<<<<<<< + * # maximum span of a grammar rule in TEST DATA + * unsigned max_initial_size=10, + */ + values[3] = ((PyObject *)Py_None); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":322 + * 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, # <<<<<<<<<<<<<< + * # 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, + */ + values[7] = ((PyObject *)Py_None); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":324 + * 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, # <<<<<<<<<<<<<< + * # minimum span of a nonterminal in the RHS of a rule in TEST DATA + * unsigned min_gap_size=2, + */ + values[8] = ((PyObject *)Py_None); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":328 + * unsigned min_gap_size=2, + * # filename of file containing precomputed collocations + * precompute_file=None, # <<<<<<<<<<<<<< + * # maximum frequency rank of patterns used to compute triples (don't set higher than 20). + * unsigned precompute_secondary_rank=20, + */ + values[10] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); + case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); + case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); + case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); + case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); + case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); + case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__alignment)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__by_slack_factor); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__category); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_chunks); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_initial_size); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_length); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_nonterminals); + if (value) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_target_chunks); + if (value) { values[7] = value; kw_args--; } + } + case 8: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_target_length); + if (value) { values[8] = value; kw_args--; } + } + case 9: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_gap_size); + if (value) { values[9] = value; kw_args--; } + } + case 10: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__precompute_file); + if (value) { values[10] = value; kw_args--; } + } + case 11: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_72); + if (value) { values[11] = value; kw_args--; } + } + case 12: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__precompute_rank); + if (value) { values[12] = value; kw_args--; } + } + case 13: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_107); + if (value) { values[13] = value; kw_args--; } + } + case 14: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_108); + if (value) { values[14] = value; kw_args--; } + } + case 15: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_73); + if (value) { values[15] = value; kw_args--; } + } + case 16: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__train_min_gap_size); + if (value) { values[16] = value; kw_args--; } + } + case 17: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tight_phrases); + if (value) { values[17] = value; kw_args--; } + } + case 18: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_baeza_yates); + if (value) { values[18] = value; kw_args--; } + } + case 19: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_collocations); + if (value) { values[19] = value; kw_args--; } + } + case 20: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_index); + if (value) { values[20] = 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[8]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); + case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); + case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); + case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); + case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); + case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); + case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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_alignment = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)values[0]); + if (values[1]) { + __pyx_v_by_slack_factor = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_by_slack_factor == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":310 + * Alignment alignment, + * # parameter for double-binary search; doesn't seem to matter much + * float by_slack_factor=1.0, # <<<<<<<<<<<<<< + * # name of generic nonterminal used by Hiero + * char* category="[X]", + */ + __pyx_v_by_slack_factor = ((float)1.0); + } + if (values[2]) { + __pyx_v_category = __Pyx_PyObject_AsString(values[2]); if (unlikely((!__pyx_v_category) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_category = ((char *)__pyx_k_109); + } + __pyx_v_max_chunks = values[3]; + if (values[4]) { + __pyx_v_max_initial_size = __Pyx_PyInt_AsUnsignedInt(values[4]); if (unlikely((__pyx_v_max_initial_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_max_initial_size = ((unsigned int)10); + } + if (values[5]) { + __pyx_v_max_length = __Pyx_PyInt_AsUnsignedInt(values[5]); if (unlikely((__pyx_v_max_length == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_max_length = ((unsigned int)5); + } + if (values[6]) { + __pyx_v_max_nonterminals = __Pyx_PyInt_AsUnsignedInt(values[6]); if (unlikely((__pyx_v_max_nonterminals == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_max_nonterminals = ((unsigned int)2); + } + __pyx_v_max_target_chunks = values[7]; + __pyx_v_max_target_length = values[8]; + if (values[9]) { + __pyx_v_min_gap_size = __Pyx_PyInt_AsUnsignedInt(values[9]); if (unlikely((__pyx_v_min_gap_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_min_gap_size = ((unsigned int)2); + } + __pyx_v_precompute_file = values[10]; + if (values[11]) { + __pyx_v_precompute_secondary_rank = __Pyx_PyInt_AsUnsignedInt(values[11]); if (unlikely((__pyx_v_precompute_secondary_rank == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_precompute_secondary_rank = ((unsigned int)20); + } + if (values[12]) { + __pyx_v_precompute_rank = __Pyx_PyInt_AsUnsignedInt(values[12]); if (unlikely((__pyx_v_precompute_rank == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_precompute_rank = ((unsigned int)100); + } + if (values[13]) { + __pyx_v_require_aligned_terminal = __Pyx_PyObject_IsTrue(values[13]); if (unlikely((__pyx_v_require_aligned_terminal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":334 + * unsigned precompute_rank=100, + * # require extracted rules to have at least one aligned word + * bint require_aligned_terminal=True, # <<<<<<<<<<<<<< + * # require each contiguous chunk of extracted rules to have at least one aligned word + * bint require_aligned_chunks=False, + */ + __pyx_v_require_aligned_terminal = ((int)1); + } + if (values[14]) { + __pyx_v_require_aligned_chunks = __Pyx_PyObject_IsTrue(values[14]); if (unlikely((__pyx_v_require_aligned_chunks == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":336 + * bint require_aligned_terminal=True, + * # require each contiguous chunk of extracted rules to have at least one aligned word + * bint require_aligned_chunks=False, # <<<<<<<<<<<<<< + * # maximum span of a grammar rule extracted from TRAINING DATA + * unsigned train_max_initial_size=10, + */ + __pyx_v_require_aligned_chunks = ((int)0); + } + if (values[15]) { + __pyx_v_train_max_initial_size = __Pyx_PyInt_AsUnsignedInt(values[15]); if (unlikely((__pyx_v_train_max_initial_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_train_max_initial_size = ((unsigned int)10); + } + if (values[16]) { + __pyx_v_train_min_gap_size = __Pyx_PyInt_AsUnsignedInt(values[16]); if (unlikely((__pyx_v_train_min_gap_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_train_min_gap_size = ((unsigned int)2); + } + if (values[17]) { + __pyx_v_tight_phrases = __Pyx_PyObject_IsTrue(values[17]); if (unlikely((__pyx_v_tight_phrases == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":342 + * unsigned train_min_gap_size=2, + * # False if phrases should be loose (better but slower), True otherwise + * bint tight_phrases=True, # <<<<<<<<<<<<<< + * # True to require use of double-binary alg, false otherwise + * bint use_baeza_yates=True, + */ + __pyx_v_tight_phrases = ((int)1); + } + if (values[18]) { + __pyx_v_use_baeza_yates = __Pyx_PyObject_IsTrue(values[18]); if (unlikely((__pyx_v_use_baeza_yates == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":344 + * bint tight_phrases=True, + * # True to require use of double-binary alg, false otherwise + * bint use_baeza_yates=True, # <<<<<<<<<<<<<< + * # True to enable used of precomputed collocations + * bint use_collocations=True, + */ + __pyx_v_use_baeza_yates = ((int)1); + } + if (values[19]) { + __pyx_v_use_collocations = __Pyx_PyObject_IsTrue(values[19]); if (unlikely((__pyx_v_use_collocations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":346 + * bint use_baeza_yates=True, + * # True to enable used of precomputed collocations + * bint use_collocations=True, # <<<<<<<<<<<<<< + * # True to enable use of precomputed inverted indices + * bint use_index=True): + */ + __pyx_v_use_collocations = ((int)1); + } + if (values[20]) { + __pyx_v_use_index = __Pyx_PyObject_IsTrue(values[20]); if (unlikely((__pyx_v_use_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":348 + * bint use_collocations=True, + * # True to enable use of precomputed inverted indices + * bint use_index=True): # <<<<<<<<<<<<<< + * '''Note: we make a distinction between the min_gap_size + * and max_initial_size used in test and train. The latter + */ + __pyx_v_use_index = ((int)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 21, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + 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 = 308; __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_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); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":306 + * cdef online_stats + * + * def __cinit__(self, # <<<<<<<<<<<<<< + * # compiled alignment object (REQUIRED) + * Alignment alignment, + */ + +static int __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_Alignment *__pyx_v_alignment, float __pyx_v_by_slack_factor, char *__pyx_v_category, PyObject *__pyx_v_max_chunks, unsigned int __pyx_v_max_initial_size, unsigned int __pyx_v_max_length, unsigned int __pyx_v_max_nonterminals, PyObject *__pyx_v_max_target_chunks, PyObject *__pyx_v_max_target_length, unsigned int __pyx_v_min_gap_size, PyObject *__pyx_v_precompute_file, unsigned int __pyx_v_precompute_secondary_rank, unsigned int __pyx_v_precompute_rank, int __pyx_v_require_aligned_terminal, int __pyx_v_require_aligned_chunks, unsigned int __pyx_v_train_max_initial_size, unsigned int __pyx_v_train_min_gap_size, int __pyx_v_tight_phrases, int __pyx_v_use_baeza_yates, int __pyx_v_use_collocations, int __pyx_v_use_index) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":354 + * 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 # <<<<<<<<<<<<<< + * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) + * if alignment is None: + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 354; __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 = 354; __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_2sa_3_sa_TrieTable)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->rules); + __Pyx_DECREF(((PyObject *)__pyx_v_self->rules)); + __pyx_v_self->rules = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":355 + * them to be the same, therefore we don't either.''' + * self.rules = TrieTable(True) # cache + * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) # <<<<<<<<<<<<<< + * if alignment is None: + * raise Exception("Must specify an alignment object") + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->rules->root); + __Pyx_DECREF(__pyx_v_self->rules->root); + __pyx_v_self->rules->root = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":356 + * self.rules = TrieTable(True) # cache + * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) + * if alignment is None: # <<<<<<<<<<<<<< + * raise Exception("Must specify an alignment object") + * self.alignment = alignment + */ + __pyx_t_3 = (((PyObject *)__pyx_v_alignment) == Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":357 + * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) + * if alignment is None: + * raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<< + * self.alignment = alignment + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 357; __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[8]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":358 + * if alignment is None: + * raise Exception("Must specify an alignment object") + * self.alignment = alignment # <<<<<<<<<<<<<< + * + * # grammar parameters and settings + */ + __Pyx_INCREF(((PyObject *)__pyx_v_alignment)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_alignment)); + __Pyx_GOTREF(__pyx_v_self->alignment); + __Pyx_DECREF(((PyObject *)__pyx_v_self->alignment)); + __pyx_v_self->alignment = __pyx_v_alignment; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":362 + * # grammar parameters and settings + * # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero + * self.max_length = max_length # <<<<<<<<<<<<<< + * self.max_nonterminals = max_nonterminals + * self.max_initial_size = max_initial_size + */ + __pyx_v_self->max_length = __pyx_v_max_length; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":363 + * # NOTE: setting max_nonterminals > 2 is not currently supported in Hiero + * self.max_length = max_length + * self.max_nonterminals = max_nonterminals # <<<<<<<<<<<<<< + * self.max_initial_size = max_initial_size + * self.train_max_initial_size = train_max_initial_size + */ + __pyx_v_self->max_nonterminals = __pyx_v_max_nonterminals; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":364 + * self.max_length = max_length + * self.max_nonterminals = max_nonterminals + * self.max_initial_size = max_initial_size # <<<<<<<<<<<<<< + * self.train_max_initial_size = train_max_initial_size + * self.min_gap_size = min_gap_size + */ + __pyx_v_self->max_initial_size = __pyx_v_max_initial_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":365 + * self.max_nonterminals = max_nonterminals + * self.max_initial_size = max_initial_size + * 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 + */ + __pyx_v_self->train_max_initial_size = __pyx_v_train_max_initial_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":366 + * self.max_initial_size = max_initial_size + * 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 + * self.category = sym_fromstring(category, False) + */ + __pyx_v_self->min_gap_size = __pyx_v_min_gap_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":367 + * 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 # <<<<<<<<<<<<<< + * self.category = sym_fromstring(category, False) + * + */ + __pyx_v_self->train_min_gap_size = __pyx_v_train_min_gap_size; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":368 + * self.min_gap_size = min_gap_size + * self.train_min_gap_size = train_min_gap_size + * self.category = sym_fromstring(category, False) # <<<<<<<<<<<<<< + * + * if max_chunks is None: + */ + __pyx_v_self->category = __pyx_f_4cdec_2sa_3_sa_sym_fromstring(__pyx_v_category, 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":370 + * self.category = sym_fromstring(category, False) + * + * if max_chunks is None: # <<<<<<<<<<<<<< + * self.max_chunks = self.max_nonterminals + 1 + * else: + */ + __pyx_t_4 = (__pyx_v_max_chunks == Py_None); + __pyx_t_3 = (__pyx_t_4 != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":371 + * + * if max_chunks is None: + * self.max_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<< + * else: + * self.max_chunks = max_chunks + */ + __pyx_v_self->max_chunks = (__pyx_v_self->max_nonterminals + 1); + goto __pyx_L4; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":373 + * self.max_chunks = self.max_nonterminals + 1 + * else: + * self.max_chunks = max_chunks # <<<<<<<<<<<<<< + * + * if max_target_chunks is None: + */ + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_chunks); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->max_chunks = __pyx_t_5; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":375 + * self.max_chunks = max_chunks + * + * if max_target_chunks is None: # <<<<<<<<<<<<<< + * self.max_target_chunks = self.max_nonterminals + 1 + * else: + */ + __pyx_t_3 = (__pyx_v_max_target_chunks == Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":376 + * + * if max_target_chunks is None: + * self.max_target_chunks = self.max_nonterminals + 1 # <<<<<<<<<<<<<< + * else: + * self.max_target_chunks = max_target_chunks + */ + __pyx_v_self->max_target_chunks = (__pyx_v_self->max_nonterminals + 1); + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":378 + * self.max_target_chunks = self.max_nonterminals + 1 + * else: + * self.max_target_chunks = max_target_chunks # <<<<<<<<<<<<<< + * + * if max_target_length is None: + */ + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_target_chunks); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->max_target_chunks = __pyx_t_5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":380 + * self.max_target_chunks = max_target_chunks + * + * if max_target_length is None: # <<<<<<<<<<<<<< + * self.max_target_length = max_initial_size + * else: + */ + __pyx_t_4 = (__pyx_v_max_target_length == Py_None); + __pyx_t_3 = (__pyx_t_4 != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":381 + * + * if max_target_length is None: + * self.max_target_length = max_initial_size # <<<<<<<<<<<<<< + * else: + * self.max_target_length = max_target_length + */ + __pyx_v_self->max_target_length = __pyx_v_max_initial_size; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":383 + * self.max_target_length = max_initial_size + * else: + * self.max_target_length = max_target_length # <<<<<<<<<<<<<< + * + * # algorithmic parameters and settings + */ + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_max_target_length); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->max_target_length = __pyx_t_5; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":386 + * + * # algorithmic parameters and settings + * self.precomputed_collocations = {} # <<<<<<<<<<<<<< + * self.precomputed_index = {} + * self.use_index = use_index + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_v_self->precomputed_collocations); + __Pyx_DECREF(__pyx_v_self->precomputed_collocations); + __pyx_v_self->precomputed_collocations = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":387 + * # algorithmic parameters and settings + * self.precomputed_collocations = {} + * self.precomputed_index = {} # <<<<<<<<<<<<<< + * self.use_index = use_index + * self.use_collocations = use_collocations + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_v_self->precomputed_index); + __Pyx_DECREF(__pyx_v_self->precomputed_index); + __pyx_v_self->precomputed_index = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":388 + * self.precomputed_collocations = {} + * self.precomputed_index = {} + * self.use_index = use_index # <<<<<<<<<<<<<< + * self.use_collocations = use_collocations + * self.max_rank = {} + */ + __pyx_v_self->use_index = __pyx_v_use_index; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":389 + * self.precomputed_index = {} + * self.use_index = use_index + * self.use_collocations = use_collocations # <<<<<<<<<<<<<< + * self.max_rank = {} + * self.precompute_file = precompute_file + */ + __pyx_v_self->use_collocations = __pyx_v_use_collocations; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":390 + * self.use_index = use_index + * self.use_collocations = use_collocations + * self.max_rank = {} # <<<<<<<<<<<<<< + * self.precompute_file = precompute_file + * self.precompute_rank = precompute_rank + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_v_self->max_rank); + __Pyx_DECREF(__pyx_v_self->max_rank); + __pyx_v_self->max_rank = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":391 + * self.use_collocations = use_collocations + * self.max_rank = {} + * self.precompute_file = precompute_file # <<<<<<<<<<<<<< + * self.precompute_rank = precompute_rank + * self.precompute_secondary_rank = precompute_secondary_rank + */ + __Pyx_INCREF(__pyx_v_precompute_file); + __Pyx_GIVEREF(__pyx_v_precompute_file); + __Pyx_GOTREF(__pyx_v_self->precompute_file); + __Pyx_DECREF(__pyx_v_self->precompute_file); + __pyx_v_self->precompute_file = __pyx_v_precompute_file; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":392 + * self.max_rank = {} + * self.precompute_file = precompute_file + * self.precompute_rank = precompute_rank # <<<<<<<<<<<<<< + * self.precompute_secondary_rank = precompute_secondary_rank + * self.use_baeza_yates = use_baeza_yates + */ + __pyx_v_self->precompute_rank = __pyx_v_precompute_rank; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":393 + * self.precompute_file = precompute_file + * self.precompute_rank = precompute_rank + * self.precompute_secondary_rank = precompute_secondary_rank # <<<<<<<<<<<<<< + * self.use_baeza_yates = use_baeza_yates + * self.by_slack_factor = by_slack_factor + */ + __pyx_v_self->precompute_secondary_rank = __pyx_v_precompute_secondary_rank; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":394 + * self.precompute_rank = precompute_rank + * self.precompute_secondary_rank = precompute_secondary_rank + * self.use_baeza_yates = use_baeza_yates # <<<<<<<<<<<<<< + * self.by_slack_factor = by_slack_factor + * self.tight_phrases = tight_phrases + */ + __pyx_v_self->use_baeza_yates = __pyx_v_use_baeza_yates; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":395 + * self.precompute_secondary_rank = precompute_secondary_rank + * self.use_baeza_yates = use_baeza_yates + * self.by_slack_factor = by_slack_factor # <<<<<<<<<<<<<< + * self.tight_phrases = tight_phrases + * + */ + __pyx_v_self->by_slack_factor = __pyx_v_by_slack_factor; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":396 + * self.use_baeza_yates = use_baeza_yates + * self.by_slack_factor = by_slack_factor + * self.tight_phrases = tight_phrases # <<<<<<<<<<<<<< + * + * if require_aligned_chunks: + */ + __pyx_v_self->tight_phrases = __pyx_v_tight_phrases; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":398 + * self.tight_phrases = tight_phrases + * + * if require_aligned_chunks: # <<<<<<<<<<<<<< + * # one condition is a stronger version of the other. + * self.require_aligned_chunks = self.require_aligned_terminal = True + */ + __pyx_t_3 = (__pyx_v_require_aligned_chunks != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":400 + * if require_aligned_chunks: + * # one condition is a stronger version of the other. + * self.require_aligned_chunks = self.require_aligned_terminal = True # <<<<<<<<<<<<<< + * elif require_aligned_terminal: + * self.require_aligned_chunks = False + */ + __pyx_v_self->require_aligned_chunks = 1; + __pyx_v_self->require_aligned_terminal = 1; + goto __pyx_L7; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":401 + * # one condition is a stronger version of the other. + * self.require_aligned_chunks = self.require_aligned_terminal = True + * elif require_aligned_terminal: # <<<<<<<<<<<<<< + * self.require_aligned_chunks = False + * self.require_aligned_terminal = True + */ + __pyx_t_3 = (__pyx_v_require_aligned_terminal != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":402 + * self.require_aligned_chunks = self.require_aligned_terminal = True + * elif require_aligned_terminal: + * self.require_aligned_chunks = False # <<<<<<<<<<<<<< + * self.require_aligned_terminal = True + * else: + */ + __pyx_v_self->require_aligned_chunks = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":403 + * elif require_aligned_terminal: + * self.require_aligned_chunks = False + * self.require_aligned_terminal = True # <<<<<<<<<<<<<< + * else: + * self.require_aligned_chunks = self.require_aligned_terminal = False + */ + __pyx_v_self->require_aligned_terminal = 1; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":405 + * self.require_aligned_terminal = True + * else: + * self.require_aligned_chunks = self.require_aligned_terminal = False # <<<<<<<<<<<<<< + * + * # diagnostics + */ + __pyx_v_self->require_aligned_chunks = 0; + __pyx_v_self->require_aligned_terminal = 0; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":408 + * + * # diagnostics + * self.prev_norm_prefix = () # <<<<<<<<<<<<<< + * + * self.findexes = IntList(initial_len=10) + */ + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); + __Pyx_GOTREF(__pyx_v_self->prev_norm_prefix); + __Pyx_DECREF(__pyx_v_self->prev_norm_prefix); + __pyx_v_self->prev_norm_prefix = ((PyObject *)__pyx_empty_tuple); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":410 + * self.prev_norm_prefix = () + * + * self.findexes = IntList(initial_len=10) # <<<<<<<<<<<<<< + * self.findexes1 = IntList(initial_len=10) + * + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->findexes); + __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes)); + __pyx_v_self->findexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":411 + * + * self.findexes = IntList(initial_len=10) + * self.findexes1 = IntList(initial_len=10) # <<<<<<<<<<<<<< + * + * # Online stats + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->findexes1); + __Pyx_DECREF(((PyObject *)__pyx_v_self->findexes1)); + __pyx_v_self->findexes1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":416 + * + * # True after data is added + * self.online = False # <<<<<<<<<<<<<< + * self.online_stats = defaultdict(OnlineStats) + * + */ + __pyx_v_self->online = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":417 + * # 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 = 417; __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 = 417; __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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_6); + __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_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure[] = "This gives the RuleFactory access to the Context object.\n Here we also use it to precompute the most expensive intersections\n in the corpus quickly."; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_3configure(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray = 0; + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_edarray = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_sampler = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_scorer = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("configure (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fsarray,&__pyx_n_s__edarray,&__pyx_n_s__sampler,&__pyx_n_s__scorer,0}; + PyObject* values[4] = {0,0,0,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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__fsarray)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__edarray)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sampler)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scorer)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "configure") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_fsarray = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)values[0]); + __pyx_v_edarray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)values[1]); + __pyx_v_sampler = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)values[2]); + __pyx_v_scorer = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)values[3]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("configure", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fsarray), __pyx_ptype_4cdec_2sa_3_sa_SuffixArray, 1, "fsarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_edarray), __pyx_ptype_4cdec_2sa_3_sa_DataArray, 1, "edarray", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sampler), __pyx_ptype_4cdec_2sa_3_sa_Sampler, 1, "sampler", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scorer), __pyx_ptype_4cdec_2sa_3_sa_Scorer, 1, "scorer", 0))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fsarray, __pyx_v_edarray, __pyx_v_sampler, __pyx_v_scorer); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":419 + * self.online_stats = defaultdict(OnlineStats) + * + * def configure(self, SuffixArray fsarray, DataArray edarray, # <<<<<<<<<<<<<< + * Sampler sampler, Scorer scorer): + * '''This gives the RuleFactory access to the Context object. + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_2configure(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *__pyx_v_fsarray, struct __pyx_obj_4cdec_2sa_3_sa_DataArray *__pyx_v_edarray, struct __pyx_obj_4cdec_2sa_3_sa_Sampler *__pyx_v_sampler, struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_scorer) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("configure", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":424 + * Here we also use it to precompute the most expensive intersections + * in the corpus quickly.''' + * self.fsa = fsarray # <<<<<<<<<<<<<< + * self.fda = fsarray.darray + * self.eda = edarray + */ + __Pyx_INCREF(((PyObject *)__pyx_v_fsarray)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_fsarray)); + __Pyx_GOTREF(__pyx_v_self->fsa); + __Pyx_DECREF(((PyObject *)__pyx_v_self->fsa)); + __pyx_v_self->fsa = __pyx_v_fsarray; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":425 + * in the corpus quickly.''' + * self.fsa = fsarray + * self.fda = fsarray.darray # <<<<<<<<<<<<<< + * self.eda = edarray + * self.fid2symid = self.set_idmap(self.fda) + */ + __pyx_t_1 = ((PyObject *)__pyx_v_fsarray->darray); + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->fda); + __Pyx_DECREF(((PyObject *)__pyx_v_self->fda)); + __pyx_v_self->fda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":426 + * self.fsa = fsarray + * self.fda = fsarray.darray + * self.eda = edarray # <<<<<<<<<<<<<< + * self.fid2symid = self.set_idmap(self.fda) + * self.eid2symid = self.set_idmap(self.eda) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_edarray)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_edarray)); + __Pyx_GOTREF(__pyx_v_self->eda); + __Pyx_DECREF(((PyObject *)__pyx_v_self->eda)); + __pyx_v_self->eda = __pyx_v_edarray; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":427 + * self.fda = fsarray.darray + * self.eda = edarray + * self.fid2symid = self.set_idmap(self.fda) # <<<<<<<<<<<<<< + * self.eid2symid = self.set_idmap(self.eda) + * self.precompute() + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->fda); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->fid2symid); + __Pyx_DECREF(((PyObject *)__pyx_v_self->fid2symid)); + __pyx_v_self->fid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":428 + * self.eda = edarray + * self.fid2symid = self.set_idmap(self.fda) + * self.eid2symid = self.set_idmap(self.eda) # <<<<<<<<<<<<<< + * self.precompute() + * self.sampler = sampler + */ + __pyx_t_2 = ((PyObject *)__pyx_v_self->eda); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->set_idmap(__pyx_v_self, ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->eid2symid); + __Pyx_DECREF(((PyObject *)__pyx_v_self->eid2symid)); + __pyx_v_self->eid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":429 + * 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 = 429; __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[8]; __pyx_lineno = 429; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":430 + * self.eid2symid = self.set_idmap(self.eda) + * self.precompute() + * self.sampler = sampler # <<<<<<<<<<<<<< + * self.scorer = scorer + * + */ + __Pyx_INCREF(((PyObject *)__pyx_v_sampler)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_sampler)); + __Pyx_GOTREF(__pyx_v_self->sampler); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sampler)); + __pyx_v_self->sampler = __pyx_v_sampler; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":431 + * self.precompute() + * self.sampler = sampler + * self.scorer = scorer # <<<<<<<<<<<<<< + * + * cdef set_idmap(self, DataArray darray): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_scorer)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_scorer)); + __Pyx_GOTREF(__pyx_v_self->scorer); + __Pyx_DECREF(((PyObject *)__pyx_v_self->scorer)); + __pyx_v_self->scorer = __pyx_v_scorer; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.configure", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":433 + * self.scorer = scorer + * + * cdef set_idmap(self, DataArray darray): # <<<<<<<<<<<<<< + * cdef int word_id, new_word_id, N + * cdef IntList idmap + */ + +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) { + int __pyx_v_word_id; + int __pyx_v_new_word_id; + int __pyx_v_N; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_idmap = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_idmap", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":437 + * cdef IntList idmap + * + * N = len(darray.id2word) # <<<<<<<<<<<<<< + * idmap = IntList(initial_len=N) + * for word_id from 0 <= word_id < N: + */ + __pyx_t_1 = __pyx_v_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[8]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_N = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":438 + * + * N = len(darray.id2word) + * idmap = IntList(initial_len=N) # <<<<<<<<<<<<<< + * for word_id from 0 <= word_id < N: + * new_word_id = sym_fromstring(darray.id2word[word_id], True) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_idmap = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":439 + * N = len(darray.id2word) + * idmap = IntList(initial_len=N) + * 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 + */ + __pyx_t_4 = __pyx_v_N; + for (__pyx_v_word_id = 0; __pyx_v_word_id < __pyx_t_4; __pyx_v_word_id++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":440 + * idmap = IntList(initial_len=N) + * 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 + * return idmap + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_darray->id2word, __pyx_v_word_id, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 440; __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 = 440; __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":441 + * 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 # <<<<<<<<<<<<<< + * return idmap + * + */ + (__pyx_v_idmap->arr[__pyx_v_word_id]) = __pyx_v_new_word_id; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":442 + * new_word_id = sym_fromstring(darray.id2word[word_id], True) + * idmap.arr[word_id] = new_word_id + * return idmap # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_idmap)); + __pyx_r = ((PyObject *)__pyx_v_idmap); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.set_idmap", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_idmap); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5pattern2phrase(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pattern2phrase (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phrase(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":445 + * + * + * def pattern2phrase(self, pattern): # <<<<<<<<<<<<<< + * # pattern is a tuple, which we must convert to a hiero Phrase + * result = () + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_4pattern2phrase(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_arity = NULL; + PyObject *__pyx_v_word_id = NULL; + int __pyx_v_new_id; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + char *__pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pattern2phrase", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":447 + * def pattern2phrase(self, pattern): + * # pattern is a tuple, which we must convert to a hiero Phrase + * result = () # <<<<<<<<<<<<<< + * arity = 0 + * for word_id in pattern: + */ + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + __pyx_v_result = __pyx_empty_tuple; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":448 + * # pattern is a tuple, which we must convert to a hiero Phrase + * result = () + * arity = 0 # <<<<<<<<<<<<<< + * for word_id in pattern: + * if word_id == -1: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_arity = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":449 + * 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)) { + __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 = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #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 = 449; __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 = 449; __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 = 449; __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 = 449; __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(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_word_id); + __pyx_v_word_id = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":450 + * arity = 0 + * for word_id in pattern: + * if word_id == -1: # <<<<<<<<<<<<<< + * arity = arity + 1 + * new_id = sym_setindex(self.category, arity) + */ + __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[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":451 + * for word_id in pattern: + * if word_id == -1: + * arity = arity + 1 # <<<<<<<<<<<<<< + * new_id = sym_setindex(self.category, arity) + * else: + */ + __pyx_t_4 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_arity); + __pyx_v_arity = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":452 + * if word_id == -1: + * arity = arity + 1 + * new_id = sym_setindex(self.category, arity) # <<<<<<<<<<<<<< + * else: + * new_id = sym_fromstring(self.fda.id2word[word_id], True) + */ + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_arity); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_new_id = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6); + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":454 + * new_id = sym_setindex(self.category, arity) + * else: + * new_id = sym_fromstring(self.fda.id2word[word_id], True) # <<<<<<<<<<<<<< + * result = result + (new_id,) + * return Phrase(result) + */ + __pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 454; __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 = 454; __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_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":455 + * else: + * new_id = sym_fromstring(self.fda.id2word[word_id], True) + * result = result + (new_id,) # <<<<<<<<<<<<<< + * return Phrase(result) + * + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_new_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __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); + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":456 + * new_id = sym_fromstring(self.fda.id2word[word_id], True) + * result = result + (new_id,) + * return Phrase(result) # <<<<<<<<<<<<<< + * + * def pattern2phrase_plus(self, pattern): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.pattern2phrase", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_arity); + __Pyx_XDECREF(__pyx_v_word_id); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_7pattern2phrase_plus(PyObject *__pyx_v_self, PyObject *__pyx_v_pattern) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pattern2phrase_plus (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_pattern)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":458 + * return Phrase(result) + * + * def pattern2phrase_plus(self, pattern): # <<<<<<<<<<<<<< + * # returns a list containing both the pattern, and pattern + * # suffixed/prefixed with the NT category. + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_6pattern2phrase_plus(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_pattern) { + PyObject *__pyx_v_patterns = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_arity = NULL; + PyObject *__pyx_v_word_id = NULL; + int __pyx_v_new_id; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + char *__pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pattern2phrase_plus", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":461 + * # returns a list containing both the pattern, and pattern + * # suffixed/prefixed with the NT category. + * patterns = [] # <<<<<<<<<<<<<< + * result = () + * arity = 0 + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_patterns = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":462 + * # suffixed/prefixed with the NT category. + * patterns = [] + * result = () # <<<<<<<<<<<<<< + * arity = 0 + * for word_id in pattern: + */ + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + __pyx_v_result = __pyx_empty_tuple; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":463 + * patterns = [] + * result = () + * arity = 0 # <<<<<<<<<<<<<< + * for word_id in pattern: + * if word_id == -1: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_arity = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":464 + * 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)) { + __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 = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #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 = 464; __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 = 464; __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 = 464; __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 = 464; __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(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_word_id); + __pyx_v_word_id = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":465 + * arity = 0 + * for word_id in pattern: + * if word_id == -1: # <<<<<<<<<<<<<< + * arity = arity + 1 + * new_id = sym_setindex(self.category, arity) + */ + __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[8]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":466 + * for word_id in pattern: + * if word_id == -1: + * arity = arity + 1 # <<<<<<<<<<<<<< + * new_id = sym_setindex(self.category, arity) + * else: + */ + __pyx_t_4 = PyNumber_Add(__pyx_v_arity, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_arity); + __pyx_v_arity = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":467 + * if word_id == -1: + * arity = arity + 1 + * new_id = sym_setindex(self.category, arity) # <<<<<<<<<<<<<< + * else: + * new_id = sym_fromstring(self.fda.id2word[word_id], True) + */ + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_arity); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_new_id = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_t_6); + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":469 + * new_id = sym_setindex(self.category, arity) + * else: + * new_id = sym_fromstring(self.fda.id2word[word_id], True) # <<<<<<<<<<<<<< + * result = result + (new_id,) + * patterns.append(Phrase(result)) + */ + __pyx_t_4 = PyObject_GetItem(__pyx_v_self->fda->id2word, __pyx_v_word_id); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 469; __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 = 469; __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_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":470 + * else: + * new_id = sym_fromstring(self.fda.id2word[word_id], True) + * result = result + (new_id,) # <<<<<<<<<<<<<< + * patterns.append(Phrase(result)) + * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_new_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 470; __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); + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":471 + * new_id = sym_fromstring(self.fda.id2word[word_id], True) + * result = result + (new_id,) + * patterns.append(Phrase(result)) # <<<<<<<<<<<<<< + * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) + * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __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 = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":472 + * result = result + (new_id,) + * patterns.append(Phrase(result)) + * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) # <<<<<<<<<<<<<< + * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) + * return patterns + */ + __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __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[8]; __pyx_lineno = 472; __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 = PyNumber_Add(((PyObject *)__pyx_v_result), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __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 = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":473 + * patterns.append(Phrase(result)) + * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) + * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) # <<<<<<<<<<<<<< + * return patterns + * + */ + __pyx_t_4 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __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[8]; __pyx_lineno = 473; __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 = PyNumber_Add(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __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 = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":474 + * patterns.append(Phrase(result + (sym_setindex(self.category, 1),))) + * patterns.append(Phrase((sym_setindex(self.category, 1),) + result)) + * return patterns # <<<<<<<<<<<<<< + * + * def precompute(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_patterns)); + __pyx_r = ((PyObject *)__pyx_v_patterns); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.pattern2phrase_plus", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_patterns); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_arity); + __Pyx_XDECREF(__pyx_v_word_id); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9precompute(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("precompute (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":476 + * return patterns + * + * def precompute(self): # <<<<<<<<<<<<<< + * cdef Precomputation pre + * + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8precompute(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self) { + struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *__pyx_v_pre = 0; + PyObject *__pyx_v_start_time = NULL; + PyObject *__pyx_v_pattern = NULL; + PyObject *__pyx_v_arr = NULL; + PyObject *__pyx_v_phrases = NULL; + PyObject *__pyx_v_phrase = NULL; + PyObject *__pyx_v_stop_time = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + 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 *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("precompute", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":479 + * cdef Precomputation pre + * + * if self.precompute_file is not None: # <<<<<<<<<<<<<< + * start_time = monitor_cpu() + * logger.info("Reading precomputed data from file %s... ", self.precompute_file) + */ + __pyx_t_1 = (__pyx_v_self->precompute_file != Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":480 + * + * 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 = 480; __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[8]; __pyx_lineno = 480; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":481 + * 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) + * # check parameters of precomputation -- some are critical and some are not + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 481; __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 = 481; __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(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_112)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_112)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_112)); + __Pyx_INCREF(__pyx_v_self->precompute_file); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->precompute_file); + __Pyx_GIVEREF(__pyx_v_self->precompute_file); + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 481; __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_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":482 + * 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 = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__from_binary), __pyx_v_self->precompute_file) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Precomputation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":484 + * 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: # <<<<<<<<<<<<<< + * logger.warn("Precomputation done with max nonterminals %d, decoder uses %d", pre.max_nonterminals, self.max_nonterminals) + * if pre.max_length != self.max_length: + */ + __pyx_t_2 = ((__pyx_v_pre->max_nonterminals != __pyx_v_self->max_nonterminals) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":485 + * # 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 = 485; __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 = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromLong(__pyx_v_pre->max_nonterminals); 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_t_3 = PyInt_FromLong(__pyx_v_self->max_nonterminals); 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); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_113)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_113)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_113)); + 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); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); 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); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":486 + * 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) + * if pre.train_max_initial_size != self.train_max_initial_size: + */ + __pyx_t_2 = ((__pyx_v_pre->max_length != __pyx_v_self->max_length) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":487 + * 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 = 487; __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 = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(__pyx_v_pre->max_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyInt_FromLong(__pyx_v_self->max_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __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 = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_114)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_114)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_114)); + 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 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":488 + * 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)) + * if pre.train_min_gap_size != self.train_min_gap_size: + */ + __pyx_t_2 = ((__pyx_v_pre->train_max_initial_size != __pyx_v_self->train_max_initial_size) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":489 + * 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)) # <<<<<<<<<<<<<< + * 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)) + */ + __pyx_t_5 = PyInt_FromLong(__pyx_v_pre->train_max_initial_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyInt_FromLong(__pyx_v_self->train_max_initial_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __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 = 489; __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); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_5 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_115), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__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 = 489; __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_builtin_Exception, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[8]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":490 + * 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: # <<<<<<<<<<<<<< + * 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: + */ + __pyx_t_2 = ((__pyx_v_pre->train_min_gap_size != __pyx_v_self->train_min_gap_size) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":491 + * 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 = PyInt_FromLong(__pyx_v_pre->train_min_gap_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyInt_FromLong(__pyx_v_self->train_min_gap_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __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 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_116), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(((PyObject *)__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 = 491; __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 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[8]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":492 + * 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)) + * for pattern, arr in pre.precomputed_index.iteritems(): + */ + __pyx_t_2 = (__pyx_v_self->use_index != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":493 + * 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 = 493; __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 = 493; __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 = 493; __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 = 493; __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 = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_117)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_117)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_117)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":494 + * 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; + 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 = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_index, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_8), (&__pyx_t_9)); 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_XDECREF(__pyx_t_6); + __pyx_t_6 = __pyx_t_4; + __pyx_t_4 = 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 = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_v_pattern); + __pyx_v_pattern = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_v_arr); + __pyx_v_arr = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":495 + * 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 = 495; __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 = 495; __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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_v_phrases); + __pyx_v_phrases = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":496 + * 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; + } 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 = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + 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 = 496; __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 = 496; __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 = 496; __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 = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_12(__pyx_t_3); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_phrase); + __pyx_v_phrase = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":497 + * phrases = self.pattern2phrase_plus(pattern) + * for phrase in phrases: + * self.precomputed_index[phrase] = arr # <<<<<<<<<<<<<< + * if self.use_collocations: + * logger.info("Converting %d hash keys on precomputed collocations... ", len(pre.precomputed_collocations)) + */ + if (PyObject_SetItem(__pyx_v_self->precomputed_index, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":498 + * for phrase in phrases: + * 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(): + */ + __pyx_t_2 = (__pyx_v_self->use_collocations != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":499 + * 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 = 499; __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 = 499; __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 = 499; __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 = 499; __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 = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_118)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_118)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_118)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":500 + * 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; + 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 = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_pre->precomputed_collocations, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_7), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 500; __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; + 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 = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_pattern); + __pyx_v_pattern = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_v_arr); + __pyx_v_arr = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":501 + * 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 = 501; __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 = 501; __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 501; __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_XDECREF(__pyx_v_phrase); + __pyx_v_phrase = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":502 + * for pattern, arr in pre.precomputed_collocations.iteritems(): + * phrase = self.pattern2phrase(pattern) + * self.precomputed_collocations[phrase] = arr # <<<<<<<<<<<<<< + * stop_time = monitor_cpu() + * logger.info("Processing precomputations took %f seconds", stop_time - start_time) + */ + if (PyObject_SetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase, __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":503 + * 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 = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 503; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":504 + * self.precomputed_collocations[phrase] = arr + * stop_time = monitor_cpu() + * logger.info("Processing precomputations took %f seconds", stop_time - start_time) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 504; __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_Subtract(__pyx_v_stop_time, __pyx_v_start_time); 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_t_4 = PyTuple_New(2); 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(((PyObject *)__pyx_kp_s_119)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_119)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_119)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__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_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + 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_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.precompute", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_pre); + __Pyx_XDECREF(__pyx_v_start_time); + __Pyx_XDECREF(__pyx_v_pattern); + __Pyx_XDECREF(__pyx_v_arr); + __Pyx_XDECREF(__pyx_v_phrases); + __Pyx_XDECREF(__pyx_v_phrase); + __Pyx_XDECREF(__pyx_v_stop_time); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_11get_precomputed_collocation(PyObject *__pyx_v_self, PyObject *__pyx_v_phrase) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_precomputed_collocation (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), ((PyObject *)__pyx_v_phrase)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":507 + * + * + * def get_precomputed_collocation(self, phrase): # <<<<<<<<<<<<<< + * if phrase in self.precomputed_collocations: + * arr = self.precomputed_collocations[phrase] + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_10get_precomputed_collocation(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_phrase) { + PyObject *__pyx_v_arr = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_precomputed_collocation", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":508 + * + * def get_precomputed_collocation(self, phrase): + * 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) + */ + __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_phrase, __pyx_v_self->precomputed_collocations, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":509 + * def get_precomputed_collocation(self, phrase): + * 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) + * return None + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_self->precomputed_collocations, __pyx_v_phrase); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_arr = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":510 + * 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) # <<<<<<<<<<<<<< + * return None + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr), __pyx_v_arr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr_low), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__arr_high), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __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 = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __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 = 510; __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, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":511 + * arr = self.precomputed_collocations[phrase] + * return PhraseLocation(arr=arr, arr_low=0, arr_high=len(arr), num_subpatterns=phrase.arity()+1) + * return None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_precomputed_collocation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_arr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":514 + * + * + * cdef int* baeza_yates_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<< + * int low2, int high2, int* arr2, int step2, + * int offset_by_one, int len_last, int num_subpatterns, int* result_len): + */ + +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) { + int __pyx_v_i1; + int __pyx_v_i2; + int __pyx_v_med1; + int __pyx_v_med2; + int __pyx_v_med1_plus; + int __pyx_v_med1_minus; + int __pyx_v_med2_minus; + int __pyx_v_med2_plus; + int __pyx_v_d_first; + int __pyx_v_qsetsize; + int __pyx_v_dsetsize; + int __pyx_v_tmp; + int __pyx_v_search_low; + int __pyx_v_search_high; + int __pyx_v_med_result_len; + int __pyx_v_low_result_len; + int __pyx_v_high_result_len; + long __pyx_v_comparison; + int *__pyx_v_result; + int *__pyx_v_low_result; + int *__pyx_v_med_result; + int *__pyx_v_high_result; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc1; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc2; + int *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":527 + * cdef Matching loc1, loc2 + * + * result = malloc(0*sizeof(int*)) # <<<<<<<<<<<<<< + * + * d_first = 0 + */ + __pyx_v_result = ((int *)malloc((0 * (sizeof(int *))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":529 + * result = malloc(0*sizeof(int*)) + * + * d_first = 0 # <<<<<<<<<<<<<< + * if high1 - low1 > high2 - low2: + * d_first = 1 + */ + __pyx_v_d_first = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":530 + * + * d_first = 0 + * if high1 - low1 > high2 - low2: # <<<<<<<<<<<<<< + * d_first = 1 + * + */ + __pyx_t_1 = (((__pyx_v_high1 - __pyx_v_low1) > (__pyx_v_high2 - __pyx_v_low2)) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":531 + * d_first = 0 + * if high1 - low1 > high2 - low2: + * d_first = 1 # <<<<<<<<<<<<<< + * + * # First, check to see if we are at any of the recursive base cases + */ + __pyx_v_d_first = 1; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":535 + * # 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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":536 + * # Case 1: one of the sets is empty + * if low1 >= high1 or low2 >= high2: + * return result # <<<<<<<<<<<<<< + * + * # Case 2: sets are non-overlapping + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":539 + * + * # 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) + * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1: + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":540 + * # 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) # <<<<<<<<<<<<<< + * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == -1: + * return result + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":541 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":542 + * 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 # <<<<<<<<<<<<<< + * + * assign_matching(&loc1, arr1, low1, step1, self.fda.sent_id.arr) + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":544 + * return result + * + * 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: + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":545 + * + * 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_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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":546 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":547 + * 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 # <<<<<<<<<<<<<< + * + * # Case 3: query set and data set do not meet size mismatch constraints; + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":551 + * # 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); + if (unlikely(__pyx_v_step1 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_step1 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_4))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_qsetsize = __Pyx_div_int(__pyx_t_4, __pyx_v_step1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":552 + * # 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); + if (unlikely(__pyx_v_step2 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_step2 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_4))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_dsetsize = __Pyx_div_int(__pyx_t_4, __pyx_v_step2); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":553 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":554 + * dsetsize = (high2-low2) / step2 + * if d_first: + * tmp = qsetsize # <<<<<<<<<<<<<< + * qsetsize = dsetsize + * dsetsize = tmp + */ + __pyx_v_tmp = __pyx_v_qsetsize; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":555 + * if d_first: + * tmp = qsetsize + * qsetsize = dsetsize # <<<<<<<<<<<<<< + * dsetsize = tmp + * + */ + __pyx_v_qsetsize = __pyx_v_dsetsize; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":556 + * tmp = qsetsize + * qsetsize = dsetsize + * dsetsize = tmp # <<<<<<<<<<<<<< + * + * if self.by_slack_factor * qsetsize * log(dsetsize) / log(2) > dsetsize: + */ + __pyx_v_dsetsize = __pyx_v_tmp; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":558 + * 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)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = (((__pyx_t_5 / __pyx_t_6) > __pyx_v_dsetsize) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":559 + * + * 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) + * + */ + free(__pyx_v_result); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":560 + * 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) # <<<<<<<<<<<<<< + * + * # binary search. There are two flavors, depending on + */ + __pyx_r = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->merge_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, __pyx_v_result_len); + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":564 + * # 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":565 + * # 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_v_med2 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_low2, __pyx_v_high2, __pyx_v_step2); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":566 + * if d_first: + * med2 = median(low2, high2, step2) + * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) # <<<<<<<<<<<<<< + * + * search_low = low1 + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":568 + * assign_matching(&loc2, arr2, med2, step2, self.fda.sent_id.arr) + * + * search_low = low1 # <<<<<<<<<<<<<< + * search_high = high1 + * while search_low < search_high: + */ + __pyx_v_search_low = __pyx_v_low1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":569 + * + * search_low = low1 + * search_high = high1 # <<<<<<<<<<<<<< + * while search_low < search_high: + * med1 = median(search_low, search_high, step1) + */ + __pyx_v_search_high = __pyx_v_high1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":570 + * search_low = low1 + * search_high = high1 + * while search_low < search_high: # <<<<<<<<<<<<<< + * med1 = median(search_low, search_high, step1) + * 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":571 + * search_high = high1 + * while search_low < search_high: + * 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) + */ + __pyx_v_med1 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":572 + * while search_low < search_high: + * 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) + * if comparison == -1: + */ + __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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":573 + * 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) # <<<<<<<<<<<<<< + * if comparison == -1: + * search_low = med1_plus + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":576 + * if comparison == -1: + * search_low = med1_plus + * elif comparison == 1: # <<<<<<<<<<<<<< + * search_high = med1_minus + * else: + */ + switch (__pyx_v_comparison) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":574 + * 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: # <<<<<<<<<<<<<< + * search_low = med1_plus + * elif comparison == 1: + */ + case -1: + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":575 + * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) + * if comparison == -1: + * search_low = med1_plus # <<<<<<<<<<<<<< + * elif comparison == 1: + * search_high = med1_minus + */ + __pyx_v_search_low = __pyx_v_med1_plus; + break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":576 + * if comparison == -1: + * search_low = med1_plus + * elif comparison == 1: # <<<<<<<<<<<<<< + * search_high = med1_minus + * else: + */ + case 1: + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":577 + * search_low = med1_plus + * elif comparison == 1: + * search_high = med1_minus # <<<<<<<<<<<<<< + * else: + * break + */ + __pyx_v_search_high = __pyx_v_med1_minus; + break; + default: + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":579 + * search_high = med1_minus + * else: + * break # <<<<<<<<<<<<<< + * else: + * med1 = median(low1, high1, step1) + */ + goto __pyx_L11_break; + break; + } + } + __pyx_L11_break:; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":581 + * break + * else: + * med1 = median(low1, high1, step1) # <<<<<<<<<<<<<< + * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) + * + */ + __pyx_v_med1 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_low1, __pyx_v_high1, __pyx_v_step1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":582 + * else: + * med1 = median(low1, high1, step1) + * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) # <<<<<<<<<<<<<< + * + * search_low = low2 + */ + __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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":584 + * find_comparable_matchings(low1, high1, arr1, step1, med1, &med1_minus, &med1_plus) + * + * search_low = low2 # <<<<<<<<<<<<<< + * search_high = high2 + * while search_low < search_high: + */ + __pyx_v_search_low = __pyx_v_low2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":585 + * + * search_low = low2 + * search_high = high2 # <<<<<<<<<<<<<< + * while search_low < search_high: + * med2 = median(search_low, search_high, step2) + */ + __pyx_v_search_high = __pyx_v_high2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":586 + * search_low = low2 + * search_high = high2 + * while search_low < search_high: # <<<<<<<<<<<<<< + * med2 = median(search_low, search_high, step2) + * 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":587 + * search_high = high2 + * while search_low < search_high: + * 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) + */ + __pyx_v_med2 = __pyx_f_4cdec_2sa_3_sa_median(__pyx_v_search_low, __pyx_v_search_high, __pyx_v_step2); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":588 + * while search_low < search_high: + * 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) + * if comparison == -1: + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":589 + * 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) # <<<<<<<<<<<<<< + * if comparison == -1: + * search_high = med2 + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":592 + * if comparison == -1: + * search_high = med2 + * elif comparison == 1: # <<<<<<<<<<<<<< + * search_low = med2 + step2 + * else: + */ + switch (__pyx_v_comparison) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":590 + * 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: # <<<<<<<<<<<<<< + * search_high = med2 + * elif comparison == 1: + */ + case -1: + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":591 + * comparison = self.compare_matchings_set(med1_minus, med1_plus, arr1, step1, &loc2, offset_by_one, len_last) + * if comparison == -1: + * search_high = med2 # <<<<<<<<<<<<<< + * elif comparison == 1: + * search_low = med2 + step2 + */ + __pyx_v_search_high = __pyx_v_med2; + break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":592 + * if comparison == -1: + * search_high = med2 + * elif comparison == 1: # <<<<<<<<<<<<<< + * search_low = med2 + step2 + * else: + */ + case 1: + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":593 + * search_high = med2 + * elif comparison == 1: + * search_low = med2 + step2 # <<<<<<<<<<<<<< + * else: + * break + */ + __pyx_v_search_low = (__pyx_v_med2 + __pyx_v_step2); + break; + default: + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":595 + * search_low = med2 + step2 + * else: + * break # <<<<<<<<<<<<<< + * + * med_result_len = 0 + */ + goto __pyx_L13_break; + break; + } + } + __pyx_L13_break:; + } + __pyx_L9:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":597 + * break + * + * med_result_len = 0 # <<<<<<<<<<<<<< + * med_result = malloc(0*sizeof(int*)) + * if search_high > search_low: + */ + __pyx_v_med_result_len = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":598 + * + * med_result_len = 0 + * med_result = malloc(0*sizeof(int*)) # <<<<<<<<<<<<<< + * if search_high > search_low: + * # Then there is a match for the median element of Q + */ + __pyx_v_med_result = ((int *)malloc((0 * (sizeof(int *))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":599 + * med_result_len = 0 + * med_result = 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":605 + * # want to store the bindings for all of those elements. We can + * # subsequently throw all of them away. + * med2_minus = med2 # <<<<<<<<<<<<<< + * med2_plus = med2 + step2 + * i1 = med1_minus + */ + __pyx_v_med2_minus = __pyx_v_med2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":606 + * # subsequently throw all of them away. + * med2_minus = med2 + * med2_plus = med2 + step2 # <<<<<<<<<<<<<< + * i1 = med1_minus + * while i1 < med1_plus: + */ + __pyx_v_med2_plus = (__pyx_v_med2 + __pyx_v_step2); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":607 + * med2_minus = med2 + * med2_plus = med2 + step2 + * i1 = med1_minus # <<<<<<<<<<<<<< + * while i1 < med1_plus: + * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) + */ + __pyx_v_i1 = __pyx_v_med1_minus; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":608 + * med2_plus = med2 + step2 + * i1 = med1_minus + * while i1 < med1_plus: # <<<<<<<<<<<<<< + * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) + * while med2_minus-step2 >= low2: + */ + while (1) { + __pyx_t_3 = ((__pyx_v_i1 < __pyx_v_med1_plus) != 0); + if (!__pyx_t_3) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":609 + * i1 = med1_minus + * while i1 < med1_plus: + * 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) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":610 + * while i1 < med1_plus: + * 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) + * 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":611 + * 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) # <<<<<<<<<<<<<< + * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) < 1: + * med2_minus = med2_minus - step2 + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":612 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":613 + * 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: + * break + */ + __pyx_v_med2_minus = (__pyx_v_med2_minus - __pyx_v_step2); + goto __pyx_L19; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":615 + * med2_minus = med2_minus - step2 + * else: + * break # <<<<<<<<<<<<<< + * i2 = med2_minus + * while i2 < high2: + */ + goto __pyx_L18_break; + } + __pyx_L19:; + } + __pyx_L18_break:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":616 + * else: + * break + * i2 = med2_minus # <<<<<<<<<<<<<< + * while i2 < high2: + * assign_matching(&loc2, arr2, i2, step2, self.fda.sent_id.arr) + */ + __pyx_v_i2 = __pyx_v_med2_minus; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":617 + * break + * i2 = med2_minus + * 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) + */ + while (1) { + __pyx_t_3 = ((__pyx_v_i2 < __pyx_v_high2) != 0); + if (!__pyx_t_3) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":618 + * i2 = med2_minus + * 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) + * if comparison == 0: + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":619 + * 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) # <<<<<<<<<<<<<< + * if comparison == 0: + * pass + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":620 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":622 + * if comparison == 0: + * pass + * med_result = append_combined_matching(med_result, &loc1, &loc2, offset_by_one, num_subpatterns, &med_result_len) # <<<<<<<<<<<<<< + * if comparison == -1: + * 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; + } + __pyx_L22:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":623 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":624 + * 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; + } + __pyx_L23:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":625 + * if comparison == -1: + * break + * i2 = i2 + step2 # <<<<<<<<<<<<<< + * if i2 > med2_plus: + * med2_plus = i2 + */ + __pyx_v_i2 = (__pyx_v_i2 + __pyx_v_step2); + } + __pyx_L21_break:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":626 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":627 + * i2 = i2 + step2 + * if i2 > med2_plus: + * med2_plus = i2 # <<<<<<<<<<<<<< + * i1 = i1 + step1 + * + */ + __pyx_v_med2_plus = __pyx_v_i2; + goto __pyx_L24; + } + __pyx_L24:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":628 + * if i2 > med2_plus: + * med2_plus = i2 + * i1 = i1 + step1 # <<<<<<<<<<<<<< + * + * tmp = med1_minus + */ + __pyx_v_i1 = (__pyx_v_i1 + __pyx_v_step1); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":630 + * i1 = i1 + step1 + * + * tmp = med1_minus # <<<<<<<<<<<<<< + * med1_minus = med1_plus + * med1_plus = tmp + */ + __pyx_v_tmp = __pyx_v_med1_minus; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":631 + * + * tmp = med1_minus + * med1_minus = med1_plus # <<<<<<<<<<<<<< + * med1_plus = tmp + * else: + */ + __pyx_v_med1_minus = __pyx_v_med1_plus; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":632 + * tmp = med1_minus + * med1_minus = med1_plus + * med1_plus = tmp # <<<<<<<<<<<<<< + * else: + * # No match; need to figure out the point of division in D and Q + */ + __pyx_v_med1_plus = __pyx_v_tmp; + goto __pyx_L14; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":635 + * else: + * # No match; need to figure out the point of division in D and Q + * med2_minus = med2 # <<<<<<<<<<<<<< + * med2_plus = med2 + * if d_first: + */ + __pyx_v_med2_minus = __pyx_v_med2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":636 + * # No match; need to figure out the point of division in D and Q + * med2_minus = med2 + * med2_plus = med2 # <<<<<<<<<<<<<< + * if d_first: + * med2_minus = med2_minus + step2 + */ + __pyx_v_med2_plus = __pyx_v_med2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":637 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":638 + * med2_plus = med2 + * if d_first: + * med2_minus = med2_minus + step2 # <<<<<<<<<<<<<< + * if comparison == -1: + * med1_minus = med1_plus + */ + __pyx_v_med2_minus = (__pyx_v_med2_minus + __pyx_v_step2); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":639 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":640 + * med2_minus = med2_minus + step2 + * if comparison == -1: + * med1_minus = med1_plus # <<<<<<<<<<<<<< + * if comparison == 1: + * med1_plus = med1_minus + */ + __pyx_v_med1_minus = __pyx_v_med1_plus; + goto __pyx_L26; + } + __pyx_L26:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":641 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":642 + * med1_minus = med1_plus + * if comparison == 1: + * med1_plus = med1_minus # <<<<<<<<<<<<<< + * else: + * tmp = med1_minus + */ + __pyx_v_med1_plus = __pyx_v_med1_minus; + goto __pyx_L27; + } + __pyx_L27:; + goto __pyx_L25; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":644 + * med1_plus = med1_minus + * else: + * tmp = med1_minus # <<<<<<<<<<<<<< + * med1_minus = med1_plus + * med1_plus = tmp + */ + __pyx_v_tmp = __pyx_v_med1_minus; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":645 + * else: + * tmp = med1_minus + * med1_minus = med1_plus # <<<<<<<<<<<<<< + * med1_plus = tmp + * if comparison == 1: + */ + __pyx_v_med1_minus = __pyx_v_med1_plus; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":646 + * tmp = med1_minus + * med1_minus = med1_plus + * med1_plus = tmp # <<<<<<<<<<<<<< + * if comparison == 1: + * med2_minus = med2_minus + step2 + */ + __pyx_v_med1_plus = __pyx_v_tmp; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":647 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":648 + * med1_plus = tmp + * if comparison == 1: + * med2_minus = med2_minus + step2 # <<<<<<<<<<<<<< + * med2_plus = med2_plus + step2 + * + */ + __pyx_v_med2_minus = (__pyx_v_med2_minus + __pyx_v_step2); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":649 + * if comparison == 1: + * med2_minus = med2_minus + step2 + * med2_plus = med2_plus + step2 # <<<<<<<<<<<<<< + * + * low_result_len = 0 + */ + __pyx_v_med2_plus = (__pyx_v_med2_plus + __pyx_v_step2); + goto __pyx_L28; + } + __pyx_L28:; + } + __pyx_L25:; + } + __pyx_L14:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":651 + * med2_plus = med2_plus + step2 + * + * 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 + */ + __pyx_v_low_result_len = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":652 + * + * 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 + * 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) + */ + __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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":653 + * 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 # <<<<<<<<<<<<<< + * 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) + * + */ + __pyx_v_high_result_len = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":654 + * 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) # <<<<<<<<<<<<<< + * + * result = extend_arr(result, result_len, low_result, low_result_len) + */ + __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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":656 + * 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) # <<<<<<<<<<<<<< + * result = extend_arr(result, result_len, med_result, med_result_len) + * result = extend_arr(result, result_len, high_result, high_result_len) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":657 + * + * 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) + * free(low_result) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":658 + * 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) # <<<<<<<<<<<<<< + * free(low_result) + * free(med_result) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":659 + * 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) # <<<<<<<<<<<<<< + * free(med_result) + * free(high_result) + */ + free(__pyx_v_low_result); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":660 + * result = extend_arr(result, result_len, high_result, high_result_len) + * free(low_result) + * free(med_result) # <<<<<<<<<<<<<< + * free(high_result) + * + */ + free(__pyx_v_med_result); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":661 + * free(low_result) + * free(med_result) + * free(high_result) # <<<<<<<<<<<<<< + * + * return result + */ + free(__pyx_v_high_result); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":663 + * free(high_result) + * + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_WriteUnraisable("cdec.sa._sa.HieroCachingRuleFactory.baeza_yates_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":667 + * + * + * cdef long compare_matchings_set(self, int i1_minus, int i1_plus, int* arr1, int step1, # <<<<<<<<<<<<<< + * Matching* loc2, int offset_by_one, int len_last): + * """ + */ + +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) { + int __pyx_v_i1; + int __pyx_v_comparison; + int __pyx_v_prev_comparison; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_l1_stack; + struct __pyx_t_4cdec_2sa_3_sa_Matching *__pyx_v_loc1; + long __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("compare_matchings_set", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":678 + * cdef Matching* loc1 + * + * loc1 = &l1_stack # <<<<<<<<<<<<<< + * + * i1 = i1_minus + */ + __pyx_v_loc1 = (&__pyx_v_l1_stack); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":680 + * loc1 = &l1_stack + * + * i1 = i1_minus # <<<<<<<<<<<<<< + * while i1 < i1_plus: + * assign_matching(loc1, arr1, i1, step1, self.fda.sent_id.arr) + */ + __pyx_v_i1 = __pyx_v_i1_minus; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":681 + * + * i1 = i1_minus + * 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) + */ + while (1) { + __pyx_t_1 = ((__pyx_v_i1 < __pyx_v_i1_plus) != 0); + if (!__pyx_t_1) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":682 + * i1 = i1_minus + * 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) + * if comparison == 0: + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":683 + * 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) # <<<<<<<<<<<<<< + * if comparison == 0: + * prev_comparison = 0 + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":684 + * 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: # <<<<<<<<<<<<<< + * prev_comparison = 0 + * break + */ + __pyx_t_1 = ((__pyx_v_comparison == 0) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":685 + * comparison = self.compare_matchings(loc1, loc2, offset_by_one, len_last) + * if comparison == 0: + * prev_comparison = 0 # <<<<<<<<<<<<<< + * break + * elif i1 == i1_minus: + */ + __pyx_v_prev_comparison = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":686 + * if comparison == 0: + * prev_comparison = 0 + * break # <<<<<<<<<<<<<< + * elif i1 == i1_minus: + * prev_comparison = comparison + */ + goto __pyx_L4_break; + goto __pyx_L5; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":687 + * prev_comparison = 0 + * break + * elif i1 == i1_minus: # <<<<<<<<<<<<<< + * prev_comparison = comparison + * else: + */ + __pyx_t_1 = ((__pyx_v_i1 == __pyx_v_i1_minus) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":688 + * break + * elif i1 == i1_minus: + * prev_comparison = comparison # <<<<<<<<<<<<<< + * else: + * if comparison != prev_comparison: + */ + __pyx_v_prev_comparison = __pyx_v_comparison; + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":690 + * prev_comparison = comparison + * else: + * if comparison != prev_comparison: # <<<<<<<<<<<<<< + * prev_comparison = 0 + * break + */ + __pyx_t_1 = ((__pyx_v_comparison != __pyx_v_prev_comparison) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":691 + * else: + * if comparison != prev_comparison: + * prev_comparison = 0 # <<<<<<<<<<<<<< + * break + * i1 = i1 + step1 + */ + __pyx_v_prev_comparison = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":692 + * if comparison != prev_comparison: + * prev_comparison = 0 + * break # <<<<<<<<<<<<<< + * i1 = i1 + step1 + * return prev_comparison + */ + goto __pyx_L4_break; + goto __pyx_L6; + } + __pyx_L6:; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":693 + * prev_comparison = 0 + * break + * i1 = i1 + step1 # <<<<<<<<<<<<<< + * return prev_comparison + * + */ + __pyx_v_i1 = (__pyx_v_i1 + __pyx_v_step1); + } + __pyx_L4_break:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":694 + * break + * i1 = i1 + step1 + * return prev_comparison # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_prev_comparison; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":697 + * + * + * cdef long compare_matchings(self, Matching* loc1, Matching* loc2, int offset_by_one, int len_last): # <<<<<<<<<<<<<< + * cdef int i + * + */ + +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) { + int __pyx_v_i; + long __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("compare_matchings", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":700 + * cdef int i + * + * if loc1.sent_id > loc2.sent_id: # <<<<<<<<<<<<<< + * return 1 + * if loc2.sent_id > loc1.sent_id: + */ + __pyx_t_1 = ((__pyx_v_loc1->sent_id > __pyx_v_loc2->sent_id) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":701 + * + * if loc1.sent_id > loc2.sent_id: + * return 1 # <<<<<<<<<<<<<< + * if loc2.sent_id > loc1.sent_id: + * return -1 + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":702 + * if loc1.sent_id > loc2.sent_id: + * return 1 + * if loc2.sent_id > loc1.sent_id: # <<<<<<<<<<<<<< + * return -1 + * + */ + __pyx_t_1 = ((__pyx_v_loc2->sent_id > __pyx_v_loc1->sent_id) != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":703 + * return 1 + * if loc2.sent_id > loc1.sent_id: + * return -1 # <<<<<<<<<<<<<< + * + * if loc1.size == 1 and loc2.size == 1: + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":705 + * 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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":706 + * + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":707 + * if loc1.size == 1 and loc2.size == 1: + * if loc2.arr[loc2.start] - loc1.arr[loc1.start] <= self.train_min_gap_size: + * return 1 # <<<<<<<<<<<<<< + * + * elif offset_by_one: + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + goto __pyx_L5; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":709 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":710 + * + * 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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":711 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":712 + * 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]: + * return -1 + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":713 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":714 + * return 1 + * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i-1]: + * return -1 # <<<<<<<<<<<<<< + * + * else: + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L10; + } + __pyx_L10:; + } + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":717 + * + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":718 + * else: + * 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_r = 1; + goto __pyx_L0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":719 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":720 + * return 1 + * if loc1.arr[loc1.start]+1 < loc2.arr[loc2.start]: + * return -1 # <<<<<<<<<<<<<< + * + * for i from 1 <= i < loc1.size: + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":722 + * 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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":723 + * + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":724 + * 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]: + * return -1 + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L15; + } + __pyx_L15:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":725 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":726 + * return 1 + * if loc1.arr[loc1.start+i] < loc2.arr[loc2.start+i]: + * return -1 # <<<<<<<<<<<<<< + * + * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L16; + } + __pyx_L16:; + } + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":728 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":729 + * + * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: + * return -1 # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":730 + * if loc2.arr[loc2.end-1] + len_last - loc1.arr[loc1.start] > self.train_max_initial_size: + * return -1 + * return 0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":733 + * + * + * cdef int* merge_helper(self, int low1, int high1, int* arr1, int step1, # <<<<<<<<<<<<<< + * int low2, int high2, int* arr2, int step2, + * int offset_by_one, int len_last, int num_subpatterns, int* result_len): + */ + +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) { + int __pyx_v_i1; + int __pyx_v_i2; + int __pyx_v_j1; + int __pyx_v_j2; + long __pyx_v_comparison; + int *__pyx_v_result; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc1; + struct __pyx_t_4cdec_2sa_3_sa_Matching __pyx_v_loc2; + int *__pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("merge_helper", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":741 + * cdef Matching loc1, loc2 + * + * result_len[0] = 0 # <<<<<<<<<<<<<< + * result = malloc(0*sizeof(int)) + * + */ + (__pyx_v_result_len[0]) = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":742 + * + * result_len[0] = 0 + * result = malloc(0*sizeof(int)) # <<<<<<<<<<<<<< + * + * i1 = low1 + */ + __pyx_v_result = ((int *)malloc((0 * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":744 + * result = malloc(0*sizeof(int)) + * + * i1 = low1 # <<<<<<<<<<<<<< + * i2 = low2 + * while i1 < high1 and i2 < high2: + */ + __pyx_v_i1 = __pyx_v_low1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":745 + * + * i1 = low1 + * i2 = low2 # <<<<<<<<<<<<<< + * while i1 < high1 and i2 < high2: + * + */ + __pyx_v_i2 = __pyx_v_low2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":746 + * i1 = low1 + * i2 = low2 + * while i1 < high1 and i2 < high2: # <<<<<<<<<<<<<< + * + * # 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; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (!__pyx_t_3) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":749 + * + * # First, pop all unneeded loc2's off the stack + * 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) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":750 + * # First, pop all unneeded loc2's off the stack + * 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) + * 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":751 + * 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) # <<<<<<<<<<<<<< + * if self.compare_matchings(&loc1, &loc2, offset_by_one, len_last) == 1: + * i2 = i2 + step2 + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":752 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":753 + * 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: + * break + */ + __pyx_v_i2 = (__pyx_v_i2 + __pyx_v_step2); + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":755 + * i2 = i2 + step2 + * else: + * break # <<<<<<<<<<<<<< + * + * # Next: process all loc1's with the same starting val + */ + goto __pyx_L6_break; + } + __pyx_L7:; + } + __pyx_L6_break:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":758 + * + * # Next: process all loc1's with the same starting val + * j1 = i1 # <<<<<<<<<<<<<< + * while i1 < high1 and arr1[j1] == arr1[i1]: + * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) + */ + __pyx_v_j1 = __pyx_v_i1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":759 + * # Next: process all loc1's with the same starting val + * j1 = i1 + * while i1 < high1 and arr1[j1] == arr1[i1]: # <<<<<<<<<<<<<< + * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) + * 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; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (!__pyx_t_2) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":760 + * j1 = i1 + * while i1 < high1 and arr1[j1] == arr1[i1]: + * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) # <<<<<<<<<<<<<< + * j2 = i2 + * while j2 < high2: + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":761 + * while i1 < high1 and arr1[j1] == arr1[i1]: + * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) + * j2 = i2 # <<<<<<<<<<<<<< + * while j2 < high2: + * assign_matching(&loc2, arr2, j2, step2, self.fda.sent_id.arr) + */ + __pyx_v_j2 = __pyx_v_i2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":762 + * assign_matching(&loc1, arr1, i1, step1, self.fda.sent_id.arr) + * j2 = i2 + * 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) + */ + while (1) { + __pyx_t_2 = ((__pyx_v_j2 < __pyx_v_high2) != 0); + if (!__pyx_t_2) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":763 + * j2 = i2 + * 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) + * if comparison == 0: + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":764 + * 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) # <<<<<<<<<<<<<< + * if comparison == 0: + * result = append_combined_matching(result, &loc1, &loc2, offset_by_one, num_subpatterns, result_len) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":765 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":766 + * 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: + * 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; + } + __pyx_L12:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":767 + * 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_L13:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":769 + * if comparison == 1: + * pass + * if comparison == -1: # <<<<<<<<<<<<<< + * break + * else: + */ + __pyx_t_2 = ((__pyx_v_comparison == -1) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":770 + * pass + * if comparison == -1: + * break # <<<<<<<<<<<<<< + * else: + * j2 = j2 + step2 + */ + goto __pyx_L11_break; + goto __pyx_L14; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":772 + * break + * else: + * j2 = j2 + step2 # <<<<<<<<<<<<<< + * i1 = i1 + step1 + * return result + */ + __pyx_v_j2 = (__pyx_v_j2 + __pyx_v_step2); + } + __pyx_L14:; + } + __pyx_L11_break:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":773 + * else: + * j2 = j2 + step2 + * i1 = i1 + step1 # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_v_i1 = (__pyx_v_i1 + __pyx_v_step1); + } + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":774 + * j2 = j2 + step2 + * i1 = i1 + step1 + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":777 + * + * + * cdef void sort_phrase_loc(self, IntList arr, PhraseLocation loc, Phrase phrase): # <<<<<<<<<<<<<< + * cdef int i, j + * cdef VEB veb + */ + +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) { + int __pyx_v_i; + int __pyx_v_j; + struct __pyx_obj_4cdec_2sa_3_sa_VEB *__pyx_v_veb = 0; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sort_phrase_loc", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":782 + * cdef IntList result + * + * if phrase in self.precomputed_index: # <<<<<<<<<<<<<< + * loc.arr = self.precomputed_index[phrase] + * else: + */ + __pyx_t_1 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_phrase), __pyx_v_self->precomputed_index, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":783 + * + * if phrase in self.precomputed_index: + * loc.arr = self.precomputed_index[phrase] # <<<<<<<<<<<<<< + * else: + * loc.arr = IntList(initial_len=loc.sa_high-loc.sa_low) + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_self->precomputed_index, ((PyObject *)__pyx_v_phrase)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 783; __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_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_loc->arr); + __Pyx_DECREF(((PyObject *)__pyx_v_loc->arr)); + __pyx_v_loc->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":785 + * loc.arr = self.precomputed_index[phrase] + * else: + * 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: + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyInt_FromLong((__pyx_v_loc->sa_high - __pyx_v_loc->sa_low)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_loc->arr); + __Pyx_DECREF(((PyObject *)__pyx_v_loc->arr)); + __pyx_v_loc->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":786 + * else: + * 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: + * veb._insert(arr.arr[i]) + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_arr->len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 786; __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[8]; __pyx_lineno = 786; __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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_VEB)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":787 + * 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: # <<<<<<<<<<<<<< + * veb._insert(arr.arr[i]) + * i = veb.veb.min_val + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":788 + * veb = VEB(arr.len) + * for i from loc.sa_low <= i < loc.sa_high: + * veb._insert(arr.arr[i]) # <<<<<<<<<<<<<< + * i = veb.veb.min_val + * for j from 0 <= j < loc.sa_high-loc.sa_low: + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_insert(__pyx_v_veb, (__pyx_v_arr->arr[__pyx_v_i])); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":789 + * for i from loc.sa_low <= i < loc.sa_high: + * veb._insert(arr.arr[i]) + * i = veb.veb.min_val # <<<<<<<<<<<<<< + * for j from 0 <= j < loc.sa_high-loc.sa_low: + * loc.arr.arr[j] = i + */ + __pyx_t_5 = __pyx_v_veb->veb->min_val; + __pyx_v_i = __pyx_t_5; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":790 + * veb._insert(arr.arr[i]) + * i = veb.veb.min_val + * for j from 0 <= j < loc.sa_high-loc.sa_low: # <<<<<<<<<<<<<< + * loc.arr.arr[j] = i + * i = veb._findsucc(i) + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":791 + * i = veb.veb.min_val + * for j from 0 <= j < loc.sa_high-loc.sa_low: + * loc.arr.arr[j] = i # <<<<<<<<<<<<<< + * i = veb._findsucc(i) + * loc.arr_low = 0 + */ + (__pyx_v_loc->arr->arr[__pyx_v_j]) = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":792 + * for j from 0 <= j < loc.sa_high-loc.sa_low: + * loc.arr.arr[j] = i + * i = veb._findsucc(i) # <<<<<<<<<<<<<< + * loc.arr_low = 0 + * loc.arr_high = loc.arr.len + */ + __pyx_v_i = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB *)__pyx_v_veb->__pyx_vtab)->_findsucc(__pyx_v_veb, __pyx_v_i); + } + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":793 + * loc.arr.arr[j] = i + * i = veb._findsucc(i) + * loc.arr_low = 0 # <<<<<<<<<<<<<< + * loc.arr_high = loc.arr.len + * + */ + __pyx_v_loc->arr_low = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":794 + * i = veb._findsucc(i) + * loc.arr_low = 0 + * loc.arr_high = loc.arr.len # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_5 = __pyx_v_loc->arr->len; + __pyx_v_loc->arr_high = __pyx_t_5; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("cdec.sa._sa.HieroCachingRuleFactory.sort_phrase_loc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_veb); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":797 + * + * + * cdef intersect_helper(self, Phrase prefix, Phrase suffix, # <<<<<<<<<<<<<< + * PhraseLocation prefix_loc, PhraseLocation suffix_loc, int algorithm): + * + */ + +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) { + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr1 = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_arr2 = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_result = 0; + int __pyx_v_low1; + int __pyx_v_high1; + int __pyx_v_step1; + int __pyx_v_low2; + int __pyx_v_high2; + 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; + int *__pyx_v_result_ptr; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("intersect_helper", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":804 + * cdef int* result_ptr + * + * result_len = 0 # <<<<<<<<<<<<<< + * + * if sym_isvar(suffix[0]): + */ + __pyx_v_result_len = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":806 + * result_len = 0 + * + * if sym_isvar(suffix[0]): # <<<<<<<<<<<<<< + * offset_by_one = 1 + * else: + */ + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_suffix), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_2) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":807 + * + * if sym_isvar(suffix[0]): + * offset_by_one = 1 # <<<<<<<<<<<<<< + * else: + * offset_by_one = 0 + */ + __pyx_v_offset_by_one = 1; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":809 + * offset_by_one = 1 + * else: + * offset_by_one = 0 # <<<<<<<<<<<<<< + * + * len_last = len(suffix.getchunk(suffix.arity())) + */ + __pyx_v_offset_by_one = 0; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":811 + * 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 = 811; __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 = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __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(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __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_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__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 = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_len_last = __pyx_t_6; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":813 + * len_last = len(suffix.getchunk(suffix.arity())) + * + * if prefix_loc.arr is None: # <<<<<<<<<<<<<< + * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":814 + * + * 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; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":815 + * 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":816 + * self.sort_phrase_loc(self.fsa.sa, prefix_loc, prefix) + * arr1 = prefix_loc.arr + * low1 = prefix_loc.arr_low # <<<<<<<<<<<<<< + * high1 = prefix_loc.arr_high + * step1 = prefix_loc.num_subpatterns + */ + __pyx_t_2 = __pyx_v_prefix_loc->arr_low; + __pyx_v_low1 = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":817 + * arr1 = prefix_loc.arr + * low1 = prefix_loc.arr_low + * high1 = prefix_loc.arr_high # <<<<<<<<<<<<<< + * step1 = prefix_loc.num_subpatterns + * + */ + __pyx_t_2 = __pyx_v_prefix_loc->arr_high; + __pyx_v_high1 = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":818 + * low1 = prefix_loc.arr_low + * high1 = prefix_loc.arr_high + * step1 = prefix_loc.num_subpatterns # <<<<<<<<<<<<<< + * + * if suffix_loc.arr is None: + */ + __pyx_t_2 = __pyx_v_prefix_loc->num_subpatterns; + __pyx_v_step1 = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":820 + * 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); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":821 + * + * 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; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":822 + * 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":823 + * self.sort_phrase_loc(self.fsa.sa, suffix_loc, suffix) + * arr2 = suffix_loc.arr + * low2 = suffix_loc.arr_low # <<<<<<<<<<<<<< + * high2 = suffix_loc.arr_high + * step2 = suffix_loc.num_subpatterns + */ + __pyx_t_2 = __pyx_v_suffix_loc->arr_low; + __pyx_v_low2 = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":824 + * arr2 = suffix_loc.arr + * low2 = suffix_loc.arr_low + * high2 = suffix_loc.arr_high # <<<<<<<<<<<<<< + * step2 = suffix_loc.num_subpatterns + * + */ + __pyx_t_2 = __pyx_v_suffix_loc->arr_high; + __pyx_v_high2 = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":825 + * low2 = suffix_loc.arr_low + * high2 = suffix_loc.arr_high + * step2 = suffix_loc.num_subpatterns # <<<<<<<<<<<<<< + * + * num_subpatterns = prefix.arity()+1 + */ + __pyx_t_2 = __pyx_v_suffix_loc->num_subpatterns; + __pyx_v_step2 = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":827 + * 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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 827; __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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_num_subpatterns = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":829 + * num_subpatterns = prefix.arity()+1 + * + * if algorithm == MERGE: # <<<<<<<<<<<<<< + * result_ptr = self.merge_helper(low1, high1, arr1.arr, step1, + * low2, high2, arr2.arr, step2, + */ + __pyx_t_3 = ((__pyx_v_algorithm == __pyx_v_4cdec_2sa_3_sa_MERGE) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":832 + * result_ptr = self.merge_helper(low1, high1, arr1.arr, step1, + * low2, high2, arr2.arr, step2, + * offset_by_one, len_last, num_subpatterns, &result_len) # <<<<<<<<<<<<<< + * else: + * result_ptr = self.baeza_yates_helper(low1, high1, arr1.arr, step1, + */ + __pyx_v_result_ptr = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->merge_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1->arr, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2->arr, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_result_len)); + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":836 + * result_ptr = self.baeza_yates_helper(low1, high1, arr1.arr, step1, + * low2, high2, arr2.arr, step2, + * offset_by_one, len_last, num_subpatterns, &result_len) # <<<<<<<<<<<<<< + * + * if result_len == 0: + */ + __pyx_v_result_ptr = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->baeza_yates_helper(__pyx_v_self, __pyx_v_low1, __pyx_v_high1, __pyx_v_arr1->arr, __pyx_v_step1, __pyx_v_low2, __pyx_v_high2, __pyx_v_arr2->arr, __pyx_v_step2, __pyx_v_offset_by_one, __pyx_v_len_last, __pyx_v_num_subpatterns, (&__pyx_v_result_len)); + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":838 + * offset_by_one, len_last, num_subpatterns, &result_len) + * + * if result_len == 0: # <<<<<<<<<<<<<< + * free(result_ptr) + * return None + */ + __pyx_t_3 = ((__pyx_v_result_len == 0) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":839 + * + * if result_len == 0: + * free(result_ptr) # <<<<<<<<<<<<<< + * return None + * else: + */ + free(__pyx_v_result_ptr); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":840 + * if result_len == 0: + * free(result_ptr) + * return None # <<<<<<<<<<<<<< + * else: + * result = IntList() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":842 + * return None + * else: + * result = IntList() # <<<<<<<<<<<<<< + * free(result.arr) + * result.arr = result_ptr + */ + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 842; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":843 + * else: + * result = IntList() + * free(result.arr) # <<<<<<<<<<<<<< + * result.arr = result_ptr + * result.len = result_len + */ + free(__pyx_v_result->arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":844 + * result = IntList() + * free(result.arr) + * result.arr = result_ptr # <<<<<<<<<<<<<< + * result.len = result_len + * result.size = result_len + */ + __pyx_v_result->arr = __pyx_v_result_ptr; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":845 + * free(result.arr) + * result.arr = result_ptr + * result.len = result_len # <<<<<<<<<<<<<< + * result.size = result_len + * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) + */ + __pyx_v_result->len = __pyx_v_result_len; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":846 + * result.arr = result_ptr + * result.len = result_len + * result.size = result_len # <<<<<<<<<<<<<< + * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) + * + */ + __pyx_v_result->size = __pyx_v_result_len; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":847 + * result.len = result_len + * result.size = result_len + * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) # <<<<<<<<<<<<<< + * + * 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 = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr_low), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_result_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr_high), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__arr), ((PyObject *)__pyx_v_result)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__num_subpatterns), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + __pyx_L7:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.intersect_helper", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_arr1); + __Pyx_XDECREF((PyObject *)__pyx_v_arr2); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":849 + * return PhraseLocation(arr_low=0, arr_high=result_len, arr=result, num_subpatterns=num_subpatterns) + * + * cdef loc2str(self, PhraseLocation loc): # <<<<<<<<<<<<<< + * cdef int i, j + * result = "{" + */ + +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) { + int __pyx_v_i; + int __pyx_v_j; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loc2str", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":851 + * cdef loc2str(self, PhraseLocation loc): + * cdef int i, j + * result = "{" # <<<<<<<<<<<<<< + * i = 0 + * while i < loc.arr_high: + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_120)); + __pyx_v_result = ((PyObject *)__pyx_kp_s_120); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":852 + * cdef int i, j + * result = "{" + * i = 0 # <<<<<<<<<<<<<< + * while i < loc.arr_high: + * result = result + "(" + */ + __pyx_v_i = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":853 + * result = "{" + * i = 0 + * while i < loc.arr_high: # <<<<<<<<<<<<<< + * result = result + "(" + * for j from i <= j < i + loc.num_subpatterns: + */ + while (1) { + __pyx_t_1 = ((__pyx_v_i < __pyx_v_loc->arr_high) != 0); + if (!__pyx_t_1) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":854 + * i = 0 + * while i < loc.arr_high: + * result = result + "(" # <<<<<<<<<<<<<< + * for j from i <= j < i + loc.num_subpatterns: + * result = result + ("%d " %loc.arr[j]) + */ + __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_121)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":855 + * while i < loc.arr_high: + * result = result + "(" + * for j from i <= j < i + loc.num_subpatterns: # <<<<<<<<<<<<<< + * result = result + ("%d " %loc.arr[j]) + * result = result + ")" + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":856 + * result = result + "(" + * for j from i <= j < i + loc.num_subpatterns: + * result = result + ("%d " %loc.arr[j]) # <<<<<<<<<<<<<< + * result = result + ")" + * i = i + loc.num_subpatterns + */ + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_loc->arr), __pyx_v_j, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":857 + * for j from i <= j < i + loc.num_subpatterns: + * result = result + ("%d " %loc.arr[j]) + * result = result + ")" # <<<<<<<<<<<<<< + * i = i + loc.num_subpatterns + * result = result + "}" + */ + __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":858 + * result = result + ("%d " %loc.arr[j]) + * result = result + ")" + * i = i + loc.num_subpatterns # <<<<<<<<<<<<<< + * result = result + "}" + * return result + */ + __pyx_v_i = (__pyx_v_i + __pyx_v_loc->num_subpatterns); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":859 + * result = result + ")" + * i = i + loc.num_subpatterns + * result = result + "}" # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_2 = PyNumber_Add(__pyx_v_result, ((PyObject *)__pyx_kp_s_122)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":860 + * i = i + loc.num_subpatterns + * result = result + "}" + * return result # <<<<<<<<<<<<<< + * + * cdef PhraseLocation intersect(self, prefix_node, suffix_node, Phrase phrase): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.loc2str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":862 + * return result + * + * cdef PhraseLocation intersect(self, prefix_node, suffix_node, Phrase phrase): # <<<<<<<<<<<<<< + * cdef Phrase prefix, suffix + * cdef PhraseLocation prefix_loc, suffix_loc, result + */ + +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) { + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_prefix = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_suffix = 0; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_prefix_loc = 0; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_suffix_loc = 0; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_v_result = 0; + CYTHON_UNUSED PyObject *__pyx_v_intersect_method = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("intersect", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":866 + * cdef PhraseLocation prefix_loc, suffix_loc, result + * + * prefix = prefix_node.phrase # <<<<<<<<<<<<<< + * suffix = suffix_node.phrase + * prefix_loc = prefix_node.phrase_location + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix_node, __pyx_n_s__phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __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_Phrase))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_prefix = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":867 + * + * prefix = prefix_node.phrase + * suffix = suffix_node.phrase # <<<<<<<<<<<<<< + * prefix_loc = prefix_node.phrase_location + * suffix_loc = suffix_node.phrase_location + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_suffix_node, __pyx_n_s__phrase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 867; __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_Phrase))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_suffix = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":868 + * prefix = prefix_node.phrase + * suffix = suffix_node.phrase + * prefix_loc = prefix_node.phrase_location # <<<<<<<<<<<<<< + * suffix_loc = suffix_node.phrase_location + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_prefix_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 868; __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 = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_prefix_loc = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":869 + * suffix = suffix_node.phrase + * prefix_loc = prefix_node.phrase_location + * suffix_loc = suffix_node.phrase_location # <<<<<<<<<<<<<< + * + * result = self.get_precomputed_collocation(phrase) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_suffix_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 869; __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 = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_suffix_loc = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":871 + * 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_123); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __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 = 871; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 871; __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 (!(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 = 871; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":872 + * + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":873 + * result = self.get_precomputed_collocation(phrase) + * if result is not None: + * intersect_method = "precomputed" # <<<<<<<<<<<<<< + * + * if result is None: + */ + __Pyx_INCREF(((PyObject *)__pyx_n_s__precomputed)); + __pyx_v_intersect_method = ((PyObject *)__pyx_n_s__precomputed); + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":875 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":876 + * + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":877 + * 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 = 877; __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 = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":878 + * if self.use_baeza_yates: + * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, BAEZA_YATES) + * intersect_method="double binary" # <<<<<<<<<<<<<< + * else: + * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_124)); + __Pyx_XDECREF(__pyx_v_intersect_method); + __pyx_v_intersect_method = ((PyObject *)__pyx_kp_s_124); + goto __pyx_L5; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":880 + * 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 = 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(((PyObject *)__pyx_v_result)); + __pyx_v_result = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":881 + * else: + * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) + * intersect_method="merge" # <<<<<<<<<<<<<< + * return result + * + */ + __Pyx_INCREF(((PyObject *)__pyx_n_s__merge)); + __Pyx_XDECREF(__pyx_v_intersect_method); + __pyx_v_intersect_method = ((PyObject *)__pyx_n_s__merge); + } + __pyx_L5:; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":882 + * result = self.intersect_helper(prefix, suffix, prefix_loc, suffix_loc, MERGE) + * intersect_method="merge" + * return result # <<<<<<<<<<<<<< + * + * def advance(self, frontier, res, fwords): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_prefix); + __Pyx_XDECREF((PyObject *)__pyx_v_suffix); + __Pyx_XDECREF((PyObject *)__pyx_v_prefix_loc); + __Pyx_XDECREF((PyObject *)__pyx_v_suffix_loc); + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_intersect_method); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13advance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_frontier = 0; + PyObject *__pyx_v_res = 0; + PyObject *__pyx_v_fwords = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("advance (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__frontier,&__pyx_n_s__res,&__pyx_n_s__fwords,0}; + PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__frontier)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "advance") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_frontier = values[0]; + __pyx_v_res = values[1]; + __pyx_v_fwords = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("advance", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_frontier, __pyx_v_res, __pyx_v_fwords); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":884 + * return result + * + * def advance(self, frontier, res, fwords): # <<<<<<<<<<<<<< + * cdef unsigned na + * nf = [] + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12advance(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_frontier, PyObject *__pyx_v_res, PyObject *__pyx_v_fwords) { + unsigned int __pyx_v_na; + PyObject *__pyx_v_nf = NULL; + PyObject *__pyx_v_toskip = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_alt = NULL; + PyObject *__pyx_v_pathlen = NULL; + PyObject *__pyx_v_spanlen = NULL; + PyObject *__pyx_v_ni = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + 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; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + Py_ssize_t __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + unsigned int __pyx_t_16; + int __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("advance", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":886 + * def advance(self, frontier, res, fwords): + * cdef unsigned na + * nf = [] # <<<<<<<<<<<<<< + * for toskip, (i, alt, pathlen) in frontier: + * spanlen = fwords[i][alt][2] + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_nf = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":887 + * 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)) { + __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 = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #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 = 887; __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 = 887; __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 = 887; __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 = 887; __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(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 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[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_toskip); + __pyx_v_toskip = __pyx_t_5; + __pyx_t_5 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_7 = PyList_GET_ITEM(sequence, 0); + __pyx_t_9 = PyList_GET_ITEM(sequence, 1); + __pyx_t_10 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + #else + __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + #endif + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_11)->tp_iternext; + index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 2; __pyx_t_10 = __pyx_t_8(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_11), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L8_unpacking_done; + __pyx_L7_unpacking_failed:; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L8_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_v_alt); + __pyx_v_alt = __pyx_t_9; + __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_v_pathlen); + __pyx_v_pathlen = __pyx_t_10; + __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":888 + * nf = [] + * for toskip, (i, alt, pathlen) in frontier: + * spanlen = fwords[i][alt][2] # <<<<<<<<<<<<<< + * if toskip == 0: + * res.append((i, alt, pathlen)) + */ + __pyx_t_4 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_v_alt); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __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_GetItemInt(__pyx_t_6, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_spanlen); + __pyx_v_spanlen = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":889 + * for toskip, (i, alt, pathlen) in frontier: + * spanlen = fwords[i][alt][2] + * if toskip == 0: # <<<<<<<<<<<<<< + * res.append((i, alt, pathlen)) + * ni = i + spanlen + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_toskip, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_12) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":890 + * spanlen = fwords[i][alt][2] + * if toskip == 0: + * res.append((i, alt, pathlen)) # <<<<<<<<<<<<<< + * ni = i + spanlen + * if ni < len(fwords) and pathlen + 1 < self.max_initial_size: + */ + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + __Pyx_INCREF(__pyx_v_alt); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_alt); + __Pyx_GIVEREF(__pyx_v_alt); + __Pyx_INCREF(__pyx_v_pathlen); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_pathlen); + __Pyx_GIVEREF(__pyx_v_pathlen); + __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_res, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":891 + * if toskip == 0: + * res.append((i, alt, pathlen)) + * ni = i + spanlen # <<<<<<<<<<<<<< + * if ni < len(fwords) and pathlen + 1 < self.max_initial_size: + * for na in range(len(fwords[ni])): + */ + __pyx_t_6 = PyNumber_Add(__pyx_v_i, __pyx_v_spanlen); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_v_ni); + __pyx_v_ni = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":892 + * res.append((i, alt, pathlen)) + * ni = i + spanlen + * 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))) + */ + __pyx_t_13 = PyObject_Length(__pyx_v_fwords); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_ni, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_12) { + __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_15 = __pyx_t_14; + } else { + __pyx_t_15 = __pyx_t_12; + } + if (__pyx_t_15) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":893 + * ni = i + spanlen + * 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))) + * if len(nf) > 0: + */ + __pyx_t_5 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ni); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_13 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_13; __pyx_t_16+=1) { + __pyx_v_na = __pyx_t_16; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":894 + * 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))) # <<<<<<<<<<<<<< + * if len(nf) > 0: + * return self.advance(nf, res, fwords) + */ + __pyx_t_5 = PyNumber_Subtract(__pyx_v_toskip, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_na); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PyNumber_Add(__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __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 = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_v_ni); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ni); + __Pyx_GIVEREF(__pyx_v_ni); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_6 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __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); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + __pyx_t_5 = 0; + __pyx_t_10 = 0; + __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_nf, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + } + goto __pyx_L10; + } + __pyx_L10:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":895 + * for na in range(len(fwords[ni])): + * nf.append((toskip - 1, (ni, na, pathlen + 1))) + * if len(nf) > 0: # <<<<<<<<<<<<<< + * return self.advance(nf, res, fwords) + * else: + */ + __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_nf)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = ((__pyx_t_2 > 0) != 0); + if (__pyx_t_15) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":896 + * nf.append((toskip - 1, (ni, na, pathlen + 1))) + * if len(nf) > 0: + * return self.advance(nf, res, fwords) # <<<<<<<<<<<<<< + * else: + * 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 = 896; __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 = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_nf)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_nf)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_nf)); + __Pyx_INCREF(__pyx_v_res); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_res); + __Pyx_GIVEREF(__pyx_v_res); + __Pyx_INCREF(__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_fwords); + __Pyx_GIVEREF(__pyx_v_fwords); + __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_r = __pyx_t_10; + __pyx_t_10 = 0; + goto __pyx_L0; + goto __pyx_L13; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":898 + * return self.advance(nf, res, fwords) + * else: + * return res # <<<<<<<<<<<<<< + * + * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_res); + __pyx_r = __pyx_v_res; + goto __pyx_L0; + } + __pyx_L13:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.advance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_nf); + __Pyx_XDECREF(__pyx_v_toskip); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_alt); + __Pyx_XDECREF(__pyx_v_pathlen); + __Pyx_XDECREF(__pyx_v_spanlen); + __Pyx_XDECREF(__pyx_v_ni); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_15get_all_nodes_isteps_away(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_skip = 0; + PyObject *__pyx_v_i = 0; + PyObject *__pyx_v_spanlen = 0; + PyObject *__pyx_v_pathlen = 0; + PyObject *__pyx_v_fwords = 0; + PyObject *__pyx_v_next_states = 0; + PyObject *__pyx_v_reachable_buffer = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_all_nodes_isteps_away (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__skip,&__pyx_n_s__i,&__pyx_n_s__spanlen,&__pyx_n_s__pathlen,&__pyx_n_s__fwords,&__pyx_n_s__next_states,&__pyx_n_s__reachable_buffer,0}; + PyObject* values[7] = {0,0,0,0,0,0,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 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__skip)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__spanlen)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pathlen)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 3); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwords)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 4); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__next_states)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 5); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reachable_buffer)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, 6); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __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_all_nodes_isteps_away") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + } + __pyx_v_skip = values[0]; + __pyx_v_i = values[1]; + __pyx_v_spanlen = values[2]; + __pyx_v_pathlen = values[3]; + __pyx_v_fwords = values[4]; + __pyx_v_next_states = values[5]; + __pyx_v_reachable_buffer = values[6]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_all_nodes_isteps_away", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_skip, __pyx_v_i, __pyx_v_spanlen, __pyx_v_pathlen, __pyx_v_fwords, __pyx_v_next_states, __pyx_v_reachable_buffer); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":900 + * return res + * + * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): # <<<<<<<<<<<<<< + * cdef unsigned alt_it + * frontier = [] + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_14get_all_nodes_isteps_away(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_skip, PyObject *__pyx_v_i, PyObject *__pyx_v_spanlen, PyObject *__pyx_v_pathlen, PyObject *__pyx_v_fwords, PyObject *__pyx_v_next_states, PyObject *__pyx_v_reachable_buffer) { + PyObject *__pyx_v_frontier = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_reachable = NULL; + PyObject *__pyx_v_nextreachable = NULL; + PyObject *__pyx_v_next_id = NULL; + PyObject *__pyx_v_jump = NULL; + PyObject *__pyx_v_alt_id = NULL; + PyObject *__pyx_v_newel = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + 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_11 = NULL; + Py_ssize_t __pyx_t_12; + PyObject *(*__pyx_t_13)(PyObject *); + PyObject *__pyx_t_14 = NULL; + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":902 + * def get_all_nodes_isteps_away(self, skip, i, spanlen, pathlen, fwords, next_states, reachable_buffer): + * cdef unsigned alt_it + * frontier = [] # <<<<<<<<<<<<<< + * if i+spanlen+skip >= len(next_states): + * return frontier + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_frontier = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":903 + * cdef unsigned alt_it + * frontier = [] + * if i+spanlen+skip >= len(next_states): # <<<<<<<<<<<<<< + * return frontier + * key = tuple([i,spanlen]) + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_i, __pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyObject_Length(__pyx_v_next_states); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __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_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":904 + * frontier = [] + * if i+spanlen+skip >= len(next_states): + * return frontier # <<<<<<<<<<<<<< + * key = tuple([i,spanlen]) + * reachable = [] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_frontier)); + __pyx_r = ((PyObject *)__pyx_v_frontier); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":905 + * if i+spanlen+skip >= len(next_states): + * return frontier + * key = tuple([i,spanlen]) # <<<<<<<<<<<<<< + * reachable = [] + * if key in reachable_buffer: + */ + __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_i); + PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + __Pyx_INCREF(__pyx_v_spanlen); + PyList_SET_ITEM(__pyx_t_4, 1, __pyx_v_spanlen); + __Pyx_GIVEREF(__pyx_v_spanlen); + __pyx_t_1 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_4))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_key = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":906 + * return frontier + * key = tuple([i,spanlen]) + * reachable = [] # <<<<<<<<<<<<<< + * if key in reachable_buffer: + * reachable = reachable_buffer[key] + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_reachable = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":907 + * key = tuple([i,spanlen]) + * reachable = [] + * if key in reachable_buffer: # <<<<<<<<<<<<<< + * reachable = reachable_buffer[key] + * else: + */ + __pyx_t_5 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_key), __pyx_v_reachable_buffer, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = (__pyx_t_5 != 0); + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":908 + * reachable = [] + * if key in reachable_buffer: + * reachable = reachable_buffer[key] # <<<<<<<<<<<<<< + * else: + * reachable = self.reachable(fwords, i, spanlen) + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_reachable); + __pyx_v_reachable = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L4; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":910 + * 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 = 910; __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 = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fwords); + __Pyx_GIVEREF(__pyx_v_fwords); + __Pyx_INCREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + __Pyx_INCREF(__pyx_v_spanlen); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_spanlen); + __Pyx_GIVEREF(__pyx_v_spanlen); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 910; __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_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_reachable); + __pyx_v_reachable = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":911 + * else: + * reachable = self.reachable(fwords, i, spanlen) + * reachable_buffer[key] = reachable # <<<<<<<<<<<<<< + * for nextreachable in reachable: + * for next_id in next_states[nextreachable]: + */ + if (PyObject_SetItem(__pyx_v_reachable_buffer, ((PyObject *)__pyx_v_key), __pyx_v_reachable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":912 + * 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; + } 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 = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + 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 = 912; __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 = 912; __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 = 912; __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 = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_7(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_nextreachable); + __pyx_v_nextreachable = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":913 + * 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_t_4 = PyObject_GetItem(__pyx_v_next_states, __pyx_v_nextreachable); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __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; + } 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 = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + __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 = 913; __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 = 913; __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 = 913; __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 = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_next_id); + __pyx_v_next_id = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":914 + * 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 = 914; __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 = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_fwords); + __Pyx_GIVEREF(__pyx_v_fwords); + __Pyx_INCREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_10, 1, __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); + __Pyx_GIVEREF(__pyx_v_next_id); + __pyx_t_11 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_v_jump); + __pyx_v_jump = __pyx_t_11; + __pyx_t_11 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":915 + * 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 = 915; __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 = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":916 + * jump = self.shortest(fwords,i,next_id) + * if jump < skip: + * continue # <<<<<<<<<<<<<< + * if pathlen+jump <= self.max_initial_size: + * for alt_id in range(len(fwords[next_id])): + */ + goto __pyx_L7_continue; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":917 + * 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 = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyInt_FromLong(__pyx_v_self->max_initial_size); 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_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 = 917; __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 = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":918 + * 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 (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __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 = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_10 = __pyx_t_4; __Pyx_INCREF(__pyx_t_10); __pyx_t_12 = 0; + __pyx_t_13 = NULL; + } else { + __pyx_t_12 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = Py_TYPE(__pyx_t_10)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_10)) { + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_10)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_10, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_10)) { + if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_10)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_10, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_13(__pyx_t_10); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_alt_id); + __pyx_v_alt_id = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":919 + * 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 (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = PyObject_GetItem(__pyx_t_4, __pyx_v_alt_id); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_11, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_14 = PyObject_RichCompare(__pyx_t_4, __pyx_t_11, Py_NE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":920 + * 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_14 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_11 = PyTuple_New(3); 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_INCREF(__pyx_v_next_id); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_next_id); + __Pyx_GIVEREF(__pyx_v_next_id); + __Pyx_INCREF(__pyx_v_alt_id); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_alt_id); + __Pyx_GIVEREF(__pyx_v_alt_id); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + __pyx_t_14 = 0; + __Pyx_XDECREF(((PyObject *)__pyx_v_newel)); + __pyx_v_newel = ((PyObject*)__pyx_t_11); + __pyx_t_11 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":921 + * 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)) + * return frontier + */ + __pyx_t_6 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_v_newel), ((PyObject *)__pyx_v_frontier), Py_NE)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_6 != 0); + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":922 + * newel = (next_id,alt_id,pathlen+jump) + * if newel not in frontier: + * frontier.append((next_id,alt_id,pathlen+jump)) # <<<<<<<<<<<<<< + * return frontier + * + */ + __pyx_t_11 = PyNumber_Add(__pyx_v_pathlen, __pyx_v_jump); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_INCREF(__pyx_v_next_id); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_next_id); + __Pyx_GIVEREF(__pyx_v_next_id); + __Pyx_INCREF(__pyx_v_alt_id); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_alt_id); + __Pyx_GIVEREF(__pyx_v_alt_id); + PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_frontier, ((PyObject *)__pyx_t_14)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + goto __pyx_L14; + } + __pyx_L14:; + goto __pyx_L13; + } + __pyx_L13:; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L10; + } + __pyx_L10:; + __pyx_L7_continue:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":923 + * if newel not in frontier: + * frontier.append((next_id,alt_id,pathlen+jump)) + * return frontier # <<<<<<<<<<<<<< + * + * def reachable(self, fwords, ifrom, dist): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_frontier)); + __pyx_r = ((PyObject *)__pyx_v_frontier); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_all_nodes_isteps_away", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_frontier); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_reachable); + __Pyx_XDECREF(__pyx_v_nextreachable); + __Pyx_XDECREF(__pyx_v_next_id); + __Pyx_XDECREF(__pyx_v_jump); + __Pyx_XDECREF(__pyx_v_alt_id); + __Pyx_XDECREF(__pyx_v_newel); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_17reachable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fwords = 0; + PyObject *__pyx_v_ifrom = 0; + PyObject *__pyx_v_dist = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reachable (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__ifrom,&__pyx_n_s__dist,0}; + PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__fwords)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dist)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reachable") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_fwords = values[0]; + __pyx_v_ifrom = values[1]; + __pyx_v_dist = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("reachable", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_16reachable(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_dist); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":925 + * return frontier + * + * def reachable(self, fwords, ifrom, dist): # <<<<<<<<<<<<<< + * ret = [] + * if ifrom >= len(fwords): + */ + +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) { + PyObject *__pyx_v_ret = NULL; + PyObject *__pyx_v_alt_id = NULL; + PyObject *__pyx_v_ifromchild = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("reachable", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":926 + * + * def reachable(self, fwords, ifrom, dist): + * ret = [] # <<<<<<<<<<<<<< + * if ifrom >= len(fwords): + * return ret + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_ret = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":927 + * def reachable(self, fwords, ifrom, dist): + * ret = [] + * if ifrom >= len(fwords): # <<<<<<<<<<<<<< + * return ret + * for alt_id in range(len(fwords[ifrom])): + */ + __pyx_t_2 = PyObject_Length(__pyx_v_fwords); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 927; __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 = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":928 + * ret = [] + * if ifrom >= len(fwords): + * return ret # <<<<<<<<<<<<<< + * for alt_id in range(len(fwords[ifrom])): + * if fwords[ifrom][alt_id][0] == EPSILON: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_ret)); + __pyx_r = ((PyObject *)__pyx_v_ret); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":929 + * if ifrom >= len(fwords): + * return ret + * 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)) + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __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[8]; __pyx_lineno = 929; __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 = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + 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 = 929; __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 = 929; __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 = 929; __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 = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_3 = __pyx_t_5(__pyx_t_1); + if (unlikely(!__pyx_t_3)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF(__pyx_v_alt_id); + __pyx_v_alt_id = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":930 + * return ret + * 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: + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __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_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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 = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":931 + * 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_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ret), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __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 = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Add(__pyx_v_ifrom, __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fwords); + __Pyx_GIVEREF(__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_dist); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_dist); + __Pyx_GIVEREF(__pyx_v_dist); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __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[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":933 + * 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_8 = PyObject_RichCompare(__pyx_v_dist, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 933; __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 = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":934 + * else: + * if dist == 0: + * if ifrom not in ret: # <<<<<<<<<<<<<< + * ret.append(ifrom) + * else: + */ + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_ifrom, ((PyObject *)__pyx_v_ret), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = (__pyx_t_4 != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":935 + * 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_10 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_ifrom); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":937 + * 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_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__reachable); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyObject_GetItem(__pyx_t_3, __pyx_v_alt_id); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __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_GetItemInt(__pyx_t_7, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __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 = 937; __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_Subtract(__pyx_v_dist, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __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 = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fwords); + __Pyx_GIVEREF(__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_7 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_6 = __pyx_t_3; __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_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (!__pyx_t_12 && PyList_CheckExact(__pyx_t_6)) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_12 && PyTuple_CheckExact(__pyx_t_6)) { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_3 = __pyx_t_12(__pyx_t_6); + if (unlikely(!__pyx_t_3)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF(__pyx_v_ifromchild); + __pyx_v_ifromchild = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":938 + * 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_9 = (__Pyx_PySequence_Contains(__pyx_v_ifromchild, ((PyObject *)__pyx_v_ret), Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_9 != 0); + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":939 + * 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_10 = __Pyx_PyList_Append(__pyx_v_ret, __pyx_v_ifromchild); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_L7:; + } + __pyx_L6:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":941 + * ret.append(ifromchild) + * + * return ret # <<<<<<<<<<<<<< + * + * def shortest(self, fwords, ifrom, ito): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_ret)); + __pyx_r = ((PyObject *)__pyx_v_ret); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.reachable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_alt_id); + __Pyx_XDECREF(__pyx_v_ifromchild); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_19shortest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fwords = 0; + PyObject *__pyx_v_ifrom = 0; + PyObject *__pyx_v_ito = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("shortest (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__ifrom,&__pyx_n_s__ito,0}; + PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__fwords)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ifrom)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ito)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, 2); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shortest") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_fwords = values[0]; + __pyx_v_ifrom = values[1]; + __pyx_v_ito = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("shortest", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_18shortest(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_ifrom, __pyx_v_ito); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":943 + * return ret + * + * def shortest(self, fwords, ifrom, ito): # <<<<<<<<<<<<<< + * cdef unsigned alt_id + * min = 1000 + */ + +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) { + unsigned int __pyx_v_alt_id; + PyObject *__pyx_v_min = NULL; + PyObject *__pyx_v_currmin = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + unsigned int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("shortest", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":945 + * def shortest(self, fwords, ifrom, ito): + * cdef unsigned alt_id + * min = 1000 # <<<<<<<<<<<<<< + * if ifrom > ito: + * return min + */ + __Pyx_INCREF(__pyx_int_1000); + __pyx_v_min = __pyx_int_1000; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":946 + * cdef unsigned alt_id + * min = 1000 + * if ifrom > ito: # <<<<<<<<<<<<<< + * return min + * if ifrom == ito: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 946; __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 = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":947 + * min = 1000 + * if ifrom > ito: + * return min # <<<<<<<<<<<<<< + * if ifrom == ito: + * return 0 + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_min); + __pyx_r = __pyx_v_min; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":948 + * if ifrom > ito: + * return min + * if ifrom == ito: # <<<<<<<<<<<<<< + * return 0 + * for alt_id in range(len(fwords[ifrom])): + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_ifrom, __pyx_v_ito, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 948; __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 = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":949 + * return min + * if ifrom == ito: + * return 0 # <<<<<<<<<<<<<< + * for alt_id in range(len(fwords[ifrom])): + * currmin = self.shortest(fwords,ifrom+fwords[ifrom][alt_id][2],ito) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_0); + __pyx_r = __pyx_int_0; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":950 + * if ifrom == ito: + * 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: + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_alt_id = __pyx_t_4; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":951 + * 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 = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetItem(__pyx_v_fwords, __pyx_v_ifrom); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_alt_id, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __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 = 951; __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 = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_fwords); + __Pyx_GIVEREF(__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_ito); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_ito); + __Pyx_GIVEREF(__pyx_v_ito); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_v_currmin); + __pyx_v_currmin = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":952 + * 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 (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_alt_id, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 952; __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 = 952; __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 = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":953 + * 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 = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_currmin); + __pyx_v_currmin = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":954 + * 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 = 954; __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 = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":955 + * currmin += 1 + * if currmin < min: + * min = currmin # <<<<<<<<<<<<<< + * return min + * + */ + __Pyx_INCREF(__pyx_v_currmin); + __Pyx_DECREF(__pyx_v_min); + __pyx_v_min = __pyx_v_currmin; + goto __pyx_L8; + } + __pyx_L8:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":956 + * if currmin < min: + * min = currmin + * return min # <<<<<<<<<<<<<< + * + * def get_next_states(self, _columns, curr_idx, min_dist=2): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_min); + __pyx_r = __pyx_v_min; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.shortest", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_min); + __Pyx_XDECREF(__pyx_v_currmin); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_21get_next_states(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v__columns = 0; + PyObject *__pyx_v_curr_idx = 0; + PyObject *__pyx_v_min_dist = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_next_states (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___columns,&__pyx_n_s__curr_idx,&__pyx_n_s__min_dist,0}; + PyObject* values[3] = {0,0,0}; + values[2] = ((PyObject *)__pyx_int_2); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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___columns)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__curr_idx)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_next_states", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_dist); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_next_states") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v__columns = values[0]; + __pyx_v_curr_idx = values[1]; + __pyx_v_min_dist = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_next_states", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_20get_next_states(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v__columns, __pyx_v_curr_idx, __pyx_v_min_dist); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":958 + * return min + * + * def get_next_states(self, _columns, curr_idx, min_dist=2): # <<<<<<<<<<<<<< + * result = [] + * candidate = [[curr_idx,0]] + */ + +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) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_candidate = NULL; + PyObject *__pyx_v_curr = NULL; + PyObject *__pyx_v_curr_col = NULL; + PyObject *__pyx_v_alt = NULL; + PyObject *__pyx_v_next_id = NULL; + PyObject *__pyx_v_jump = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_next_states", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":959 + * + * def get_next_states(self, _columns, curr_idx, min_dist=2): + * result = [] # <<<<<<<<<<<<<< + * candidate = [[curr_idx,0]] + * + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":960 + * def get_next_states(self, _columns, curr_idx, min_dist=2): + * result = [] + * candidate = [[curr_idx,0]] # <<<<<<<<<<<<<< + * + * while len(candidate) > 0: + */ + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_curr_idx); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_curr_idx); + __Pyx_GIVEREF(__pyx_v_curr_idx); + __Pyx_INCREF(__pyx_int_0); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_v_candidate = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":962 + * candidate = [[curr_idx,0]] + * + * while len(candidate) > 0: # <<<<<<<<<<<<<< + * curr = candidate.pop() + * if curr[0] >= len(_columns): + */ + while (1) { + __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_candidate)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((__pyx_t_3 > 0) != 0); + if (!__pyx_t_4) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":963 + * + * while len(candidate) > 0: + * curr = candidate.pop() # <<<<<<<<<<<<<< + * if curr[0] >= len(_columns): + * continue + */ + __pyx_t_2 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_candidate)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_curr); + __pyx_v_curr = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":964 + * while len(candidate) > 0: + * curr = candidate.pop() + * if curr[0] >= len(_columns): # <<<<<<<<<<<<<< + * continue + * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Length(__pyx_v__columns); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __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_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":965 + * curr = candidate.pop() + * if curr[0] >= len(_columns): + * continue # <<<<<<<<<<<<<< + * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: + * result.append(curr[0]); + */ + goto __pyx_L3_continue; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":966 + * if curr[0] >= len(_columns): + * continue + * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: # <<<<<<<<<<<<<< + * result.append(curr[0]); + * curr_col = _columns[curr[0]] + */ + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_5, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __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 = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { + __Pyx_DECREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 966; __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 = 966; __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 = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_4; + } + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":967 + * continue + * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: + * result.append(curr[0]); # <<<<<<<<<<<<<< + * curr_col = _columns[curr[0]] + * for alt in curr_col: + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":968 + * if curr[0] not in result and min_dist <= curr[1] <= self.max_initial_size: + * result.append(curr[0]); + * curr_col = _columns[curr[0]] # <<<<<<<<<<<<<< + * for alt in curr_col: + * next_id = curr[0]+alt[2] + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetItem(__pyx_v__columns, __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_curr_col); + __pyx_v_curr_col = __pyx_t_5; + __pyx_t_5 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":969 + * 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)) { + __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 = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; + } + 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 = 969; __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 = 969; __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 = 969; __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 = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_9(__pyx_t_5); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_alt); + __pyx_v_alt = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":970 + * curr_col = _columns[curr[0]] + * for alt in curr_col: + * next_id = curr[0]+alt[2] # <<<<<<<<<<<<<< + * jump = 1 + * if alt[0] == EPSILON: + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_alt, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_v_next_id); + __pyx_v_next_id = __pyx_t_10; + __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":971 + * for alt in curr_col: + * next_id = curr[0]+alt[2] + * jump = 1 # <<<<<<<<<<<<<< + * if alt[0] == EPSILON: + * jump = 0 + */ + __Pyx_INCREF(__pyx_int_1); + __Pyx_XDECREF(__pyx_v_jump); + __pyx_v_jump = __pyx_int_1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":972 + * next_id = curr[0]+alt[2] + * jump = 1 + * if alt[0] == EPSILON: # <<<<<<<<<<<<<< + * jump = 0 + * if next_id not in result and min_dist <= curr[1]+jump <= self.max_initial_size+1: + */ + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_alt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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 = 972; __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 = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":973 + * jump = 1 + * if alt[0] == EPSILON: + * 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]) + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_jump); + __pyx_v_jump = __pyx_int_0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":974 + * if alt[0] == EPSILON: + * 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]) + * return sorted(result); + */ + __pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_next_id, ((PyObject *)__pyx_v_result), Py_NE)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __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 = 974; __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 = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { + __Pyx_DECREF(__pyx_t_1); + __pyx_t_10 = PyInt_FromLong((__pyx_v_self->max_initial_size + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 974; __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 = 974; __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 = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_t_4; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":975 + * 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]) # <<<<<<<<<<<<<< + * return sorted(result); + * + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_curr, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __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 = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_next_id); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_next_id); + __Pyx_GIVEREF(__pyx_v_next_id); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_candidate, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L10; + } + __pyx_L10:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_L3_continue:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":976 + * 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); # <<<<<<<<<<<<<< + * + * def input(self, fwords, meta, ctx_name=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_result)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_result)); + __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_next_states", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_candidate); + __Pyx_XDECREF(__pyx_v_curr); + __Pyx_XDECREF(__pyx_v_curr_col); + __Pyx_XDECREF(__pyx_v_alt); + __Pyx_XDECREF(__pyx_v_next_id); + __Pyx_XDECREF(__pyx_v_jump); + __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); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input[] = "When this function is called on the RuleFactory,\n it looks up all of the rules that can be used to translate\n the input sentence"; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_23input(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fwords = 0; + PyObject *__pyx_v_meta = 0; + PyObject *__pyx_v_ctx_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("input (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fwords,&__pyx_n_s__meta,&__pyx_n_s__ctx_name,0}; + PyObject* values[3] = {0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":978 + * 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 + */ + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__fwords)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__meta)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("input", 0, 2, 3, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx_name); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "input") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_fwords = values[0]; + __pyx_v_meta = values[1]; + __pyx_v_ctx_name = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("input", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_22input(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_fwords, __pyx_v_meta, __pyx_v_ctx_name); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4 = {__Pyx_NAMESTR("lambda4"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4(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_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5 = {__Pyx_NAMESTR("lambda5"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_7lambda4_lambda5(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda5 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda5(__pyx_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1147 + * if len(extracts) > 0: + * fcount = Counter() + * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) # <<<<<<<<<<<<<< + * for (f, e, count, als), loc in extracts: + * fcount[f] += count + */ + +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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 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 = 1147; __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 = 1147; __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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __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; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda4.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 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 = 1147; __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_7lambda4_lambda5, 0, __pyx_n_s_125, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __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 = 1147; __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[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6 = {__Pyx_NAMESTR("lambda6"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6(PyObject *__pyx_self, PyObject *__pyx_v_x) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda6 (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda6(__pyx_self, ((PyObject *)__pyx_v_x)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1153 + * 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) + */ + +static PyObject *__pyx_lambda_funcdef_lambda6(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda6", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.input.lambda6", __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 */ + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1193 + * 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 + */ + +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; + 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); + 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_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 = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __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 = 1193; __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)) { + __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 = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #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 = 1193; __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 = 1193; __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 = 1193; __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 = 1193; __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(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_word = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_word, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("genexpr", __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; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":978 + * 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 + */ + +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; + 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); + 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_fwords = __pyx_v_fwords; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords); + __pyx_cur_scope->__pyx_v_meta = __pyx_v_meta; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_meta); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_meta); + __pyx_cur_scope->__pyx_v_ctx_name = __pyx_v_ctx_name; + __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 = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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); + 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; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_t_14; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *(*__pyx_t_20)(PyObject *); + int __pyx_t_21; + PyObject *(*__pyx_t_22)(PyObject *); + Py_ssize_t __pyx_t_23; + 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 *); + 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_L61_resume_from_yield; + case 2: goto __pyx_L82_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[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":989 + * cdef Phrase hiero_phrase + * + * flen = len(fwords) # <<<<<<<<<<<<<< + * start_time = monitor_cpu() + * self.extract_time = 0.0 + */ + __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 = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_cur_scope->__pyx_v_flen = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":990 + * + * 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 = 990; __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[8]; __pyx_lineno = 990; __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 = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_cur_scope->__pyx_v_start_time = __pyx_t_4; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":991 + * flen = len(fwords) + * start_time = monitor_cpu() + * self.extract_time = 0.0 # <<<<<<<<<<<<<< + * self.intersect_time = 0.0 + * nodes_isteps_away_buffer = {} + */ + __pyx_cur_scope->__pyx_v_self->extract_time = 0.0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":992 + * start_time = monitor_cpu() + * self.extract_time = 0.0 + * self.intersect_time = 0.0 # <<<<<<<<<<<<<< + * nodes_isteps_away_buffer = {} + * hit = 0 + */ + __pyx_cur_scope->__pyx_v_self->intersect_time = 0.0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":993 + * 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 = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":994 + * self.intersect_time = 0.0 + * nodes_isteps_away_buffer = {} + * hit = 0 # <<<<<<<<<<<<<< + * reachable_buffer = {} + * + */ + __pyx_cur_scope->__pyx_v_hit = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":995 + * 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 = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_cur_scope->__pyx_v_reachable_buffer = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1000 + * # 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 = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_cur_scope->__pyx_v_seen_phrases = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1003 + * + * # 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 = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); 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); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1005 + * 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 = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_cur_scope->__pyx_v_frontier = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1006 + * + * 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 = 1006; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1007 + * 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, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1007; __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 = 1007; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1008 + * 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, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __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, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); 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_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 = 1008; __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_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1009 + * 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 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __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 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyTuple_New(8); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->rules->root); + PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_cur_scope->__pyx_v_self->rules->root); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->rules->root); + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_12, 6, ((PyObject *)__pyx_empty_tuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_12, 7, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_8 = 0; + __pyx_t_3 = 0; + __pyx_t_10 = 0; + __pyx_t_1 = 0; + __pyx_t_11 = 0; + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_12)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + goto __pyx_L8; + } + __pyx_L8:; + } + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1011 + * frontier.append((i, i, (i,), alt, 0, self.rules.root, (), False)) + * + * xroot = None # <<<<<<<<<<<<<< + * x1 = sym_setindex(self.category, 1) + * if x1 in self.rules.root.children: + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __pyx_cur_scope->__pyx_v_xroot = Py_None; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1012 + * + * xroot = None + * x1 = sym_setindex(self.category, 1) # <<<<<<<<<<<<<< + * if x1 in self.rules.root.children: + * xroot = self.rules.root.children[x1] + */ + __pyx_cur_scope->__pyx_v_x1 = __pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1013 + * xroot = None + * x1 = sym_setindex(self.category, 1) + * if x1 in self.rules.root.children: # <<<<<<<<<<<<<< + * xroot = self.rules.root.children[x1] + * else: + */ + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_t_12, __pyx_t_11, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_14 = (__pyx_t_9 != 0); + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1014 + * 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_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_x1, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_xroot); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_xroot = __pyx_t_12; + __pyx_t_12 = 0; + goto __pyx_L9; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1016 + * xroot = self.rules.root.children[x1] + * else: + * xroot = ExtendedTrieNode(suffix_link=self.rules.root, phrase_location=PhraseLocation()) # <<<<<<<<<<<<<< + * self.rules.root.children[x1] = xroot + * + */ + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_self->rules->root) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), NULL); 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); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_11) < 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_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); 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_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_xroot); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_xroot); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_cur_scope->__pyx_v_xroot = __pyx_t_11; + __pyx_t_11 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1017 + * 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_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self->rules->root, __pyx_n_s__children); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_SetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_x1, __pyx_cur_scope->__pyx_v_xroot, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __pyx_L9:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1019 + * 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_11 = __pyx_cur_scope->__pyx_v_fwords; + __Pyx_INCREF(__pyx_t_11); + __pyx_t_2 = PyObject_Length(__pyx_t_11); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1020 + * + * 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_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_6 = PyObject_Length(__pyx_t_11); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1021 + * 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_11 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_11, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_12, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_11, __pyx_t_12, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1022 + * 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)) # <<<<<<<<<<<<<< + * + * next_states = [] + */ + __pyx_t_1 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_i - __pyx_cur_scope->__pyx_v_self->min_gap_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_x1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_16 = PyTuple_New(8); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_16, 2, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_16, 4, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_xroot); + PyTuple_SET_ITEM(__pyx_t_16, 5, __pyx_cur_scope->__pyx_v_xroot); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xroot); + PyTuple_SET_ITEM(__pyx_t_16, 6, ((PyObject *)__pyx_t_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_15)); + PyTuple_SET_ITEM(__pyx_t_16, 7, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_1 = 0; + __pyx_t_12 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_3 = 0; + __pyx_t_15 = 0; + __pyx_t_8 = 0; + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_16)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; + goto __pyx_L14; + } + __pyx_L14:; + } + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1024 + * frontier.append((i-self.min_gap_size, i, (i,), alt, self.min_gap_size, xroot, (x1,), True)) + * + * next_states = [] # <<<<<<<<<<<<<< + * for i in range(len(fwords)): + * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) + */ + __pyx_t_16 = PyList_New(0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_GIVEREF(((PyObject *)__pyx_t_16)); + __pyx_cur_scope->__pyx_v_next_states = ((PyObject*)__pyx_t_16); + __pyx_t_16 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1025 + * + * next_states = [] + * for i in range(len(fwords)): # <<<<<<<<<<<<<< + * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) + * + */ + __pyx_t_16 = __pyx_cur_scope->__pyx_v_fwords; + __Pyx_INCREF(__pyx_t_16); + __pyx_t_2 = PyObject_Length(__pyx_t_16); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1026 + * 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_16 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__get_next_states); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_fwords); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_8 = 0; + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_next_states, __pyx_t_15); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1028 + * next_states.append(self.get_next_states(fwords,i,self.min_gap_size)) + * + * while len(frontier) > 0: # <<<<<<<<<<<<<< + * new_frontier = [] + * for k, i, input_match, alt, pathlen, node, prefix, is_shadow_path in frontier: + */ + while (1) { + __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = ((__pyx_t_2 > 0) != 0); + if (!__pyx_t_14) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1029 + * + * 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_15 = PyList_New(0); 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_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_15)); + __pyx_cur_scope->__pyx_v_new_frontier = ((PyObject*)__pyx_t_15); + __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1030 + * 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_15 = ((PyObject *)__pyx_cur_scope->__pyx_v_frontier); __Pyx_INCREF(__pyx_t_15); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_15)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_15, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __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; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 8)) { + if (size > 8) __Pyx_RaiseTooManyValuesError(8); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 5); + __pyx_t_17 = PyTuple_GET_ITEM(sequence, 6); + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 7); + } else { + __pyx_t_16 = PyList_GET_ITEM(sequence, 0); + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + __pyx_t_11 = PyList_GET_ITEM(sequence, 2); + __pyx_t_10 = PyList_GET_ITEM(sequence, 3); + __pyx_t_12 = PyList_GET_ITEM(sequence, 4); + __pyx_t_1 = 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_16); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(__pyx_t_18); + #else + Py_ssize_t i; + PyObject** temps[8] = {&__pyx_t_16,&__pyx_t_8,&__pyx_t_11,&__pyx_t_10,&__pyx_t_12,&__pyx_t_1,&__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 = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(item); + *(temps[i]) = item; + } + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + { + Py_ssize_t index = -1; + PyObject** temps[8] = {&__pyx_t_16,&__pyx_t_8,&__pyx_t_11,&__pyx_t_10,&__pyx_t_12,&__pyx_t_1,&__pyx_t_17,&__pyx_t_18}; + __pyx_t_19 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_19), 8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = NULL; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + goto __pyx_L22_unpacking_done; + __pyx_L21_unpacking_failed:; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_20 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L22_unpacking_done:; + } + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_16); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_cur_scope->__pyx_v_k = __pyx_t_5; + __pyx_cur_scope->__pyx_v_i = __pyx_t_7; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_input_match); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_input_match); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_cur_scope->__pyx_v_input_match = __pyx_t_11; + __pyx_t_11 = 0; + __pyx_cur_scope->__pyx_v_alt = __pyx_t_21; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pathlen); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_pathlen); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_12; + __pyx_t_12 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_node = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_prefix); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_prefix); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_cur_scope->__pyx_v_prefix = __pyx_t_17; + __pyx_t_17 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_is_shadow_path); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_is_shadow_path); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_is_shadow_path = __pyx_t_18; + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1031 + * 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_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_18, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_word_id); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_word_id); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_word_id = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1032 + * 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_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_fwords, __pyx_cur_scope->__pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = __Pyx_GetItemInt(__pyx_t_3, __pyx_cur_scope->__pyx_v_alt, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_18, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_spanlen); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_spanlen); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1034 + * 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_3 = PyInt_FromLong(__pyx_v_4cdec_2sa_3_sa_EPSILON); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_18); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1036 + * if word_id == EPSILON: + * # skipping because word_id is epsilon + * if i+spanlen >= len(fwords): # <<<<<<<<<<<<<< + * continue + * for nualt in range(0,len(fwords[i+spanlen])): + */ + __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __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 = 1036; __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_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 = 1036; __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 = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_17 = PyObject_RichCompare(__pyx_t_3, __pyx_t_18, Py_GE); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __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_14 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1037 + * # skipping because word_id is epsilon + * if i+spanlen >= len(fwords): + * continue # <<<<<<<<<<<<<< + * for nualt in range(0,len(fwords[i+spanlen])): + * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) + */ + goto __pyx_L19_continue; + goto __pyx_L24; + } + __pyx_L24:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1038 + * if i+spanlen >= len(fwords): + * continue + * for nualt in range(0,len(fwords[i+spanlen])): # <<<<<<<<<<<<<< + * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) + * continue + */ + __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyNumber_Add(__pyx_t_17, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_18); if (!__pyx_t_17) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1038; __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 = 1038; __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) { + __pyx_cur_scope->__pyx_v_nualt = __pyx_t_21; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1039 + * continue + * for nualt in range(0,len(fwords[i+spanlen])): + * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyInt_FromLong(__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_3 = PyNumber_Add(__pyx_t_18, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_nualt); 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 = PyTuple_New(8); 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); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_input_match); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_cur_scope->__pyx_v_input_match); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_input_match); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_cur_scope->__pyx_v_pathlen); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pathlen); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_node); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_cur_scope->__pyx_v_node); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_prefix); + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_cur_scope->__pyx_v_prefix); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_prefix); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_shadow_path); + PyTuple_SET_ITEM(__pyx_t_1, 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_3 = 0; + __pyx_t_18 = 0; + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_frontier, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1040 + * for nualt in range(0,len(fwords[i+spanlen])): + * frontier.append((k, i+spanlen, input_match, nualt, pathlen, node, prefix, is_shadow_path)) + * continue # <<<<<<<<<<<<<< + * + * phrase = prefix + (word_id,) + */ + goto __pyx_L19_continue; + goto __pyx_L23; + } + __pyx_L23:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1042 + * continue + * + * phrase = prefix + (word_id,) # <<<<<<<<<<<<<< + * hiero_phrase = Phrase(phrase) + * arity = hiero_phrase.arity() + */ + __pyx_t_1 = PyTuple_New(1); 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_INCREF(__pyx_cur_scope->__pyx_v_word_id); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_word_id); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_word_id); + __pyx_t_18 = PyNumber_Add(__pyx_cur_scope->__pyx_v_prefix, ((PyObject *)__pyx_t_1)); 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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_phrase); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_phrase); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_phrase = __pyx_t_18; + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1043 + * + * phrase = prefix + (word_id,) + * hiero_phrase = Phrase(phrase) # <<<<<<<<<<<<<< + * arity = hiero_phrase.arity() + * + */ + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_phrase); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_cur_scope->__pyx_v_phrase); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_phrase); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_hiero_phrase = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1044 + * phrase = prefix + (word_id,) + * hiero_phrase = Phrase(phrase) + * arity = hiero_phrase.arity() # <<<<<<<<<<<<<< + * + * lookup_required = False + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase), __pyx_n_s__arity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_18 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_cur_scope->__pyx_v_arity = __pyx_t_21; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1046 + * arity = hiero_phrase.arity() + * + * lookup_required = False # <<<<<<<<<<<<<< + * if word_id in node.children: + * if node.children[word_id] is None: + */ + __pyx_cur_scope->__pyx_v_lookup_required = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1047 + * + * 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 = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_14 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_18, Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_9 = (__pyx_t_14 != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1048 + * 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 = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_1 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_9 = (__pyx_t_1 == Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_14 = (__pyx_t_9 != 0); + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1050 + * if node.children[word_id] is None: + * # Path dead-ends at this node + * continue # <<<<<<<<<<<<<< + * else: + * # Path continues at this node + */ + goto __pyx_L19_continue; + goto __pyx_L28; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1053 + * else: + * # Path continues at this node + * node = node.children[word_id] # <<<<<<<<<<<<<< + * else: + * if node.suffix_link is None: + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_18 = PyObject_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_node = __pyx_t_18; + __pyx_t_18 = 0; + } + __pyx_L28:; + goto __pyx_L27; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1055 + * 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 = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_14 = (__pyx_t_18 == Py_None); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_9 = (__pyx_t_14 != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1057 + * if node.suffix_link is None: + * # Current node is root; lookup required + * lookup_required = True # <<<<<<<<<<<<<< + * else: + * if word_id in node.suffix_link.children: + */ + __pyx_cur_scope->__pyx_v_lookup_required = 1; + goto __pyx_L29; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1059 + * 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 = 1059; __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 = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_9 = (__Pyx_PySequence_Contains(__pyx_cur_scope->__pyx_v_word_id, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_14 = (__pyx_t_9 != 0); + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1060 + * 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_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 = 1060; __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 = 1060; __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 (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_14 = (__pyx_t_1 == Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (__pyx_t_14 != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1062 + * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1063 + * # Suffix link reports path is dead end + * node.children[word_id] = None + * continue # <<<<<<<<<<<<<< + * else: + * # Suffix link indicates lookup is reqired + */ + goto __pyx_L19_continue; + goto __pyx_L31; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1066 + * else: + * # Suffix link indicates lookup is reqired + * lookup_required = True # <<<<<<<<<<<<<< + * else: + * #ERROR: We never get here + */ + __pyx_cur_scope->__pyx_v_lookup_required = 1; + } + __pyx_L31:; + goto __pyx_L30; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1069 + * else: + * #ERROR: We never get here + * raise Exception("Keyword trie error") # <<<<<<<<<<<<<< + * # checking whether lookup_required + * if lookup_required: + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __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[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L30:; + } + __pyx_L29:; + } + __pyx_L27:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1071 + * raise Exception("Keyword trie error") + * # checking whether lookup_required + * if lookup_required: # <<<<<<<<<<<<<< + * new_node = None + * if is_shadow_path: + */ + __pyx_t_9 = (__pyx_cur_scope->__pyx_v_lookup_required != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1072 + * # checking whether lookup_required + * if lookup_required: + * new_node = None # <<<<<<<<<<<<<< + * if is_shadow_path: + * # Extending shadow path + */ + __Pyx_INCREF(Py_None); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_new_node); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_new_node); + __Pyx_GIVEREF(Py_None); + __pyx_cur_scope->__pyx_v_new_node = Py_None; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1073 + * if lookup_required: + * new_node = None + * if is_shadow_path: # <<<<<<<<<<<<<< + * # Extending shadow path + * # on the shadow path we don't do any search, we just use info from suffix link + */ + __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 = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1076 + * # 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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __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 = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyObject_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1077 + * # 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_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1078 + * 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_1, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_new_node); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_new_node = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L33; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1080 + * phrase=hiero_phrase) + * else: + * if arity > 0: # <<<<<<<<<<<<<< + * # Intersecting because of arity > 0 + * intersect_start_time = monitor_cpu() + */ + __pyx_t_9 = ((__pyx_cur_scope->__pyx_v_arity > 0) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1082 + * 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_intersect_start_time); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_intersect_start_time); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_intersect_start_time = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1083 + * # 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_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 = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __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_GetItem(__pyx_t_3, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __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 *)((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_1, __pyx_cur_scope->__pyx_v_hiero_phrase)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1084 + * 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_intersect_stop_time); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_intersect_stop_time); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_intersect_stop_time = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1085 + * 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_1 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); 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_3 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_intersect_stop_time, __pyx_cur_scope->__pyx_v_intersect_start_time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_3); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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 = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_cur_scope->__pyx_v_self->intersect_time = __pyx_t_4; + goto __pyx_L34; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1088 + * 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 = 1088; __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 = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_18); + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1089 + * # 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 = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_phrase, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_f_4cdec_2sa_3_sa_sym_tostring(__pyx_t_21)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_6 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_6 - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_low); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_phrase_location->sa_high); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_17 = 0; + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sa_range); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_sa_range); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_sa_range = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1090 + * 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]) + * else: + */ + __pyx_t_9 = (__pyx_cur_scope->__pyx_v_sa_range != Py_None); + __pyx_t_14 = (__pyx_t_9 != 0); + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1091 + * 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_10 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__sa_low), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_sa_range, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__sa_high), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_PhraseLocation)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_10); + __pyx_t_10 = 0; + goto __pyx_L35; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1093 + * phrase_location = PhraseLocation(sa_low=sa_range[0], sa_high=sa_range[1]) + * else: + * phrase_location = None # <<<<<<<<<<<<<< + * + * if phrase_location is None: + */ + __Pyx_INCREF(Py_None); + __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)); + __Pyx_GIVEREF(Py_None); + __pyx_cur_scope->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None); + } + __pyx_L35:; + } + __pyx_L34:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1095 + * phrase_location = None + * + * if phrase_location is None: # <<<<<<<<<<<<<< + * node.children[word_id] = None + * # Search failed + */ + __pyx_t_14 = (((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location) == Py_None); + __pyx_t_9 = (__pyx_t_14 != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1096 + * + * if phrase_location is None: + * node.children[word_id] = None # <<<<<<<<<<<<<< + * # Search failed + * continue + */ + __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 = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (PyObject_SetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_word_id, Py_None) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1098 + * node.children[word_id] = None + * # Search failed + * continue # <<<<<<<<<<<<<< + * # Search succeeded + * suffix_link = self.rules.root + */ + goto __pyx_L19_continue; + goto __pyx_L36; + } + __pyx_L36:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1100 + * 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_10 = __pyx_cur_scope->__pyx_v_self->rules->root; + __Pyx_INCREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_suffix_link); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_suffix_link); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_v_suffix_link = __pyx_t_10; + __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1101 + * # 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_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = (__pyx_t_10 != Py_None); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_14 = (__pyx_t_9 != 0); + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1102 + * 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_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_word_id); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_suffix_link); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_v_suffix_link = __pyx_t_10; + __pyx_t_10 = 0; + goto __pyx_L37; + } + __pyx_L37:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1103 + * 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 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__phrase_location), ((PyObject *)__pyx_cur_scope->__pyx_v_phrase_location)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1104 + * 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_10, ((PyObject *)__pyx_n_s__suffix_link), __pyx_cur_scope->__pyx_v_suffix_link) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1105 + * 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_10, ((PyObject *)__pyx_n_s__phrase), ((PyObject *)__pyx_cur_scope->__pyx_v_hiero_phrase)) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new_node); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_new_node); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_new_node = __pyx_t_12; + __pyx_t_12 = 0; + } + __pyx_L33:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1106 + * suffix_link=suffix_link, + * phrase=hiero_phrase) + * node.children[word_id] = new_node # <<<<<<<<<<<<<< + * node = new_node + * + */ + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (PyObject_SetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_word_id, __pyx_cur_scope->__pyx_v_new_node) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1107 + * phrase=hiero_phrase) + * node.children[word_id] = new_node + * node = new_node # <<<<<<<<<<<<<< + * + * '''Automatically add a trailing X node, if allowed -- + */ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new_node); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_node); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_node); + __pyx_cur_scope->__pyx_v_node = __pyx_cur_scope->__pyx_v_new_node; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1112 + * This should happen before we get to extraction (so that + * the node will exist if needed)''' + * if arity < self.max_nonterminals: # <<<<<<<<<<<<<< + * xcat_index = arity+1 + * xcat = sym_setindex(self.category, xcat_index) + */ + __pyx_t_14 = ((__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals) != 0); + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1113 + * 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_12 = PyInt_FromLong((__pyx_cur_scope->__pyx_v_arity + 1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xcat_index); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_xcat_index); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_xcat_index = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1114 + * if arity < self.max_nonterminals: + * xcat_index = arity+1 + * xcat = sym_setindex(self.category, xcat_index) # <<<<<<<<<<<<<< + * suffix_link_xcat_index = xcat_index + * if is_shadow_path: + */ + __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_xcat_index); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1114; __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1115 + * xcat_index = arity+1 + * xcat = sym_setindex(self.category, xcat_index) + * suffix_link_xcat_index = xcat_index # <<<<<<<<<<<<<< + * if is_shadow_path: + * suffix_link_xcat_index = xcat_index-1 + */ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_xcat_index); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xcat_index); + __pyx_cur_scope->__pyx_v_suffix_link_xcat_index = __pyx_cur_scope->__pyx_v_xcat_index; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1116 + * xcat = sym_setindex(self.category, xcat_index) + * 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) + */ + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1117 + * 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_12 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_xcat_index, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_suffix_link_xcat_index); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_suffix_link_xcat_index = __pyx_t_12; + __pyx_t_12 = 0; + goto __pyx_L39; + } + __pyx_L39:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1118 + * 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, + * suffix_link=node.suffix_link.children[suffix_link_xcat], + */ + __pyx_t_21 = __Pyx_PyInt_AsInt(__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 = 1118; __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1119 + * 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __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 = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase_location), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1120 + * 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 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__suffix_link); 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_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__children); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_18, __pyx_cur_scope->__pyx_v_suffix_link_xcat, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__suffix_link), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1121 + * 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_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __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 = 1121; __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 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__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 = 1121; __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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__phrase), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1119 + * 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_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__children); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_SetItemInt(__pyx_t_12, __pyx_cur_scope->__pyx_v_xcat, __pyx_t_10, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L38; + } + __pyx_L38:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1124 + * + * # sample from range + * if not is_shadow_path: # <<<<<<<<<<<<<< + * sample = self.sampler.sample(node.phrase_location) + * num_subpatterns = ( node.phrase_location).num_subpatterns + */ + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((!__pyx_t_14) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1125 + * # sample from range + * if not is_shadow_path: + * sample = self.sampler.sample(node.phrase_location) # <<<<<<<<<<<<<< + * num_subpatterns = ( node.phrase_location).num_subpatterns + * chunklen = IntList(initial_len=num_subpatterns) + */ + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self->sampler), __pyx_n_s__sample); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_4cdec_2sa_3_sa_IntList))))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_sample)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_sample)); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_12); + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1126 + * if not is_shadow_path: + * sample = self.sampler.sample(node.phrase_location) + * num_subpatterns = ( node.phrase_location).num_subpatterns # <<<<<<<<<<<<<< + * chunklen = IntList(initial_len=num_subpatterns) + * for j from 0 <= j < num_subpatterns: + */ + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_node, __pyx_n_s__phrase_location); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_21 = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)__pyx_t_12)->num_subpatterns; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_cur_scope->__pyx_v_num_subpatterns = __pyx_t_21; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1127 + * sample = self.sampler.sample(node.phrase_location) + * num_subpatterns = ( 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_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_subpatterns); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__initial_len), __pyx_t_18) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_chunklen)); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_chunklen = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_18); + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1128 + * num_subpatterns = ( 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) + * extracts = [] + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1129 + * chunklen = IntList(initial_len=num_subpatterns) + * for j from 0 <= j < num_subpatterns: + * chunklen.arr[j] = hiero_phrase.chunklen(j) # <<<<<<<<<<<<<< + * extracts = [] + * j = 0 + */ + (__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); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1130 + * 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 = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); + __pyx_cur_scope->__pyx_v_extracts = ((PyObject*)__pyx_t_18); + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1131 + * chunklen.arr[j] = hiero_phrase.chunklen(j) + * extracts = [] + * j = 0 # <<<<<<<<<<<<<< + * extract_start = monitor_cpu() + * while j < sample.len: + */ + __pyx_cur_scope->__pyx_v_j = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1132 + * 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 = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_12 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_start); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract_start); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_extract_start = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1133 + * j = 0 + * extract_start = monitor_cpu() + * while j < sample.len: # <<<<<<<<<<<<<< + * extract = [] + * + */ + while (1) { + __pyx_t_9 = ((__pyx_cur_scope->__pyx_v_j < __pyx_cur_scope->__pyx_v_sample->len) != 0); + if (!__pyx_t_9) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1134 + * extract_start = monitor_cpu() + * while j < sample.len: + * extract = [] # <<<<<<<<<<<<<< + * + * assign_matching(&matching, sample.arr, j, num_subpatterns, self.fda.sent_id.arr) + */ + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract); + __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); + __pyx_cur_scope->__pyx_v_extract = ((PyObject *)__pyx_t_12); + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1136 + * extract = [] + * + * 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) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1137 + * + * 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_12 = __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_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_loc); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_loc); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_loc = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1138 + * 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_12 = ((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_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_extract); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_extract); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_extract = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1139 + * 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_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_extracts), __pyx_n_s__extend); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_extract) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_extract)) { + __pyx_t_10 = __pyx_cur_scope->__pyx_v_extract; __Pyx_INCREF(__pyx_t_10); __pyx_t_6 = 0; + __pyx_t_22 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_extract); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_22 = Py_TYPE(__pyx_t_10)->tp_iternext; + } + for (;;) { + if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_10)) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_10)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_17 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_17); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_17 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_10)) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_10)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_17); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_17 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_17 = __pyx_t_22(__pyx_t_10); + if (unlikely(!__pyx_t_17)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_17); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_cur_scope->__pyx_v_e = __pyx_t_17; + __pyx_t_17 = 0; + __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e); + PyTuple_SET_ITEM(__pyx_t_17, 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_17, 1, __pyx_cur_scope->__pyx_v_loc); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_loc); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_18, (PyObject*)__pyx_t_17))) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); + __pyx_t_18 = 0; + __pyx_t_18 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1140 + * extract = self.extract(hiero_phrase, &matching, chunklen.arr, num_subpatterns) + * extracts.extend([(e, loc) for e in extract]) + * j = j + num_subpatterns # <<<<<<<<<<<<<< + * + * num_samples = sample.len/num_subpatterns + */ + __pyx_cur_scope->__pyx_v_j = (__pyx_cur_scope->__pyx_v_j + __pyx_cur_scope->__pyx_v_num_subpatterns); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1142 + * j = j + num_subpatterns + * + * num_samples = sample.len/num_subpatterns # <<<<<<<<<<<<<< + * extract_stop = monitor_cpu() + * self.extract_time = self.extract_time + extract_stop - extract_start + */ + if (unlikely(__pyx_cur_scope->__pyx_v_num_subpatterns == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_cur_scope->__pyx_v_num_subpatterns == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_cur_scope->__pyx_v_sample->len))) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_cur_scope->__pyx_v_num_samples = __Pyx_div_int(__pyx_cur_scope->__pyx_v_sample->len, __pyx_cur_scope->__pyx_v_num_subpatterns); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1143 + * + * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_extract_stop); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_extract_stop); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_v_extract_stop = __pyx_t_10; + __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1144 + * 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_10 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __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_extract_stop); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyNumber_Subtract(__pyx_t_18, __pyx_cur_scope->__pyx_v_extract_start); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_10); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_cur_scope->__pyx_v_self->extract_time = __pyx_t_4; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1145 + * 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(((PyObject *)__pyx_cur_scope->__pyx_v_extracts)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((__pyx_t_6 > 0) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1146 + * 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_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__Counter); 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 = PyObject_Call(__pyx_t_10, ((PyObject *)__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_XGOTREF(__pyx_cur_scope->__pyx_v_fcount); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_fcount); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_fcount = __pyx_t_18; + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1147 + * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__defaultdict); 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 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_lambda4, 0, __pyx_n_s_128, NULL, __pyx_n_s_102, NULL); 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_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_12), NULL); 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_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_fphrases); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_fphrases); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_v_fphrases = __pyx_t_10; + __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1148 + * 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_10 = ((PyObject *)__pyx_cur_scope->__pyx_v_extracts); __Pyx_INCREF(__pyx_t_10); __pyx_t_6 = 0; + for (;;) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_10)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_12); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_12 = PySequence_ITEM(__pyx_t_10, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_18 = PyList_GET_ITEM(sequence, 0); + __pyx_t_17 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(__pyx_t_17); + #else + __pyx_t_18 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + #endif + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_1 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_20 = Py_TYPE(__pyx_t_1)->tp_iternext; + index = 0; __pyx_t_18 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_18)) goto __pyx_L50_unpacking_failed; + __Pyx_GOTREF(__pyx_t_18); + index = 1; __pyx_t_17 = __pyx_t_20(__pyx_t_1); if (unlikely(!__pyx_t_17)) goto __pyx_L50_unpacking_failed; + __Pyx_GOTREF(__pyx_t_17); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = NULL; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L51_unpacking_done; + __pyx_L50_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 = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L51_unpacking_done:; + } + if ((likely(PyTuple_CheckExact(__pyx_t_18))) || (PyList_CheckExact(__pyx_t_18))) { + PyObject* sequence = __pyx_t_18; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 4)) { + if (size > 4) __Pyx_RaiseTooManyValuesError(4); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); + } else { + __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_t_8 = PyList_GET_ITEM(sequence, 3); + } + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(__pyx_t_8); + #else + Py_ssize_t i; + PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_11,&__pyx_t_8}; + for (i=0; i < 4; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(item); + *(temps[i]) = item; + } + #endif + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + { + Py_ssize_t index = -1; + PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_11,&__pyx_t_8}; + __pyx_t_16 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_20 = Py_TYPE(__pyx_t_16)->tp_iternext; + for (index=0; index < 4; index++) { + PyObject* item = __pyx_t_20(__pyx_t_16); if (unlikely(!item)) goto __pyx_L52_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_16), 4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = NULL; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + goto __pyx_L53_unpacking_done; + __pyx_L52_unpacking_failed:; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_20 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L53_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_f = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_e = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_count); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_cur_scope->__pyx_v_count = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_als); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_als); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_v_als = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_loc); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_loc); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_cur_scope->__pyx_v_loc = __pyx_t_17; + __pyx_t_17 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1149 + * fphrases = defaultdict(lambda: defaultdict(lambda: defaultdict(list))) + * for (f, e, count, als), loc in extracts: + * fcount[f] += count # <<<<<<<<<<<<<< + * fphrases[f][e][als].append(loc) + * for f, elist in fphrases.iteritems(): + */ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); + __pyx_t_12 = __pyx_cur_scope->__pyx_v_f; + __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_12); if (!__pyx_t_17) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_17, __pyx_cur_scope->__pyx_v_count); 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_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (PyObject_SetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_t_12, __pyx_t_18) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1150 + * 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_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fphrases, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_18 = PyObject_GetItem(__pyx_t_12, __pyx_cur_scope->__pyx_v_e); if (!__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_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_GetItem(__pyx_t_18, __pyx_cur_scope->__pyx_v_als); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_cur_scope->__pyx_v_loc); 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_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1151 + * 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; + 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 = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_18 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_fphrases, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_23), (&__pyx_t_21)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_10); + __pyx_t_10 = __pyx_t_18; + __pyx_t_18 = 0; + while (1) { + __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_10, __pyx_t_23, &__pyx_t_6, &__pyx_t_18, &__pyx_t_12, NULL, __pyx_t_21); + if (unlikely(__pyx_t_7 == 0)) break; + if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_f = __pyx_t_18; + __pyx_t_18 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elist); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_elist); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_elist = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1152 + * 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])) + * locs = tuple(itertools.chain.from_iterable(alslist.itervalues())) + */ + __pyx_t_24 = 0; + if (unlikely(__pyx_cur_scope->__pyx_v_elist == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_18 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_elist, 0, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_25), (&__pyx_t_7)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_12); + __pyx_t_12 = __pyx_t_18; + __pyx_t_18 = 0; + while (1) { + __pyx_t_5 = __Pyx_dict_iter_next(__pyx_t_12, __pyx_t_25, &__pyx_t_24, &__pyx_t_18, &__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 = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GOTREF(__pyx_t_17); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_e = __pyx_t_18; + __pyx_t_18 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alslist); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alslist); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_cur_scope->__pyx_v_alslist = __pyx_t_17; + __pyx_t_17 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1153 + * 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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __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 = 1153; __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 = 0; + __pyx_t_18 = PyDict_New(); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_1lambda6, 0, __pyx_n_s_128, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_18, ((PyObject *)__pyx_n_s__key), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_17), ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) { + PyObject* sequence = __pyx_t_8; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_18 = PyList_GET_ITEM(sequence, 0); + __pyx_t_17 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(__pyx_t_17); + #else + __pyx_t_18 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + #endif + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_11 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_20 = Py_TYPE(__pyx_t_11)->tp_iternext; + index = 0; __pyx_t_18 = __pyx_t_20(__pyx_t_11); if (unlikely(!__pyx_t_18)) goto __pyx_L58_unpacking_failed; + __Pyx_GOTREF(__pyx_t_18); + index = 1; __pyx_t_17 = __pyx_t_20(__pyx_t_11); if (unlikely(!__pyx_t_17)) goto __pyx_L58_unpacking_failed; + __Pyx_GOTREF(__pyx_t_17); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = NULL; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L59_unpacking_done; + __pyx_L58_unpacking_failed:; + __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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L59_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alignment); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_alignment = __pyx_t_18; + __pyx_t_18 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_max_locs); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_max_locs); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_cur_scope->__pyx_v_max_locs = __pyx_t_17; + __pyx_t_17 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1154 + * 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) + * scores = self.scorer.score(FeatureContext( + */ + __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__itertools); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__chain); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s__from_iterable); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __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 = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __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 = 1154; __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 = 0; + __pyx_t_18 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__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 = 1154; __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 = 0; + __pyx_t_18 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_locs = ((PyObject*)__pyx_t_18); + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1155 + * alignment, max_locs = max(alslist.iteritems(), key=lambda x: len(x[1])) + * locs = tuple(itertools.chain.from_iterable(alslist.itervalues())) + * count = len(locs) # <<<<<<<<<<<<<< + * scores = self.scorer.score(FeatureContext( + * f, e, count, fcount[f], num_samples, + */ + __pyx_t_26 = PyTuple_GET_SIZE(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); if (unlikely(__pyx_t_26 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_26); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_count); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_count); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_count = __pyx_t_18; + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1156 + * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__FeatureContext); 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1157 + * count = len(locs) + * scores = self.scorer.score(FeatureContext( + * f, e, count, fcount[f], num_samples, # <<<<<<<<<<<<<< + * (k,i+spanlen), locs, input_match, + * fwords, self.fda, self.eda, + */ + __pyx_t_17 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fcount, __pyx_cur_scope->__pyx_v_f); if (!__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_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_num_samples); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1158 + * 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_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); 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_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __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 = 1158; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1162 + * meta, + * # Include online stats. None if none. + * self.online_ctx_lookup(f, e, ctx_name))) # <<<<<<<<<<<<<< + * # Phrase pair processed + * if self.online: + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__online_ctx_lookup); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1162; __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_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_11, 1, __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_11, 2, __pyx_cur_scope->__pyx_v_ctx_name); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ctx_name); + __pyx_t_16 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __pyx_t_11 = PyTuple_New(13); 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_INCREF(__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_11, 1, __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_11, 2, __pyx_cur_scope->__pyx_v_count); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_count); + PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_11, 5, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); + PyTuple_SET_ITEM(__pyx_t_11, 6, ((PyObject *)__pyx_cur_scope->__pyx_v_locs)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_locs)); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_input_match); + PyTuple_SET_ITEM(__pyx_t_11, 7, __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_11, 8, __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_11, 9, ((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_11, 10, ((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_11, 11, __pyx_cur_scope->__pyx_v_meta); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_meta); + PyTuple_SET_ITEM(__pyx_t_11, 12, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_16); + __pyx_t_17 = 0; + __pyx_t_8 = 0; + __pyx_t_3 = 0; + __pyx_t_16 = 0; + __pyx_t_16 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __pyx_t_11 = ((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_16)); 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_16); __pyx_t_16 = 0; + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1164 + * self.online_ctx_lookup(f, e, ctx_name))) + * # Phrase pair processed + * if self.online: # <<<<<<<<<<<<<< + * seen_phrases.add((f, e)) + * yield Rule(self.category, f, e, scores, alignment) + */ + __pyx_t_9 = (__pyx_cur_scope->__pyx_v_self->online != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1165 + * # Phrase pair processed + * if self.online: + * seen_phrases.add((f, e)) # <<<<<<<<<<<<<< + * yield Rule(self.category, f, e, scores, alignment) + * + */ + __pyx_t_11 = PyTuple_New(2); 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_INCREF(__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_11, 1, __pyx_cur_scope->__pyx_v_e); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); + __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, ((PyObject *)__pyx_t_11)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + goto __pyx_L60; + } + __pyx_L60:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1166 + * 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_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_16 = PyTuple_New(5); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_16, 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_16, 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_16, 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_16, 4, __pyx_cur_scope->__pyx_v_alignment); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignment); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)), ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; + __pyx_r = __pyx_t_11; + __pyx_t_11 = 0; + __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_6; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_7; + __Pyx_XGIVEREF(__pyx_t_10); + __pyx_cur_scope->__pyx_t_3 = __pyx_t_10; + __Pyx_XGIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_t_4 = __pyx_t_12; + __Pyx_XGIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_t_5 = __pyx_t_15; + __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; + __pyx_cur_scope->__pyx_t_9 = __pyx_t_25; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __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_7 = __pyx_cur_scope->__pyx_t_2; + __pyx_t_10 = __pyx_cur_scope->__pyx_t_3; + __pyx_cur_scope->__pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_t_10); + __pyx_t_12 = __pyx_cur_scope->__pyx_t_4; + __pyx_cur_scope->__pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_t_12); + __pyx_t_15 = __pyx_cur_scope->__pyx_t_5; + __pyx_cur_scope->__pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_t_15); + __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 = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L47; + } + __pyx_L47:; + goto __pyx_L40; + } + __pyx_L40:; + goto __pyx_L32; + } + __pyx_L32:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1168 + * 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: # <<<<<<<<<<<<<< + * 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)) + */ + __pyx_t_23 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __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_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __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_cur_scope->__pyx_v_fwords; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_23 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_23); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_14) { + __pyx_t_11 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, __pyx_t_10, Py_LE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __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_27 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_27 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_28 = __pyx_t_27; + } else { + __pyx_t_28 = __pyx_t_14; + } + __pyx_t_14 = __pyx_t_28; + } else { + __pyx_t_14 = __pyx_t_9; + } + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1169 + * + * 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_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = PyNumber_Add(__pyx_t_12, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_fwords, __pyx_t_10); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_23 = PyObject_Length(__pyx_t_12); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1170 + * 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_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyNumber_Add(__pyx_t_10, __pyx_cur_scope->__pyx_v_spanlen); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt_id); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_16 = PyNumber_Add(__pyx_cur_scope->__pyx_v_pathlen, __pyx_int_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_18 = PyTuple_New(8); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_input_match); + PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_cur_scope->__pyx_v_input_match); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_input_match); + PyTuple_SET_ITEM(__pyx_t_18, 3, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_18, 4, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_16); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_node); + PyTuple_SET_ITEM(__pyx_t_18, 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_18, 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_18, 7, __pyx_cur_scope->__pyx_v_is_shadow_path); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path); + __pyx_t_12 = 0; + __pyx_t_11 = 0; + __pyx_t_10 = 0; + __pyx_t_16 = 0; + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_18)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1171 + * 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: + * num_subpatterns = num_subpatterns + 1 + */ + __pyx_cur_scope->__pyx_v_num_subpatterns = __pyx_cur_scope->__pyx_v_arity; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1172 + * 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_14 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_is_shadow_path); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((!__pyx_t_14) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1173 + * 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: + * 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; + } + __pyx_L65:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1174 + * 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: # <<<<<<<<<<<<<< + * xcat = sym_setindex(self.category, arity+1) + * xnode = node.children[xcat] + */ + __pyx_t_23 = PyObject_Length(__pyx_cur_scope->__pyx_v_phrase); if (unlikely(__pyx_t_23 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1174; __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_14 = ((__pyx_cur_scope->__pyx_v_arity < __pyx_cur_scope->__pyx_v_self->max_nonterminals) != 0); + if (__pyx_t_14) { + __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_14; + } + __pyx_t_14 = __pyx_t_27; + } else { + __pyx_t_14 = __pyx_t_9; + } + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1175 + * 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) # <<<<<<<<<<<<<< + * xnode = node.children[xcat] + * # I put spanlen=1 below + */ + __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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1176 + * 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_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 = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_16 = __Pyx_GetItemInt(__pyx_t_18, __pyx_cur_scope->__pyx_v_xcat, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_16) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_xnode); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_xnode); + __Pyx_GIVEREF(__pyx_t_16); + __pyx_cur_scope->__pyx_v_xnode = __pyx_t_16; + __pyx_t_16 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1178 + * 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_16 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_10 = PyList_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_16); + PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + __Pyx_INCREF(__pyx_int_1); + PyList_SET_ITEM(__pyx_t_10, 2, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); + PyList_SET_ITEM(__pyx_t_10, 3, __pyx_cur_scope->__pyx_v_pathlen); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pathlen); + __pyx_t_16 = 0; + __pyx_t_18 = 0; + __pyx_t_18 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_10))); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_key)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_key)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); + __pyx_cur_scope->__pyx_v_key = ((PyObject*)__pyx_t_18); + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1179 + * # 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_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); + __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); + __pyx_cur_scope->__pyx_v_frontier_nodes = ((PyObject *)__pyx_t_18); + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1180 + * 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] + * else: + */ + __pyx_t_14 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_cur_scope->__pyx_v_key), ((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), Py_EQ)); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = (__pyx_t_14 != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1181 + * 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_18 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key)); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_18; + __pyx_t_18 = 0; + goto __pyx_L67; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1183 + * 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_18 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_129); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->min_gap_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_16 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_11 = PyTuple_New(7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __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_16); + __Pyx_GIVEREF(__pyx_t_16); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); + PyTuple_SET_ITEM(__pyx_t_11, 3, __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_11, 4, __pyx_cur_scope->__pyx_v_fwords); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_fwords); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_next_states)); + PyTuple_SET_ITEM(__pyx_t_11, 5, ((PyObject *)__pyx_cur_scope->__pyx_v_next_states)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_next_states)); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); + PyTuple_SET_ITEM(__pyx_t_11, 6, ((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_reachable_buffer)); + __pyx_t_10 = 0; + __pyx_t_16 = 0; + __pyx_t_16 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_frontier_nodes); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_frontier_nodes); + __Pyx_GIVEREF(__pyx_t_16); + __pyx_cur_scope->__pyx_v_frontier_nodes = __pyx_t_16; + __pyx_t_16 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1184 + * 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 # <<<<<<<<<<<<<< + * + * for i, alt, pathlen in frontier_nodes: + */ + if (PyDict_SetItem(((PyObject *)__pyx_cur_scope->__pyx_v_nodes_isteps_away_buffer), ((PyObject *)__pyx_cur_scope->__pyx_v_key), __pyx_cur_scope->__pyx_v_frontier_nodes) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L67:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1186 + * 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_16 = __pyx_cur_scope->__pyx_v_frontier_nodes; __Pyx_INCREF(__pyx_t_16); __pyx_t_23 = 0; + __pyx_t_22 = NULL; + } else { + __pyx_t_23 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_frontier_nodes); 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_22 = Py_TYPE(__pyx_t_16)->tp_iternext; + } + for (;;) { + if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_16)) { + if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_16)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_11 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_23); __Pyx_INCREF(__pyx_t_11); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_11 = PySequence_ITEM(__pyx_t_16, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_16)) { + if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_16)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_23); __Pyx_INCREF(__pyx_t_11); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_11 = PySequence_ITEM(__pyx_t_16, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_11 = __pyx_t_22(__pyx_t_16); + if (unlikely(!__pyx_t_11)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_11); + } + if ((likely(PyTuple_CheckExact(__pyx_t_11))) || (PyList_CheckExact(__pyx_t_11))) { + PyObject* sequence = __pyx_t_11; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_18 = PyList_GET_ITEM(sequence, 0); + __pyx_t_10 = PyList_GET_ITEM(sequence, 1); + __pyx_t_12 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_12); + #else + __pyx_t_18 = PySequence_ITEM(sequence, 0); 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_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + #endif + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(__pyx_t_11); 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); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_20 = Py_TYPE(__pyx_t_3)->tp_iternext; + index = 0; __pyx_t_18 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_18)) goto __pyx_L70_unpacking_failed; + __Pyx_GOTREF(__pyx_t_18); + index = 1; __pyx_t_10 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_10)) goto __pyx_L70_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + index = 2; __pyx_t_12 = __pyx_t_20(__pyx_t_3); if (unlikely(!__pyx_t_12)) goto __pyx_L70_unpacking_failed; + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = NULL; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L71_unpacking_done; + __pyx_L70_unpacking_failed:; + __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 = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L71_unpacking_done:; + } + __pyx_t_21 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_cur_scope->__pyx_v_i = __pyx_t_21; + __pyx_cur_scope->__pyx_v_alt = __pyx_t_7; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_pathlen); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_pathlen); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_v_pathlen = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1187 + * + * 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_11 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_k); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __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 = 1187; __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 = PyNumber_Add(__pyx_cur_scope->__pyx_v_input_match, ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __pyx_t_18 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_3 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_xcat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_phrase, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pathlen); + PyTuple_SET_ITEM(__pyx_t_8, 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_8, 5, __pyx_cur_scope->__pyx_v_xnode); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_xnode); + PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_is_shadow_path); + PyTuple_SET_ITEM(__pyx_t_8, 7, __pyx_cur_scope->__pyx_v_is_shadow_path); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_is_shadow_path); + __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_t_10 = 0; + __pyx_t_18 = 0; + __pyx_t_3 = 0; + __pyx_t_13 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_new_frontier, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + goto __pyx_L66; + } + __pyx_L66:; + goto __pyx_L62; + } + __pyx_L62:; + __pyx_L19_continue:; + } + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1188 + * 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 # <<<<<<<<<<<<<< + * + * # Online rule extraction and scoring + */ + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); + __Pyx_GOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_frontier)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_new_frontier)); + __pyx_cur_scope->__pyx_v_frontier = __pyx_cur_scope->__pyx_v_new_frontier; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1191 + * + * # Online rule extraction and scoring + * if self.online: # <<<<<<<<<<<<<< + * stats = self.online_stats[ctx_name] + * f_syms = tuple(word[0][0] for word in fwords) + */ + __pyx_t_9 = (__pyx_cur_scope->__pyx_v_self->online != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1192 + * # 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_15 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_self->online_stats, __pyx_cur_scope->__pyx_v_ctx_name); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_v_stats = __pyx_t_15; + __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1193 + * 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_15 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_5input_2genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; + __Pyx_GIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_v_f_syms = ((PyObject*)__pyx_t_15); + __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1194 + * 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_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__get_f_phrases); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_syms)); + PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_f_syms)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_f_syms)); + __pyx_t_8 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; + if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) { + __pyx_t_16 = __pyx_t_8; __Pyx_INCREF(__pyx_t_16); __pyx_t_2 = 0; + __pyx_t_22 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_22 = Py_TYPE(__pyx_t_16)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + for (;;) { + if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_16)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_16)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_16, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_16)) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_16)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_2); __Pyx_INCREF(__pyx_t_8); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_16, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_8 = __pyx_t_22(__pyx_t_16); + if (unlikely(!__pyx_t_8)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) { + PyObject* sequence = __pyx_t_8; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __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_3 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_15 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 1); + __pyx_t_18 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_18); + #else + __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + #endif + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_20 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_15 = __pyx_t_20(__pyx_t_10); if (unlikely(!__pyx_t_15)) goto __pyx_L75_unpacking_failed; + __Pyx_GOTREF(__pyx_t_15); + index = 1; __pyx_t_3 = __pyx_t_20(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L75_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 2; __pyx_t_18 = __pyx_t_20(__pyx_t_10); if (unlikely(!__pyx_t_18)) goto __pyx_L75_unpacking_failed; + __Pyx_GOTREF(__pyx_t_18); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L76_unpacking_done; + __pyx_L75_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_20 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L76_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_f); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_f); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_v_f = __pyx_t_15; + __pyx_t_15 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_lex_i); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_lex_i); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_lex_i = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_lex_j); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_lex_j); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_lex_j = __pyx_t_18; + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1195 + * 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_8 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_lex_j, __pyx_cur_scope->__pyx_v_lex_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_18 = PyNumber_Add(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_spanlen); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_spanlen); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_18; + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1196 + * 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 + * if not sym_isvar(f[1]): + */ + __pyx_t_18 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_f, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_7) != 0)) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1197 + * spanlen = (lex_j - lex_i) + 1 + * if not sym_isvar(f[0]): + * spanlen += 1 # <<<<<<<<<<<<<< + * if not sym_isvar(f[1]): + * spanlen += 1 + */ + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_spanlen, __pyx_int_1); 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_GOTREF(__pyx_cur_scope->__pyx_v_spanlen); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_spanlen); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_18; + __pyx_t_18 = 0; + goto __pyx_L77; + } + __pyx_L77:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1198 + * if not sym_isvar(f[0]): + * spanlen += 1 + * if not sym_isvar(f[1]): # <<<<<<<<<<<<<< + * spanlen += 1 + * for e in stats.phrases_fe.get(f, ()): + */ + __pyx_t_18 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_f, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_18) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_18); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_9 = ((!(__pyx_f_4cdec_2sa_3_sa_sym_isvar(__pyx_t_7) != 0)) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1199 + * spanlen += 1 + * if not sym_isvar(f[1]): + * spanlen += 1 # <<<<<<<<<<<<<< + * for e in stats.phrases_fe.get(f, ()): + * if (f, e) not in seen_phrases: + */ + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_spanlen, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_spanlen); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_spanlen); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_spanlen = __pyx_t_18; + __pyx_t_18 = 0; + goto __pyx_L78; + } + __pyx_L78:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1200 + * 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_18 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_stats, __pyx_n_s__phrases_fe); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__get); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_cur_scope->__pyx_v_f); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f); + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_18, 1, ((PyObject *)__pyx_empty_tuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); + __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_18 = __pyx_t_3; __Pyx_INCREF(__pyx_t_18); __pyx_t_23 = 0; + __pyx_t_29 = NULL; + } else { + __pyx_t_23 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_29 = Py_TYPE(__pyx_t_18)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (!__pyx_t_29 && PyList_CheckExact(__pyx_t_18)) { + if (__pyx_t_23 >= PyList_GET_SIZE(__pyx_t_18)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_18, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_29 && PyTuple_CheckExact(__pyx_t_18)) { + if (__pyx_t_23 >= PyTuple_GET_SIZE(__pyx_t_18)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_23); __Pyx_INCREF(__pyx_t_3); __pyx_t_23++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_18, __pyx_t_23); __pyx_t_23++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_3 = __pyx_t_29(__pyx_t_18); + if (unlikely(!__pyx_t_3)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_e = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1201 + * 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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_3, 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); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); + __pyx_t_9 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_cur_scope->__pyx_v_seen_phrases), Py_NE)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_14 = (__pyx_t_9 != 0); + if (__pyx_t_14) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1203 + * 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_3 = PyTuple_New(2); 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_INCREF(__pyx_cur_scope->__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_3, 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); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); + __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_seen_phrases, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1204 + * # 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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__FeatureContext); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1209 + * fwords, self.fda, self.eda, + * 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(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__online_ctx_lookup); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __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_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_15, 1, __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_15, 2, __pyx_cur_scope->__pyx_v_ctx_name); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ctx_name); + __pyx_t_10 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_15 = PyTuple_New(13); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __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_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_15, 1, __pyx_cur_scope->__pyx_v_e); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_spanlen); + PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_cur_scope->__pyx_v_spanlen); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_spanlen); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_15, 6, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_15, 7, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_fwords); + PyTuple_SET_ITEM(__pyx_t_15, 8, __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_15, 9, ((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_15, 10, ((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_15, 11, __pyx_cur_scope->__pyx_v_meta); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_meta); + PyTuple_SET_ITEM(__pyx_t_15, 12, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __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_10)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); + __Pyx_XDECREF(((PyObject *)__pyx_cur_scope->__pyx_v_scores)); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_15); + __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1210 + * 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_15 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_stats, __pyx_n_s__phrases_al); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_10 = PyObject_GetItem(__pyx_t_15, __pyx_cur_scope->__pyx_v_f); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyObject_GetItem(__pyx_t_10, __pyx_cur_scope->__pyx_v_e); if (!__pyx_t_15) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_alignment); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alignment); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_cur_scope->__pyx_v_alignment = __pyx_t_15; + __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1211 + * 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_15 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->category); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_10 = PyTuple_New(5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_10, 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_10, 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_10, 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_10, 4, __pyx_cur_scope->__pyx_v_alignment); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alignment); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Rule)), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_r = __pyx_t_15; + __pyx_t_15 = 0; + __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_t_16); + __pyx_cur_scope->__pyx_t_3 = __pyx_t_16; + __Pyx_XGIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_t_4 = __pyx_t_18; + __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_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_16 = __pyx_cur_scope->__pyx_t_3; + __pyx_cur_scope->__pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_t_16); + __pyx_t_18 = __pyx_cur_scope->__pyx_t_4; + __pyx_cur_scope->__pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_t_18); + __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; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L81; + } + __pyx_L81:; + } + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + goto __pyx_L72; + } + __pyx_L72:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1213 + * 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_16 = __Pyx_GetModuleGlobalName(__pyx_n_s__monitor_cpu); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_18 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_GIVEREF(__pyx_t_18); + __pyx_cur_scope->__pyx_v_stop_time = __pyx_t_18; + __pyx_t_18 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1214 + * + * 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_18 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); 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); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s__info); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_start_time); 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); + __pyx_t_15 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_stop_time, __pyx_t_18); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyTuple_New(2); 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); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_130)); + PyTuple_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_kp_s_130)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_130)); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1215 + * 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_15 = __Pyx_GetModuleGlobalName(__pyx_n_s__gc); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s__collect); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1215; __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_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1216 + * 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_15 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s__info); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->extract_time); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_16); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_131)); + PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_kp_s_131)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_131)); + PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1217 + * gc.collect() + * logger.info(" Extract time = %f seconds", self.extract_time) + * logger.info(" Intersect time = %f seconds", self.intersect_time) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s__info); 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); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_self->intersect_time); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_132)); + PyTuple_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_kp_s_132)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_132)); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_16, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_AddTraceback("input", __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; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1220 + * + * + * cdef int find_fixpoint(self, # <<<<<<<<<<<<<< + * int f_low, f_high, + * int* f_links_low, int* f_links_high, + */ + +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) { + int __pyx_v_e_low_prev; + int __pyx_v_e_high_prev; + int __pyx_v_f_low_prev; + int __pyx_v_f_high_prev; + int __pyx_v_new_x; + int __pyx_v_new_low_x; + int __pyx_v_new_high_x; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + 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("find_fixpoint", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1235 + * 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 # <<<<<<<<<<<<<< + * e_high[0] = e_in_high + * self.find_projection(f_low, f_high, f_links_low, f_links_high, e_low, e_high) + */ + (__pyx_v_e_low[0]) = __pyx_v_e_in_low; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1236 + * + * 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) + * if e_low[0] == -1: + */ + (__pyx_v_e_high[0]) = __pyx_v_e_in_high; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1237 + * 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) # <<<<<<<<<<<<<< + * if e_low[0] == -1: + * # low-priority corner case: if phrase w is unaligned, + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, __pyx_v_f_low, __pyx_t_1, __pyx_v_f_links_low, __pyx_v_f_links_high, __pyx_v_e_low, __pyx_v_e_high); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1238 + * 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: # <<<<<<<<<<<<<< + * # low-priority corner case: if phrase w is unaligned, + * # but we don't require aligned terminals, then returning + */ + __pyx_t_3 = (((__pyx_v_e_low[0]) == -1) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1244 + * # rule X -> X_1 w X_2 / X_1 X_2. This is probably + * # 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: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1245 + * # 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; + } else { + __pyx_t_5 = __pyx_t_3; + } + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1246 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1247 + * 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: + * return 0 + */ + (__pyx_v_e_low[0]) = (__pyx_v_e_in_low - __pyx_v_min_ex_size); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1248 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1249 + * e_low[0] = e_in_low - min_ex_size + * if e_low[0] < 0: + * return 0 # <<<<<<<<<<<<<< + * + * if e_high[0] - e_low[0] > max_e_len: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + goto __pyx_L4; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1251 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1252 + * + * 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: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L6; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1253 + * 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; + } else { + __pyx_t_4 = __pyx_t_5; + } + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1254 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1255 + * 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: + * return 0 + */ + (__pyx_v_e_high[0]) = (__pyx_v_e_in_high + __pyx_v_min_ex_size); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1256 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1257 + * e_high[0] = e_in_high + min_ex_size + * if e_high[0] > e_sent_len: + * return 0 # <<<<<<<<<<<<<< + * + * f_back_low[0] = -1 + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1259 + * return 0 + * + * f_back_low[0] = -1 # <<<<<<<<<<<<<< + * f_back_high[0] = -1 + * f_low_prev = f_low + */ + (__pyx_v_f_back_low[0]) = -1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1260 + * + * f_back_low[0] = -1 + * f_back_high[0] = -1 # <<<<<<<<<<<<<< + * f_low_prev = f_low + * f_high_prev = f_high + */ + (__pyx_v_f_back_high[0]) = -1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1261 + * f_back_low[0] = -1 + * f_back_high[0] = -1 + * f_low_prev = f_low # <<<<<<<<<<<<<< + * f_high_prev = f_high + * new_x = 0 + */ + __pyx_v_f_low_prev = __pyx_v_f_low; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1262 + * f_back_high[0] = -1 + * f_low_prev = f_low + * f_high_prev = f_high # <<<<<<<<<<<<<< + * new_x = 0 + * new_low_x = 0 + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f_high_prev = __pyx_t_1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1263 + * f_low_prev = f_low + * f_high_prev = f_high + * new_x = 0 # <<<<<<<<<<<<<< + * new_low_x = 0 + * new_high_x = 0 + */ + __pyx_v_new_x = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1264 + * f_high_prev = f_high + * new_x = 0 + * new_low_x = 0 # <<<<<<<<<<<<<< + * new_high_x = 0 + * + */ + __pyx_v_new_low_x = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1265 + * new_x = 0 + * new_low_x = 0 + * new_high_x = 0 # <<<<<<<<<<<<<< + * + * while True: + */ + __pyx_v_new_high_x = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1267 + * new_high_x = 0 + * + * while True: # <<<<<<<<<<<<<< + * + * if f_back_low[0] == -1: + */ + while (1) { + if (!1) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1269 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1270 + * + * 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: + * self.find_projection(e_low[0], e_low_prev, e_links_low, e_links_high, f_back_low, f_back_high) + */ + __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 = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L11; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1272 + * 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) # <<<<<<<<<<<<<< + * self.find_projection(e_high_prev, e_high[0], e_links_low, e_links_high, f_back_low, f_back_high) + * + */ + __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_low_prev, __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 = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1273 + * 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) # <<<<<<<<<<<<<< + * + * if f_back_low[0] > f_low: + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self->__pyx_vtab)->find_projection(__pyx_v_self, __pyx_v_e_high_prev, (__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; + } + __pyx_L11:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1275 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1276 + * + * if f_back_low[0] > f_low: + * f_back_low[0] = f_low # <<<<<<<<<<<<<< + * + * if f_back_high[0] < f_high: + */ + (__pyx_v_f_back_low[0]) = __pyx_v_f_low; + goto __pyx_L12; + } + __pyx_L12:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1278 + * f_back_low[0] = f_low + * + * if f_back_high[0] < f_high: # <<<<<<<<<<<<<< + * f_back_high[0] = f_high + * + */ + __pyx_t_2 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1278; __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 = 1278; __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 = 1278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1279 + * + * if f_back_high[0] < f_high: + * f_back_high[0] = f_high # <<<<<<<<<<<<<< + * + * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_f_high); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_f_back_high[0]) = __pyx_t_1; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1281 + * f_back_high[0] = f_high + * + * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: # <<<<<<<<<<<<<< + * return 1 + * + */ + __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; + } else { + __pyx_t_3 = __pyx_t_4; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1282 + * + * if f_back_low[0] == f_low_prev and f_back_high[0] == f_high_prev: + * return 1 # <<<<<<<<<<<<<< + * + * if allow_low_x == 0 and f_back_low[0] < f_low: + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1284 + * 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; + } else { + __pyx_t_5 = __pyx_t_3; + } + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1286 + * if allow_low_x == 0 and f_back_low[0] < f_low: + * # FAIL: f phrase is not tight + * return 0 # <<<<<<<<<<<<<< + * + * if f_back_high[0] - f_back_low[0] > max_f_len: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L15; + } + __pyx_L15:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1288 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1290 + * if f_back_high[0] - f_back_low[0] > max_f_len: + * # FAIL: f back projection is too wide + * return 0 # <<<<<<<<<<<<<< + * + * if allow_high_x == 0 and f_back_high[0] > f_high: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L16; + } + __pyx_L16:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1292 + * 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 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1292; __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 = 1292; __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 = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_5; + } + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1294 + * if allow_high_x == 0 and f_back_high[0] > f_high: + * # FAIL: extension on high side not allowed + * return 0 # <<<<<<<<<<<<<< + * + * if f_low != f_back_low[0]: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1296 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1297 + * + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1298 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1300 + * if new_x >= max_new_x: + * # FAIL: extension required on low side violates max # of gaps + * return 0 # <<<<<<<<<<<<<< + * else: + * new_x = new_x + 1 + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L20; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1302 + * return 0 + * else: + * new_x = new_x + 1 # <<<<<<<<<<<<<< + * new_low_x = 1 + * if f_low - f_back_low[0] < min_fx_size: + */ + __pyx_v_new_x = (__pyx_v_new_x + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1303 + * else: + * 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 + */ + __pyx_v_new_low_x = 1; + } + __pyx_L20:; + goto __pyx_L19; + } + __pyx_L19:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1304 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1305 + * 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: + * # FAIL: extension required on low side violates max initial length + */ + (__pyx_v_f_back_low[0]) = (__pyx_v_f_low - __pyx_v_min_fx_size); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1306 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1308 + * if f_back_high[0] - f_back_low[0] > max_f_len: + * # 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 + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L22; + } + __pyx_L22:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1309 + * # 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1311 + * if f_back_low[0] < 0: + * # FAIL: extension required on low side violates sentence boundary + * return 0 # <<<<<<<<<<<<<< + * + * if f_high != f_back_high[0]: + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L23; + } + __pyx_L23:; + goto __pyx_L21; + } + __pyx_L21:; + goto __pyx_L18; + } + __pyx_L18:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1313 + * return 0 + * + * if f_high != f_back_high[0]: # <<<<<<<<<<<<<< + * if new_high_x == 0: + * if new_x >= max_new_x: + */ + __pyx_t_2 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1313; __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 = 1313; __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 = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1314 + * + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1315 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1317 + * if new_x >= max_new_x: + * # FAIL: extension required on high side violates max # of gaps + * return 0 # <<<<<<<<<<<<<< + * else: + * new_x = new_x + 1 + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L26; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1319 + * return 0 + * else: + * new_x = new_x + 1 # <<<<<<<<<<<<<< + * new_high_x = 1 + * if f_back_high[0] - f_high < min_fx_size: + */ + __pyx_v_new_x = (__pyx_v_new_x + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1320 + * else: + * 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 + */ + __pyx_v_new_high_x = 1; + } + __pyx_L26:; + goto __pyx_L25; + } + __pyx_L25:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1321 + * 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 = PyInt_FromLong((__pyx_v_f_back_high[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1321; __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 = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyInt_FromLong(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1321; __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 = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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 = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1322 + * 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 = PyInt_FromLong(__pyx_v_min_fx_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1322; __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 = 1322; __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_AsInt(__pyx_t_6); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + (__pyx_v_f_back_high[0]) = __pyx_t_1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1323 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1325 + * if f_back_high[0] - f_back_low[0] > max_f_len: + * # 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 + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L28; + } + __pyx_L28:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1326 + * # 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1328 + * if f_back_high[0] > f_sent_len: + * # FAIL: extension required on high side violates sentence boundary + * return 0 # <<<<<<<<<<<<<< + * + * e_low_prev = e_low[0] + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L29; + } + __pyx_L29:; + goto __pyx_L27; + } + __pyx_L27:; + goto __pyx_L24; + } + __pyx_L24:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1330 + * return 0 + * + * e_low_prev = e_low[0] # <<<<<<<<<<<<<< + * e_high_prev = e_high[0] + * + */ + __pyx_v_e_low_prev = (__pyx_v_e_low[0]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1331 + * + * e_low_prev = e_low[0] + * 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) + */ + __pyx_v_e_high_prev = (__pyx_v_e_high[0]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1333 + * 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 = 1333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1334 + * + * 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 = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1335 + * 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 + * if allow_arbitrary_x == 0: + */ + __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; + } else { + __pyx_t_3 = __pyx_t_4; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1336 + * 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 # <<<<<<<<<<<<<< + * if allow_arbitrary_x == 0: + * # FAIL: arbitrary expansion not permitted + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L30; + } + __pyx_L30:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1337 + * if e_low[0] == e_low_prev and e_high[0] == e_high_prev: + * return 1 + * if allow_arbitrary_x == 0: # <<<<<<<<<<<<<< + * # FAIL: arbitrary expansion not permitted + * return 0 + */ + __pyx_t_3 = ((__pyx_v_allow_arbitrary_x == 0) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1339 + * if allow_arbitrary_x == 0: + * # FAIL: arbitrary expansion not permitted + * return 0 # <<<<<<<<<<<<<< + * if e_high[0] - e_low[0] > max_e_len: + * # FAIL: re-projection violates sentence max phrase length + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L31; + } + __pyx_L31:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1340 + * # FAIL: arbitrary expansion not permitted + * return 0 + * if e_high[0] - e_low[0] > max_e_len: # <<<<<<<<<<<<<< + * # FAIL: re-projection violates sentence max phrase length + * return 0 + */ + __pyx_t_3 = ((((__pyx_v_e_high[0]) - (__pyx_v_e_low[0])) > __pyx_v_max_e_len) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1342 + * if e_high[0] - e_low[0] > max_e_len: + * # FAIL: re-projection violates sentence max phrase length + * return 0 # <<<<<<<<<<<<<< + * f_low_prev = f_back_low[0] + * f_high_prev = f_back_high[0] + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L32; + } + __pyx_L32:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1343 + * # FAIL: re-projection violates sentence max phrase length + * return 0 + * f_low_prev = f_back_low[0] # <<<<<<<<<<<<<< + * f_high_prev = f_back_high[0] + * + */ + __pyx_v_f_low_prev = (__pyx_v_f_back_low[0]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1344 + * return 0 + * f_low_prev = f_back_low[0] + * f_high_prev = f_back_high[0] # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_f_high_prev = (__pyx_v_f_back_high[0]); + } + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_WriteUnraisable("cdec.sa._sa.HieroCachingRuleFactory.find_fixpoint", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1347 + * + * + * cdef find_projection(self, int in_low, int in_high, int* in_links_low, int* in_links_high, # <<<<<<<<<<<<<< + * int* out_low, int* out_high): + * cdef int i + */ + +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) { + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("find_projection", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1350 + * int* out_low, int* out_high): + * cdef int i + * 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]: + */ + __pyx_t_1 = __pyx_v_in_high; + for (__pyx_v_i = __pyx_v_in_low; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1351 + * cdef int i + * 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] + */ + __pyx_t_2 = (((__pyx_v_in_links_low[__pyx_v_i]) != -1) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1352 + * 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; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1353 + * 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]: + * out_high[0] = in_links_high[i] + */ + (__pyx_v_out_low[0]) = (__pyx_v_in_links_low[__pyx_v_i]); + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1354 + * 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; + } else { + __pyx_t_3 = __pyx_t_4; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1355 + * 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_v_out_high[0]) = (__pyx_v_in_links_high[__pyx_v_i]); + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L5; + } + __pyx_L5:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1358 + * + * + * 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 + */ + +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) { + int __pyx_v_new_len; + int *__pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("int_arr_extend", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1360 + * 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 # <<<<<<<<<<<<<< + * arr = realloc(arr, new_len*sizeof(int)) + * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) + */ + __pyx_v_new_len = ((__pyx_v_arr_len[0]) + __pyx_v_data_len); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1361 + * cdef int new_len + * new_len = arr_len[0] + data_len + * arr = realloc(arr, new_len*sizeof(int)) # <<<<<<<<<<<<<< + * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) + * arr_len[0] = new_len + */ + __pyx_v_arr = ((int *)realloc(__pyx_v_arr, (__pyx_v_new_len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1362 + * new_len = arr_len[0] + data_len + * arr = realloc(arr, new_len*sizeof(int)) + * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) # <<<<<<<<<<<<<< + * arr_len[0] = new_len + * return arr + */ + memcpy((__pyx_v_arr + (__pyx_v_arr_len[0])), __pyx_v_data, (__pyx_v_data_len * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1363 + * arr = realloc(arr, new_len*sizeof(int)) + * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) + * arr_len[0] = new_len # <<<<<<<<<<<<<< + * return arr + * + */ + (__pyx_v_arr_len[0]) = __pyx_v_new_len; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1364 + * memcpy(arr+arr_len[0], data, data_len*sizeof(int)) + * arr_len[0] = new_len + * return arr # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_arr; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1367 + * + * + * 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): + */ + +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) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_m; + int __pyx_v_n; + int *__pyx_v_e_gap_order; + int __pyx_v_e_x_low; + int __pyx_v_e_x_high; + int __pyx_v_e_x_gap_low; + int __pyx_v_e_x_gap_high; + int *__pyx_v_e_gaps1; + int *__pyx_v_e_gaps2; + int __pyx_v_len1; + int __pyx_v_len2; + int __pyx_v_step; + int __pyx_v_num_chunks; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_ephr_arr = 0; + PyObject *__pyx_v_result = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_indexes = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + 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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("extract_phrases", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1375 + * cdef result + * + * result = [] # <<<<<<<<<<<<<< + * len1 = 0 + * e_gaps1 = malloc(0) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1376 + * + * result = [] + * len1 = 0 # <<<<<<<<<<<<<< + * e_gaps1 = malloc(0) + * ephr_arr = IntList() + */ + __pyx_v_len1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1377 + * result = [] + * len1 = 0 + * e_gaps1 = malloc(0) # <<<<<<<<<<<<<< + * ephr_arr = IntList() + * + */ + __pyx_v_e_gaps1 = ((int *)malloc(0)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1378 + * len1 = 0 + * e_gaps1 = malloc(0) + * ephr_arr = IntList() # <<<<<<<<<<<<<< + * + * e_gap_order = malloc(num_gaps*sizeof(int)) + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1378; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1380 + * ephr_arr = IntList() + * + * e_gap_order = malloc(num_gaps*sizeof(int)) # <<<<<<<<<<<<<< + * if num_gaps > 0: + * e_gap_order[0] = 0 + */ + __pyx_v_e_gap_order = ((int *)malloc((__pyx_v_num_gaps * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1381 + * + * e_gap_order = malloc(num_gaps*sizeof(int)) + * if num_gaps > 0: # <<<<<<<<<<<<<< + * e_gap_order[0] = 0 + * for i from 1 <= i < num_gaps: + */ + __pyx_t_2 = ((__pyx_v_num_gaps > 0) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1382 + * e_gap_order = malloc(num_gaps*sizeof(int)) + * if num_gaps > 0: + * e_gap_order[0] = 0 # <<<<<<<<<<<<<< + * for i from 1 <= i < num_gaps: + * for j from 0 <= j < i: + */ + (__pyx_v_e_gap_order[0]) = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1383 + * if num_gaps > 0: + * e_gap_order[0] = 0 + * for i from 1 <= i < num_gaps: # <<<<<<<<<<<<<< + * for j from 0 <= j < i: + * if e_gap_low[i] < e_gap_low[j]: + */ + __pyx_t_3 = __pyx_v_num_gaps; + for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1384 + * e_gap_order[0] = 0 + * for i from 1 <= i < num_gaps: + * for j from 0 <= j < i: # <<<<<<<<<<<<<< + * if e_gap_low[i] < e_gap_low[j]: + * for k from j <= k < i: + */ + __pyx_t_4 = __pyx_v_i; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_4; __pyx_v_j++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1385 + * for i from 1 <= i < num_gaps: + * for j from 0 <= j < i: + * if e_gap_low[i] < e_gap_low[j]: # <<<<<<<<<<<<<< + * for k from j <= k < i: + * e_gap_order[k+1] = e_gap_order[k] + */ + __pyx_t_2 = (((__pyx_v_e_gap_low[__pyx_v_i]) < (__pyx_v_e_gap_low[__pyx_v_j])) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1386 + * for j from 0 <= j < i: + * if e_gap_low[i] < e_gap_low[j]: + * for k from j <= k < i: # <<<<<<<<<<<<<< + * e_gap_order[k+1] = e_gap_order[k] + * e_gap_order[j] = i + */ + __pyx_t_5 = __pyx_v_i; + for (__pyx_v_k = __pyx_v_j; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1387 + * if e_gap_low[i] < e_gap_low[j]: + * for k from j <= k < i: + * e_gap_order[k+1] = e_gap_order[k] # <<<<<<<<<<<<<< + * e_gap_order[j] = i + * break + */ + (__pyx_v_e_gap_order[(__pyx_v_k + 1)]) = (__pyx_v_e_gap_order[__pyx_v_k]); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1388 + * for k from j <= k < i: + * e_gap_order[k+1] = e_gap_order[k] + * e_gap_order[j] = i # <<<<<<<<<<<<<< + * break + * else: + */ + (__pyx_v_e_gap_order[__pyx_v_j]) = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1389 + * e_gap_order[k+1] = e_gap_order[k] + * e_gap_order[j] = i + * break # <<<<<<<<<<<<<< + * else: + * e_gap_order[i] = i + */ + goto __pyx_L7_break; + goto __pyx_L8; + } + __pyx_L8:; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1391 + * break + * else: + * e_gap_order[i] = i # <<<<<<<<<<<<<< + * + * e_x_low = e_low + */ + (__pyx_v_e_gap_order[__pyx_v_i]) = __pyx_v_i; + } + __pyx_L7_break:; + } + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1393 + * e_gap_order[i] = i + * + * e_x_low = e_low # <<<<<<<<<<<<<< + * e_x_high = e_high + * if not self.tight_phrases: + */ + __pyx_v_e_x_low = __pyx_v_e_low; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1394 + * + * e_x_low = e_low + * 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: + */ + __pyx_v_e_x_high = __pyx_v_e_high; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1395 + * e_x_low = e_low + * 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: + * e_x_low = e_x_low - 1 + */ + __pyx_t_2 = ((!(__pyx_v_self->tight_phrases != 0)) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1396 + * 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: # <<<<<<<<<<<<<< + * 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: + */ + 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; + } else { + __pyx_t_6 = __pyx_t_2; + } + if (!__pyx_t_6) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1397 + * 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 # <<<<<<<<<<<<<< + * 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 + */ + __pyx_v_e_x_low = (__pyx_v_e_x_low - 1); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1398 + * 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: # <<<<<<<<<<<<<< + * e_x_high = e_x_high + 1 + * + */ + 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; + } else { + __pyx_t_2 = __pyx_t_6; + } + if (!__pyx_t_2) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1399 + * 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 # <<<<<<<<<<<<<< + * + * for i from e_x_low <= i <= e_low: + */ + __pyx_v_e_x_high = (__pyx_v_e_x_high + 1); + } + goto __pyx_L11; + } + __pyx_L11:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1401 + * e_x_high = e_x_high + 1 + * + * for i from e_x_low <= i <= e_low: # <<<<<<<<<<<<<< + * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) + * + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1402 + * + * for i from e_x_low <= i <= e_low: + * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) # <<<<<<<<<<<<<< + * + * for i from 0 <= i < num_gaps: + */ + __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); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1404 + * e_gaps1 = self.int_arr_extend(e_gaps1, &len1, &i, 1) + * + * for i from 0 <= i < num_gaps: # <<<<<<<<<<<<<< + * e_gaps2 = malloc(0) + * len2 = 0 + */ + __pyx_t_3 = __pyx_v_num_gaps; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1405 + * + * for i from 0 <= i < num_gaps: + * e_gaps2 = malloc(0) # <<<<<<<<<<<<<< + * len2 = 0 + * + */ + __pyx_v_e_gaps2 = ((int *)malloc(0)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1406 + * for i from 0 <= i < num_gaps: + * e_gaps2 = malloc(0) + * len2 = 0 # <<<<<<<<<<<<<< + * + * j = e_gap_order[i] + */ + __pyx_v_len2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1408 + * len2 = 0 + * + * j = e_gap_order[i] # <<<<<<<<<<<<<< + * e_x_gap_low = e_gap_low[j] + * e_x_gap_high = e_gap_high[j] + */ + __pyx_v_j = (__pyx_v_e_gap_order[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1409 + * + * j = e_gap_order[i] + * e_x_gap_low = e_gap_low[j] # <<<<<<<<<<<<<< + * e_x_gap_high = e_gap_high[j] + * if not self.tight_phrases: + */ + __pyx_v_e_x_gap_low = (__pyx_v_e_gap_low[__pyx_v_j]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1410 + * j = e_gap_order[i] + * e_x_gap_low = e_gap_low[j] + * 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: + */ + __pyx_v_e_x_gap_high = (__pyx_v_e_gap_high[__pyx_v_j]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1411 + * e_x_gap_low = e_gap_low[j] + * 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: + * e_x_gap_low = e_x_gap_low - 1 + */ + __pyx_t_2 = ((!(__pyx_v_self->tight_phrases != 0)) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1412 + * 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: # <<<<<<<<<<<<<< + * 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: + */ + 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; + } else { + __pyx_t_7 = __pyx_t_2; + } + if (!__pyx_t_7) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1413 + * 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 # <<<<<<<<<<<<<< + * 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 + */ + __pyx_v_e_x_gap_low = (__pyx_v_e_x_gap_low - 1); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1414 + * 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: # <<<<<<<<<<<<<< + * e_x_gap_high = e_x_gap_high + 1 + * + */ + 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; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (!__pyx_t_6) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1415 + * 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 # <<<<<<<<<<<<<< + * + * k = 0 + */ + __pyx_v_e_x_gap_high = (__pyx_v_e_x_gap_high + 1); + } + goto __pyx_L20; + } + __pyx_L20:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1417 + * e_x_gap_high = e_x_gap_high + 1 + * + * k = 0 # <<<<<<<<<<<<<< + * step = 1+(i*2) + * while k < len1: + */ + __pyx_v_k = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1418 + * + * k = 0 + * step = 1+(i*2) # <<<<<<<<<<<<<< + * while k < len1: + * for m from e_x_gap_low <= m <= e_gap_low[j]: + */ + __pyx_v_step = (1 + (__pyx_v_i * 2)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1419 + * k = 0 + * step = 1+(i*2) + * while k < len1: # <<<<<<<<<<<<<< + * for m from e_x_gap_low <= m <= e_gap_low[j]: + * if m >= e_gaps1[k+step-1]: + */ + while (1) { + __pyx_t_6 = ((__pyx_v_k < __pyx_v_len1) != 0); + if (!__pyx_t_6) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1420 + * step = 1+(i*2) + * 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: + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1421 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1422 + * 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 + * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, e_gaps1+k, step) + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1423 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1424 + * 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) + * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1425 + * 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) # <<<<<<<<<<<<<< + * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) + * k = k + step + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1426 + * 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) # <<<<<<<<<<<<<< + * k = k + step + * 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; + } + __pyx_L32:; + } + goto __pyx_L29; + } + __pyx_L29:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1427 + * 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 # <<<<<<<<<<<<<< + * free(e_gaps1) + * e_gaps1 = e_gaps2 + */ + __pyx_v_k = (__pyx_v_k + __pyx_v_step); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1428 + * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &n, 1) + * k = k + step + * free(e_gaps1) # <<<<<<<<<<<<<< + * e_gaps1 = e_gaps2 + * len1 = len2 + */ + free(__pyx_v_e_gaps1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1429 + * k = k + step + * free(e_gaps1) + * e_gaps1 = e_gaps2 # <<<<<<<<<<<<<< + * len1 = len2 + * + */ + __pyx_v_e_gaps1 = __pyx_v_e_gaps2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1430 + * free(e_gaps1) + * e_gaps1 = e_gaps2 + * len1 = len2 # <<<<<<<<<<<<<< + * + * step = 1+(num_gaps*2) + */ + __pyx_v_len1 = __pyx_v_len2; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1432 + * len1 = len2 + * + * step = 1+(num_gaps*2) # <<<<<<<<<<<<<< + * e_gaps2 = malloc(0) + * len2 = 0 + */ + __pyx_v_step = (1 + (__pyx_v_num_gaps * 2)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1433 + * + * step = 1+(num_gaps*2) + * e_gaps2 = malloc(0) # <<<<<<<<<<<<<< + * len2 = 0 + * for i from e_high <= i <= e_x_high: + */ + __pyx_v_e_gaps2 = ((int *)malloc(0)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1434 + * step = 1+(num_gaps*2) + * e_gaps2 = malloc(0) + * len2 = 0 # <<<<<<<<<<<<<< + * for i from e_high <= i <= e_x_high: + * j = 0 + */ + __pyx_v_len2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1435 + * e_gaps2 = malloc(0) + * len2 = 0 + * for i from e_high <= i <= e_x_high: # <<<<<<<<<<<<<< + * j = 0 + * while j < len1: + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1436 + * len2 = 0 + * for i from e_high <= i <= e_x_high: + * j = 0 # <<<<<<<<<<<<<< + * while j < len1: + * if i - e_gaps1[j] <= self.train_max_initial_size and i >= e_gaps1[j+step-1]: + */ + __pyx_v_j = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1437 + * for i from e_high <= i <= e_x_high: + * j = 0 + * 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) + */ + while (1) { + __pyx_t_6 = ((__pyx_v_j < __pyx_v_len1) != 0); + if (!__pyx_t_6) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1438 + * j = 0 + * 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) + * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) + */ + __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; + } else { + __pyx_t_2 = __pyx_t_6; + } + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1439 + * 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) # <<<<<<<<<<<<<< + * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) + * j = j + step + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1440 + * 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) # <<<<<<<<<<<<<< + * j = j + step + * 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; + } + __pyx_L37:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1441 + * 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 # <<<<<<<<<<<<<< + * free(e_gaps1) + * e_gaps1 = e_gaps2 + */ + __pyx_v_j = (__pyx_v_j + __pyx_v_step); + } + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1442 + * e_gaps2 = self.int_arr_extend(e_gaps2, &len2, &i, 1) + * j = j + step + * free(e_gaps1) # <<<<<<<<<<<<<< + * e_gaps1 = e_gaps2 + * len1 = len2 + */ + free(__pyx_v_e_gaps1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1443 + * j = j + step + * free(e_gaps1) + * e_gaps1 = e_gaps2 # <<<<<<<<<<<<<< + * len1 = len2 + * + */ + __pyx_v_e_gaps1 = __pyx_v_e_gaps2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1444 + * free(e_gaps1) + * e_gaps1 = e_gaps2 + * len1 = len2 # <<<<<<<<<<<<<< + * + * step = (num_gaps+1)*2 + */ + __pyx_v_len1 = __pyx_v_len2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1446 + * len1 = len2 + * + * step = (num_gaps+1)*2 # <<<<<<<<<<<<<< + * i = 0 + * + */ + __pyx_v_step = ((__pyx_v_num_gaps + 1) * 2); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1447 + * + * step = (num_gaps+1)*2 + * i = 0 # <<<<<<<<<<<<<< + * + * cdef IntList indexes + */ + __pyx_v_i = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1450 + * + * cdef IntList indexes + * while i < len1: # <<<<<<<<<<<<<< + * ephr_arr._clear() + * num_chunks = 0 + */ + while (1) { + __pyx_t_2 = ((__pyx_v_i < __pyx_v_len1) != 0); + if (!__pyx_t_2) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1451 + * cdef IntList indexes + * while i < len1: + * ephr_arr._clear() # <<<<<<<<<<<<<< + * num_chunks = 0 + * indexes = IntList() + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_clear(__pyx_v_ephr_arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1452 + * while i < len1: + * ephr_arr._clear() + * num_chunks = 0 # <<<<<<<<<<<<<< + * indexes = IntList() + * for j from 0 <= j < num_gaps+1: + */ + __pyx_v_num_chunks = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1453 + * 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 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(((PyObject *)__pyx_v_indexes)); + __pyx_v_indexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1454 + * 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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1455 + * 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 + * for k from e_gaps1[i+2*j] <= k < e_gaps1[i+(2*j)+1]: + */ + __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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1456 + * 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 # <<<<<<<<<<<<<< + * for k from e_gaps1[i+2*j] <= k < e_gaps1[i+(2*j)+1]: + * indexes.append(k) + */ + __pyx_v_num_chunks = (__pyx_v_num_chunks + 1); + goto __pyx_L42; + } + __pyx_L42:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1457 + * 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]: # <<<<<<<<<<<<<< + * indexes.append(k) + * ephr_arr._append(self.eid2symid[self.eda.data.arr[e_sent_start+k]]) + */ + __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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1458 + * 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 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1458; __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)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1459 + * 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: + * 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_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->eid2symid), __pyx_t_4, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_10) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_ephr_arr->__pyx_vtab)->_append(__pyx_v_ephr_arr, __pyx_t_4); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1460 + * indexes.append(k) + * 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)) + */ + __pyx_t_2 = ((__pyx_v_j < __pyx_v_num_gaps) != 0); + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1461 + * 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_10 = PyInt_FromLong(__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_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_indexes), __pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1461; __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_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1462 + * 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 + * 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; + } + __pyx_L45:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1463 + * 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 # <<<<<<<<<<<<<< + * if ephr_arr.len <= self.max_target_length and num_chunks <= self.max_target_chunks: + * result.append((Phrase(ephr_arr),indexes)) + */ + __pyx_v_i = (__pyx_v_i + __pyx_v_step); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1464 + * 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; + } else { + __pyx_t_7 = __pyx_t_2; + } + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1465 + * 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 = 1465; __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_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__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 = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __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_10 = 0; + __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L46; + } + __pyx_L46:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1467 + * result.append((Phrase(ephr_arr),indexes)) + * + * free(e_gaps1) # <<<<<<<<<<<<<< + * free(e_gap_order) + * return result + */ + free(__pyx_v_e_gaps1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1468 + * + * free(e_gaps1) + * free(e_gap_order) # <<<<<<<<<<<<<< + * return result + * + */ + free(__pyx_v_e_gap_order); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1469 + * free(e_gaps1) + * free(e_gap_order) + * return result # <<<<<<<<<<<<<< + * + * cdef IntList create_alignments(self, int* sent_links, int num_links, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.extract_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_ephr_arr); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF((PyObject *)__pyx_v_indexes); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1471 + * return result + * + * cdef IntList create_alignments(self, int* sent_links, int num_links, # <<<<<<<<<<<<<< + * IntList findexes, IntList eindexes): + * cdef unsigned i + */ + +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) { + unsigned int __pyx_v_i; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_ret = 0; + int __pyx_v_s; + PyObject *__pyx_v_idx = NULL; + PyObject *__pyx_v_j = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + unsigned int __pyx_t_3; + int __pyx_t_4; + 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("create_alignments", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1474 + * IntList findexes, IntList eindexes): + * cdef unsigned i + * cdef IntList ret = IntList() # <<<<<<<<<<<<<< + * for i in range(findexes.len): + * s = findexes.arr[i] + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1474; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1475 + * cdef unsigned i + * cdef IntList ret = IntList() + * for i in range(findexes.len): # <<<<<<<<<<<<<< + * s = findexes.arr[i] + * if s < 0: continue + */ + __pyx_t_2 = __pyx_v_findexes->len; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1476 + * cdef IntList ret = IntList() + * for i in range(findexes.len): + * s = findexes.arr[i] # <<<<<<<<<<<<<< + * if s < 0: continue + * idx = 0 + */ + __pyx_v_s = (__pyx_v_findexes->arr[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1477 + * for i in range(findexes.len): + * s = findexes.arr[i] + * if s < 0: continue # <<<<<<<<<<<<<< + * idx = 0 + * while idx < num_links * 2: + */ + __pyx_t_4 = ((__pyx_v_s < 0) != 0); + if (__pyx_t_4) { + goto __pyx_L3_continue; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1478 + * s = findexes.arr[i] + * if s < 0: continue + * idx = 0 # <<<<<<<<<<<<<< + * while idx < num_links * 2: + * if sent_links[idx] == s: + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_XDECREF(__pyx_v_idx); + __pyx_v_idx = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1479 + * if s < 0: continue + * idx = 0 + * while idx < num_links * 2: # <<<<<<<<<<<<<< + * if sent_links[idx] == s: + * j = eindexes.index(sent_links[idx+1]) + */ + while (1) { + __pyx_t_1 = PyInt_FromLong((__pyx_v_num_links * 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1479; __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 = 1479; __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 = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!__pyx_t_4) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1480 + * 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 = 1480; __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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1481 + * 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 = 1481; __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 = 1481; __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 = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong((__pyx_v_sent_links[__pyx_t_6])); 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_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1481; __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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1482 + * 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 = PyLong_FromUnsignedLong((__pyx_v_i * __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __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 = 1482; __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_PyObject_Append(((PyObject *)__pyx_v_ret), __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1482; __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_1); __pyx_t_1 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1483 + * j = eindexes.index(sent_links[idx+1]) + * ret.append(i * ALIGNMENT_CODE + j) + * idx += 2 # <<<<<<<<<<<<<< + * return ret + * + */ + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_idx); + __pyx_v_idx = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_L3_continue:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1484 + * ret.append(i * ALIGNMENT_CODE + j) + * idx += 2 + * return ret # <<<<<<<<<<<<<< + * + * cdef extract(self, Phrase phrase, Matching* matching, int* chunklen, int num_chunks): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_ret)); + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.create_alignments", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_ret); + __Pyx_XDECREF(__pyx_v_idx); + __Pyx_XDECREF(__pyx_v_j); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1486 + * 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 + */ + +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) { + int *__pyx_v_sent_links; + int *__pyx_v_e_links_low; + int *__pyx_v_e_links_high; + int *__pyx_v_f_links_low; + int *__pyx_v_f_links_high; + int *__pyx_v_f_gap_low; + int *__pyx_v_f_gap_high; + int *__pyx_v_e_gap_low; + int *__pyx_v_e_gap_high; + int __pyx_v_num_gaps; + int __pyx_v_gap_start; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_e_i; + int __pyx_v_f_i; + int __pyx_v_num_links; + int __pyx_v_num_aligned_chunks; + int __pyx_v_met_constraints; + int __pyx_v_x; + int __pyx_v_f_low; + int __pyx_v_f_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_e_sent_start; + int __pyx_v_e_sent_end; + int __pyx_v_f_sent_start; + int __pyx_v_f_sent_end; + int __pyx_v_e_sent_len; + int __pyx_v_f_sent_len; + CYTHON_UNUSED int __pyx_v_e_word_count; + int __pyx_v_f_x_low; + int __pyx_v_f_x_high; + int __pyx_v_e_x_low; + int __pyx_v_e_x_high; + int __pyx_v_phrase_len; + float __pyx_v_pair_count; + PyObject *__pyx_v_extracts = 0; + PyObject *__pyx_v_phrase_list = 0; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_fphr_arr = 0; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_fphr = 0; + CYTHON_UNUSED PyObject *__pyx_v_reason_for_failure = 0; + PyObject *__pyx_v_sofar = NULL; + PyObject *__pyx_v_als = NULL; + PyObject *__pyx_v_al = NULL; + long __pyx_v_gap_error; + PyObject *__pyx_v_phrase2 = NULL; + PyObject *__pyx_v_eindexes = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als1 = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als2 = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als3 = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_IntList *__pyx_v_als4 = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + long __pyx_t_12; + Py_ssize_t __pyx_t_13; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1499 + * cdef reason_for_failure + * + * fphr_arr = IntList() # <<<<<<<<<<<<<< + * phrase_len = phrase.n + * extracts = [] + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1499; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1500 + * + * fphr_arr = IntList() + * phrase_len = phrase.n # <<<<<<<<<<<<<< + * extracts = [] + * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) + */ + __pyx_t_2 = __pyx_v_phrase->n; + __pyx_v_phrase_len = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1501 + * 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 = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_extracts = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1502 + * phrase_len = phrase.n + * extracts = [] + * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) # <<<<<<<<<<<<<< + * + * e_sent_start = self.eda.sent_index.arr[matching.sent_id] + */ + __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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1504 + * sent_links = self.alignment._get_sent_links(matching.sent_id, &num_links) + * + * 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 + */ + __pyx_v_e_sent_start = (__pyx_v_self->eda->sent_index->arr[__pyx_v_matching->sent_id]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1505 + * + * 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 + * f_sent_start = self.fda.sent_index.arr[matching.sent_id] + */ + __pyx_v_e_sent_end = (__pyx_v_self->eda->sent_index->arr[(__pyx_v_matching->sent_id + 1)]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1506 + * 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 # <<<<<<<<<<<<<< + * f_sent_start = self.fda.sent_index.arr[matching.sent_id] + * f_sent_end = self.fda.sent_index.arr[matching.sent_id+1] + */ + __pyx_v_e_sent_len = ((__pyx_v_e_sent_end - __pyx_v_e_sent_start) - 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1507 + * 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] # <<<<<<<<<<<<<< + * f_sent_end = self.fda.sent_index.arr[matching.sent_id+1] + * f_sent_len = f_sent_end - f_sent_start - 1 + */ + __pyx_v_f_sent_start = (__pyx_v_self->fda->sent_index->arr[__pyx_v_matching->sent_id]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1508 + * 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] # <<<<<<<<<<<<<< + * f_sent_len = f_sent_end - f_sent_start - 1 + * + */ + __pyx_v_f_sent_end = (__pyx_v_self->fda->sent_index->arr[(__pyx_v_matching->sent_id + 1)]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1509 + * 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 # <<<<<<<<<<<<<< + * + * self.findexes1.reset() + */ + __pyx_v_f_sent_len = ((__pyx_v_f_sent_end - __pyx_v_f_sent_start) - 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1511 + * 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 = 1511; __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[8]; __pyx_lineno = 1511; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1512 + * + * self.findexes1.reset() + * sofar = 0 # <<<<<<<<<<<<<< + * for i in range(num_chunks): + * for j in range(chunklen[i]): + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_sofar = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1513 + * self.findexes1.reset() + * 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); + */ + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1514 + * 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1515 + * 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 = PyInt_FromLong((((__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 = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1515; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1516 + * 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_1 = PyNumber_InPlaceAdd(__pyx_v_sofar, __pyx_int_1); 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_DECREF(__pyx_v_sofar); + __pyx_v_sofar = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1517 + * 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_7 = (((__pyx_v_i + 1) < __pyx_v_num_chunks) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1518 + * sofar += 1 + * if i+1 < num_chunks: + * self.findexes1.append(phrase[sofar]) # <<<<<<<<<<<<<< + * sofar += 1 + * + */ + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_phrase), __pyx_v_sofar); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes1), __pyx_t_1); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1519 + * 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 = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_sofar); + __pyx_v_sofar = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L7; + } + __pyx_L7:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1522 + * + * + * e_links_low = malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<< + * e_links_high = malloc(e_sent_len*sizeof(int)) + * f_links_low = malloc(f_sent_len*sizeof(int)) + */ + __pyx_v_e_links_low = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1523 + * + * e_links_low = malloc(e_sent_len*sizeof(int)) + * e_links_high = malloc(e_sent_len*sizeof(int)) # <<<<<<<<<<<<<< + * f_links_low = malloc(f_sent_len*sizeof(int)) + * f_links_high = malloc(f_sent_len*sizeof(int)) + */ + __pyx_v_e_links_high = ((int *)malloc((__pyx_v_e_sent_len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1524 + * e_links_low = malloc(e_sent_len*sizeof(int)) + * e_links_high = malloc(e_sent_len*sizeof(int)) + * f_links_low = malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<< + * f_links_high = malloc(f_sent_len*sizeof(int)) + * f_gap_low = malloc((num_chunks+1)*sizeof(int)) + */ + __pyx_v_f_links_low = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1525 + * e_links_high = malloc(e_sent_len*sizeof(int)) + * f_links_low = malloc(f_sent_len*sizeof(int)) + * f_links_high = malloc(f_sent_len*sizeof(int)) # <<<<<<<<<<<<<< + * f_gap_low = malloc((num_chunks+1)*sizeof(int)) + * f_gap_high = malloc((num_chunks+1)*sizeof(int)) + */ + __pyx_v_f_links_high = ((int *)malloc((__pyx_v_f_sent_len * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1526 + * f_links_low = malloc(f_sent_len*sizeof(int)) + * f_links_high = malloc(f_sent_len*sizeof(int)) + * f_gap_low = malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< + * f_gap_high = malloc((num_chunks+1)*sizeof(int)) + * e_gap_low = malloc((num_chunks+1)*sizeof(int)) + */ + __pyx_v_f_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1527 + * f_links_high = malloc(f_sent_len*sizeof(int)) + * f_gap_low = malloc((num_chunks+1)*sizeof(int)) + * f_gap_high = malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< + * e_gap_low = malloc((num_chunks+1)*sizeof(int)) + * e_gap_high = malloc((num_chunks+1)*sizeof(int)) + */ + __pyx_v_f_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1528 + * f_gap_low = malloc((num_chunks+1)*sizeof(int)) + * f_gap_high = malloc((num_chunks+1)*sizeof(int)) + * e_gap_low = malloc((num_chunks+1)*sizeof(int)) # <<<<<<<<<<<<<< + * e_gap_high = malloc((num_chunks+1)*sizeof(int)) + * memset(f_gap_low, 0, (num_chunks+1)*sizeof(int)) + */ + __pyx_v_e_gap_low = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1529 + * f_gap_high = malloc((num_chunks+1)*sizeof(int)) + * e_gap_low = malloc((num_chunks+1)*sizeof(int)) + * e_gap_high = 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)) + */ + __pyx_v_e_gap_high = ((int *)malloc(((__pyx_v_num_chunks + 1) * (sizeof(int))))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1530 + * e_gap_low = malloc((num_chunks+1)*sizeof(int)) + * e_gap_high = 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)) + * memset(e_gap_low, 0, (num_chunks+1)*sizeof(int)) + */ + memset(__pyx_v_f_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1531 + * e_gap_high = 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)) # <<<<<<<<<<<<<< + * memset(e_gap_low, 0, (num_chunks+1)*sizeof(int)) + * memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) + */ + memset(__pyx_v_f_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1532 + * 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)) # <<<<<<<<<<<<<< + * memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) + * + */ + memset(__pyx_v_e_gap_low, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1533 + * 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)) # <<<<<<<<<<<<<< + * + * reason_for_failure = "" + */ + memset(__pyx_v_e_gap_high, 0, ((__pyx_v_num_chunks + 1) * (sizeof(int)))); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1535 + * memset(e_gap_high, 0, (num_chunks+1)*sizeof(int)) + * + * reason_for_failure = "" # <<<<<<<<<<<<<< + * + * for i from 0 <= i < e_sent_len: + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_47)); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_47); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1537 + * reason_for_failure = "" + * + * for i from 0 <= i < e_sent_len: # <<<<<<<<<<<<<< + * e_links_low[i] = -1 + * e_links_high[i] = -1 + */ + __pyx_t_2 = __pyx_v_e_sent_len; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1538 + * + * for i from 0 <= i < e_sent_len: + * e_links_low[i] = -1 # <<<<<<<<<<<<<< + * e_links_high[i] = -1 + * for i from 0 <= i < f_sent_len: + */ + (__pyx_v_e_links_low[__pyx_v_i]) = -1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1539 + * for i from 0 <= i < e_sent_len: + * e_links_low[i] = -1 + * e_links_high[i] = -1 # <<<<<<<<<<<<<< + * for i from 0 <= i < f_sent_len: + * f_links_low[i] = -1 + */ + (__pyx_v_e_links_high[__pyx_v_i]) = -1; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1540 + * e_links_low[i] = -1 + * e_links_high[i] = -1 + * for i from 0 <= i < f_sent_len: # <<<<<<<<<<<<<< + * f_links_low[i] = -1 + * f_links_high[i] = -1 + */ + __pyx_t_2 = __pyx_v_f_sent_len; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1541 + * e_links_high[i] = -1 + * for i from 0 <= i < f_sent_len: + * f_links_low[i] = -1 # <<<<<<<<<<<<<< + * f_links_high[i] = -1 + * + */ + (__pyx_v_f_links_low[__pyx_v_i]) = -1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1542 + * for i from 0 <= i < f_sent_len: + * f_links_low[i] = -1 + * f_links_high[i] = -1 # <<<<<<<<<<<<<< + * + * # this is really inefficient -- might be good to + */ + (__pyx_v_f_links_high[__pyx_v_i]) = -1; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1548 + * # links that we care about (but then how to look up + * # when we want to check something on the e side?) + * i = 0 # <<<<<<<<<<<<<< + * while i < num_links*2: + * f_i = sent_links[i] + */ + __pyx_v_i = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1549 + * # when we want to check something on the e side?) + * i = 0 + * while i < num_links*2: # <<<<<<<<<<<<<< + * f_i = sent_links[i] + * e_i = sent_links[i+1] + */ + while (1) { + __pyx_t_7 = ((__pyx_v_i < (__pyx_v_num_links * 2)) != 0); + if (!__pyx_t_7) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1550 + * i = 0 + * while i < num_links*2: + * 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: + */ + __pyx_v_f_i = (__pyx_v_sent_links[__pyx_v_i]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1551 + * while i < num_links*2: + * 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 + */ + __pyx_v_e_i = (__pyx_v_sent_links[(__pyx_v_i + 1)]); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1552 + * 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_7 = (((__pyx_v_f_links_low[__pyx_v_f_i]) == -1) != 0); + if (!__pyx_t_7) { + __pyx_t_8 = (((__pyx_v_f_links_low[__pyx_v_f_i]) > __pyx_v_e_i) != 0); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1553 + * 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: + * f_links_high[f_i] = e_i + 1 + */ + (__pyx_v_f_links_low[__pyx_v_f_i]) = __pyx_v_e_i; + goto __pyx_L14; + } + __pyx_L14:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1554 + * 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: # <<<<<<<<<<<<<< + * f_links_high[f_i] = e_i + 1 + * if e_links_low[e_i] == -1 or e_links_low[e_i] > f_i: + */ + __pyx_t_9 = (((__pyx_v_f_links_high[__pyx_v_f_i]) == -1) != 0); + if (!__pyx_t_9) { + __pyx_t_7 = (((__pyx_v_f_links_high[__pyx_v_f_i]) < (__pyx_v_e_i + 1)) != 0); + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_9; + } + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1555 + * 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 # <<<<<<<<<<<<<< + * if e_links_low[e_i] == -1 or e_links_low[e_i] > f_i: + * e_links_low[e_i] = f_i + */ + (__pyx_v_f_links_high[__pyx_v_f_i]) = (__pyx_v_e_i + 1); + goto __pyx_L15; + } + __pyx_L15:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1556 + * 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_8 = (((__pyx_v_e_links_low[__pyx_v_e_i]) == -1) != 0); + if (!__pyx_t_8) { + __pyx_t_9 = (((__pyx_v_e_links_low[__pyx_v_e_i]) > __pyx_v_f_i) != 0); + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1557 + * 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: + * e_links_high[e_i] = f_i + 1 + */ + (__pyx_v_e_links_low[__pyx_v_e_i]) = __pyx_v_f_i; + goto __pyx_L16; + } + __pyx_L16:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1558 + * 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_7 = (((__pyx_v_e_links_high[__pyx_v_e_i]) == -1) != 0); + if (!__pyx_t_7) { + __pyx_t_8 = (((__pyx_v_e_links_high[__pyx_v_e_i]) < (__pyx_v_f_i + 1)) != 0); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1559 + * 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_v_e_links_high[__pyx_v_e_i]) = (__pyx_v_f_i + 1); + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1560 + * 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 # <<<<<<<<<<<<<< + * + * als = [] + */ + __pyx_v_i = (__pyx_v_i + 2); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1562 + * 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 = 1562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_als = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1563 + * + * 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) + */ + __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1564 + * 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 = PyInt_FromLong(((__pyx_v_matching->arr[__pyx_v_x]) - __pyx_v_f_sent_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyInt_FromLong((__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 = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __Pyx_XDECREF(((PyObject *)__pyx_v_al)); + __pyx_v_al = ((PyObject*)__pyx_t_10); + __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1565 + * 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_11 = __Pyx_PyList_Append(__pyx_v_als, ((PyObject *)__pyx_v_al)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1567 + * als.append(al) + * # check all source-side alignment constraints + * met_constraints = 1 # <<<<<<<<<<<<<< + * if self.require_aligned_terminal: + * num_aligned_chunks = 0 + */ + __pyx_v_met_constraints = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1568 + * # 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_9 = (__pyx_v_self->require_aligned_terminal != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1569 + * met_constraints = 1 + * if self.require_aligned_terminal: + * num_aligned_chunks = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < num_chunks: + * for j from 0 <= j < chunklen[i]: + */ + __pyx_v_num_aligned_chunks = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1570 + * if self.require_aligned_terminal: + * 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: + */ + __pyx_t_2 = __pyx_v_num_chunks; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1571 + * 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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1572 + * 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_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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1573 + * 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 + * if num_aligned_chunks == 0: + */ + __pyx_v_num_aligned_chunks = (__pyx_v_num_aligned_chunks + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1574 + * 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_L25; + } + __pyx_L25:; + } + __pyx_L24_break:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1575 + * num_aligned_chunks = num_aligned_chunks + 1 + * break + * if num_aligned_chunks == 0: # <<<<<<<<<<<<<< + * reason_for_failure = "No aligned terminals" + * met_constraints = 0 + */ + __pyx_t_9 = ((__pyx_v_num_aligned_chunks == 0) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1576 + * break + * if num_aligned_chunks == 0: + * reason_for_failure = "No aligned terminals" # <<<<<<<<<<<<<< + * met_constraints = 0 + * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_133)); + __Pyx_DECREF(__pyx_v_reason_for_failure); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_133); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1577 + * if num_aligned_chunks == 0: + * 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" + */ + __pyx_v_met_constraints = 0; + goto __pyx_L26; + } + __pyx_L26:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1578 + * 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_9 = ((__pyx_v_num_aligned_chunks < __pyx_v_num_chunks) != 0); + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = (__pyx_v_self->require_aligned_chunks != 0); + } + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1579 + * met_constraints = 0 + * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: + * reason_for_failure = "Unaligned chunk" # <<<<<<<<<<<<<< + * met_constraints = 0 + * + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_134)); + __Pyx_DECREF(__pyx_v_reason_for_failure); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_134); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1580 + * if self.require_aligned_chunks and num_aligned_chunks < num_chunks: + * reason_for_failure = "Unaligned chunk" + * met_constraints = 0 # <<<<<<<<<<<<<< + * + * if met_constraints and self.tight_phrases: + */ + __pyx_v_met_constraints = 0; + goto __pyx_L27; + } + __pyx_L27:; + goto __pyx_L20; + } + __pyx_L20:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1582 + * 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_7 = __pyx_v_self->tight_phrases; + __pyx_t_9 = __pyx_t_7; + } else { + __pyx_t_9 = (__pyx_v_met_constraints != 0); + } + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1584 + * 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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1585 + * # 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_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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1586 + * 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 + * break + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_135)); + __Pyx_DECREF(__pyx_v_reason_for_failure); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_135); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1587 + * 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 # <<<<<<<<<<<<<< + * break + * if f_links_low[matching.arr[matching.start+i+1]-1-f_sent_start] == -1: + */ + __pyx_v_met_constraints = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1588 + * 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_L31; + } + __pyx_L31:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1589 + * 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_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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1590 + * 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 + * break + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_135)); + __Pyx_DECREF(__pyx_v_reason_for_failure); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_135); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1591 + * 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 # <<<<<<<<<<<<<< + * break + * + */ + __pyx_v_met_constraints = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1592 + * 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_L32; + } + __pyx_L32:; + } + __pyx_L30_break:; + goto __pyx_L28; + } + __pyx_L28:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1594 + * break + * + * 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: + */ + __pyx_v_f_low = ((__pyx_v_matching->arr[__pyx_v_matching->start]) - __pyx_v_f_sent_start); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1595 + * + * 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: + * + */ + __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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1596 + * 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_9 = (__pyx_v_met_constraints != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1598 + * 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_10 = PyInt_FromLong(__pyx_v_f_high); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1602 + * 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_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_10, __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_10); __pyx_t_10 = 0; + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1603 + * self.train_min_gap_size, 0, + * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): + * gap_error = 0 # <<<<<<<<<<<<<< + * num_gaps = 0 + * + */ + __pyx_v_gap_error = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1604 + * self.max_nonterminals - num_chunks + 1, 1, 1, 0, 0): + * gap_error = 0 + * num_gaps = 0 # <<<<<<<<<<<<<< + * + * if f_back_low < f_low: + */ + __pyx_v_num_gaps = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1606 + * num_gaps = 0 + * + * if f_back_low < f_low: # <<<<<<<<<<<<<< + * f_gap_low[0] = f_back_low + * f_gap_high[0] = f_low + */ + __pyx_t_9 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1607 + * + * if f_back_low < f_low: + * f_gap_low[0] = f_back_low # <<<<<<<<<<<<<< + * f_gap_high[0] = f_low + * num_gaps = 1 + */ + (__pyx_v_f_gap_low[0]) = __pyx_v_f_back_low; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1608 + * if f_back_low < f_low: + * f_gap_low[0] = f_back_low + * f_gap_high[0] = f_low # <<<<<<<<<<<<<< + * num_gaps = 1 + * gap_start = 0 + */ + (__pyx_v_f_gap_high[0]) = __pyx_v_f_low; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1609 + * f_gap_low[0] = f_back_low + * f_gap_high[0] = f_low + * num_gaps = 1 # <<<<<<<<<<<<<< + * gap_start = 0 + * phrase_len = phrase_len+1 + */ + __pyx_v_num_gaps = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1610 + * f_gap_high[0] = f_low + * num_gaps = 1 + * gap_start = 0 # <<<<<<<<<<<<<< + * phrase_len = phrase_len+1 + * if phrase_len > self.max_length: + */ + __pyx_v_gap_start = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1611 + * num_gaps = 1 + * gap_start = 0 + * phrase_len = phrase_len+1 # <<<<<<<<<<<<<< + * if phrase_len > self.max_length: + * gap_error = 1 + */ + __pyx_v_phrase_len = (__pyx_v_phrase_len + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1612 + * gap_start = 0 + * phrase_len = phrase_len+1 + * if phrase_len > self.max_length: # <<<<<<<<<<<<<< + * gap_error = 1 + * if self.tight_phrases: + */ + __pyx_t_9 = ((__pyx_v_phrase_len > __pyx_v_self->max_length) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1613 + * phrase_len = phrase_len+1 + * 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: + */ + __pyx_v_gap_error = 1; + goto __pyx_L36; + } + __pyx_L36:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1614 + * 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_9 = (__pyx_v_self->tight_phrases != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1615 + * 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 + * reason_for_failure = "Inside edges of preceding subphrase are not tight" + */ + __pyx_t_9 = (((__pyx_v_f_links_low[__pyx_v_f_back_low]) == -1) != 0); + if (!__pyx_t_9) { + __pyx_t_7 = (((__pyx_v_f_links_low[(__pyx_v_f_low - 1)]) == -1) != 0); + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_9; + } + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1616 + * if self.tight_phrases: + * 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" + * else: + */ + __pyx_v_gap_error = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1617 + * 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" # <<<<<<<<<<<<<< + * else: + * gap_start = 1 + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_136)); + __Pyx_DECREF(__pyx_v_reason_for_failure); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_136); + goto __pyx_L38; + } + __pyx_L38:; + goto __pyx_L37; + } + __pyx_L37:; + goto __pyx_L35; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1619 + * reason_for_failure = "Inside edges of preceding subphrase are not tight" + * 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 + */ + __pyx_v_gap_start = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1620 + * 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_8 = (((__pyx_v_f_links_low[__pyx_v_f_low]) == -1) != 0); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = (__pyx_v_self->tight_phrases != 0); + } + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1623 + * # 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 # <<<<<<<<<<<<<< + * + * for i from 0 <= i < matching.size - 1: + */ + __pyx_v_met_constraints = 0; + goto __pyx_L39; + } + __pyx_L39:; + } + __pyx_L35:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1625 + * 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++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1626 + * + * 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 + * num_gaps = num_gaps + 1 + */ + (__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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1627 + * 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 # <<<<<<<<<<<<<< + * num_gaps = num_gaps + 1 + * + */ + (__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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1628 + * 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 # <<<<<<<<<<<<<< + * + * if f_high < f_back_high: + */ + __pyx_v_num_gaps = (__pyx_v_num_gaps + 1); + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1630 + * 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_9 = ((__pyx_v_f_high < __pyx_v_f_back_high) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1631 + * + * 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 + * num_gaps = num_gaps + 1 + */ + (__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_num_gaps)]) = __pyx_v_f_high; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1632 + * 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 # <<<<<<<<<<<<<< + * num_gaps = num_gaps + 1 + * phrase_len = phrase_len+1 + */ + (__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_num_gaps)]) = __pyx_v_f_back_high; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1633 + * f_gap_low[gap_start+num_gaps] = f_high + * f_gap_high[gap_start+num_gaps] = f_back_high + * num_gaps = num_gaps + 1 # <<<<<<<<<<<<<< + * phrase_len = phrase_len+1 + * if phrase_len > self.max_length: + */ + __pyx_v_num_gaps = (__pyx_v_num_gaps + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1634 + * f_gap_high[gap_start+num_gaps] = f_back_high + * num_gaps = num_gaps + 1 + * phrase_len = phrase_len+1 # <<<<<<<<<<<<<< + * if phrase_len > self.max_length: + * gap_error = 1 + */ + __pyx_v_phrase_len = (__pyx_v_phrase_len + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1635 + * 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_9 = ((__pyx_v_phrase_len > __pyx_v_self->max_length) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1636 + * phrase_len = phrase_len+1 + * 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: + */ + __pyx_v_gap_error = 1; + goto __pyx_L43; + } + __pyx_L43:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1637 + * 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_9 = (__pyx_v_self->tight_phrases != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1638 + * 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 + * reason_for_failure = "Inside edges of following subphrase are not tight" + */ + __pyx_t_9 = (((__pyx_v_f_links_low[(__pyx_v_f_back_high - 1)]) == -1) != 0); + if (!__pyx_t_9) { + __pyx_t_8 = (((__pyx_v_f_links_low[__pyx_v_f_high]) == -1) != 0); + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = __pyx_t_9; + } + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1639 + * if self.tight_phrases: + * 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" + * else: + */ + __pyx_v_gap_error = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1640 + * 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" # <<<<<<<<<<<<<< + * else: + * if self.tight_phrases and f_links_low[f_high-1] == -1: + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_137)); + __Pyx_DECREF(__pyx_v_reason_for_failure); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_137); + goto __pyx_L45; + } + __pyx_L45:; + goto __pyx_L44; + } + __pyx_L44:; + goto __pyx_L42; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1642 + * 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_7 = (((__pyx_v_f_links_low[(__pyx_v_f_high - 1)]) == -1) != 0); + __pyx_t_9 = __pyx_t_7; + } else { + __pyx_t_9 = (__pyx_v_self->tight_phrases != 0); + } + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1643 + * else: + * if self.tight_phrases and f_links_low[f_high-1] == -1: + * met_constraints = 0 # <<<<<<<<<<<<<< + * + * if gap_error == 0: + */ + __pyx_v_met_constraints = 0; + goto __pyx_L46; + } + __pyx_L46:; + } + __pyx_L42:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1645 + * 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_9 = ((__pyx_v_gap_error == 0) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1646 + * + * if gap_error == 0: + * 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], + */ + __pyx_v_e_word_count = (__pyx_v_e_high - __pyx_v_e_low); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1647 + * if gap_error == 0: + * 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, + */ + __pyx_t_2 = __pyx_v_num_gaps; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1648 + * 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_10 = PyInt_FromLong((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1653 + * f_gap_low+gap_start+i, f_gap_high+gap_start+i, + * 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 + */ + __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_10, __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_10); __pyx_t_10 = 0; + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1655 + * 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]) + * break + */ + __pyx_v_gap_error = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1656 + * 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_10 = PyInt_FromLong((__pyx_v_f_gap_low[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = PyInt_FromLong((__pyx_v_f_gap_high[(__pyx_v_gap_start + __pyx_v_i)])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1656; __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 = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_10 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_138), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_reason_for_failure); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1657 + * 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_L50; + } + __pyx_L50:; + } + __pyx_L49_break:; + goto __pyx_L47; + } + __pyx_L47:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1659 + * break + * + * if gap_error == 0: # <<<<<<<<<<<<<< + * i = 1 + * self.findexes.reset() + */ + __pyx_t_9 = ((__pyx_v_gap_error == 0) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1660 + * + * if gap_error == 0: + * i = 1 # <<<<<<<<<<<<<< + * self.findexes.reset() + * if f_back_low < f_low: + */ + __pyx_v_i = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1661 + * 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 = 1661; __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[8]; __pyx_lineno = 1661; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1662 + * i = 1 + * self.findexes.reset() + * if f_back_low < f_low: # <<<<<<<<<<<<<< + * fphr_arr._append(sym_setindex(self.category, i)) + * i = i+1 + */ + __pyx_t_9 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1663 + * self.findexes.reset() + * if f_back_low < f_low: + * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< + * i = i+1 + * self.findexes.append(sym_setindex(self.category, i)) + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1664 + * if f_back_low < f_low: + * fphr_arr._append(sym_setindex(self.category, i)) + * i = i+1 # <<<<<<<<<<<<<< + * self.findexes.append(sym_setindex(self.category, i)) + * self.findexes.extend(self.findexes1) + */ + __pyx_v_i = (__pyx_v_i + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1665 + * 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 = PyInt_FromLong(__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 = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1665; __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; + goto __pyx_L52; + } + __pyx_L52:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1666 + * 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_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 = 1666; __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 = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->findexes1)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); + __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1667 + * 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]): + * fphr_arr._append(sym_setindex(self.category, i)) + */ + __pyx_t_2 = __pyx_v_phrase->n; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1668 + * 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_9 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1669 + * for j from 0 <= j < phrase.n: + * if sym_isvar(phrase.syms[j]): + * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< + * i = i + 1 + * else: + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1670 + * if sym_isvar(phrase.syms[j]): + * fphr_arr._append(sym_setindex(self.category, i)) + * i = i + 1 # <<<<<<<<<<<<<< + * else: + * fphr_arr._append(phrase.syms[j]) + */ + __pyx_v_i = (__pyx_v_i + 1); + goto __pyx_L55; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1672 + * i = i + 1 + * else: + * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< + * if f_back_high > f_high: + * fphr_arr._append(sym_setindex(self.category, i)) + */ + ((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:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1673 + * 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_9 = ((__pyx_v_f_back_high > __pyx_v_f_high) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1674 + * 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)) + * + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1675 + * 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_10 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_3 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L56; + } + __pyx_L56:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1677 + * 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((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_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_10); + __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1678 + * + * 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_9 = (__pyx_v_met_constraints != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1681 + * 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) # <<<<<<<<<<<<<< + * if len(phrase_list) > 0: + * pair_count = 1.0 / len(phrase_list) + */ + __pyx_t_10 = ((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_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_v_phrase_list = __pyx_t_10; + __pyx_t_10 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1682 + * 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 = 1682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((__pyx_t_13 > 0) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1683 + * 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 = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_13 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_pair_count = (1.0 / __pyx_t_13); + goto __pyx_L58; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1685 + * pair_count = 1.0 / len(phrase_list) + * 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: + */ + __pyx_v_pair_count = 0.0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1686 + * 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_10 = PyInt_FromLong(__pyx_v_f_back_low); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_3 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyInt_FromLong(__pyx_v_e_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = PyInt_FromLong(__pyx_v_e_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __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 = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + __pyx_t_10 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_14 = 0; + __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_139), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_14)); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_v_reason_for_failure); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_t_14); + __pyx_t_14 = 0; + } + __pyx_L58:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1687 + * 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; + } 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 = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext; + } + 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 = 1687; __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 = 1687; __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 = 1687; __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 = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_15 = __pyx_t_16(__pyx_t_14); + if (unlikely(!__pyx_t_15)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_15); + } + 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_1 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __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 = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_1 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L61_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L61_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L62_unpacking_done; + __pyx_L61_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L62_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_phrase2); + __pyx_v_phrase2 = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_eindexes); + __pyx_v_eindexes = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1688 + * 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 = 1688; __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_15), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_XDECREF(((PyObject *)__pyx_v_als1)); + __pyx_v_als1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1689 + * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = PyTuple_New(1); 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); + __Pyx_INCREF(((PyObject *)__pyx_v_als1)); + PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_als1)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_als1)); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__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 = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); + PyTuple_SET_ITEM(__pyx_t_15, 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); + __Pyx_GIVEREF(__pyx_v_phrase2); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + goto __pyx_L57; + } + __pyx_L57:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1690 + * 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 + * f_back_high - f_back_low + self.train_min_gap_size <= self.train_max_initial_size): + */ + __pyx_t_9 = ((__pyx_v_num_gaps < __pyx_v_self->max_nonterminals) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1691 + * 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_7 = ((__pyx_v_phrase_len < __pyx_v_self->max_length) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1692 + * 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_8 = ((((__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_8; + } else { + __pyx_t_18 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_18; + } else { + __pyx_t_7 = __pyx_t_9; + } + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1693 + * 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_7 = ((__pyx_v_f_back_low == __pyx_v_f_low) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1694 + * 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_9 = ((__pyx_v_f_low >= __pyx_v_self->train_min_gap_size) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1695 + * 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_8 = (((__pyx_v_f_links_low[(__pyx_v_f_low - 1)]) != -1) != 0); + if (__pyx_t_8) { + __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_8; + } + __pyx_t_8 = __pyx_t_20; + } 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_t_7; + } + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1696 + * 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 + * if self.tight_phrases: + */ + __pyx_v_f_x_low = (__pyx_v_f_low - __pyx_v_self->train_min_gap_size); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1697 + * ((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 # <<<<<<<<<<<<<< + * if self.tight_phrases: + * while f_x_low >= 0 and f_links_low[f_x_low] == -1: + */ + __pyx_v_met_constraints = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1698 + * 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_9 = (__pyx_v_self->tight_phrases != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1699 + * 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 + * if f_x_low < 0 or f_back_high - f_x_low > self.train_max_initial_size: + */ + while (1) { + __pyx_t_9 = ((__pyx_v_f_x_low >= 0) != 0); + if (__pyx_t_9) { + __pyx_t_7 = (((__pyx_v_f_links_low[__pyx_v_f_x_low]) == -1) != 0); + __pyx_t_18 = __pyx_t_7; + } else { + __pyx_t_18 = __pyx_t_9; + } + if (!__pyx_t_18) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1700 + * if self.tight_phrases: + * 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_v_f_x_low = (__pyx_v_f_x_low - 1); + } + goto __pyx_L65; + } + __pyx_L65:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1701 + * 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_9 = (((__pyx_v_f_back_high - __pyx_v_f_x_low) > __pyx_v_self->train_max_initial_size) != 0); + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_18; + } + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1702 + * 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 # <<<<<<<<<<<<<< + * + * if (met_constraints and + */ + __pyx_v_met_constraints = 0; + goto __pyx_L68; + } + __pyx_L68:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1704 + * 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)) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1705 + * + * 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 = PyInt_FromLong(__pyx_v_f_back_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1709 + * 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, 1, 0, 1, 0) == 1) and + * ((not self.tight_phrases) or f_links_low[f_x_low] != -1) and + */ + __pyx_t_7 = (((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_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1711 + * 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_9 = ((__pyx_v_f_links_low[__pyx_v_f_x_low]) != -1); + __pyx_t_8 = __pyx_t_9; + } else { + __pyx_t_8 = __pyx_t_18; + } + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1712 + * 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 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1716 + * -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_8; + } + __pyx_t_8 = __pyx_t_18; + } else { + __pyx_t_8 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = (__pyx_v_met_constraints != 0); + } + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1718 + * self.train_max_initial_size, self.train_max_initial_size, + * 0, 0, 0, 0, 0, 0, 0)): + * fphr_arr._clear() # <<<<<<<<<<<<<< + * i = 1 + * self.findexes.reset() + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1719 + * 0, 0, 0, 0, 0, 0, 0)): + * fphr_arr._clear() + * i = 1 # <<<<<<<<<<<<<< + * self.findexes.reset() + * self.findexes.append(sym_setindex(self.category, i)) + */ + __pyx_v_i = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1720 + * 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 = 1720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1721 + * 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_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1721; __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_14); __pyx_t_14 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1722 + * self.findexes.reset() + * self.findexes.append(sym_setindex(self.category, i)) + * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< + * i = i+1 + * self.findexes.extend(self.findexes1) + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1723 + * self.findexes.append(sym_setindex(self.category, i)) + * fphr_arr._append(sym_setindex(self.category, i)) + * i = i+1 # <<<<<<<<<<<<<< + * self.findexes.extend(self.findexes1) + * for j from 0 <= j < phrase.n: + */ + __pyx_v_i = (__pyx_v_i + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1724 + * 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_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 = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1724; __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_15 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_1), NULL); 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_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1725 + * i = i+1 + * 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)) + */ + __pyx_t_2 = __pyx_v_phrase->n; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1726 + * 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_7 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1727 + * for j from 0 <= j < phrase.n: + * if sym_isvar(phrase.syms[j]): + * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< + * i = i + 1 + * else: + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1728 + * if sym_isvar(phrase.syms[j]): + * fphr_arr._append(sym_setindex(self.category, i)) + * i = i + 1 # <<<<<<<<<<<<<< + * else: + * fphr_arr._append(phrase.syms[j]) + */ + __pyx_v_i = (__pyx_v_i + 1); + goto __pyx_L72; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1730 + * i = i + 1 + * else: + * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< + * if f_back_high > f_high: + * fphr_arr._append(sym_setindex(self.category, i)) + */ + ((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:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1731 + * 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_7 = ((__pyx_v_f_back_high > __pyx_v_f_high) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1732 + * 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)) + * fphr = Phrase(fphr_arr) + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1733 + * 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_15 = PyInt_FromLong(__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 = 1733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1733; __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_1); __pyx_t_1 = 0; + goto __pyx_L73; + } + __pyx_L73:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1734 + * 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fphr_arr)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); + __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_fphr)); + __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_15); + __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1737 + * 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) # <<<<<<<<<<<<<< + * if len(phrase_list) > 0: + * pair_count = 1.0 / len(phrase_list) + */ + __pyx_t_15 = ((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_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_v_phrase_list); + __pyx_v_phrase_list = __pyx_t_15; + __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1738 + * 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 = 1738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((__pyx_t_13 > 0) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1739 + * 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 = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_13 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_pair_count = (1.0 / __pyx_t_13); + goto __pyx_L74; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1741 + * pair_count = 1.0 / len(phrase_list) + * else: + * pair_count = 0 # <<<<<<<<<<<<<< + * for phrase2, eindexes in phrase_list: + * als2 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) + */ + __pyx_v_pair_count = 0.0; + } + __pyx_L74:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1742 + * 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)) { + __pyx_t_15 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_15); __pyx_t_13 = 0; + __pyx_t_16 = NULL; + } else { + __pyx_t_13 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext; + } + for (;;) { + if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_15)) { + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_15)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_15)) { + if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_15)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_16(__pyx_t_15); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __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_3 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_14 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_14 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_14)) goto __pyx_L77_unpacking_failed; + __Pyx_GOTREF(__pyx_t_14); + index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L77_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L78_unpacking_done; + __pyx_L77_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L78_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_phrase2); + __pyx_v_phrase2 = __pyx_t_14; + __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_v_eindexes); + __pyx_v_eindexes = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1743 + * 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_1 = ((PyObject *)__pyx_v_self->findexes); + __Pyx_INCREF(__pyx_t_1); + 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 = 1743; __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_1), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(((PyObject *)__pyx_v_als2)); + __pyx_v_als2 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1744 + * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __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 = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_als2)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_als2)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_als2)); + __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_fphr)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr)); + __Pyx_INCREF(__pyx_v_phrase2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_phrase2); + __Pyx_GIVEREF(__pyx_v_phrase2); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + __pyx_t_3 = 0; + __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + goto __pyx_L69; + } + __pyx_L69:; + goto __pyx_L64; + } + __pyx_L64:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1746 + * 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_7 = ((__pyx_v_f_back_high == __pyx_v_f_high) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1747 + * + * 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_8 = (((__pyx_v_f_sent_len - __pyx_v_f_high) >= __pyx_v_self->train_min_gap_size) != 0); + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1748 + * 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_9 = (((__pyx_v_f_links_low[__pyx_v_f_high]) != -1) != 0); + if (__pyx_t_9) { + __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_9; + } + __pyx_t_9 = __pyx_t_19; + } else { + __pyx_t_9 = __pyx_t_18; + } + __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_7; + } + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1749 + * 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 + * if self.tight_phrases: + */ + __pyx_v_f_x_high = (__pyx_v_f_high + __pyx_v_self->train_min_gap_size); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1750 + * ((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 # <<<<<<<<<<<<<< + * if self.tight_phrases: + * while f_x_high <= f_sent_len and f_links_low[f_x_high-1] == -1: + */ + __pyx_v_met_constraints = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1751 + * f_x_high = f_high+self.train_min_gap_size + * met_constraints = 1 + * 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_8 = (__pyx_v_self->tight_phrases != 0); + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1752 + * met_constraints = 1 + * 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 + * if f_x_high > f_sent_len or f_x_high - f_back_low > self.train_max_initial_size: + */ + while (1) { + __pyx_t_8 = ((__pyx_v_f_x_high <= __pyx_v_f_sent_len) != 0); + if (__pyx_t_8) { + __pyx_t_7 = (((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) == -1) != 0); + __pyx_t_18 = __pyx_t_7; + } else { + __pyx_t_18 = __pyx_t_8; + } + if (!__pyx_t_18) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1753 + * 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 # <<<<<<<<<<<<<< + * if f_x_high > f_sent_len or f_x_high - f_back_low > self.train_max_initial_size: + * met_constraints = 0 + */ + __pyx_v_f_x_high = (__pyx_v_f_x_high + 1); + } + goto __pyx_L80; + } + __pyx_L80:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1754 + * 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_8 = (((__pyx_v_f_x_high - __pyx_v_f_back_low) > __pyx_v_self->train_max_initial_size) != 0); + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = __pyx_t_18; + } + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1755 + * 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 # <<<<<<<<<<<<<< + * + * if (met_constraints and + */ + __pyx_v_met_constraints = 0; + goto __pyx_L83; + } + __pyx_L83:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1757 + * 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)) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1758 + * + * 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_15 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1762 + * 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_15, __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_15); __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1764 + * 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_7 = (!(__pyx_v_self->tight_phrases != 0)); + if (!__pyx_t_7) { + __pyx_t_18 = ((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) != -1); + __pyx_t_8 = __pyx_t_18; + } else { + __pyx_t_8 = __pyx_t_7; + } + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1765 + * 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_14 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1770 + * 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_7 = (((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; + } else { + __pyx_t_7 = __pyx_t_8; + } + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = (((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_15, __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_15); __pyx_t_15 = 0; + } + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = (__pyx_v_met_constraints != 0); + } + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1772 + * self.train_max_initial_size, self.train_max_initial_size, + * 0, 0, 0, 0, 0, 0, 0)): + * fphr_arr._clear() # <<<<<<<<<<<<<< + * i = 1 + * self.findexes.reset() + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1773 + * 0, 0, 0, 0, 0, 0, 0)): + * fphr_arr._clear() + * i = 1 # <<<<<<<<<<<<<< + * self.findexes.reset() + * if f_back_low < f_low: + */ + __pyx_v_i = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1774 + * fphr_arr._clear() + * i = 1 + * self.findexes.reset() # <<<<<<<<<<<<<< + * if f_back_low < f_low: + * fphr_arr._append(sym_setindex(self.category, i)) + */ + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->findexes), __pyx_n_s__reset); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1775 + * i = 1 + * self.findexes.reset() + * if f_back_low < f_low: # <<<<<<<<<<<<<< + * fphr_arr._append(sym_setindex(self.category, i)) + * i = i+1 + */ + __pyx_t_7 = ((__pyx_v_f_back_low < __pyx_v_f_low) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1776 + * self.findexes.reset() + * if f_back_low < f_low: + * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< + * i = i+1 + * self.findexes.append(sym_setindex(self.category, i)) + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1777 + * if f_back_low < f_low: + * fphr_arr._append(sym_setindex(self.category, i)) + * i = i+1 # <<<<<<<<<<<<<< + * self.findexes.append(sym_setindex(self.category, i)) + * self.findexes.extend(self.findexes1) + */ + __pyx_v_i = (__pyx_v_i + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1778 + * 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_14 = PyInt_FromLong(__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 = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + goto __pyx_L85; + } + __pyx_L85:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1779 + * 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_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 = 1779; __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 = 1779; __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_1 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1780 + * 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]): + * fphr_arr._append(sym_setindex(self.category, i)) + */ + __pyx_t_2 = __pyx_v_phrase->n; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1781 + * 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_7 = (__pyx_f_4cdec_2sa_3_sa_sym_isvar((__pyx_v_phrase->syms[__pyx_v_j])) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1782 + * for j from 0 <= j < phrase.n: + * if sym_isvar(phrase.syms[j]): + * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< + * i = i + 1 + * else: + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1783 + * if sym_isvar(phrase.syms[j]): + * fphr_arr._append(sym_setindex(self.category, i)) + * i = i + 1 # <<<<<<<<<<<<<< + * else: + * fphr_arr._append(phrase.syms[j]) + */ + __pyx_v_i = (__pyx_v_i + 1); + goto __pyx_L88; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1785 + * i = i + 1 + * else: + * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< + * fphr_arr._append(sym_setindex(self.category, i)) + * self.findexes.append(sym_setindex(self.category, i)) + */ + ((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:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1786 + * else: + * 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) + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1787 + * 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_1 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_v_self->category, __pyx_v_i)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1787; __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_14); __pyx_t_14 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1788 + * 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_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_INCREF(((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_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_fphr)); + __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1791 + * 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) # <<<<<<<<<<<<<< + * if len(phrase_list) > 0: + * pair_count = 1.0 / len(phrase_list) + */ + __pyx_t_1 = ((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_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_phrase_list); + __pyx_v_phrase_list = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1792 + * 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 = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((__pyx_t_13 > 0) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1793 + * 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 = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_13 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_pair_count = (1.0 / __pyx_t_13); + goto __pyx_L89; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1795 + * pair_count = 1.0 / len(phrase_list) + * else: + * pair_count = 0 # <<<<<<<<<<<<<< + * for phrase2, eindexes in phrase_list: + * als3 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) + */ + __pyx_v_pair_count = 0.0; + } + __pyx_L89:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1796 + * 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_1 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0; + __pyx_t_16 = NULL; + } else { + __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_phrase_list); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_14 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_14 = __pyx_t_16(__pyx_t_1); + if (unlikely(!__pyx_t_14)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __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_3 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_15 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_15 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_15)) goto __pyx_L92_unpacking_failed; + __Pyx_GOTREF(__pyx_t_15); + index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L92_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L93_unpacking_done; + __pyx_L92_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L93_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_phrase2); + __pyx_v_phrase2 = __pyx_t_15; + __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_v_eindexes); + __pyx_v_eindexes = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1797 + * 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_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 = 1797; __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 = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(((PyObject *)__pyx_v_als3)); + __pyx_v_als3 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1798 + * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __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 = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_INCREF(((PyObject *)__pyx_v_als3)); + PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_als3)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_als3)); + __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(((PyObject *)__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 = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_INCREF(((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_14, 1, __pyx_v_phrase2); + __Pyx_GIVEREF(__pyx_v_phrase2); + PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_3 = 0; + __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L84; + } + __pyx_L84:; + goto __pyx_L79; + } + __pyx_L79:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1799 + * 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_7 = ((__pyx_v_num_gaps < (__pyx_v_self->max_nonterminals - 1)) != 0); + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1800 + * 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_8 = (((__pyx_v_phrase_len + 1) < __pyx_v_self->max_length) != 0); + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1801 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1802 + * 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_9 = ((__pyx_v_f_back_low == __pyx_v_f_low) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1803 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1804 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1805 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1806 + * 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_9; + } + __pyx_t_9 = __pyx_t_19; + } else { + __pyx_t_9 = __pyx_t_18; + } + __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_7; + } + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1808 + * ((not self.tight_phrases) or (f_links_low[f_low-1] != -1 and f_links_low[f_high] != -1))): + * + * met_constraints = 1 # <<<<<<<<<<<<<< + * f_x_low = f_low-self.train_min_gap_size + * if self.tight_phrases: + */ + __pyx_v_met_constraints = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1809 + * + * met_constraints = 1 + * 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: + */ + __pyx_v_f_x_low = (__pyx_v_f_low - __pyx_v_self->train_min_gap_size); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1810 + * met_constraints = 1 + * 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: + * f_x_low = f_x_low - 1 + */ + __pyx_t_8 = (__pyx_v_self->tight_phrases != 0); + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1811 + * 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: # <<<<<<<<<<<<<< + * f_x_low = f_x_low - 1 + * if f_x_low < 0: + */ + while (1) { + __pyx_t_8 = ((__pyx_v_f_x_low >= 0) != 0); + if (__pyx_t_8) { + __pyx_t_7 = (((__pyx_v_f_links_low[__pyx_v_f_x_low]) == -1) != 0); + __pyx_t_18 = __pyx_t_7; + } else { + __pyx_t_18 = __pyx_t_8; + } + if (!__pyx_t_18) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1812 + * if self.tight_phrases: + * 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_v_f_x_low = (__pyx_v_f_x_low - 1); + } + goto __pyx_L95; + } + __pyx_L95:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1813 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1814 + * f_x_low = f_x_low - 1 + * if f_x_low < 0: + * met_constraints = 0 # <<<<<<<<<<<<<< + * + * f_x_high = f_high+self.train_min_gap_size + */ + __pyx_v_met_constraints = 0; + goto __pyx_L98; + } + __pyx_L98:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1816 + * met_constraints = 0 + * + * 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: + */ + __pyx_v_f_x_high = (__pyx_v_f_high + __pyx_v_self->train_min_gap_size); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1817 + * + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1818 + * 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 + * 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_8 = (((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) == -1) != 0); + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = __pyx_t_18; + } + if (!__pyx_t_7) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1819 + * 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 # <<<<<<<<<<<<<< + * if f_x_high > f_sent_len or f_x_high - f_x_low > self.train_max_initial_size: + * met_constraints = 0 + */ + __pyx_v_f_x_high = (__pyx_v_f_x_high + 1); + } + goto __pyx_L99; + } + __pyx_L99:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1820 + * 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_7 = ((__pyx_v_f_x_high > __pyx_v_f_sent_len) != 0); + if (!__pyx_t_7) { + __pyx_t_18 = (((__pyx_v_f_x_high - __pyx_v_f_x_low) > __pyx_v_self->train_max_initial_size) != 0); + __pyx_t_8 = __pyx_t_18; + } else { + __pyx_t_8 = __pyx_t_7; + } + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1821 + * 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 # <<<<<<<<<<<<<< + * + * if (met_constraints and + */ + __pyx_v_met_constraints = 0; + goto __pyx_L102; + } + __pyx_L102:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1823 + * 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)) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1824 + * + * 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_1 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1828 + * 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, 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 + */ + __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_1, __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_1); __pyx_t_1 = 0; + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1830 + * 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_7 = (!(__pyx_v_self->tight_phrases != 0)); + if (!__pyx_t_7) { + __pyx_t_18 = ((__pyx_v_f_links_low[__pyx_v_f_x_low]) != -1); + if (__pyx_t_18) { + __pyx_t_9 = ((__pyx_v_f_links_low[(__pyx_v_f_x_high - 1)]) != -1); + __pyx_t_19 = __pyx_t_9; + } else { + __pyx_t_19 = __pyx_t_18; + } + __pyx_t_18 = __pyx_t_19; + } else { + __pyx_t_18 = __pyx_t_7; + } + if (__pyx_t_18) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1831 + * 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_1 = PyInt_FromLong(__pyx_v_f_low); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1835 + * -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_7 = (((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_1, __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_1); __pyx_t_1 = 0; + if (__pyx_t_7) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1837 + * 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_1 = PyInt_FromLong(__pyx_v_f_x_high); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1842 + * 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_1, __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_1); __pyx_t_1 = 0; + __pyx_t_9 = __pyx_t_19; + } else { + __pyx_t_9 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_9; + } else { + __pyx_t_7 = __pyx_t_18; + } + __pyx_t_18 = __pyx_t_7; + } else { + __pyx_t_18 = __pyx_t_8; + } + __pyx_t_8 = __pyx_t_18; + } else { + __pyx_t_8 = (__pyx_v_met_constraints != 0); + } + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1844 + * self.train_max_initial_size, self.train_max_initial_size, + * 0, 0, 0, 0, 0, 0, 0)): + * fphr_arr._clear() # <<<<<<<<<<<<<< + * i = 1 + * self.findexes.reset() + */ + ((struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList *)__pyx_v_fphr_arr->__pyx_vtab)->_clear(__pyx_v_fphr_arr); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1845 + * 0, 0, 0, 0, 0, 0, 0)): + * fphr_arr._clear() + * i = 1 # <<<<<<<<<<<<<< + * self.findexes.reset() + * self.findexes.append(sym_setindex(self.category, i)) + */ + __pyx_v_i = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1846 + * 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_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 = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1847 + * 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 = PyInt_FromLong(__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 = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1847; __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_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1848 + * self.findexes.reset() + * self.findexes.append(sym_setindex(self.category, i)) + * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< + * i = i+1 + * self.findexes.extend(self.findexes1) + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1849 + * self.findexes.append(sym_setindex(self.category, i)) + * fphr_arr._append(sym_setindex(self.category, i)) + * i = i+1 # <<<<<<<<<<<<<< + * self.findexes.extend(self.findexes1) + * for j from 0 <= j < phrase.n: + */ + __pyx_v_i = (__pyx_v_i + 1); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1850 + * 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_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 = 1850; __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 = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(((PyObject *)__pyx_v_self->findexes1)); + PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_self->findexes1)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->findexes1)); + __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1851 + * i = i+1 + * 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)) + */ + __pyx_t_2 = __pyx_v_phrase->n; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1852 + * 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1853 + * for j from 0 <= j < phrase.n: + * if sym_isvar(phrase.syms[j]): + * fphr_arr._append(sym_setindex(self.category, i)) # <<<<<<<<<<<<<< + * i = i + 1 + * else: + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1854 + * if sym_isvar(phrase.syms[j]): + * fphr_arr._append(sym_setindex(self.category, i)) + * i = i + 1 # <<<<<<<<<<<<<< + * else: + * fphr_arr._append(phrase.syms[j]) + */ + __pyx_v_i = (__pyx_v_i + 1); + goto __pyx_L106; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1856 + * i = i + 1 + * else: + * fphr_arr._append(phrase.syms[j]) # <<<<<<<<<<<<<< + * fphr_arr._append(sym_setindex(self.category, i)) + * self.findexes.append(sym_setindex(self.category, i)) + */ + ((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:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1857 + * else: + * 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) + */ + ((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)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1858 + * 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_14 = PyInt_FromLong(__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 = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->findexes), __pyx_t_14); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1859 + * 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_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(((PyObject *)__pyx_v_fphr_arr)); + PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_fphr_arr)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_fphr_arr)); + __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_fphr)); + __pyx_v_fphr = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_14); + __pyx_t_14 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1862 + * 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) # <<<<<<<<<<<<<< + * if len(phrase_list) > 0: + * pair_count = 1.0 / len(phrase_list) + */ + __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 = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_v_phrase_list); + __pyx_v_phrase_list = __pyx_t_14; + __pyx_t_14 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1863 + * 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 = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((__pyx_t_13 > 0) != 0); + if (__pyx_t_8) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1864 + * 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 = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_13 == 0)) { + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); + #endif + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + #ifdef WITH_THREAD + PyGILState_Release(__pyx_gilstate_save); + #endif + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_pair_count = (1.0 / __pyx_t_13); + goto __pyx_L107; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1866 + * pair_count = 1.0 / len(phrase_list) + * else: + * pair_count = 0 # <<<<<<<<<<<<<< + * for phrase2, eindexes in phrase_list: + * als4 = self.create_alignments(sent_links,num_links,self.findexes,eindexes) + */ + __pyx_v_pair_count = 0.0; + } + __pyx_L107:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1867 + * 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)) { + __pyx_t_14 = __pyx_v_phrase_list; __Pyx_INCREF(__pyx_t_14); __pyx_t_13 = 0; + __pyx_t_16 = 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 = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext; + } + 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 = 1867; __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 = 1867; __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 = 1867; __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 = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_15 = __pyx_t_16(__pyx_t_14); + if (unlikely(!__pyx_t_15)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_15); + } + 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_1 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __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 = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + #endif + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_1 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L110_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + index = 1; __pyx_t_3 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L110_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L111_unpacking_done; + __pyx_L110_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L111_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_phrase2); + __pyx_v_phrase2 = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_eindexes); + __pyx_v_eindexes = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1868 + * 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_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 = 1868; __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_15), ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_v_eindexes))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_XDECREF(((PyObject *)__pyx_v_als4)); + __pyx_v_als4 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1869 + * 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_3 = PyFloat_FromDouble(__pyx_v_pair_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(((PyObject *)__pyx_v_als4)); + PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_als4)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_als4)); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__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 = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(((PyObject *)__pyx_v_fphr)); + PyTuple_SET_ITEM(__pyx_t_15, 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); + __Pyx_GIVEREF(__pyx_v_phrase2); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_extracts, ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + goto __pyx_L103; + } + __pyx_L103:; + goto __pyx_L94; + } + __pyx_L94:; + goto __pyx_L63; + } + __pyx_L63:; + goto __pyx_L51; + } + __pyx_L51:; + goto __pyx_L34; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1871 + * extracts.append((fphr, phrase2, pair_count, tuple(als4))) + * else: + * reason_for_failure = "Unable to extract basic phrase" # <<<<<<<<<<<<<< + * + * free(sent_links) + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_140)); + __Pyx_DECREF(__pyx_v_reason_for_failure); + __pyx_v_reason_for_failure = ((PyObject *)__pyx_kp_s_140); + } + __pyx_L34:; + goto __pyx_L33; + } + __pyx_L33:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1873 + * reason_for_failure = "Unable to extract basic phrase" + * + * free(sent_links) # <<<<<<<<<<<<<< + * free(f_links_low) + * free(f_links_high) + */ + free(__pyx_v_sent_links); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1874 + * + * free(sent_links) + * free(f_links_low) # <<<<<<<<<<<<<< + * free(f_links_high) + * free(e_links_low) + */ + free(__pyx_v_f_links_low); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1875 + * free(sent_links) + * free(f_links_low) + * free(f_links_high) # <<<<<<<<<<<<<< + * free(e_links_low) + * free(e_links_high) + */ + free(__pyx_v_f_links_high); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1876 + * free(f_links_low) + * free(f_links_high) + * free(e_links_low) # <<<<<<<<<<<<<< + * free(e_links_high) + * free(f_gap_low) + */ + free(__pyx_v_e_links_low); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1877 + * free(f_links_high) + * free(e_links_low) + * free(e_links_high) # <<<<<<<<<<<<<< + * free(f_gap_low) + * free(f_gap_high) + */ + free(__pyx_v_e_links_high); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1878 + * free(e_links_low) + * free(e_links_high) + * free(f_gap_low) # <<<<<<<<<<<<<< + * free(f_gap_high) + * free(e_gap_low) + */ + free(__pyx_v_f_gap_low); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1879 + * free(e_links_high) + * free(f_gap_low) + * free(f_gap_high) # <<<<<<<<<<<<<< + * free(e_gap_low) + * free(e_gap_high) + */ + free(__pyx_v_f_gap_high); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1880 + * free(f_gap_low) + * free(f_gap_high) + * free(e_gap_low) # <<<<<<<<<<<<<< + * free(e_gap_high) + * + */ + free(__pyx_v_e_gap_low); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1881 + * free(f_gap_high) + * free(e_gap_low) + * free(e_gap_high) # <<<<<<<<<<<<<< + * + * return extracts + */ + free(__pyx_v_e_gap_high); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1883 + * free(e_gap_high) + * + * return extracts # <<<<<<<<<<<<<< + * + * # + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_extracts); + __pyx_r = __pyx_v_extracts; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_10); + __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:; + __Pyx_XDECREF(__pyx_v_extracts); + __Pyx_XDECREF(__pyx_v_phrase_list); + __Pyx_XDECREF((PyObject *)__pyx_v_fphr_arr); + __Pyx_XDECREF((PyObject *)__pyx_v_fphr); + __Pyx_XDECREF(__pyx_v_reason_for_failure); + __Pyx_XDECREF(__pyx_v_sofar); + __Pyx_XDECREF(__pyx_v_als); + __Pyx_XDECREF(__pyx_v_al); + __Pyx_XDECREF(__pyx_v_phrase2); + __Pyx_XDECREF(__pyx_v_eindexes); + __Pyx_XDECREF((PyObject *)__pyx_v_als1); + __Pyx_XDECREF((PyObject *)__pyx_v_als2); + __Pyx_XDECREF((PyObject *)__pyx_v_als3); + __Pyx_XDECREF((PyObject *)__pyx_v_als4); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_26add_instance(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_f_words = 0; + PyObject *__pyx_v_e_words = 0; + PyObject *__pyx_v_alignment = 0; + PyObject *__pyx_v_ctx_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_instance (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f_words,&__pyx_n_s__e_words,&__pyx_n_s__alignment,&__pyx_n_s__ctx_name,0}; + PyObject* values[4] = {0,0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1891 + * # 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 + */ + values[3] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__f_words)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 1891; __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 = 1891; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx_name); + if (value) { values[3] = value; kw_args--; } + } + } + 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 = 1891; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_f_words = values[0]; + __pyx_v_e_words = values[1]; + __pyx_v_alignment = values[2]; + __pyx_v_ctx_name = values[3]; + } + 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 = 1891; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_25add_instance(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_words, __pyx_v_e_words, __pyx_v_alignment, __pyx_v_ctx_name); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* 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 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; + PyObject *__pyx_v_e_i = 0; + PyObject *__pyx_v_e_j = 0; + PyObject *__pyx_v_min_bound = 0; + PyObject *__pyx_v_wc = 0; + PyObject *__pyx_v_links = 0; + PyObject *__pyx_v_nt = 0; + PyObject *__pyx_v_nt_open = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("extract (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__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,0}; + PyObject* values[9] = {0,0,0,0,0,0,0,0,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 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__f_i)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __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 = 1925; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + } + __pyx_v_f_i = values[0]; + __pyx_v_f_j = values[1]; + __pyx_v_e_i = values[2]; + __pyx_v_e_j = values[3]; + __pyx_v_min_bound = values[4]; + __pyx_v_wc = values[5]; + __pyx_v_links = values[6]; + __pyx_v_nt = values[7]; + __pyx_v_nt_open = values[8]; + } + 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 = 1925; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_12add_instance_extract(__pyx_self, __pyx_v_f_i, __pyx_v_f_j, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, __pyx_v_nt_open); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1925 + * # 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: + */ + +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; + PyObject *__pyx_v_link_i = NULL; + PyObject *__pyx_v_link_j = NULL; + PyObject *__pyx_v_new_e_i = NULL; + PyObject *__pyx_v_new_e_j = NULL; + PyObject *__pyx_v_new_min_bound = NULL; + PyObject *__pyx_v_i = NULL; + int __pyx_v_nt_collision; + PyObject *__pyx_v_link = NULL; + PyObject *__pyx_v_plus_links = NULL; + PyObject *__pyx_v_old_last_nt = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + 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_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + int __pyx_t_13; + PyObject *__pyx_t_14 = NULL; + int __pyx_t_15; + 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_cur_scope = __pyx_outer_scope; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1927 + * 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 = 1927; __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 = 1927; __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 = 1927; __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 = 1927; __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 = 1927; __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 = 1927; __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 = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1927; __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 = 1927; __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 = 1927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_3; + } + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1928 + * # Phrase extraction limits + * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: + * return # <<<<<<<<<<<<<< + * # Unaligned word + * if not al[f_j]: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1930 + * 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 = 1930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1930; __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 = 1930; __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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1932 + * 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 = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1932; __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 = 1932; __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 = 1932; __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 = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __pyx_t_6; + } else { + __pyx_t_5 = __pyx_t_3; + } + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1933 + * # 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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __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, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __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 = 1933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetItemInt(__pyx_t_1, __pyx_t_7, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1933; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1934 + * 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 = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __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 = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = __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, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1934; __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_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1935 + * 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_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__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_7 = 2; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, __pyx_t_7, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_int_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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemInt(__pyx_t_4, __pyx_t_7, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1938 + * # 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 = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (!__pyx_t_5); + if (__pyx_t_3) { + __pyx_t_4 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_t_1 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__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 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_3; + } + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1939 + * # 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_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __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 = 1939; __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_1, __pyx_v_e_i, __pyx_v_e_j, __pyx_v_min_bound, __pyx_t_4, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1939; __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1940 + * 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 + * link_i = fe_span[f_j][0] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1942 + * 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 = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1942; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_8); __pyx_t_8 = 0; + __pyx_v_link_i = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1943 + * # 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(((PyObject *)__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 = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f_j); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_link_j = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1944 + * 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) + * # Check reverse links of newly covered words to see if they violate left + */ + __Pyx_INCREF(__pyx_v_e_i); + __pyx_t_8 = __pyx_v_e_i; + __Pyx_INCREF(__pyx_v_link_i); + __pyx_t_2 = __pyx_v_link_i; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1944; __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 = 1944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + __Pyx_INCREF(__pyx_t_8); + __pyx_t_4 = __pyx_t_8; + } else { + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __pyx_t_2; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __pyx_t_4; + __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_new_e_i = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1945 + * link_j = fe_span[f_j][1] + * new_e_i = min(link_i, e_i) + * new_e_j = max(link_j, e_j) # <<<<<<<<<<<<<< + * # Check reverse links of newly covered words to see if they violate left + * # bound (return) or extend minimum right bound for chunk + */ + __Pyx_INCREF(__pyx_v_e_j); + __pyx_t_8 = __pyx_v_e_j; + __Pyx_INCREF(__pyx_v_link_j); + __pyx_t_4 = __pyx_v_link_j; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1945; __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 = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + __Pyx_INCREF(__pyx_t_8); + __pyx_t_2 = __pyx_t_8; + } else { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = __pyx_t_4; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_new_e_j = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1948 + * # 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 # <<<<<<<<<<<<<< + * # First aligned word creates span + * if e_j == -1: + */ + __Pyx_INCREF(__pyx_v_min_bound); + __pyx_v_new_min_bound = __pyx_v_min_bound; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1950 + * 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_8 = PyObject_RichCompare(__pyx_v_e_j, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1950; __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 = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1951 + * # 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_AsInt(__pyx_v_new_e_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __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_8 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1952 + * 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 = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1952; __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 = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1953 + * 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]) + * # Other aligned words extend span + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1954 + * 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(((PyObject *)__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 = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_v_new_min_bound); + __pyx_t_8 = __pyx_v_new_min_bound; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1954; __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 = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __pyx_t_2; + } else { + __Pyx_INCREF(__pyx_t_8); + __pyx_t_4 = __pyx_t_8; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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(__pyx_v_new_min_bound); + __pyx_v_new_min_bound = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1951 + * # 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 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1957 + * # 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_AsInt(__pyx_v_new_e_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_e_i); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __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 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1958 + * 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 = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1958; __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 = 1958; __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 = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1959 + * 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]) + * for i from e_j < i <= new_e_j: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L13; + } + __pyx_L13:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1960 + * 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(((PyObject *)__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 = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_v_new_min_bound); + __pyx_t_2 = __pyx_v_new_min_bound; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1960; __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 = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = __pyx_t_4; + } else { + __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = __pyx_t_2; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_new_min_bound); + __pyx_v_new_min_bound = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1957 + * # 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 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1961 + * 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_AsInt(__pyx_v_e_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_new_e_j); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __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 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1962 + * 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 = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_v_f_i, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1963 + * 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]) + * # Extract, extend with word (unless non-terminal open) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L16; + } + __pyx_L16:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1964 + * 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(((PyObject *)__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 = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_i); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_v_new_min_bound); + __pyx_t_4 = __pyx_v_new_min_bound; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1964; __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 = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + __Pyx_INCREF(__pyx_t_8); + __pyx_t_2 = __pyx_t_8; + } else { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = __pyx_t_4; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_new_min_bound); + __pyx_v_new_min_bound = __pyx_t_8; + __pyx_t_8 = 0; + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1961 + * 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_8 = PyInt_FromLong(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_8; + __pyx_t_8 = 0; + } + __pyx_L7:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1966 + * 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 = 1966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((!__pyx_t_6) != 0); + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1967 + * # Extract, extend with word (unless non-terminal open) + * if not nt_open: + * nt_collision = False # <<<<<<<<<<<<<< + * for link in al[f_j]: + * if e_nt_cover[link]: + */ + __pyx_v_nt_collision = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1968 + * if not nt_open: + * nt_collision = False + * for link in al[f_j]: # <<<<<<<<<<<<<< + * if e_nt_cover[link]: + * nt_collision = True + */ + __pyx_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) { + __pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __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_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_8 = __pyx_t_12(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_XDECREF(__pyx_v_link); + __pyx_v_link = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1969 + * 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 = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover), __pyx_v_link); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 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_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1970 + * for link in al[f_j]: + * if e_nt_cover[link]: + * nt_collision = True # <<<<<<<<<<<<<< + * # Non-terminal collisions block word extraction and extension, but + * # may be okay for continuing non-terminals + */ + __pyx_v_nt_collision = 1; + goto __pyx_L20; + } + __pyx_L20:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1973 + * # 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) { + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1973; __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 = 1973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_5 = __pyx_t_6; + } else { + __pyx_t_5 = __pyx_t_3; + } + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1974 + * # 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_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_v_plus_links = ((PyObject*)__pyx_t_8); + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1975 + * 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_t_8 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) { + __pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __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_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_8); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_8 = __pyx_t_12(__pyx_t_2); + if (unlikely(!__pyx_t_8)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_XDECREF(__pyx_v_link); + __pyx_v_link = __pyx_t_8; + __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1976 + * plus_links = [] + * for link in al[f_j]: + * plus_links.append((f_j, link)) # <<<<<<<<<<<<<< + * cover[link] += 1 + * links.append(plus_links) + */ + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_f_j); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f_j); + __Pyx_GIVEREF(__pyx_v_f_j); + __Pyx_INCREF(__pyx_v_link); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_link); + __Pyx_GIVEREF(__pyx_v_link); + __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_plus_links, ((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1976; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1977 + * 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 = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_cover) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __pyx_t_14 = __pyx_cur_scope->__pyx_v_cover; + __Pyx_INCREF(__pyx_v_link); + __pyx_t_8 = __pyx_v_link; + if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_t_14), __pyx_t_8); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_int_1); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (PyObject_SetItem(((PyObject *)__pyx_t_14), __pyx_t_8, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1978 + * 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_2 = __Pyx_PyObject_Append(__pyx_v_links, ((PyObject *)__pyx_v_plus_links)); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1979 + * 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 = 1979; __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 = 1979; __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 = 1979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __pyx_t_3; + } else { + __pyx_t_6 = __pyx_t_5; + } + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1980 + * 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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 1980; __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 = 1980; __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 = 1980; __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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __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_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __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 = 1980; __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 = 1980; __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 = 1980; __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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_f_i); + PyTuple_SET_ITEM(__pyx_t_8, 0, __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); + __Pyx_GIVEREF(__pyx_v_new_e_i); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_nt); + PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_nt); + __Pyx_GIVEREF(__pyx_v_nt); + __Pyx_INCREF(__pyx_v_links); + PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_links); + __Pyx_GIVEREF(__pyx_v_links); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__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 = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L24; + } + __pyx_L24:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1981 + * 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 = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __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 = 1981; __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_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_8, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1981; __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_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1982 + * 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_1 = __Pyx_PyObject_Pop(__pyx_v_links); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1983 + * 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_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_al, __pyx_v_f_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __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; + __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 = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 1983; __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 = 1983; __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 = 1983; __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 = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_12(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_link); + __pyx_v_link = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1984 + * 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 = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_cover) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_INCREF(((PyObject *)__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; + if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_t_14), __pyx_t_1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = PyNumber_InPlaceSubtract(__pyx_t_8, __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_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(((PyObject *)__pyx_t_14) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (PyObject_SetItem(((PyObject *)__pyx_t_14), __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1984; __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; + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L21; + } + __pyx_L21:; + goto __pyx_L17; + } + __pyx_L17:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1986 + * 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 = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __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_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1986; __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 = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __pyx_t_5; + } else { + __pyx_t_3 = __pyx_t_6; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1988 + * 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_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_4, 0, 0, NULL, NULL, &__pyx_k_slice_141, 0, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_old_last_nt = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1989 + * # 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemInt(__pyx_t_2, 2, __pyx_v_f_j, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1990 + * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __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_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1991 + * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_check); 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); + if (unlikely(!__pyx_cur_scope->__pyx_v_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_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 = 1991; __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 = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_INCREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_1, 1, __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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__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 = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = ((!__pyx_t_3) != 0); + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1992 + * 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 (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1993 + * 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) + * span_inc(e_nt_cover, link_i, nt[-1][3] - 1) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L29; + } + __pyx_L29:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1994 + * 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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1994; __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_t_2, __pyx_int_1); 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); + __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_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_INCREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link_i); + __Pyx_GIVEREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); 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); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1995 + * 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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); 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); + __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 = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + __Pyx_INCREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_link_i); + __Pyx_GIVEREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); 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); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1996 + * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemInt(__pyx_t_2, 3, __pyx_v_link_i, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L28; + } + __pyx_L28:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1997 + * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __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_v_link_j, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1997; __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 = 1997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1998 + * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_check); 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_cover)) { __Pyx_RaiseClosureNameError("cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_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 = 1998; __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 = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_link_j); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_link_j); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__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 = 1998; __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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1999 + * 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 (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2000 + * 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) + * span_inc(e_nt_cover, nt[-1][4] + 1, link_j) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L31; + } + __pyx_L31:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2001 + * 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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2001; __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_Add(__pyx_t_2, __pyx_int_1); 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); + __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_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_link_j); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); 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); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2002 + * 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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(!__pyx_cur_scope->__pyx_v_e_nt_cover)) { __Pyx_RaiseClosureNameError("e_nt_cover"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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 = 2002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_link_j); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_link_j); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2002; __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_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2003 + * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemInt(__pyx_t_2, 4, __pyx_v_link_j, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L30; + } + __pyx_L30:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2004 + * 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 = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + __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 = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 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; + __pyx_t_5 = __pyx_t_6; + } else { + __pyx_t_5 = __pyx_t_3; + } + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2005 + * 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 = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 2005; __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 = 2005; __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 = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_f_words, 0, 0, &__pyx_v_f_i, &__pyx_t_4, NULL, 0, 0, 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_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_cur_scope->__pyx_v_e_words)) { __Pyx_RaiseClosureNameError("e_words"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = PyNumber_Add(__pyx_v_new_e_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_e_words, 0, 0, &__pyx_v_new_e_i, &__pyx_t_4, NULL, 0, 0, 1); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_f_i); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f_i); + __Pyx_GIVEREF(__pyx_v_f_i); + __Pyx_INCREF(__pyx_v_new_e_i); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_new_e_i); + __Pyx_GIVEREF(__pyx_v_new_e_i); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_nt); + PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_nt); + __Pyx_GIVEREF(__pyx_v_nt); + __Pyx_INCREF(__pyx_v_links); + PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_links); + __Pyx_GIVEREF(__pyx_v_links); + __pyx_t_1 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __pyx_t_8); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L32; + } + __pyx_L32:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2006 + * 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_8 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2006; __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 = 2006; __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_8, __pyx_v_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_v_wc, __pyx_v_links, __pyx_v_nt, __pyx_t_4); 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_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2007 + * 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 (__Pyx_SetItemInt(__pyx_v_nt, -1, __pyx_v_old_last_nt, sizeof(long), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2008 + * 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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_link_i, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2009 + * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); 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); + 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_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_t_4 = PyNumber_Subtract(__pyx_t_8, __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); + __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 = 2009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_INCREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_link_i); + __Pyx_GIVEREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); 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); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2010 + * 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 = 2010; __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 = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_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 = 2010; __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 = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + __Pyx_INCREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_2, 1, __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 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L33; + } + __pyx_L33:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2011 + * 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_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyObject_RichCompare(__pyx_v_link_j, __pyx_t_2, Py_GT); __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_2); __pyx_t_2 = 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) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2012 + * 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_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_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_2 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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 = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_link_j); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_link_j); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2013 + * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); 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); + 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_4 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_8, __pyx_int_1); 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); + __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_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_link_j); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); 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); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L34; + } + __pyx_L34:; + goto __pyx_L27; + } + __pyx_L27:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2015 + * 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 = 2015; __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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Subtract(__pyx_v_f_j, __pyx_t_8); 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); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __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 = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_3; + } + if (__pyx_t_6) { + __pyx_t_8 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_t_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2015; __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 = 2015; __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; + } else { + __pyx_t_3 = __pyx_t_6; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2017 + * 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 = 2017; __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 = 2017; __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 = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_INCREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_8, 1, __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); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), 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_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = ((!__pyx_t_3) != 0); + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2018 + * # Check for collisions + * 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) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L36; + } + __pyx_L36:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2019 + * 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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_inc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_INCREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_8, 1, __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); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2020 + * 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 = 2020; __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 = 2020; __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 = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + __Pyx_GIVEREF(((PyObject *)__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); + __Pyx_GIVEREF(__pyx_v_link_i); + __Pyx_INCREF(__pyx_v_link_j); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_link_j); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2021 + * 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 = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __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 = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_t_8; + __pyx_t_8 = 0; + } else { + __Pyx_INCREF(__pyx_int_1); + __pyx_t_2 = __pyx_int_1; + } + __pyx_t_8 = PyList_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_f_j); + PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_f_j); + __Pyx_GIVEREF(__pyx_v_f_j); + __Pyx_INCREF(__pyx_v_f_j); + PyList_SET_ITEM(__pyx_t_8, 2, __pyx_v_f_j); + __Pyx_GIVEREF(__pyx_v_f_j); + __Pyx_INCREF(__pyx_v_link_i); + PyList_SET_ITEM(__pyx_t_8, 3, __pyx_v_link_i); + __Pyx_GIVEREF(__pyx_v_link_i); + __Pyx_INCREF(__pyx_v_link_j); + PyList_SET_ITEM(__pyx_t_8, 4, __pyx_v_link_j); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_nt, ((PyObject *)__pyx_t_8)); 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); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2023 + * 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 = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { + __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 = 2023; __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 = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_15 = __pyx_t_3; + } else { + __pyx_t_15 = __pyx_t_6; + } + if (__pyx_t_15) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2024 + * # 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 = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 2024; __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 = 2024; __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 = 2024; __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 = 2024; __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 = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __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 = 2024; __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 = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __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_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_8); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(6); 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_INCREF(__pyx_v_f_i); + PyTuple_SET_ITEM(__pyx_t_8, 0, __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); + __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_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_nt); + PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_nt); + __Pyx_GIVEREF(__pyx_v_nt); + __Pyx_INCREF(__pyx_v_links); + PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_v_links); + __Pyx_GIVEREF(__pyx_v_links); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); 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_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_13 = PySet_Add(__pyx_cur_scope->__pyx_v_rules, __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; + goto __pyx_L37; + } + __pyx_L37:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2025 + * 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_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_PyBool_FromLong(0); 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_extract)) { __Pyx_RaiseClosureNameError("extract"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_4 = __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_new_e_i, __pyx_v_new_e_j, __pyx_v_new_min_bound, __pyx_t_8, __pyx_v_links, __pyx_v_nt, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2025; __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_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2026 + * 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_4 = __Pyx_PyObject_Pop(__pyx_v_nt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2027 + * 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_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); 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_2 = PyTuple_New(3); 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_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_cover)); + __Pyx_INCREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link_i); + __Pyx_GIVEREF(__pyx_v_link_i); + __Pyx_INCREF(__pyx_v_link_j); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); 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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2028 + * 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_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__span_dec); 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_t_2 = PyTuple_New(3); 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); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_e_nt_cover)); + __Pyx_INCREF(__pyx_v_link_i); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_link_i); + __Pyx_GIVEREF(__pyx_v_link_i); + __Pyx_INCREF(__pyx_v_link_j); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_link_j); + __Pyx_GIVEREF(__pyx_v_link_j); + __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L35; + } + __pyx_L35:; + + __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(((PyObject *)__pyx_t_14)); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_link_i); + __Pyx_XDECREF(__pyx_v_link_j); + __Pyx_XDECREF(__pyx_v_new_e_i); + __Pyx_XDECREF(__pyx_v_new_e_j); + __Pyx_XDECREF(__pyx_v_new_min_bound); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_link); + __Pyx_XDECREF(__pyx_v_plus_links); + __Pyx_XDECREF(__pyx_v_old_last_nt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1891 + * # 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 + */ + +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; + PyObject *__pyx_v_e_len = NULL; + PyObject *__pyx_v_f = NULL; + PyObject *__pyx_v_e = NULL; + CYTHON_UNUSED PyObject *__pyx_v_f_nt_cover = NULL; + long __pyx_v_f_i; + PyObject *__pyx_v_stats = NULL; + CYTHON_UNUSED PyObject *__pyx_v_lex_i = NULL; + CYTHON_UNUSED PyObject *__pyx_v_lex_j = NULL; + PyObject *__pyx_v_rule = NULL; + PyObject *__pyx_v_f_ph = NULL; + PyObject *__pyx_v_e_ph = NULL; + PyObject *__pyx_v_e_w = NULL; + PyObject *__pyx_v_f_w = NULL; + CYTHON_UNUSED PyObject *__pyx_v_i = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_t_9; + long __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + Py_ssize_t __pyx_t_15; + PyObject *(*__pyx_t_16)(PyObject *); + int __pyx_lineno = 0; + 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); + 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_f_words = __pyx_v_f_words; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_words); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_words); + __pyx_cur_scope->__pyx_v_e_words = __pyx_v_e_words; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_e_words); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_e_words); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1893 + * def add_instance(self, f_words, e_words, alignment, ctx_name=None): + * + * self.online = True # <<<<<<<<<<<<<< + * + * # Rules extracted from this instance + */ + __pyx_cur_scope->__pyx_v_self->online = 1; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1900 + * # 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 = 1900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_cur_scope->__pyx_v_rules = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1902 + * rules = set() + * + * f_len = len(f_words) # <<<<<<<<<<<<<< + * e_len = len(e_words) + * + */ + __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 = 1902; __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 = 1902; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1903 + * + * f_len = len(f_words) + * e_len = len(e_words) # <<<<<<<<<<<<<< + * + * # Pre-compute alignment info + */ + __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 = 1903; __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 = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_e_len = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1906 + * + * # 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 = 1906; __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 = 1906; __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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__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_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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + __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 = 1906; __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 = 1906; __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 = 1906; __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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_i); + __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 = 1906; __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 = 1906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_cur_scope->__pyx_v_al = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1907 + * # 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 = 1907; __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 = 1907; __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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__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_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 = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + __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 = 1907; __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 = 1907; __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 = 1907; __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 = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_4 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_i); + __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 = 1907; __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 = 1907; __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); + __Pyx_INCREF(__pyx_int_neg_1); + 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 = 1907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_cur_scope->__pyx_v_fe_span = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1908 + * 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 = 1908; __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 = 1908; __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 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (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 = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + __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 = 1908; __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 = 1908; __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 = 1908; __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 = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_6 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_6)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_XDECREF(__pyx_v_i); + __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 = 1908; __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 = 1908; __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); + __Pyx_INCREF(__pyx_int_neg_1); + 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 = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_cur_scope->__pyx_v_ef_span = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1909 + * 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)) { + __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 = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + 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 = 1909; __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 = 1909; __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 = 1909; __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 = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_3 = __pyx_t_5(__pyx_t_1); + if (unlikely(!__pyx_t_3)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + } + __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 = 1909; __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 = 1909; __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 = 1909; __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; + index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed; + __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 = 1909; __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; + __pyx_L11_unpacking_failed:; + __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 = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L12_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_v_e); + __pyx_v_e = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1910 + * 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 (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_e); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1910; __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_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1911 + * 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) + * ef_span[e][0] = min(ef_span[e][0], f) + */ + __Pyx_INCREF(__pyx_v_e); + __pyx_t_6 = __pyx_v_e; + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_9) { + __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = __pyx_t_6; + } else { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1912 + * al[f].append(e) + * 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) + * ef_span[e][1] = max(ef_span[e][1], f) + */ + __Pyx_INCREF(__pyx_v_e); + __pyx_t_6 = __pyx_v_e; + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_9) { + __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = __pyx_t_6; + } else { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_fe_span), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1913 + * 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) # <<<<<<<<<<<<<< + * ef_span[e][1] = max(ef_span[e][1], f) + * + */ + __Pyx_INCREF(__pyx_v_f); + __pyx_t_6 = __pyx_v_f; + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_9) { + __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = __pyx_t_6; + } else { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1914 + * 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) # <<<<<<<<<<<<<< + * + * # Target side word coverage + */ + __Pyx_INCREF(__pyx_v_f); + __pyx_t_6 = __pyx_v_f; + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_GT); __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_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_9) { + __Pyx_INCREF(__pyx_t_6); + __pyx_t_3 = __pyx_t_6; + } else { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_ef_span), __pyx_v_e); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_6, sizeof(long), PyInt_FromLong, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1917 + * + * # 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 = 1917; __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 = 1917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_temp); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_temp; + } + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_cur_scope->__pyx_v_cover = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1919 + * 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 = 1919; __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 = 1919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_temp); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_temp; + } + __pyx_v_f_nt_cover = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1920 + * # 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 = 1920; __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;} + __Pyx_GOTREF(__pyx_temp); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_temp; + } + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_cur_scope->__pyx_v_e_nt_cover = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1925 + * # 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_145, ((PyObject*)__pyx_cur_scope), __pyx_n_s_102, ((PyObject *)__pyx_k_codeobj_143)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2031 + * + * # 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_10 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_v_f_i = 0; __pyx_v_f_i < __pyx_t_10; __pyx_v_f_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2033 + * 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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = ((!__pyx_t_9) != 0); + if (__pyx_t_11) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2034 + * # 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) + * + */ + goto __pyx_L13_continue; + goto __pyx_L15; + } + __pyx_L15:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2035 + * 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 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyNumber_Add(__pyx_cur_scope->__pyx_v_f_len, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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 = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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_6, __pyx_t_3, __pyx_int_neg_1, __pyx_t_4, __pyx_int_0, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_12), __pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2035; __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_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_L13_continue:; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2037 + * 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 (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_v_stats = __pyx_t_14; + __pyx_t_14 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2042 + * # 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 = 2042; __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 = 2042; __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_12 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + if (PyList_CheckExact(__pyx_t_12) || PyTuple_CheckExact(__pyx_t_12)) { + __pyx_t_13 = __pyx_t_12; __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_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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_12 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __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_12 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_12 = __pyx_t_5(__pyx_t_13); + if (unlikely(!__pyx_t_12)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_12); + } + 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __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_7 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_14 = PyList_GET_ITEM(sequence, 0); + __pyx_t_7 = PyList_GET_ITEM(sequence, 1); + __pyx_t_4 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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_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_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L18_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 = 2042; __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; + __pyx_L18_unpacking_failed:; + __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 = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L19_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_14; + __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_v_lex_i); + __pyx_v_lex_i = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_v_lex_j); + __pyx_v_lex_j = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2043 + * # 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_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__samples_f); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_f); + __pyx_t_4 = __pyx_v_f; + __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_t_4); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyObject_SetItem(__pyx_t_12, __pyx_t_4, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2046 + * + * # 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(((PyObject *)__pyx_cur_scope->__pyx_v_rules)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; + for (;;) { + { + __pyx_t_12 = __pyx_t_5(__pyx_t_13); + if (unlikely(!__pyx_t_12)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_12); + } + __Pyx_XDECREF(__pyx_v_rule); + __pyx_v_rule = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2047 + * # 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_12 = __Pyx_PyObject_GetSlice(__pyx_v_rule, 0, 3, NULL, NULL, &__pyx_k_slice_146, 0, 1, 1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 3)) { + if (size > 3) __Pyx_RaiseTooManyValuesError(3); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); + } else { + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_14 = PyList_GET_ITEM(sequence, 1); + __pyx_t_7 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; + index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L22_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + 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_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 = 2047; __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; + __pyx_L22_unpacking_failed:; + __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 = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L23_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_f_ph); + __pyx_v_f_ph = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_v_e_ph); + __pyx_v_e_ph = __pyx_t_14; + __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_al); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_al); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_cur_scope->__pyx_v_al = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2048 + * 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_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_f); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_f_ph); + __pyx_t_7 = __pyx_v_f_ph; + __pyx_t_14 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2048; __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_12); __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2049 + * (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_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_e); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_e_ph); + __pyx_t_7 = __pyx_v_e_ph; + __pyx_t_4 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __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 = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2050 + * 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_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__phrases_fe); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_v_f_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_INCREF(__pyx_v_e_ph); + __pyx_t_12 = __pyx_v_e_ph; + __pyx_t_14 = PyObject_GetItem(__pyx_t_7, __pyx_t_12); if (!__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 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); 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_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (PyObject_SetItem(__pyx_t_7, __pyx_t_12, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2051 + * 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_al); 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_t_12 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_ph); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyObject_GetItem(__pyx_t_12, __pyx_v_e_ph); if (!__pyx_t_7) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = ((!__pyx_t_11) != 0); + if (__pyx_t_9) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2052 + * 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 counts + */ + __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 = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_ph); if (!__pyx_t_12) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyObject_SetItem(__pyx_t_12, __pyx_v_e_ph, __pyx_cur_scope->__pyx_v_al) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L24; + } + __pyx_L24:; + } + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2055 + * + * # Update Bilexical counts + * for e_w in e_words: # <<<<<<<<<<<<<< + * stats.bilex_e[e_w] += 1 + * for f_w in f_words: + */ + if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_e_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_e_words)) { + __pyx_t_13 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_5 = Py_TYPE(__pyx_t_13)->tp_iternext; + } + 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_12 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __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_12 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_12 = __pyx_t_5(__pyx_t_13); + if (unlikely(!__pyx_t_12)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_12); + } + __Pyx_XDECREF(__pyx_v_e_w); + __pyx_v_e_w = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2056 + * # Update Bilexical counts + * for e_w in e_words: + * stats.bilex_e[e_w] += 1 # <<<<<<<<<<<<<< + * for f_w in f_words: + * stats.bilex_f[f_w] += 1 + */ + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_e); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_e_w); + __pyx_t_7 = __pyx_v_e_w; + __pyx_t_4 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __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 = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __pyx_t_14) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2057 + * for e_w in e_words: + * stats.bilex_e[e_w] += 1 + * for f_w in f_words: # <<<<<<<<<<<<<< + * stats.bilex_f[f_w] += 1 + * for e_w in e_words: + */ + if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_f_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_f_words)) { + __pyx_t_13 = __pyx_cur_scope->__pyx_v_f_words; __Pyx_INCREF(__pyx_t_13); __pyx_t_2 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_f_words); 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; + } + 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_12 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __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_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __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_12 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2); __Pyx_INCREF(__pyx_t_12); __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_12 = PySequence_ITEM(__pyx_t_13, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_12 = __pyx_t_5(__pyx_t_13); + if (unlikely(!__pyx_t_12)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_12); + } + __Pyx_XDECREF(__pyx_v_f_w); + __pyx_v_f_w = __pyx_t_12; + __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2058 + * stats.bilex_e[e_w] += 1 + * for f_w in f_words: + * stats.bilex_f[f_w] += 1 # <<<<<<<<<<<<<< + * for e_w in e_words: + * stats.bilex_fe[f_w][e_w] += 1 + */ + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_f); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_f_w); + __pyx_t_7 = __pyx_v_f_w; + __pyx_t_14 = PyObject_GetItem(__pyx_t_12, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_14, __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_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (PyObject_SetItem(__pyx_t_12, __pyx_t_7, __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; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2059 + * for f_w in f_words: + * stats.bilex_f[f_w] += 1 + * for e_w in e_words: # <<<<<<<<<<<<<< + * stats.bilex_fe[f_w][e_w] += 1 + * + */ + if (PyList_CheckExact(__pyx_cur_scope->__pyx_v_e_words) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_e_words)) { + __pyx_t_12 = __pyx_cur_scope->__pyx_v_e_words; __Pyx_INCREF(__pyx_t_12); __pyx_t_15 = 0; + __pyx_t_16 = NULL; + } else { + __pyx_t_15 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_e_words); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_16 = Py_TYPE(__pyx_t_12)->tp_iternext; + } + for (;;) { + if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_12)) { + if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_12)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_15); __Pyx_INCREF(__pyx_t_7); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_12, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_12)) { + if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_15); __Pyx_INCREF(__pyx_t_7); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_12, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_7 = __pyx_t_16(__pyx_t_12); + if (unlikely(!__pyx_t_7)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_XDECREF(__pyx_v_e_w); + __pyx_v_e_w = __pyx_t_7; + __pyx_t_7 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2060 + * stats.bilex_f[f_w] += 1 + * for e_w in e_words: + * stats.bilex_fe[f_w][e_w] += 1 # <<<<<<<<<<<<<< + * + * # Create a rule from source, target, non-terminals, and alignments + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PyObject_GetItem(__pyx_t_7, __pyx_v_f_w); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_v_e_w); + __pyx_t_7 = __pyx_v_e_w; + __pyx_t_14 = PyObject_GetItem(__pyx_t_4, __pyx_t_7); if (!__pyx_t_14) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (PyObject_SetItem(__pyx_t_4, __pyx_t_7, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __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_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.add_instance", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_e_len); + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_e); + __Pyx_XDECREF(__pyx_v_f_nt_cover); + __Pyx_XDECREF(__pyx_v_stats); + __Pyx_XDECREF(__pyx_v_lex_i); + __Pyx_XDECREF(__pyx_v_lex_j); + __Pyx_XDECREF(__pyx_v_rule); + __Pyx_XDECREF(__pyx_v_f_ph); + __Pyx_XDECREF(__pyx_v_e_ph); + __Pyx_XDECREF(__pyx_v_e_w); + __Pyx_XDECREF(__pyx_v_f_w); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_28form_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_f_i = 0; + PyObject *__pyx_v_e_i = 0; + PyObject *__pyx_v_f_span = 0; + PyObject *__pyx_v_e_span = 0; + PyObject *__pyx_v_nt = 0; + PyObject *__pyx_v_al = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("form_rule (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f_i,&__pyx_n_s__e_i,&__pyx_n_s__f_span,&__pyx_n_s__e_span,&__pyx_n_s__nt,&__pyx_n_s__al,0}; + PyObject* values[6] = {0,0,0,0,0,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 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__f_i)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 2063; __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 = 2063; __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 = 2063; __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 = 2063; __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 = 2063; __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 = 2063; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + } + __pyx_v_f_i = values[0]; + __pyx_v_e_i = values[1]; + __pyx_v_f_span = values[2]; + __pyx_v_e_span = values[3]; + __pyx_v_nt = values[4]; + __pyx_v_al = values[5]; + } + 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 = 2063; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_27form_rule(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f_i, __pyx_v_e_i, __pyx_v_f_span, __pyx_v_e_span, __pyx_v_nt, __pyx_v_al); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7 = {__Pyx_NAMESTR("lambda7"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_x = 0; + PyObject *__pyx_v_y = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda7 (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,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__x)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 2066; __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 = 2066; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_x = values[0]; + __pyx_v_y = values[1]; + } + 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 = 2066; __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_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda7(__pyx_self, __pyx_v_x, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2066 + * + * # 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 + */ + +static PyObject *__pyx_lambda_funcdef_lambda7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) { + 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("lambda7", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __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 = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8 = {__Pyx_NAMESTR("lambda8"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_x = 0; + PyObject *__pyx_v_y = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda8 (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,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__x)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, 1); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda8") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_x = values[0]; + __pyx_v_y = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda8", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __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_lambda8(__pyx_self, __pyx_v_x, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2090 + * # 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) + */ + +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; + 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("lambda8", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_y, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __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 = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_3), NULL); 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule.lambda8", __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 */ + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2124 + * 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) + * + */ + +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; + 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); + 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_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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *(*__pyx_t_7)(PyObject *); + int __pyx_t_8; + int __pyx_t_9; + 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; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__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 = 2124; __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 = 2124; __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; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_5 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + #else + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __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 = 2124; __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 = 2124; __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; + index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed; + __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 = 2124; __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; + __pyx_L6_unpacking_failed:; + __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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L7_unpacking_done:; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_i); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_j); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_j); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_cur_scope->__pyx_v_j = __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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_i); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_j); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(((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 = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 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_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_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; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("genexpr", __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; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2063 + * + * # 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 + */ + +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; + PyObject *__pyx_v_nt_inv = NULL; + PyObject *__pyx_v_f_sym = NULL; + PyObject *__pyx_v_off = NULL; + PyObject *__pyx_v_next_nt = NULL; + PyObject *__pyx_v_nt_len = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_e_sym = NULL; + PyObject *__pyx_v_links_inv = NULL; + PyObject *__pyx_v_links_len = NULL; + PyObject *__pyx_v_nt_i = NULL; + PyObject *__pyx_v_lex_f_i = NULL; + PyObject *__pyx_v_lex_f_j = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_f = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *__pyx_v_e = NULL; + PyObject *__pyx_v_a = NULL; + PyObject *__pyx_v_sub = NULL; + PyObject *__pyx_v_link = 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)(PyObject *); + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + 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); + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2066 + * + * # 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 = 2066; __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 = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_lambda7, 0, __pyx_n_s_147, NULL, __pyx_n_s_102, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_nt_inv = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2067 + * # 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_k_slice_148, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __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 = 2067; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_f_sym = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2068 + * 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: + * nt_len = (next_nt[2] - next_nt[1]) + 1 + */ + __Pyx_INCREF(__pyx_v_f_i); + __pyx_v_off = __pyx_v_f_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2069 + * 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)) { + __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 = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + 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 = 2069; __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 = 2069; __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 = 2069; __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 = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF(__pyx_v_next_nt); + __pyx_v_next_nt = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2070 + * 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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2070; __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 = 2070; __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 = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_nt_len); + __pyx_v_nt_len = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2071 + * for next_nt in nt: + * nt_len = (next_nt[2] - next_nt[1]) + 1 + * i = 0 # <<<<<<<<<<<<<< + * while i < nt_len: + * f_sym.pop(next_nt[1] - off) + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2072 + * nt_len = (next_nt[2] - next_nt[1]) + 1 + * i = 0 + * while i < nt_len: # <<<<<<<<<<<<<< + * f_sym.pop(next_nt[1] - off) + * 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 = 2072; __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 = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_7) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2073 + * 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_PyObject_GetAttrStr(((PyObject *)__pyx_v_f_sym), __pyx_n_s__pop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_v_off); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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 = 2073; __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); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2073; __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_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2074 + * 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_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_2 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2075 + * 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_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_v_off); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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 = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyInt_FromLong(__pyx_f_4cdec_2sa_3_sa_sym_setindex(__pyx_cur_scope->__pyx_v_self->category, __pyx_t_9)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = PyList_Insert(__pyx_v_f_sym, __pyx_t_8, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2076 + * 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_6 = PyNumber_Subtract(__pyx_v_nt_len, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_6); 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_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_off); + __pyx_v_off = __pyx_t_2; + __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2077 + * 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_k_slice_149, 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 = 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 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__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(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_e_sym = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2078 + * off += (nt_len - 1) + * e_sym = list(e_span[:]) + * off = e_i # <<<<<<<<<<<<<< + * for next_nt in nt_inv: + * nt_len = (next_nt[4] - next_nt[3]) + 1 + */ + __Pyx_INCREF(__pyx_v_e_i); + __Pyx_DECREF(__pyx_v_off); + __pyx_v_off = __pyx_v_e_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2079 + * 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)) { + __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 = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + 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 = 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_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 = 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)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF(__pyx_v_next_nt); + __pyx_v_next_nt = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2080 + * 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_2 = __Pyx_GetItemInt(__pyx_v_next_nt, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_6); 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_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_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_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_nt_len); + __pyx_v_nt_len = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2081 + * for next_nt in nt_inv: + * nt_len = (next_nt[4] - next_nt[3]) + 1 + * i = 0 # <<<<<<<<<<<<<< + * while i < nt_len: + * e_sym.pop(next_nt[3] - off) + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2082 + * nt_len = (next_nt[4] - next_nt[3]) + 1 + * i = 0 + * while i < nt_len: # <<<<<<<<<<<<<< + * e_sym.pop(next_nt[3] - off) + * i += 1 + */ + while (1) { + __pyx_t_6 = PyObject_RichCompare(__pyx_v_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); 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_6); __pyx_t_6 = 0; + if (!__pyx_t_7) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2083 + * 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_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_e_sym), __pyx_n_s__pop); 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_t_1 = __Pyx_GetItemInt(__pyx_v_next_nt, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __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 = 2083; __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[8]; __pyx_lineno = 2083; __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(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2084 + * 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 = 2084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_2 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2085 + * 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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2085; __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 = 2085; __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 = 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, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_9 = __Pyx_PyInt_AsInt(__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 = PyInt_FromLong(__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_e_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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2086 + * 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 = 2086; __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 = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_off); + __pyx_v_off = __pyx_t_2; + __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2089 + * + * # 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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + 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 = 2089; __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 = 2089; __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 = 2089; __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF(__pyx_v_sub); + __pyx_v_sub = __pyx_t_1; + __pyx_t_1 = 0; + if (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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + 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 = 2089; __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 = 2089; __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 = 2089; __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 = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_6 = __pyx_t_11(__pyx_t_1); + if (unlikely(!__pyx_t_6)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_XDECREF(__pyx_v_link); + __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 = 2089; __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 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__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 = 2089; __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; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_cur_scope->__pyx_v_links = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2090 + * # 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 = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_links)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_links)); + __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_links)); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_1lambda8, 0, __pyx_n_s_147, NULL, __pyx_n_s_102, NULL); 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); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__cmp), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_links_inv = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2091 + * 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) + * nt_i = 0 + */ + __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_links); + __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 = 2091; __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 = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_links_len = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2092 + * 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 = 2092; __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 = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_nt_len); + __pyx_v_nt_len = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2093 + * links_len = len(links) + * nt_len = len(nt) + * nt_i = 0 # <<<<<<<<<<<<<< + * off = f_i + * i = 0 + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_nt_i = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2094 + * nt_len = len(nt) + * nt_i = 0 + * off = f_i # <<<<<<<<<<<<<< + * i = 0 + * while i < links_len: + */ + __Pyx_INCREF(__pyx_v_f_i); + __Pyx_DECREF(__pyx_v_off); + __pyx_v_off = __pyx_v_f_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2095 + * nt_i = 0 + * off = f_i + * i = 0 # <<<<<<<<<<<<<< + * while i < links_len: + * while nt_i < nt_len and links[i][0] > nt[nt_i][1]: + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2096 + * off = f_i + * i = 0 + * 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]) + */ + while (1) { + __pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2096; __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 = 2096; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_7) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2097 + * i = 0 + * 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 + */ + while (1) { + __pyx_t_1 = PyObject_RichCompare(__pyx_v_nt_i, __pyx_v_nt_len, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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 = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_7) { + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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_RichCompare(__pyx_t_2, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __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_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_14 = __pyx_t_13; + } else { + __pyx_t_14 = __pyx_t_7; + } + if (!__pyx_t_14) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2098 + * 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_1 = PyObject_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __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_GetItem(__pyx_v_nt, __pyx_v_nt_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __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_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __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_t_2 = PyNumber_InPlaceAdd(__pyx_v_off, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_off); + __pyx_v_off = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2099 + * 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_2 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); 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_DECREF(__pyx_v_nt_i); + __pyx_v_nt_i = __pyx_t_2; + __pyx_t_2 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2100 + * off += (nt[nt_i][2] - nt[nt_i][1]) + * nt_i += 1 + * links[i][0] -= off # <<<<<<<<<<<<<< + * i += 1 + * nt_i = 0 + */ + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_links), __pyx_v_i); if (!__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_4 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_v_off); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_SetItemInt(__pyx_t_2, __pyx_t_4, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2100; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2101 + * nt_i += 1 + * links[i][0] -= off + * i += 1 # <<<<<<<<<<<<<< + * nt_i = 0 + * off = e_i + */ + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_2 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2102 + * links[i][0] -= off + * i += 1 + * nt_i = 0 # <<<<<<<<<<<<<< + * off = e_i + * i = 0 + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_nt_i); + __pyx_v_nt_i = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2103 + * i += 1 + * nt_i = 0 + * off = e_i # <<<<<<<<<<<<<< + * i = 0 + * while i < links_len: + */ + __Pyx_INCREF(__pyx_v_e_i); + __Pyx_DECREF(__pyx_v_off); + __pyx_v_off = __pyx_v_e_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2104 + * nt_i = 0 + * off = e_i + * i = 0 # <<<<<<<<<<<<<< + * while i < links_len: + * while nt_i < nt_len and links_inv[i][1] > nt_inv[nt_i][3]: + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_int_0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2105 + * off = e_i + * i = 0 + * 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]) + */ + while (1) { + __pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_v_links_len, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_14) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2106 + * i = 0 + * 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 + */ + 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 = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 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_14) { + __pyx_t_2 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __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_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2106; __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_3, __pyx_t_1, Py_GT); __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_3); __pyx_t_3 = 0; + __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 = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_13 = __pyx_t_7; + } else { + __pyx_t_13 = __pyx_t_14; + } + if (!__pyx_t_13) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2107 + * 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_2 = PyObject_GetItem(__pyx_v_nt_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__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, 4, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__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_inv, __pyx_v_nt_i); if (!__pyx_t_2) {__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, 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__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 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2107; __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_InPlaceAdd(__pyx_v_off, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__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_DECREF(__pyx_v_off); + __pyx_v_off = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2108 + * 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_3 = PyNumber_InPlaceAdd(__pyx_v_nt_i, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_nt_i); + __pyx_v_nt_i = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2109 + * off += (nt_inv[nt_i][4] - nt_inv[nt_i][3]) + * nt_i += 1 + * links_inv[i][1] -= off # <<<<<<<<<<<<<< + * i += 1 + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_links_inv, __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = 1; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_4, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_off); 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(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemInt(__pyx_t_3, __pyx_t_4, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2109; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2110 + * nt_i += 1 + * links_inv[i][1] -= off + * i += 1 # <<<<<<<<<<<<<< + * + * # Find lexical span + */ + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); 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_v_i); + __pyx_v_i = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2113 + * + * # Find lexical span + * lex_f_i = f_i # <<<<<<<<<<<<<< + * lex_f_j = f_i + (len(f_span) - 1) + * if nt: + */ + __Pyx_INCREF(__pyx_v_f_i); + __pyx_v_lex_f_i = __pyx_v_f_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2114 + * # 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 = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_Add(__pyx_v_f_i, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_lex_f_j = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2115 + * 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 = 2115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_13) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2116 + * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2116; __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_RichCompare(__pyx_t_3, __pyx_v_lex_f_i, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__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_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); 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_1); __pyx_t_1 = 0; + if (__pyx_t_13) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2117 + * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2117; __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_t_3, __pyx_t_2); 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(__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 = 2117; __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_InPlaceAdd(__pyx_v_lex_f_i, __pyx_t_2); 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_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_lex_f_i); + __pyx_v_lex_f_i = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L24; + } + __pyx_L24:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2118 + * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __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_lex_f_j, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_13) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2119 + * 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_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_nt, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __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_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_lex_f_j, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_lex_f_j); + __pyx_v_lex_f_j = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L25; + } + __pyx_L25:; + goto __pyx_L23; + } + __pyx_L23:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2122 + * + * # 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_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_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_f_sym)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f_sym)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_f_sym)); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2123 + * # 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_e_sym)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_e_sym)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_e_sym)); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2124 + * 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 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_9form_rule_2genexpr(((PyObject*)__pyx_cur_scope)); 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); 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_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_a = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2125 + * 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) # <<<<<<<<<<<<<< + * + * # Rule string from rule + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_f)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); + __Pyx_INCREF(((PyObject *)__pyx_v_e)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_e)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_e)); + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + __Pyx_INCREF(__pyx_v_lex_f_i); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_lex_f_i); + __Pyx_GIVEREF(__pyx_v_lex_f_i); + __Pyx_INCREF(__pyx_v_lex_f_j); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_lex_f_j); + __Pyx_GIVEREF(__pyx_v_lex_f_j); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.form_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_nt_inv); + __Pyx_XDECREF(__pyx_v_f_sym); + __Pyx_XDECREF(__pyx_v_off); + __Pyx_XDECREF(__pyx_v_next_nt); + __Pyx_XDECREF(__pyx_v_nt_len); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_e_sym); + __Pyx_XDECREF(__pyx_v_links_inv); + __Pyx_XDECREF(__pyx_v_links_len); + __Pyx_XDECREF(__pyx_v_nt_i); + __Pyx_XDECREF(__pyx_v_lex_f_i); + __Pyx_XDECREF(__pyx_v_lex_f_j); + __Pyx_XDECREF((PyObject *)__pyx_v_f); + __Pyx_XDECREF((PyObject *)__pyx_v_e); + __Pyx_XDECREF(__pyx_v_a); + __Pyx_XDECREF(__pyx_v_sub); + __Pyx_XDECREF(__pyx_v_link); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_30fmt_rule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_f = 0; + PyObject *__pyx_v_e = 0; + PyObject *__pyx_v_a = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fmt_rule (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__a,0}; + PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__f)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 2128; __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 = 2128; __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 = 2128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_f = values[0]; + __pyx_v_e = values[1]; + __pyx_v_a = values[2]; + } + 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 = 2128; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_29fmt_rule(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f, __pyx_v_e, __pyx_v_a); + __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 */ + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2129 + * # 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) + * + */ + +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; + 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); + 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_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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = 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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __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 = 2129; __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)) { + __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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #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 = 2129; __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 = 2129; __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 = 2129; __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 = 2129; __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(); + else {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_packed); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_packed); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_packed = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_150), __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __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 = 2129; __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 = 2129; __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 = 2129; __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 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__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 = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2128 + * + * # 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) + */ + +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; + 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; + 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); + 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_a = __pyx_v_a; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_a); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2129 + * # 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_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); 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_t_2 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_8fmt_rule_genexpr(((PyObject*)__pyx_cur_scope)); 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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __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[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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_a_str = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2130 + * 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) # <<<<<<<<<<<<<< + * + * # Lookup online stats for phrase pair (f, e). Return None if no match. + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_151), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __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 = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __Pyx_INCREF(__pyx_v_e); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_e); + __Pyx_GIVEREF(__pyx_v_e); + __Pyx_INCREF(__pyx_v_a_str); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_a_str); + __Pyx_GIVEREF(__pyx_v_a_str); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.fmt_rule", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_a_str); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_32online_ctx_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_f = 0; + PyObject *__pyx_v_e = 0; + PyObject *__pyx_v_ctx_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("online_ctx_lookup (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__e,&__pyx_n_s__ctx_name,0}; + PyObject* values[3] = {0,0,0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2134 + * # 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): # <<<<<<<<<<<<<< + * if self.online: + * stats = self.online_stats[ctx_name] + */ + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__f)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 2134; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ctx_name); + if (value) { values[2] = value; kw_args--; } + } + } + 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 = 2134; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_f = values[0]; + __pyx_v_e = values[1]; + __pyx_v_ctx_name = values[2]; + } + 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 = 2134; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_lookup(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_f, __pyx_v_e, __pyx_v_ctx_name); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_31online_ctx_lookup(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e, PyObject *__pyx_v_ctx_name) { + PyObject *__pyx_v_stats = NULL; + PyObject *__pyx_v_fcount = NULL; + PyObject *__pyx_v_fsample_count = NULL; + PyObject *__pyx_v_d = NULL; + PyObject *__pyx_v_paircount = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + 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; + __Pyx_RefNannySetupContext("online_ctx_lookup", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2135 + * # IMPORTANT: use get() to avoid adding items to defaultdict + * 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) + */ + __pyx_t_1 = (__pyx_v_self->online != 0); + if (__pyx_t_1) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2136 + * 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 (!__pyx_t_2) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_stats = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2137 + * 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 = 2137; __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 = 2137; __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 = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2137; __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_2)); __pyx_t_2 = 0; + __pyx_v_fcount = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2138 + * 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 = 2138; __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 = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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 = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_fsample_count = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2139 + * 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_f, stats.bilex_e, stats.bilex_fe) + */ + __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 = 2139; __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 = 2139; __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 = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); 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_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_d = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2140 + * 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_f, stats.bilex_e, stats.bilex_fe) + * return None + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_d); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2140; __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 = 2140; __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 = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_e); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_e); + __Pyx_GIVEREF(__pyx_v_e); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); 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); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + } else { + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + } + __pyx_v_paircount = __pyx_t_2; + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2141 + * d = stats.phrases_fe.get(f, None) + * paircount = d.get(e, 0) if d else 0 + * return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe) # <<<<<<<<<<<<<< + * return None + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_152); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __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_f); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_e); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_stats, __pyx_n_s__bilex_fe); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_fcount); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fcount); + __Pyx_GIVEREF(__pyx_v_fcount); + __Pyx_INCREF(__pyx_v_fsample_count); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_fsample_count); + __Pyx_GIVEREF(__pyx_v_fsample_count); + __Pyx_INCREF(__pyx_v_paircount); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_paircount); + __Pyx_GIVEREF(__pyx_v_paircount); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2142 + * paircount = d.get(e, 0) if d else 0 + * return OnlineFeatureContext(fcount, fsample_count, paircount, stats.bilex_f, stats.bilex_e, stats.bilex_fe) + * return None # <<<<<<<<<<<<<< + * + * # Find all phrases that we might try to extract + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __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.HieroCachingRuleFactory.online_ctx_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_stats); + __Pyx_XDECREF(__pyx_v_fcount); + __Pyx_XDECREF(__pyx_v_fsample_count); + __Pyx_XDECREF(__pyx_v_d); + __Pyx_XDECREF(__pyx_v_paircount); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_34get_f_phrases(PyObject *__pyx_v_self, PyObject *__pyx_v_f_words); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_34get_f_phrases(PyObject *__pyx_v_self, PyObject *__pyx_v_f_words) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_f_phrases (wrapper)", 0); + __pyx_r = __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)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* 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 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; + PyObject *__pyx_v_lex_i = 0; + PyObject *__pyx_v_lex_j = 0; + PyObject *__pyx_v_wc = 0; + PyObject *__pyx_v_ntc = 0; + PyObject *__pyx_v_syms = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("extract (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__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,0}; + PyObject* values[7] = {0,0,0,0,0,0,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 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__f_i)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 2152; __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 = 2152; __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 = 2152; __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 = 2152; __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 = 2152; __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 = 2152; __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 = 2152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + } + __pyx_v_f_i = values[0]; + __pyx_v_f_j = values[1]; + __pyx_v_lex_i = values[2]; + __pyx_v_lex_j = values[3]; + __pyx_v_wc = values[4]; + __pyx_v_ntc = values[5]; + __pyx_v_syms = values[6]; + } + 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 = 2152; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_self, __pyx_v_f_i, __pyx_v_f_j, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_v_ntc, __pyx_v_syms); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152 + * 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: + */ + +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_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; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + 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_cur_scope = __pyx_outer_scope; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2154 + * 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 + */ + if (unlikely(!__pyx_cur_scope->__pyx_v_f_len)) { __Pyx_RaiseClosureNameError("f_len"); {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2154; __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 = 2154; __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 = 2154; __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 = 2154; __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 = 2154; __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 = 2154; __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 = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_initial_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2154; __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 = 2154; __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 = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_3; + } + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2155 + * # Phrase extraction limits + * if f_j > (f_len - 1) or (f_j - f_i) + 1 > self.max_initial_size: + * return # <<<<<<<<<<<<<< + * # Extend with word + * if wc + ntc < self.max_length: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2157 + * 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 = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_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 = 2157; __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_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2158 + * # 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 = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_f_words, __pyx_v_f_j); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2158; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2159 + * 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_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_syms); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_syms); + __Pyx_GIVEREF(__pyx_v_syms); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2160 + * 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) + * phrases.add((f, new_lex_i, new_lex_j)) + */ + __Pyx_INCREF(__pyx_v_f_j); + __pyx_t_1 = __pyx_v_f_j; + __Pyx_INCREF(__pyx_v_lex_i); + __pyx_t_2 = __pyx_v_lex_i; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_6) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; + } else { + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = __pyx_t_2; + } + __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_lex_i = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2161 + * f = Phrase(syms) + * 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) + */ + __Pyx_INCREF(__pyx_v_f_j); + __pyx_t_1 = __pyx_v_f_j; + __Pyx_INCREF(__pyx_v_lex_j); + __pyx_t_4 = __pyx_v_lex_j; + __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[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_6) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_t_1; + } else { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = __pyx_t_4; + } + __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_2); __pyx_t_2 = 0; + __pyx_v_new_lex_j = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2162 + * 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 = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 2162; __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 = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_f)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); + __Pyx_INCREF(__pyx_v_new_lex_i); + PyTuple_SET_ITEM(__pyx_t_1, 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_1, 2, __pyx_v_new_lex_j); + __Pyx_GIVEREF(__pyx_v_new_lex_j); + __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2163 + * 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_1 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Add(__pyx_v_wc, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2163; __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 = 2163; __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_1, __pyx_v_new_lex_i, __pyx_v_new_lex_j, __pyx_t_2, __pyx_v_ntc, __pyx_v_syms); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2163; __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_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2164 + * 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 = 2164; __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_L4:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2166 + * 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 = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_syms, -1, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2166; __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); + } else { + __pyx_t_3 = __pyx_t_6; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2168 + * 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 = 2168; __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 = 2168; __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_4, __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 = 2168; __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; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2170 + * 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_2 = PyNumber_Add(__pyx_v_wc, __pyx_v_ntc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_length); 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_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __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_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2171 + * # 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 = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = (!__pyx_t_3); + if (!__pyx_t_6) { + __pyx_t_1 = PyInt_FromLong(__pyx_cur_scope->__pyx_v_self->max_nonterminals); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_ntc, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __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 = 2171; __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, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__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_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2171; __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; + } else { + __pyx_t_3 = __pyx_t_6; + } + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2172 + * 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: + */ + __pyx_t_4 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromLong(__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 = 2172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_syms, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2172; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2173 + * 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_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_syms); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_syms); + __Pyx_GIVEREF(__pyx_v_syms); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_Phrase)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_XDECREF(((PyObject *)__pyx_v_f)); + __pyx_v_f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2174 + * 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_4 = PyObject_RichCompare(__pyx_v_wc, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_3) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2175 + * 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 = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(((PyObject *)__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 = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_f)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_f)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_f)); + __Pyx_INCREF(__pyx_v_lex_i); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_lex_i); + __Pyx_GIVEREF(__pyx_v_lex_i); + __Pyx_INCREF(__pyx_v_lex_j); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_lex_j); + __Pyx_GIVEREF(__pyx_v_lex_j); + __pyx_t_8 = PySet_Add(__pyx_cur_scope->__pyx_v_phrases, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2176 + * 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_4 = PyNumber_Add(__pyx_v_f_j, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyNumber_Add(__pyx_v_ntc, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __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 = 2176; __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_4, __pyx_v_lex_i, __pyx_v_lex_j, __pyx_v_wc, __pyx_t_1, __pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2176; __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; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2177 + * 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_2 = __Pyx_PyObject_Pop(__pyx_v_syms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + __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_7); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_f_phrases.extract", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_f); + __Pyx_XDECREF(__pyx_v_new_lex_i); + __Pyx_XDECREF(__pyx_v_new_lex_j); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2147 + * # (Used for EGivenFCoherent) + * # Return set of (fphrase, lex_i, lex_j) + * def get_f_phrases(self, f_words): # <<<<<<<<<<<<<< + * + * f_len = len(f_words) + */ + +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; + long __pyx_v_f_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + long __pyx_t_3; + 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; + __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); + 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_f_words = __pyx_v_f_words; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_f_words); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_f_words); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2149 + * def get_f_phrases(self, f_words): + * + * f_len = len(f_words) # <<<<<<<<<<<<<< + * phrases = set() # (fphrase, lex_i, lex_j) + * + */ + __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 = 2149; __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 = 2149; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2150 + * + * 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 = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_cur_scope->__pyx_v_phrases = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152 + * 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_155, ((PyObject*)__pyx_cur_scope), __pyx_n_s_102, ((PyObject *)__pyx_k_codeobj_154)); 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_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_extract = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2180 + * + * # 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, []) + * + */ + __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_cur_scope->__pyx_v_f_len); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_v_f_i = 0; __pyx_v_f_i < __pyx_t_3; __pyx_v_f_i++) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2181 + * # 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 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyInt_FromLong(__pyx_v_f_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __pyx_cur_scope->__pyx_v_f_len; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_13get_f_phrases_extract(__pyx_cur_scope->__pyx_v_extract, __pyx_t_1, __pyx_t_4, __pyx_t_5, __pyx_int_neg_1, __pyx_int_0, __pyx_int_0, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2181; __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_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2183 + * extract(f_i, f_i, f_len, -1, 0, 0, []) + * + * return phrases # <<<<<<<<<<<<<< + * + * # Drop online stats for a context + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_phrases)); + __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_phrases); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.get_f_phrases", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_36drop_ctx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_ctx_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("drop_ctx (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ctx_name,0}; + PyObject* values[1] = {0}; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2186 + * + * # Drop online stats for a context + * def drop_ctx(self, ctx_name=None): # <<<<<<<<<<<<<< + * self.online_stats.pop(ctx_name, None) + * + */ + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + 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__ctx_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, "drop_ctx") < 0)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_ctx_name = values[0]; + } + 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 = 2186; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)__pyx_v_self), __pyx_v_ctx_name); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_23HieroCachingRuleFactory_35drop_ctx(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *__pyx_v_self, PyObject *__pyx_v_ctx_name) { + 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("drop_ctx", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2187 + * # 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 = 2187; __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 = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_ctx_name); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ctx_name); + __Pyx_GIVEREF(__pyx_v_ctx_name); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2187; __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.HieroCachingRuleFactory.drop_ctx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_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 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; + PyObject *__pyx_v_j = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("span_check (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vec,&__pyx_n_s__i,&__pyx_n_s__j,0}; + PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__vec)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 2190; __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 = 2190; __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 = 2190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_vec = values[0]; + __pyx_v_i = values[1]; + __pyx_v_j = values[2]; + } + 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 = 2190; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_16span_check(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190 + * + * # Spans are _inclusive_ on both ends [i, j] + * def span_check(vec, i, j): # <<<<<<<<<<<<<< + * k = i + * while k <= j: + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_16span_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { + PyObject *__pyx_v_k = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("span_check", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2191 + * # Spans are _inclusive_ on both ends [i, j] + * def span_check(vec, i, j): + * k = i # <<<<<<<<<<<<<< + * while k <= j: + * if vec[k]: + */ + __Pyx_INCREF(__pyx_v_i); + __pyx_v_k = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2192 + * def span_check(vec, i, j): + * k = i + * while k <= j: # <<<<<<<<<<<<<< + * if vec[k]: + * 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 = 2192; __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 = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_2) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2193 + * k = i + * while k <= j: + * if vec[k]: # <<<<<<<<<<<<<< + * return False + * k += 1 + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_vec, __pyx_v_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2193; __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 = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2194 + * while k <= j: + * if vec[k]: + * return False # <<<<<<<<<<<<<< + * k += 1 + * return True + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2195 + * 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 = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2196 + * return False + * k += 1 + * return True # <<<<<<<<<<<<<< + * + * def span_inc(vec, i, j): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cdec.sa._sa.span_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_k); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* 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 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; + PyObject *__pyx_v_j = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("span_inc (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vec,&__pyx_n_s__i,&__pyx_n_s__j,0}; + PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__vec)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 2198; __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 = 2198; __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 = 2198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_vec = values[0]; + __pyx_v_i = values[1]; + __pyx_v_j = values[2]; + } + 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 = 2198; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_18span_inc(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198 + * return True + * + * def span_inc(vec, i, j): # <<<<<<<<<<<<<< + * k = i + * while k <= j: + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_18span_inc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { + PyObject *__pyx_v_k = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + 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("span_inc", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2199 + * + * def span_inc(vec, i, j): + * k = i # <<<<<<<<<<<<<< + * while k <= j: + * vec[k] += 1 + */ + __Pyx_INCREF(__pyx_v_i); + __pyx_v_k = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2200 + * def span_inc(vec, i, j): + * k = i + * while k <= j: # <<<<<<<<<<<<<< + * vec[k] += 1 + * 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 = 2200; __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 = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_2) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2201 + * k = i + * while k <= j: + * vec[k] += 1 # <<<<<<<<<<<<<< + * k += 1 + * + */ + __Pyx_INCREF(__pyx_v_k); + __pyx_t_1 = __pyx_v_k; + __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __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 = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2201; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2202 + * 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 = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_1; + __pyx_t_1 = 0; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.span_inc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_k); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* 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 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; + PyObject *__pyx_v_j = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("span_dec (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vec,&__pyx_n_s__i,&__pyx_n_s__j,0}; + PyObject* values[3] = {0,0,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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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__vec)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + 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 = 2204; __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 = 2204; __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 = 2204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_vec = values[0]; + __pyx_v_i = values[1]; + __pyx_v_j = values[2]; + } + 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 = 2204; __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(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_20span_dec(__pyx_self, __pyx_v_vec, __pyx_v_i, __pyx_v_j); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204 + * k += 1 + * + * def span_dec(vec, i, j): # <<<<<<<<<<<<<< + * k = i + * while k <= j: + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_20span_dec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vec, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { + PyObject *__pyx_v_k = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + 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("span_dec", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2205 + * + * def span_dec(vec, i, j): + * k = i # <<<<<<<<<<<<<< + * while k <= j: + * vec[k] -= 1 + */ + __Pyx_INCREF(__pyx_v_i); + __pyx_v_k = __pyx_v_i; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2206 + * def span_dec(vec, i, j): + * k = i + * while k <= j: # <<<<<<<<<<<<<< + * vec[k] -= 1 + * 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 = 2206; __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 = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_2) break; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2207 + * k = i + * while k <= j: + * vec[k] -= 1 # <<<<<<<<<<<<<< + * k += 1 + */ + __Pyx_INCREF(__pyx_v_k); + __pyx_t_1 = __pyx_v_k; + __pyx_t_3 = PyObject_GetItem(__pyx_v_vec, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2207; __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 = 2207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyObject_SetItem(__pyx_v_vec, __pyx_t_1, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2207; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2208 + * 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 = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_1; + __pyx_t_1 = 0; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.span_dec", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_k); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_13FeatureVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __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_2sa_3_sa_13FeatureVector___cinit__(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":7 + * + * cdef class FeatureVector: + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.names = IntList(INITIAL_CAPACITY, INCREMENT) + * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) + */ + +static int __pyx_pf_4cdec_2sa_3_sa_13FeatureVector___cinit__(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self) { + int __pyx_r; + __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("__cinit__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":8 + * cdef class FeatureVector: + * def __cinit__(self): + * self.names = IntList(INITIAL_CAPACITY, INCREMENT) # <<<<<<<<<<<<<< + * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) + * + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__INITIAL_CAPACITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__INCREMENT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __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[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_IntList)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->names); + __Pyx_DECREF(((PyObject *)__pyx_v_self->names)); + __pyx_v_self->names = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":9 + * def __cinit__(self): + * self.names = IntList(INITIAL_CAPACITY, INCREMENT) + * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) # <<<<<<<<<<<<<< + * + * def set(self, unsigned name, float value): + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__INITIAL_CAPACITY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__INCREMENT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 9; __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[13]; __pyx_lineno = 9; __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); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FloatList)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->values); + __Pyx_DECREF(((PyObject *)__pyx_v_self->values)); + __pyx_v_self->values = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)__pyx_t_3); + __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_3set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + unsigned int __pyx_v_name; + float __pyx_v_value; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__value,0}; + PyObject* values[2] = {0,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__name)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_name = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_name == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[13]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self), __pyx_v_name, __pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":11 + * self.values = FloatList(INITIAL_CAPACITY, INCREMENT) + * + * def set(self, unsigned name, float value): # <<<<<<<<<<<<<< + * self.names.append(name) + * self.values.append(value) + */ + +static PyObject *__pyx_pf_4cdec_2sa_3_sa_13FeatureVector_2set(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_self, unsigned int __pyx_v_name, float __pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":12 + * + * def set(self, unsigned name, float value): + * self.names.append(name) # <<<<<<<<<<<<<< + * self.values.append(value) + * + */ + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->names), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 12; __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; + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":13 + * def set(self, unsigned name, float value): + * self.names.append(name) + * self.values.append(value) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Append(((PyObject *)__pyx_v_self->values), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 13; __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; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.set", __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_13FeatureVector_6generator5(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_4__iter__(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":15 + * self.values.append(value) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * cdef unsigned i + * for i in range(self.names.len): + */ + +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; + 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); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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); + PyObject *__pyx_r = NULL; + int __pyx_t_1; + unsigned int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":17 + * def __iter__(self): + * cdef unsigned i + * for i in range(self.names.len): # <<<<<<<<<<<<<< + * yield (FD.word(self.names[i]), self.values[i]) + * + */ + __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->names->len; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_cur_scope->__pyx_v_i = __pyx_t_2; + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":18 + * cdef unsigned i + * for i in range(self.names.len): + * yield (FD.word(self.names[i]), self.values[i]) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self->names), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap *)__pyx_v_4cdec_2sa_3_sa_FD->__pyx_vtab)->word(__pyx_v_4cdec_2sa_3_sa_FD, __pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_cur_scope->__pyx_v_self->values), __pyx_cur_scope->__pyx_v_i, sizeof(unsigned int)+1, PyLong_FromUnsignedLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __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[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_r = ((PyObject *)__pyx_t_6); + __pyx_t_6 = 0; + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_8__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_8__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str__(((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_v_self)); + __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 */ + +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":21 + * + * def __str__(self): + * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< + * + * cdef class Scorer: + */ + +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; + 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); + 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_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_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cdec.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 */ +{ + 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); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + 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_L6_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[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))) { + __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; + } + 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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_feat); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_feat); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_feat = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_156), __pyx_cur_scope->__pyx_v_feat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L6_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("genexpr", __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; +} + +/* "/home/mdenkows/cdec/python/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) + * + */ + +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; + 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("__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); + 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); + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":21 + * + * def __str__(self): + * return ' '.join('%s=%s' % feat for feat in self) # <<<<<<<<<<<<<< + * + * cdef class Scorer: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__join); 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_2 = __pyx_pf_4cdec_2sa_3_sa_13FeatureVector_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 21; __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[13]; __pyx_lineno = 21; __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[13]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cdec.sa._sa.FeatureVector.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_4cdec_2sa_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_4cdec_2sa_3_sa_6Scorer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_models = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __Pyx_INCREF(__pyx_args); + __pyx_v_models = __pyx_args; + __pyx_r = __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)__pyx_v_self), __pyx_v_models); + __Pyx_XDECREF(__pyx_v_models); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":25 + * cdef class Scorer: + * cdef models + * def __init__(self, *models): # <<<<<<<<<<<<<< + * names = [FD.index(model.__name__) for model in models] + * self.models = zip(names, models) + */ + +static int __pyx_pf_4cdec_2sa_3_sa_6Scorer___init__(struct __pyx_obj_4cdec_2sa_3_sa_Scorer *__pyx_v_self, PyObject *__pyx_v_models) { + PyObject *__pyx_v_names = NULL; + PyObject *__pyx_v_model = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":26 + * cdef models + * def __init__(self, *models): + * names = [FD.index(model.__name__) for model in models] # <<<<<<<<<<<<<< + * self.models = zip(names, models) + * + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = ((PyObject *)__pyx_v_models); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + for (;;) { + 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[13]; __pyx_lineno = 26; __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[13]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_model); + __pyx_v_model = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s____name__); 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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromLong(((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; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_names = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":27 + * def __init__(self, *models): + * names = [FD.index(model.__name__) for model in models] + * self.models = zip(names, models) # <<<<<<<<<<<<<< + * + * cdef FeatureVector score(self, ctx): + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_names)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_names)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_names)); + __Pyx_INCREF(((PyObject *)__pyx_v_models)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_models)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_models)); + __pyx_t_2 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->models); + __Pyx_DECREF(__pyx_v_self->models); + __pyx_v_self->models = __pyx_t_2; + __pyx_t_2 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cdec.sa._sa.Scorer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_names); + __Pyx_XDECREF(__pyx_v_model); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":29 + * self.models = zip(names, models) + * + * cdef FeatureVector score(self, ctx): # <<<<<<<<<<<<<< + * cdef FeatureVector scores = FeatureVector() + * for name, model in self.models: + */ + +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) { + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_v_scores = 0; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_model = NULL; + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("score", 0); + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":30 + * + * cdef FeatureVector score(self, ctx): + * cdef FeatureVector scores = FeatureVector() # <<<<<<<<<<<<<< + * for name, model in self.models: + * scores.set(name, model(ctx)) + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cdec_2sa_3_sa_FeatureVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/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)) { + __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; + } + 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 + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + 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 + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 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[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[13]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_v_model); + __pyx_v_model = __pyx_t_6; + __pyx_t_6 = 0; + + /* "/home/mdenkows/cdec/python/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 = PyObject_Call(__pyx_v_model, ((PyObject *)__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(((PyObject *)__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_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__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_DECREF(((PyObject *)__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; + + /* "/home/mdenkows/cdec/python/cdec/sa/features.pxi":33 + * for name, model in self.models: + * scores.set(name, model(ctx)) + * return scores # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_scores)); + __pyx_r = __pyx_v_scores; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("cdec.sa._sa.Scorer.score", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_scores); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_model); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_FeatureVector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o); + p->names = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->values = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_13FeatureVector_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_FeatureVector(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p = (struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->names); + Py_CLEAR(p->values); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_FeatureVector(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p = (struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o; + if (p->names) { + e = (*v)(((PyObject*)p->names), a); if (e) return e; + } + if (p->values) { + e = (*v)(((PyObject*)p->values), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_FeatureVector(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *p = (struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)o; + PyObject* tmp; + tmp = ((PyObject*)p->names); + p->names = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->values); + p->values = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +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)}, + {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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_FeatureVector, /*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_2sa_3_sa_13FeatureVector_8__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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_FeatureVector, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_FeatureVector, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_4cdec_2sa_3_sa_13FeatureVector_5__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_FeatureVector, /*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_FeatureVector, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_SuffixArray __pyx_vtable_4cdec_2sa_3_sa_SuffixArray; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_SuffixArray(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_SuffixArray; + p->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_11SuffixArray_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_SuffixArray(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->darray); + Py_CLEAR(p->sa); + Py_CLEAR(p->ha); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_SuffixArray(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o; + if (p->darray) { + e = (*v)(((PyObject*)p->darray), a); if (e) return e; + } + if (p->sa) { + e = (*v)(((PyObject*)p->sa), a); if (e) return e; + } + if (p->ha) { + e = (*v)(((PyObject*)p->ha), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_SuffixArray(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)o; + PyObject* tmp; + tmp = ((PyObject*)p->darray); + p->darray = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sa); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->ha); + p->ha = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_4cdec_2sa_3_sa_SuffixArray(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_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)}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_SuffixArray = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4cdec_2sa_3_sa_SuffixArray, /*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_SuffixArray = { + 0, /*mp_length*/ + __pyx_pw_4cdec_2sa_3_sa_11SuffixArray_3__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_SuffixArray = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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_SuffixArray, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SuffixArray, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_SuffixArray, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_SuffixArray, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_SuffixArray, /*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_SuffixArray, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o); + p->__pyx_v_word_ids = 0; + p->__pyx_v_words = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o; + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o; + if (p->__pyx_v_word_ids) { + e = (*v)(p->__pyx_v_word_ids, a); if (e) return e; + } + if (p->__pyx_v_words) { + e = (*v)(p->__pyx_v_words, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_word_ids); + p->__pyx_v_word_ids = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_words); + p->__pyx_v_words = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_4_make_lattice, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice, /*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_4_make_lattice, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_24_fmt_rule *)o); + p->__pyx_v_a = 0; + p->__pyx_v_self = 0; + 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; + 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); + } 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) { + 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; + if (p->__pyx_v_a) { + e = (*v)(p->__pyx_v_a, 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_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; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_a); + p->__pyx_v_a = 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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*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_24_fmt_rule, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule, /*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_24_fmt_rule, /*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_2sa_3_sa_LCP(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_LCP *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); + p->lcp = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_3LCP_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_LCP(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_LCP *p = (struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->sa); + Py_CLEAR(p->lcp); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_LCP(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_LCP *p = (struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o; + if (p->sa) { + e = (*v)(((PyObject*)p->sa), a); if (e) return e; + } + if (p->lcp) { + e = (*v)(((PyObject*)p->lcp), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_LCP(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_LCP *p = (struct __pyx_obj_4cdec_2sa_3_sa_LCP *)o; + PyObject* tmp; + tmp = ((PyObject*)p->sa); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->lcp); + p->lcp = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +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)}, + {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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_LCP), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_LCP, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_LCP, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_LCP, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_LCP, /*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_LCP, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_17_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_a = 0; + p->__pyx_t_0 = 0; + 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; + 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); + } 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) { + 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; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_a) { + e = (*v)(p->__pyx_v_a, 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_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; + PyObject* tmp; + 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); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_a); + p->__pyx_v_a = 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_2sa_3_sa___pyx_scope_struct_17_genexpr[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_17_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 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_17_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_17_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_OnlineStats(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o); + p->samples_f = Py_None; Py_INCREF(Py_None); + p->phrases_f = Py_None; Py_INCREF(Py_None); + p->phrases_e = Py_None; Py_INCREF(Py_None); + p->phrases_fe = Py_None; Py_INCREF(Py_None); + p->phrases_al = Py_None; Py_INCREF(Py_None); + p->bilex_f = Py_None; Py_INCREF(Py_None); + p->bilex_e = Py_None; Py_INCREF(Py_None); + p->bilex_fe = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_11OnlineStats_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_OnlineStats(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p = (struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->samples_f); + Py_CLEAR(p->phrases_f); + Py_CLEAR(p->phrases_e); + Py_CLEAR(p->phrases_fe); + Py_CLEAR(p->phrases_al); + Py_CLEAR(p->bilex_f); + Py_CLEAR(p->bilex_e); + Py_CLEAR(p->bilex_fe); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_OnlineStats(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p = (struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o; + if (p->samples_f) { + e = (*v)(p->samples_f, a); if (e) return e; + } + if (p->phrases_f) { + e = (*v)(p->phrases_f, a); if (e) return e; + } + if (p->phrases_e) { + e = (*v)(p->phrases_e, a); if (e) return e; + } + if (p->phrases_fe) { + e = (*v)(p->phrases_fe, a); if (e) return e; + } + if (p->phrases_al) { + e = (*v)(p->phrases_al, a); if (e) return e; + } + if (p->bilex_f) { + e = (*v)(p->bilex_f, a); if (e) return e; + } + if (p->bilex_e) { + e = (*v)(p->bilex_e, a); if (e) return e; + } + if (p->bilex_fe) { + e = (*v)(p->bilex_fe, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_OnlineStats(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *p = (struct __pyx_obj_4cdec_2sa_3_sa_OnlineStats *)o; + PyObject* tmp; + tmp = ((PyObject*)p->samples_f); + p->samples_f = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->phrases_f); + p->phrases_f = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->phrases_e); + p->phrases_e = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->phrases_fe); + p->phrases_fe = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->phrases_al); + p->phrases_al = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->bilex_f); + p->bilex_f = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->bilex_e); + p->bilex_e = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->bilex_fe); + p->bilex_fe = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_samples_f(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_samples_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9samples_f_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_f_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_9phrases_e_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_fe_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_10phrases_al_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_f_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_7bilex_e_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_11OnlineStats_8bilex_fe_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_OnlineStats[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_OnlineStats[] = { + {(char *)"samples_f", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_samples_f, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_samples_f, 0, 0}, + {(char *)"phrases_f", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_f, 0, 0}, + {(char *)"phrases_e", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_e, 0, 0}, + {(char *)"phrases_fe", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_fe, 0, 0}, + {(char *)"phrases_al", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_phrases_al, 0, 0}, + {(char *)"bilex_f", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_f, 0, 0}, + {(char *)"bilex_e", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_e, 0, 0}, + {(char *)"bilex_fe", __pyx_getprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe, __pyx_setprop_4cdec_2sa_3_sa_11OnlineStats_bilex_fe, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_OnlineStats = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_OnlineStats, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_OnlineStats, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_OnlineStats, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4cdec_2sa_3_sa_OnlineStats, /*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_OnlineStats, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_IntList __pyx_vtable_4cdec_2sa_3_sa_IntList; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_IntList(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_IntList *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_IntList; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_7IntList_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_IntList(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_7IntList_15__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_2sa_3_sa_IntList(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_2sa_3_sa_IntList(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_7IntList_22__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_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)}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_IntList = { + __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4cdec_2sa_3_sa_IntList, /*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_IntList = { + __pyx_pw_4cdec_2sa_3_sa_7IntList_24__len__, /*mp_length*/ + __pyx_pw_4cdec_2sa_3_sa_7IntList_20__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_4cdec_2sa_3_sa_IntList, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_IntList = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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_IntList, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IntList, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_4cdec_2sa_3_sa_7IntList_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*/ + __pyx_pw_4cdec_2sa_3_sa_7IntList_17__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_IntList, /*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_IntList, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Phrase __pyx_vtable_4cdec_2sa_3_sa_Phrase; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Phrase(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Phrase *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + 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; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_6Phrase_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Phrase(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_6Phrase_3__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_2sa_3_sa_Phrase(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_2sa_3_sa_6Phrase_words(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_6Phrase_5words_1__get__(o); +} + +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)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Phrase[] = { + {(char *)"words", __pyx_getprop_4cdec_2sa_3_sa_6Phrase_words, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_Phrase = { + __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4cdec_2sa_3_sa_Phrase, /*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_Phrase = { + __pyx_pw_4cdec_2sa_3_sa_6Phrase_25__len__, /*mp_length*/ + __pyx_pw_4cdec_2sa_3_sa_6Phrase_27__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Phrase = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + __pyx_pw_4cdec_2sa_3_sa_6Phrase_21__cmp__, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_Phrase, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Phrase, /*tp_as_mapping*/ + __pyx_pw_4cdec_2sa_3_sa_6Phrase_23__hash__, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_4cdec_2sa_3_sa_6Phrase_5__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*/ + __pyx_pw_4cdec_2sa_3_sa_6Phrase_29__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_Phrase, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4cdec_2sa_3_sa_Phrase, /*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_Phrase, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieNode(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o); + p->children = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_8TrieNode_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieNode(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->children); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_TrieNode(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o; + if (p->children) { + e = (*v)(p->children, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_TrieNode(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieNode *)o; + PyObject* tmp; + tmp = ((PyObject*)p->children); + p->children = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_8TrieNode_children(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_8TrieNode_children(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_8TrieNode_8children_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_TrieNode[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_TrieNode[] = { + {(char *)"children", __pyx_getprop_4cdec_2sa_3_sa_8TrieNode_children, __pyx_setprop_4cdec_2sa_3_sa_8TrieNode_children, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieNode = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_TrieNode, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_TrieNode, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_TrieNode, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4cdec_2sa_3_sa_TrieNode, /*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_TrieNode, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_2_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_line = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)o; + PyObject_GC_UnTrack(o); + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_line) { + e = (*v)(p->__pyx_v_line, 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_2sa_3_sa___pyx_scope_struct_2_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_line); + p->__pyx_v_line = 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_2sa_3_sa___pyx_scope_struct_2_genexpr[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_2_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static 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[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_1_read_bitext *)o); + p->__pyx_v_fp = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o, visitproc v, void *a) { + int e; + 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; + if (p->__pyx_v_fp) { + e = (*v)(p->__pyx_v_fp, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext(PyObject *o) { + 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* tmp; + tmp = ((PyObject*)p->__pyx_v_fp); + p->__pyx_v_fp = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_1_read_bitext, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext, /*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_1_read_bitext, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_29_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_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; + 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); + } 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) { + 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; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_feat) { + e = (*v)(p->__pyx_v_feat, a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_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; + PyObject* tmp; + 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); + 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_2sa_3_sa___pyx_scope_struct_29_genexpr[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_29_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 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_29_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_29_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static 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 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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_26_get_f_phrases *)o); + p->__pyx_v_extract = 0; + p->__pyx_v_f_len = 0; + p->__pyx_v_f_words = 0; + p->__pyx_v_phrases = 0; + p->__pyx_v_self = 0; + 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; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_extract); + Py_CLEAR(p->__pyx_v_f_len); + 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); + } 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) { + 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; + if (p->__pyx_v_extract) { + e = (*v)(p->__pyx_v_extract, a); if (e) return e; + } + if (p->__pyx_v_f_len) { + e = (*v)(p->__pyx_v_f_len, a); if (e) return e; + } + if (p->__pyx_v_f_words) { + e = (*v)(p->__pyx_v_f_words, a); if (e) return e; + } + if (p->__pyx_v_phrases) { + e = (*v)(p->__pyx_v_phrases, 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_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; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_extract); + p->__pyx_v_extract = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_f_len); + p->__pyx_v_f_len = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_f_words); + p->__pyx_v_f_words = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_phrases); + p->__pyx_v_phrases = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_26_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*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_26_get_f_phrases, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_26_get_f_phrases, /*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_26_get_f_phrases, /*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_2sa_3_sa_ExtendedTrieNode(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p; + PyObject *o = __pyx_tp_new_4cdec_2sa_3_sa_TrieNode(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o); + p->phrase = Py_None; Py_INCREF(Py_None); + p->phrase_location = Py_None; Py_INCREF(Py_None); + p->suffix_link = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_ExtendedTrieNode(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->phrase); + Py_CLEAR(p->phrase_location); + Py_CLEAR(p->suffix_link); + PyObject_GC_Track(o); + __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieNode(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_ExtendedTrieNode(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o; + e = __pyx_tp_traverse_4cdec_2sa_3_sa_TrieNode(o, v, a); if (e) return e; + if (p->phrase) { + e = (*v)(p->phrase, a); if (e) return e; + } + if (p->phrase_location) { + e = (*v)(p->phrase_location, a); if (e) return e; + } + if (p->suffix_link) { + e = (*v)(p->suffix_link, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_ExtendedTrieNode(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *p = (struct __pyx_obj_4cdec_2sa_3_sa_ExtendedTrieNode *)o; + PyObject* tmp; + __pyx_tp_clear_4cdec_2sa_3_sa_TrieNode(o); + tmp = ((PyObject*)p->phrase); + p->phrase = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->phrase_location); + p->phrase_location = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->suffix_link); + p->suffix_link = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_6phrase_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_15phrase_location_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_16ExtendedTrieNode_11suffix_link_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_ExtendedTrieNode[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_ExtendedTrieNode[] = { + {(char *)"phrase", __pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase, __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase, 0, 0}, + {(char *)"phrase_location", __pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location, __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_phrase_location, 0, 0}, + {(char *)"suffix_link", __pyx_getprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link, __pyx_setprop_4cdec_2sa_3_sa_16ExtendedTrieNode_suffix_link, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_ExtendedTrieNode, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4cdec_2sa_3_sa_ExtendedTrieNode, /*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_ExtendedTrieNode, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alignment __pyx_vtable_4cdec_2sa_3_sa_Alignment; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Alignment(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Alignment; + p->links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9Alignment_5__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Alignment(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->links); + Py_CLEAR(p->sent_index); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Alignment(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o; + if (p->links) { + e = (*v)(((PyObject*)p->links), a); if (e) return e; + } + if (p->sent_index) { + e = (*v)(((PyObject*)p->sent_index), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_Alignment(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Alignment *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)o; + PyObject* tmp; + tmp = ((PyObject*)p->links); + p->links = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sent_index); + p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +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)}, + {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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Alignment), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_Alignment, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_Alignment, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Alignment, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_Alignment, /*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_Alignment, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_19_input(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_19_input *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_19_input *)o); + p->__pyx_v_alignment = 0; + p->__pyx_v_als = 0; + p->__pyx_v_alslist = 0; + p->__pyx_v_chunklen = 0; + p->__pyx_v_count = 0; + p->__pyx_v_ctx_name = 0; + p->__pyx_v_e = 0; + p->__pyx_v_elist = 0; + p->__pyx_v_extract = 0; + p->__pyx_v_extract_start = 0; + p->__pyx_v_extract_stop = 0; + p->__pyx_v_extracts = 0; + p->__pyx_v_f = 0; + p->__pyx_v_f_syms = 0; + p->__pyx_v_fcount = 0; + p->__pyx_v_fphrases = 0; + p->__pyx_v_frontier = 0; + p->__pyx_v_frontier_nodes = 0; + p->__pyx_v_fwords = 0; + p->__pyx_v_genexpr = 0; + p->__pyx_v_hiero_phrase = 0; + p->__pyx_v_input_match = 0; + p->__pyx_v_intersect_start_time = 0; + p->__pyx_v_intersect_stop_time = 0; + p->__pyx_v_is_shadow_path = 0; + p->__pyx_v_key = 0; + p->__pyx_v_lex_i = 0; + p->__pyx_v_lex_j = 0; + p->__pyx_v_loc = 0; + p->__pyx_v_locs = 0; + p->__pyx_v_max_locs = 0; + p->__pyx_v_meta = 0; + p->__pyx_v_new_frontier = 0; + p->__pyx_v_new_node = 0; + p->__pyx_v_next_states = 0; + p->__pyx_v_node = 0; + p->__pyx_v_nodes_isteps_away_buffer = 0; + p->__pyx_v_pathlen = 0; + p->__pyx_v_phrase = 0; + p->__pyx_v_phrase_location = 0; + p->__pyx_v_prefix = 0; + p->__pyx_v_reachable_buffer = 0; + p->__pyx_v_sa_range = 0; + p->__pyx_v_sample = 0; + p->__pyx_v_scores = 0; + p->__pyx_v_seen_phrases = 0; + p->__pyx_v_self = 0; + p->__pyx_v_spanlen = 0; + p->__pyx_v_stats = 0; + p->__pyx_v_stop_time = 0; + p->__pyx_v_suffix_link = 0; + p->__pyx_v_suffix_link_xcat_index = 0; + p->__pyx_v_word_id = 0; + p->__pyx_v_xcat_index = 0; + p->__pyx_v_xnode = 0; + p->__pyx_v_xroot = 0; + p->__pyx_t_3 = 0; + p->__pyx_t_4 = 0; + p->__pyx_t_5 = 0; + 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; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_alignment); + Py_CLEAR(p->__pyx_v_als); + Py_CLEAR(p->__pyx_v_alslist); + Py_CLEAR(p->__pyx_v_chunklen); + Py_CLEAR(p->__pyx_v_count); + Py_CLEAR(p->__pyx_v_ctx_name); + Py_CLEAR(p->__pyx_v_e); + Py_CLEAR(p->__pyx_v_elist); + Py_CLEAR(p->__pyx_v_extract); + Py_CLEAR(p->__pyx_v_extract_start); + Py_CLEAR(p->__pyx_v_extract_stop); + Py_CLEAR(p->__pyx_v_extracts); + Py_CLEAR(p->__pyx_v_f); + Py_CLEAR(p->__pyx_v_f_syms); + Py_CLEAR(p->__pyx_v_fcount); + Py_CLEAR(p->__pyx_v_fphrases); + Py_CLEAR(p->__pyx_v_frontier); + Py_CLEAR(p->__pyx_v_frontier_nodes); + Py_CLEAR(p->__pyx_v_fwords); + Py_CLEAR(p->__pyx_v_genexpr); + Py_CLEAR(p->__pyx_v_hiero_phrase); + Py_CLEAR(p->__pyx_v_input_match); + Py_CLEAR(p->__pyx_v_intersect_start_time); + Py_CLEAR(p->__pyx_v_intersect_stop_time); + Py_CLEAR(p->__pyx_v_is_shadow_path); + Py_CLEAR(p->__pyx_v_key); + Py_CLEAR(p->__pyx_v_lex_i); + Py_CLEAR(p->__pyx_v_lex_j); + Py_CLEAR(p->__pyx_v_loc); + Py_CLEAR(p->__pyx_v_locs); + Py_CLEAR(p->__pyx_v_max_locs); + Py_CLEAR(p->__pyx_v_meta); + Py_CLEAR(p->__pyx_v_new_frontier); + Py_CLEAR(p->__pyx_v_new_node); + Py_CLEAR(p->__pyx_v_next_states); + Py_CLEAR(p->__pyx_v_node); + Py_CLEAR(p->__pyx_v_nodes_isteps_away_buffer); + Py_CLEAR(p->__pyx_v_pathlen); + Py_CLEAR(p->__pyx_v_phrase); + Py_CLEAR(p->__pyx_v_phrase_location); + Py_CLEAR(p->__pyx_v_prefix); + Py_CLEAR(p->__pyx_v_reachable_buffer); + Py_CLEAR(p->__pyx_v_sa_range); + Py_CLEAR(p->__pyx_v_sample); + Py_CLEAR(p->__pyx_v_scores); + Py_CLEAR(p->__pyx_v_seen_phrases); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_v_spanlen); + Py_CLEAR(p->__pyx_v_stats); + Py_CLEAR(p->__pyx_v_stop_time); + Py_CLEAR(p->__pyx_v_suffix_link); + Py_CLEAR(p->__pyx_v_suffix_link_xcat_index); + Py_CLEAR(p->__pyx_v_word_id); + 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_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); + } 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) { + 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; + if (p->__pyx_v_alignment) { + e = (*v)(p->__pyx_v_alignment, a); if (e) return e; + } + if (p->__pyx_v_als) { + e = (*v)(p->__pyx_v_als, a); if (e) return e; + } + if (p->__pyx_v_alslist) { + e = (*v)(p->__pyx_v_alslist, a); if (e) return e; + } + if (p->__pyx_v_chunklen) { + e = (*v)(((PyObject*)p->__pyx_v_chunklen), a); if (e) return e; + } + if (p->__pyx_v_count) { + e = (*v)(p->__pyx_v_count, a); if (e) return e; + } + if (p->__pyx_v_ctx_name) { + e = (*v)(p->__pyx_v_ctx_name, a); if (e) return e; + } + if (p->__pyx_v_e) { + e = (*v)(p->__pyx_v_e, a); if (e) return e; + } + if (p->__pyx_v_elist) { + e = (*v)(p->__pyx_v_elist, a); if (e) return e; + } + if (p->__pyx_v_extract) { + e = (*v)(p->__pyx_v_extract, a); if (e) return e; + } + if (p->__pyx_v_extract_start) { + e = (*v)(p->__pyx_v_extract_start, a); if (e) return e; + } + if (p->__pyx_v_extract_stop) { + e = (*v)(p->__pyx_v_extract_stop, a); if (e) return e; + } + if (p->__pyx_v_extracts) { + e = (*v)(p->__pyx_v_extracts, a); if (e) return e; + } + if (p->__pyx_v_f) { + e = (*v)(p->__pyx_v_f, a); if (e) return e; + } + if (p->__pyx_v_f_syms) { + e = (*v)(p->__pyx_v_f_syms, a); if (e) return e; + } + if (p->__pyx_v_fcount) { + e = (*v)(p->__pyx_v_fcount, a); if (e) return e; + } + if (p->__pyx_v_fphrases) { + e = (*v)(p->__pyx_v_fphrases, a); if (e) return e; + } + if (p->__pyx_v_frontier) { + e = (*v)(p->__pyx_v_frontier, a); if (e) return e; + } + if (p->__pyx_v_frontier_nodes) { + e = (*v)(p->__pyx_v_frontier_nodes, a); if (e) return e; + } + if (p->__pyx_v_fwords) { + e = (*v)(p->__pyx_v_fwords, a); if (e) return e; + } + if (p->__pyx_v_genexpr) { + e = (*v)(p->__pyx_v_genexpr, a); if (e) return e; + } + if (p->__pyx_v_hiero_phrase) { + e = (*v)(((PyObject*)p->__pyx_v_hiero_phrase), a); if (e) return e; + } + if (p->__pyx_v_input_match) { + e = (*v)(p->__pyx_v_input_match, a); if (e) return e; + } + if (p->__pyx_v_intersect_start_time) { + e = (*v)(p->__pyx_v_intersect_start_time, a); if (e) return e; + } + if (p->__pyx_v_intersect_stop_time) { + e = (*v)(p->__pyx_v_intersect_stop_time, a); if (e) return e; + } + if (p->__pyx_v_is_shadow_path) { + e = (*v)(p->__pyx_v_is_shadow_path, 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_lex_i) { + e = (*v)(p->__pyx_v_lex_i, a); if (e) return e; + } + if (p->__pyx_v_lex_j) { + e = (*v)(p->__pyx_v_lex_j, a); if (e) return e; + } + if (p->__pyx_v_loc) { + e = (*v)(p->__pyx_v_loc, a); if (e) return e; + } + if (p->__pyx_v_locs) { + e = (*v)(p->__pyx_v_locs, a); if (e) return e; + } + if (p->__pyx_v_max_locs) { + e = (*v)(p->__pyx_v_max_locs, a); if (e) return e; + } + if (p->__pyx_v_meta) { + e = (*v)(p->__pyx_v_meta, a); if (e) return e; + } + if (p->__pyx_v_new_frontier) { + e = (*v)(p->__pyx_v_new_frontier, a); if (e) return e; + } + if (p->__pyx_v_new_node) { + e = (*v)(p->__pyx_v_new_node, a); if (e) return e; + } + if (p->__pyx_v_next_states) { + e = (*v)(p->__pyx_v_next_states, a); if (e) return e; + } + if (p->__pyx_v_node) { + e = (*v)(p->__pyx_v_node, a); if (e) return e; + } + if (p->__pyx_v_nodes_isteps_away_buffer) { + e = (*v)(p->__pyx_v_nodes_isteps_away_buffer, a); if (e) return e; + } + if (p->__pyx_v_pathlen) { + e = (*v)(p->__pyx_v_pathlen, a); if (e) return e; + } + if (p->__pyx_v_phrase) { + e = (*v)(p->__pyx_v_phrase, a); if (e) return e; + } + if (p->__pyx_v_phrase_location) { + e = (*v)(((PyObject*)p->__pyx_v_phrase_location), a); if (e) return e; + } + if (p->__pyx_v_prefix) { + e = (*v)(p->__pyx_v_prefix, a); if (e) return e; + } + if (p->__pyx_v_reachable_buffer) { + e = (*v)(p->__pyx_v_reachable_buffer, a); if (e) return e; + } + if (p->__pyx_v_sa_range) { + e = (*v)(p->__pyx_v_sa_range, a); if (e) return e; + } + if (p->__pyx_v_sample) { + e = (*v)(((PyObject*)p->__pyx_v_sample), a); if (e) return e; + } + if (p->__pyx_v_scores) { + e = (*v)(((PyObject*)p->__pyx_v_scores), a); if (e) return e; + } + if (p->__pyx_v_seen_phrases) { + e = (*v)(p->__pyx_v_seen_phrases, 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_spanlen) { + e = (*v)(p->__pyx_v_spanlen, a); if (e) return e; + } + if (p->__pyx_v_stats) { + e = (*v)(p->__pyx_v_stats, a); if (e) return e; + } + if (p->__pyx_v_stop_time) { + e = (*v)(p->__pyx_v_stop_time, a); if (e) return e; + } + if (p->__pyx_v_suffix_link) { + e = (*v)(p->__pyx_v_suffix_link, a); if (e) return e; + } + if (p->__pyx_v_suffix_link_xcat_index) { + e = (*v)(p->__pyx_v_suffix_link_xcat_index, a); if (e) return e; + } + if (p->__pyx_v_word_id) { + e = (*v)(p->__pyx_v_word_id, a); if (e) return e; + } + if (p->__pyx_v_xcat_index) { + e = (*v)(p->__pyx_v_xcat_index, a); if (e) return e; + } + if (p->__pyx_v_xnode) { + e = (*v)(p->__pyx_v_xnode, a); if (e) return e; + } + 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_4) { + e = (*v)(p->__pyx_t_4, a); if (e) return e; + } + if (p->__pyx_t_5) { + e = (*v)(p->__pyx_t_5, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_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; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_alignment); + p->__pyx_v_alignment = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_als); + p->__pyx_v_als = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_alslist); + p->__pyx_v_alslist = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_chunklen); + p->__pyx_v_chunklen = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_count); + p->__pyx_v_count = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_ctx_name); + p->__pyx_v_ctx_name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_e); + p->__pyx_v_e = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_elist); + p->__pyx_v_elist = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_extract); + p->__pyx_v_extract = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_extract_start); + p->__pyx_v_extract_start = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_extract_stop); + p->__pyx_v_extract_stop = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_extracts); + p->__pyx_v_extracts = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_f); + p->__pyx_v_f = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_f_syms); + p->__pyx_v_f_syms = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_fcount); + p->__pyx_v_fcount = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_fphrases); + p->__pyx_v_fphrases = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_frontier); + p->__pyx_v_frontier = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_frontier_nodes); + p->__pyx_v_frontier_nodes = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_fwords); + p->__pyx_v_fwords = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_genexpr); + p->__pyx_v_genexpr = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_hiero_phrase); + p->__pyx_v_hiero_phrase = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_input_match); + p->__pyx_v_input_match = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_intersect_start_time); + p->__pyx_v_intersect_start_time = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_intersect_stop_time); + p->__pyx_v_intersect_stop_time = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_is_shadow_path); + p->__pyx_v_is_shadow_path = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_key); + p->__pyx_v_key = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_lex_i); + p->__pyx_v_lex_i = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_lex_j); + p->__pyx_v_lex_j = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_loc); + p->__pyx_v_loc = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_locs); + p->__pyx_v_locs = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_max_locs); + p->__pyx_v_max_locs = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_meta); + p->__pyx_v_meta = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_new_frontier); + p->__pyx_v_new_frontier = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_new_node); + p->__pyx_v_new_node = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_next_states); + p->__pyx_v_next_states = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_node); + p->__pyx_v_node = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_nodes_isteps_away_buffer); + p->__pyx_v_nodes_isteps_away_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_pathlen); + p->__pyx_v_pathlen = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_phrase); + p->__pyx_v_phrase = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_phrase_location); + p->__pyx_v_phrase_location = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_prefix); + p->__pyx_v_prefix = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_reachable_buffer); + p->__pyx_v_reachable_buffer = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sa_range); + p->__pyx_v_sa_range = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sample); + p->__pyx_v_sample = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_scores); + p->__pyx_v_scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_seen_phrases); + p->__pyx_v_seen_phrases = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_spanlen); + p->__pyx_v_spanlen = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_stats); + p->__pyx_v_stats = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_stop_time); + p->__pyx_v_stop_time = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_suffix_link); + p->__pyx_v_suffix_link = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_suffix_link_xcat_index); + p->__pyx_v_suffix_link_xcat_index = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_word_id); + p->__pyx_v_word_id = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_xcat_index); + p->__pyx_v_xcat_index = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_xnode); + p->__pyx_v_xnode = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + 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); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_4); + p->__pyx_t_4 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_5); + p->__pyx_t_5 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_19_input[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*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_19_input, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_19_input, /*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_19_input, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_13_decode_words *)o); + p->__pyx_v_syms = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyObject *o) { + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyObject *o, visitproc v, void *a) { + int e; + 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; + if (p->__pyx_v_syms) { + e = (*v)(p->__pyx_v_syms, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words(PyObject *o) { + 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* tmp; + tmp = ((PyObject*)p->__pyx_v_syms); + p->__pyx_v_syms = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_13_decode_words, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words, /*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_13_decode_words, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_23_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_i = 0; + p->__pyx_v_j = 0; + p->__pyx_t_0 = 0; + 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; + 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); + } 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) { + 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; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), 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_j) { + e = (*v)(p->__pyx_v_j, 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_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; + PyObject* tmp; + 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); + 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_j); + p->__pyx_v_j = 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_2sa_3_sa___pyx_scope_struct_23_genexpr[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 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_23_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Rule(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Rule *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o); + p->f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); + p->e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); + p->scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); + p->word_alignments = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_4Rule_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Rule(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Rule *p = (struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->f); + Py_CLEAR(p->e); + Py_CLEAR(p->scores); + Py_CLEAR(p->word_alignments); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Rule(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_Rule *p = (struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o; + if (p->f) { + e = (*v)(((PyObject*)p->f), a); if (e) return e; + } + if (p->e) { + e = (*v)(((PyObject*)p->e), a); if (e) return e; + } + if (p->scores) { + e = (*v)(((PyObject*)p->scores), a); if (e) return e; + } + if (p->word_alignments) { + e = (*v)(p->word_alignments, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_Rule(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Rule *p = (struct __pyx_obj_4cdec_2sa_3_sa_Rule *)o; + PyObject* tmp; + tmp = ((PyObject*)p->f); + p->f = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->e); + p->e = ((struct __pyx_obj_4cdec_2sa_3_sa_Phrase *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->scores); + p->scores = ((struct __pyx_obj_4cdec_2sa_3_sa_FeatureVector *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->word_alignments); + p->word_alignments = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_4Rule_f(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_4Rule_1f_1__get__(o); +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_4Rule_e(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_4Rule_1e_1__get__(o); +} + +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)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Rule[] = { + {(char *)"f", __pyx_getprop_4cdec_2sa_3_sa_4Rule_f, 0, 0, 0}, + {(char *)"e", __pyx_getprop_4cdec_2sa_3_sa_4Rule_e, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Rule = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + __pyx_pw_4cdec_2sa_3_sa_4Rule_5__cmp__, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + __pyx_pw_4cdec_2sa_3_sa_4Rule_3__hash__, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_4cdec_2sa_3_sa_4Rule_11__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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_Rule, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Rule, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_Rule, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4cdec_2sa_3_sa_Rule, /*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_Rule, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_20_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_word = 0; + p->__pyx_t_0 = 0; + 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; + 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); + } 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) { + 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; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_word) { + e = (*v)(p->__pyx_v_word, 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_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; + PyObject* tmp; + 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); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_word); + p->__pyx_v_word = 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_2sa_3_sa___pyx_scope_struct_20_genexpr[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 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_20_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Precomputation __pyx_vtable_4cdec_2sa_3_sa_Precomputation; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Precomputation(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Precomputation; + p->precomputed_index = Py_None; Py_INCREF(Py_None); + p->precomputed_collocations = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_14Precomputation_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Precomputation(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p = (struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->precomputed_index); + Py_CLEAR(p->precomputed_collocations); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Precomputation(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p = (struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o; + if (p->precomputed_index) { + e = (*v)(p->precomputed_index, a); if (e) return e; + } + if (p->precomputed_collocations) { + e = (*v)(p->precomputed_collocations, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_Precomputation(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *p = (struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *)o; + PyObject* tmp; + tmp = ((PyObject*)p->precomputed_index); + p->precomputed_index = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->precomputed_collocations); + p->precomputed_collocations = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +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)}, + {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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_Precomputation, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_Precomputation, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Precomputation, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_Precomputation, /*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_Precomputation, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__ *p; + 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__)); + 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_2sa_3_sa___pyx_scope_struct_27___iter__ *)o); + p->__pyx_v_self = 0; + 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; + 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); + } 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) { + 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; + 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) { + 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; + PyObject* tmp; + 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 PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_27___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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*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_27___iter__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_27___iter__, /*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_27___iter__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static 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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_21_add_instance *)o); + p->__pyx_v_al = 0; + p->__pyx_v_cover = 0; + p->__pyx_v_e_nt_cover = 0; + p->__pyx_v_e_words = 0; + p->__pyx_v_ef_span = 0; + p->__pyx_v_extract = 0; + p->__pyx_v_f_len = 0; + p->__pyx_v_f_words = 0; + p->__pyx_v_fe_span = 0; + p->__pyx_v_rules = 0; + p->__pyx_v_self = 0; + 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; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_al); + Py_CLEAR(p->__pyx_v_cover); + Py_CLEAR(p->__pyx_v_e_nt_cover); + Py_CLEAR(p->__pyx_v_e_words); + Py_CLEAR(p->__pyx_v_ef_span); + Py_CLEAR(p->__pyx_v_extract); + Py_CLEAR(p->__pyx_v_f_len); + Py_CLEAR(p->__pyx_v_f_words); + 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); + } 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) { + 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; + if (p->__pyx_v_al) { + e = (*v)(p->__pyx_v_al, a); if (e) return e; + } + if (p->__pyx_v_cover) { + e = (*v)(p->__pyx_v_cover, a); if (e) return e; + } + if (p->__pyx_v_e_nt_cover) { + e = (*v)(p->__pyx_v_e_nt_cover, a); if (e) return e; + } + if (p->__pyx_v_e_words) { + e = (*v)(p->__pyx_v_e_words, a); if (e) return e; + } + if (p->__pyx_v_ef_span) { + e = (*v)(p->__pyx_v_ef_span, a); if (e) return e; + } + if (p->__pyx_v_extract) { + e = (*v)(p->__pyx_v_extract, a); if (e) return e; + } + if (p->__pyx_v_f_len) { + e = (*v)(p->__pyx_v_f_len, a); if (e) return e; + } + if (p->__pyx_v_f_words) { + e = (*v)(p->__pyx_v_f_words, a); if (e) return e; + } + if (p->__pyx_v_fe_span) { + e = (*v)(p->__pyx_v_fe_span, a); if (e) return e; + } + if (p->__pyx_v_rules) { + e = (*v)(p->__pyx_v_rules, 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_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; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_al); + p->__pyx_v_al = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_cover); + p->__pyx_v_cover = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_e_nt_cover); + p->__pyx_v_e_nt_cover = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_e_words); + p->__pyx_v_e_words = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_ef_span); + p->__pyx_v_ef_span = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_extract); + p->__pyx_v_extract = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_f_len); + p->__pyx_v_f_len = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_f_words); + p->__pyx_v_f_words = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_fe_span); + p->__pyx_v_fe_span = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_rules); + p->__pyx_v_rules = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*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_21_add_instance, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance, /*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_21_add_instance, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_TrieMap __pyx_vtable_4cdec_2sa_3_sa_TrieMap; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_TrieMap(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieMap *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_TrieMap; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_7TrieMap_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieMap(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_7TrieMap_3__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_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)}, + {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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_TrieMap), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieMap, /*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*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_TrieMap, /*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_TrieMap, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_18_alignments *)o); + p->__pyx_v_point = 0; + p->__pyx_v_self = 0; + p->__pyx_t_0 = 0; + 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; + 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); + } 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) { + 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; + if (p->__pyx_v_point) { + e = (*v)(p->__pyx_v_point, 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_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_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; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_point); + p->__pyx_v_point = 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_Rule *)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_2sa_3_sa___pyx_scope_struct_18_alignments[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_18_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*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_18_alignments, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_18_alignments, /*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_18_alignments, /*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_2sa_3_sa_VEBIterator(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_2sa_3_sa_VEBIterator(PyObject *o) { + (*Py_TYPE(o)->tp_free)(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)}, + {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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_VEBIterator), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_VEBIterator, /*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*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + __pyx_pw_4cdec_2sa_3_sa_11VEBIterator_1__next__, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_VEBIterator, /*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_VEBIterator, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_5_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_word = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_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_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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_word) { + e = (*v)(p->__pyx_v_word, 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_2sa_3_sa___pyx_scope_struct_5_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)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); + 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_2sa_3_sa___pyx_scope_struct_5_genexpr[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_5_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_FloatList __pyx_vtable_4cdec_2sa_3_sa_FloatList; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_FloatList(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_FloatList *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_FloatList; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9FloatList_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_FloatList(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_9FloatList_3__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_2sa_3_sa_FloatList(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_2sa_3_sa_FloatList(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9FloatList_7__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_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)}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_FloatList = { + __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4cdec_2sa_3_sa_FloatList, /*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_FloatList = { + __pyx_pw_4cdec_2sa_3_sa_9FloatList_9__len__, /*mp_length*/ + __pyx_pw_4cdec_2sa_3_sa_9FloatList_5__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_4cdec_2sa_3_sa_FloatList, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_FloatList = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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_FloatList, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_FloatList, /*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*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_FloatList, /*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_FloatList, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_StringMap __pyx_vtable_4cdec_2sa_3_sa_StringMap; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_StringMap(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_StringMap *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_StringMap; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9StringMap_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_StringMap(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_9StringMap_3__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_2sa_3_sa_StringMap[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_StringMap = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_StringMap, /*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_StringMap, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__ *p; + 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__)))) { + 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__)); + 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_2sa_3_sa___pyx_scope_struct_15___iter__ *)o); + p->__pyx_v_self = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyObject *o) { + 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__))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__(PyObject *o, visitproc v, void *a) { + int e; + 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; + 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_15___iter__(PyObject *o) { + 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* 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); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_15___iter__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_15___iter__, /*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_15___iter__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static 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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_16___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_16___str__ *p; + 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__)); + 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_2sa_3_sa___pyx_scope_struct_16___str__ *)o); + p->__pyx_v_self = 0; + 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; + 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); + } 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) { + 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; + 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) { + 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; + PyObject* tmp; + 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 PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_16___str__[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_16___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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 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___str__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_16___str__, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_16___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_2sa_3_sa___pyx_scope_struct_16___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_2sa_3_sa_TrieTable(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o); + p->root = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9TrieTable_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_TrieTable(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->root); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_TrieTable(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o; + if (p->root) { + e = (*v)(p->root, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_TrieTable(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *p = (struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)o; + PyObject* tmp; + tmp = ((PyObject*)p->root); + p->root = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9TrieTable_extended(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_extended(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_8extended_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9TrieTable_count(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_count(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_5count_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9TrieTable_root(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_root(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_9TrieTable_4root_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_TrieTable[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_TrieTable[] = { + {(char *)"extended", __pyx_getprop_4cdec_2sa_3_sa_9TrieTable_extended, __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_extended, 0, 0}, + {(char *)"count", __pyx_getprop_4cdec_2sa_3_sa_9TrieTable_count, __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_count, 0, 0}, + {(char *)"root", __pyx_getprop_4cdec_2sa_3_sa_9TrieTable_root, __pyx_setprop_4cdec_2sa_3_sa_9TrieTable_root, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_TrieTable = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_TrieTable, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_TrieTable, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_TrieTable, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4cdec_2sa_3_sa_TrieTable, /*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_TrieTable, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_11_encode_words *)o); + p->__pyx_v_words = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyObject *o) { + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyObject *o, visitproc v, void *a) { + int e; + 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; + if (p->__pyx_v_words) { + e = (*v)(p->__pyx_v_words, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words(PyObject *o) { + 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* tmp; + tmp = ((PyObject*)p->__pyx_v_words); + p->__pyx_v_words = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_11_encode_words, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words, /*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_11_encode_words, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_25_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_packed = 0; + p->__pyx_t_0 = 0; + 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; + 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); + } 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) { + 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; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_packed) { + e = (*v)(p->__pyx_v_packed, 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_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; + PyObject* tmp; + 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); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_packed); + p->__pyx_v_packed = 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_2sa_3_sa___pyx_scope_struct_25_genexpr[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 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_25_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_12_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_word = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_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_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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_word) { + e = (*v)(p->__pyx_v_word, 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_2sa_3_sa___pyx_scope_struct_12_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words *)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); + 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_2sa_3_sa___pyx_scope_struct_12_genexpr[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_12_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_6_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_word = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_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_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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___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_word) { + e = (*v)(p->__pyx_v_word, 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_2sa_3_sa___pyx_scope_struct_6_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice *)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); + 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_2sa_3_sa___pyx_scope_struct_6_genexpr[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_6_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static 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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule *p; + 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)); + 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_2sa_3_sa___pyx_scope_struct_22_form_rule *)o); + p->__pyx_v_links = 0; + p->__pyx_v_self = 0; + 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; + 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); + } 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) { + 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; + if (p->__pyx_v_links) { + e = (*v)(p->__pyx_v_links, 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_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; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_links); + p->__pyx_v_links = ((PyObject*)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_HieroCachingRuleFactory *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*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_22_form_rule, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule, /*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_22_form_rule, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_10_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v__ = 0; + p->__pyx_v_sym = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v__) { + e = (*v)(p->__pyx_v__, a); if (e) return e; + } + if (p->__pyx_v_sym) { + e = (*v)(p->__pyx_v_sym, 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_2sa_3_sa___pyx_scope_struct_10_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v__); + p->__pyx_v__ = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sym); + p->__pyx_v_sym = 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_2sa_3_sa___pyx_scope_struct_10_genexpr[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_10_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_VEB __pyx_vtable_4cdec_2sa_3_sa_VEB; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_VEB(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_VEB *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_VEB; + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_3VEB_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_VEB(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_3VEB_3__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_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)}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_VEB = { + __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + __pyx_pw_4cdec_2sa_3_sa_3VEB_13__contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_VEB = { + __pyx_pw_4cdec_2sa_3_sa_3VEB_11__len__, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_VEB = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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_VEB, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_VEB, /*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_2sa_3_sa_3VEB_5__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_VEB, /*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_VEB, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice = 0; + +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)o); + p->__pyx_v_lattice = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o) { + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o, visitproc v, void *a) { + int e; + 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; + if (p->__pyx_v_lattice) { + e = (*v)(p->__pyx_v_lattice, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice(PyObject *o) { + 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* tmp; + tmp = ((PyObject*)p->__pyx_v_lattice); + p->__pyx_v_lattice = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_7_decode_lattice, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice, /*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_7_decode_lattice, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_PhraseLocation __pyx_vtable_4cdec_2sa_3_sa_PhraseLocation; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_PhraseLocation(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_PhraseLocation; + p->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_14PhraseLocation_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_PhraseLocation(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->arr); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_PhraseLocation(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o; + if (p->arr) { + e = (*v)(((PyObject*)p->arr), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_PhraseLocation(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *p = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *)o; + PyObject* tmp; + tmp = ((PyObject*)p->arr); + p->arr = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_PhraseLocation[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_PhraseLocation = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_PhraseLocation, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_PhraseLocation, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_PhraseLocation, /*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_PhraseLocation, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Scorer __pyx_vtable_4cdec_2sa_3_sa_Scorer; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Scorer(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Scorer; + p->models = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Scorer(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p = (struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->models); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Scorer(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p = (struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o; + if (p->models) { + e = (*v)(p->models, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_Scorer(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Scorer *p = (struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)o; + PyObject* tmp; + tmp = ((PyObject*)p->models); + p->models = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Scorer[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Scorer = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_Scorer, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Scorer, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_Scorer, /*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_2sa_3_sa_6Scorer_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa_Scorer, /*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_2sa_3_sa_Sampler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_7Sampler_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Sampler(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p = (struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->sa); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Sampler(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p = (struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o; + if (p->sa) { + e = (*v)(((PyObject*)p->sa), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_Sampler(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Sampler *p = (struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)o; + PyObject* tmp; + tmp = ((PyObject*)p->sa); + p->sa = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +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)}, + {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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_Sampler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_Sampler, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("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*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_Sampler, /*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_Sampler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_Alphabet __pyx_vtable_4cdec_2sa_3_sa_Alphabet; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_Alphabet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_Alphabet; + p->terminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + p->nonterminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_8Alphabet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_Alphabet(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o; + PyObject_GC_UnTrack(o); + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_8Alphabet_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_CLEAR(p->terminals); + Py_CLEAR(p->nonterminals); + Py_CLEAR(p->id2sym); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_Alphabet(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o; + if (p->terminals) { + e = (*v)(((PyObject*)p->terminals), a); if (e) return e; + } + if (p->nonterminals) { + e = (*v)(((PyObject*)p->nonterminals), a); if (e) return e; + } + if (p->id2sym) { + e = (*v)(p->id2sym, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_Alphabet(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *p = (struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)o; + PyObject* tmp; + tmp = ((PyObject*)p->terminals); + p->terminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->nonterminals); + p->nonterminals = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->id2sym); + p->id2sym = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_8Alphabet_terminals(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_8Alphabet_9terminals_1__get__(o); +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_8Alphabet_nonterminals(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_8Alphabet_12nonterminals_1__get__(o); +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa_Alphabet[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_Alphabet[] = { + {(char *)"terminals", __pyx_getprop_4cdec_2sa_3_sa_8Alphabet_terminals, 0, 0, 0}, + {(char *)"nonterminals", __pyx_getprop_4cdec_2sa_3_sa_8Alphabet_nonterminals, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_Alphabet = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_Alphabet, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_Alphabet, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_Alphabet, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4cdec_2sa_3_sa_Alphabet, /*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_Alphabet, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_BiLex __pyx_vtable_4cdec_2sa_3_sa_BiLex; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BiLex(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_BiLex; + p->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + p->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + p->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->id2eword = Py_None; Py_INCREF(Py_None); + p->id2fword = Py_None; Py_INCREF(Py_None); + p->eword2id = Py_None; Py_INCREF(Py_None); + p->fword2id = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_5BiLex_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_BiLex(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p = (struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->col1); + Py_CLEAR(p->col2); + Py_CLEAR(p->f_index); + Py_CLEAR(p->e_index); + Py_CLEAR(p->id2eword); + Py_CLEAR(p->id2fword); + Py_CLEAR(p->eword2id); + Py_CLEAR(p->fword2id); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_BiLex(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p = (struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o; + if (p->col1) { + e = (*v)(((PyObject*)p->col1), a); if (e) return e; + } + if (p->col2) { + e = (*v)(((PyObject*)p->col2), a); if (e) return e; + } + if (p->f_index) { + e = (*v)(((PyObject*)p->f_index), a); if (e) return e; + } + if (p->e_index) { + e = (*v)(((PyObject*)p->e_index), a); if (e) return e; + } + if (p->id2eword) { + e = (*v)(p->id2eword, a); if (e) return e; + } + if (p->id2fword) { + e = (*v)(p->id2fword, a); if (e) return e; + } + if (p->eword2id) { + e = (*v)(p->eword2id, a); if (e) return e; + } + if (p->fword2id) { + e = (*v)(p->fword2id, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_BiLex(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_BiLex *p = (struct __pyx_obj_4cdec_2sa_3_sa_BiLex *)o; + PyObject* tmp; + tmp = ((PyObject*)p->col1); + p->col1 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->col2); + p->col2 = ((struct __pyx_obj_4cdec_2sa_3_sa_FloatList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->f_index); + p->f_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->e_index); + p->e_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->id2eword); + p->id2eword = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->id2fword); + p->id2fword = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->eword2id); + p->eword2id = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->fword2id); + p->fword2id = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +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("get_e_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_7get_e_id, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_f_id"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_9get_f_id, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_11read_text, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_enhanced"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_13write_enhanced, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_score"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_15get_score, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("write_text"), (PyCFunction)__pyx_pw_4cdec_2sa_3_sa_5BiLex_17write_text, METH_O, __Pyx_DOCSTR(__pyx_doc_4cdec_2sa_3_sa_5BiLex_16write_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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_BiLex), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_BiLex, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_BiLex, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_BiLex, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_BiLex, /*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_BiLex, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_DataArray __pyx_vtable_4cdec_2sa_3_sa_DataArray; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_DataArray(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_DataArray; + p->word2id = Py_None; Py_INCREF(Py_None); + p->id2word = Py_None; Py_INCREF(Py_None); + p->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_9DataArray_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_DataArray(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->word2id); + Py_CLEAR(p->id2word); + Py_CLEAR(p->data); + Py_CLEAR(p->sent_id); + Py_CLEAR(p->sent_index); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_DataArray(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o; + if (p->word2id) { + e = (*v)(p->word2id, a); if (e) return e; + } + if (p->id2word) { + e = (*v)(p->id2word, a); if (e) return e; + } + if (p->data) { + e = (*v)(((PyObject*)p->data), a); if (e) return e; + } + if (p->sent_id) { + e = (*v)(((PyObject*)p->sent_id), a); if (e) return e; + } + if (p->sent_index) { + e = (*v)(((PyObject*)p->sent_index), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_DataArray(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_DataArray *p = (struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)o; + PyObject* tmp; + tmp = ((PyObject*)p->word2id); + p->word2id = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->id2word); + p->id2word = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->data); + p->data = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sent_id); + p->sent_id = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sent_index); + p->sent_index = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_4cdec_2sa_3_sa_DataArray(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_2sa_3_sa_9DataArray_word2id(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_word2id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7word2id_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_id2word(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_id2word(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7id2word_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_data(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_data(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_4data_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_id(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_7sent_id_5__del__(o); + } +} + +static PyObject *__pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_index(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_1__get__(o); +} + +static int __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_index(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { + if (v) { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_3__set__(o, v); + } + else { + return __pyx_pw_4cdec_2sa_3_sa_9DataArray_10sent_index_5__del__(o); + } +} + +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)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4cdec_2sa_3_sa_DataArray[] = { + {(char *)"word2id", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_word2id, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_word2id, 0, 0}, + {(char *)"id2word", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_id2word, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_id2word, 0, 0}, + {(char *)"data", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_data, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_data, 0, 0}, + {(char *)"sent_id", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_id, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_id, 0, 0}, + {(char *)"sent_index", __pyx_getprop_4cdec_2sa_3_sa_9DataArray_sent_index, __pyx_setprop_4cdec_2sa_3_sa_9DataArray_sent_index, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_DataArray = { + __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4cdec_2sa_3_sa_DataArray, /*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_DataArray = { + __pyx_pw_4cdec_2sa_3_sa_9DataArray_3__len__, /*mp_length*/ + __pyx_pw_4cdec_2sa_3_sa_9DataArray_11__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_DataArray = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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_DataArray, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_DataArray, /*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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_DataArray, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_DataArray, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_DataArray, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4cdec_2sa_3_sa_DataArray, /*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_DataArray, /*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_2sa_3_sa_BitSetIterator(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_2sa_3_sa_BitSetIterator(PyObject *o) { + (*Py_TYPE(o)->tp_free)(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)}, + {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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_BitSetIterator), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_BitSetIterator, /*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*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + __pyx_pw_4cdec_2sa_3_sa_14BitSetIterator_1__next__, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_BitSetIterator, /*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_BitSetIterator, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_4cdec_2sa_3_sa_HieroCachingRuleFactory __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o); + p->__pyx_vtab = __pyx_vtabptr_4cdec_2sa_3_sa_HieroCachingRuleFactory; + p->rules = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)Py_None); Py_INCREF(Py_None); + p->sampler = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)Py_None); Py_INCREF(Py_None); + p->scorer = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)Py_None); Py_INCREF(Py_None); + p->precomputed_index = Py_None; Py_INCREF(Py_None); + p->precomputed_collocations = Py_None; Py_INCREF(Py_None); + p->precompute_file = Py_None; Py_INCREF(Py_None); + p->max_rank = Py_None; Py_INCREF(Py_None); + p->prev_norm_prefix = Py_None; Py_INCREF(Py_None); + p->fsa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); + p->fda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + p->eda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + p->alignment = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)Py_None); Py_INCREF(Py_None); + p->eid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->fid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->findexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->findexes1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + p->online_stats = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_4cdec_2sa_3_sa_23HieroCachingRuleFactory_1__cinit__(o, a, k) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->rules); + Py_CLEAR(p->sampler); + Py_CLEAR(p->scorer); + Py_CLEAR(p->precomputed_index); + Py_CLEAR(p->precomputed_collocations); + Py_CLEAR(p->precompute_file); + Py_CLEAR(p->max_rank); + Py_CLEAR(p->prev_norm_prefix); + Py_CLEAR(p->fsa); + Py_CLEAR(p->fda); + Py_CLEAR(p->eda); + Py_CLEAR(p->alignment); + Py_CLEAR(p->eid2symid); + Py_CLEAR(p->fid2symid); + Py_CLEAR(p->findexes); + Py_CLEAR(p->findexes1); + Py_CLEAR(p->online_stats); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o; + if (p->rules) { + e = (*v)(((PyObject*)p->rules), a); if (e) return e; + } + if (p->sampler) { + e = (*v)(((PyObject*)p->sampler), a); if (e) return e; + } + if (p->scorer) { + e = (*v)(((PyObject*)p->scorer), a); if (e) return e; + } + if (p->precomputed_index) { + e = (*v)(p->precomputed_index, a); if (e) return e; + } + if (p->precomputed_collocations) { + e = (*v)(p->precomputed_collocations, a); if (e) return e; + } + if (p->precompute_file) { + e = (*v)(p->precompute_file, a); if (e) return e; + } + if (p->max_rank) { + e = (*v)(p->max_rank, a); if (e) return e; + } + if (p->prev_norm_prefix) { + e = (*v)(p->prev_norm_prefix, a); if (e) return e; + } + if (p->fsa) { + e = (*v)(((PyObject*)p->fsa), a); if (e) return e; + } + if (p->fda) { + e = (*v)(((PyObject*)p->fda), a); if (e) return e; + } + if (p->eda) { + e = (*v)(((PyObject*)p->eda), a); if (e) return e; + } + if (p->alignment) { + e = (*v)(((PyObject*)p->alignment), a); if (e) return e; + } + if (p->eid2symid) { + e = (*v)(((PyObject*)p->eid2symid), a); if (e) return e; + } + if (p->fid2symid) { + e = (*v)(((PyObject*)p->fid2symid), a); if (e) return e; + } + if (p->findexes) { + e = (*v)(((PyObject*)p->findexes), a); if (e) return e; + } + if (p->findexes1) { + e = (*v)(((PyObject*)p->findexes1), a); if (e) return e; + } + if (p->online_stats) { + e = (*v)(p->online_stats, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa_HieroCachingRuleFactory(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *p = (struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *)o; + PyObject* tmp; + tmp = ((PyObject*)p->rules); + p->rules = ((struct __pyx_obj_4cdec_2sa_3_sa_TrieTable *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sampler); + p->sampler = ((struct __pyx_obj_4cdec_2sa_3_sa_Sampler *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->scorer); + p->scorer = ((struct __pyx_obj_4cdec_2sa_3_sa_Scorer *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->precomputed_index); + p->precomputed_index = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->precomputed_collocations); + p->precomputed_collocations = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->precompute_file); + p->precompute_file = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->max_rank); + p->max_rank = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->prev_norm_prefix); + p->prev_norm_prefix = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->fsa); + p->fsa = ((struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->fda); + p->fda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->eda); + p->eda = ((struct __pyx_obj_4cdec_2sa_3_sa_DataArray *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->alignment); + p->alignment = ((struct __pyx_obj_4cdec_2sa_3_sa_Alignment *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->eid2symid); + p->eid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->fid2symid); + p->fid2symid = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->findexes); + p->findexes = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->findexes1); + p->findexes1 = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->online_stats); + p->online_stats = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +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)}, + {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*/ + sizeof(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*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|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*/ + __pyx_tp_traverse_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_HieroCachingRuleFactory, /*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_HieroCachingRuleFactory, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_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 PyObject *__pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_28___str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_28___str__ *p; + 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__)); + 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_2sa_3_sa___pyx_scope_struct_28___str__ *)o); + p->__pyx_v_self = 0; + 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; + 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); + } 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) { + 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; + 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) { + 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; + PyObject* tmp; + 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 PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_28___str__[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_28___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*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + 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_28___str__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_28___str__, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_28___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_2sa_3_sa___pyx_scope_struct_28___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 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[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o); + p->__pyx_v_ngram = 0; + p->__pyx_v_ngram_start = 0; + p->__pyx_v_ngram_starts = 0; + p->__pyx_v_run_start = 0; + p->__pyx_v_self = 0; + p->__pyx_v_veb = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_ngram); + Py_CLEAR(p->__pyx_v_ngram_start); + Py_CLEAR(p->__pyx_v_ngram_starts); + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o; + if (p->__pyx_v_ngram) { + e = (*v)(p->__pyx_v_ngram, a); if (e) return e; + } + if (p->__pyx_v_ngram_start) { + e = (*v)(((PyObject*)p->__pyx_v_ngram_start), a); if (e) return e; + } + if (p->__pyx_v_ngram_starts) { + e = (*v)(p->__pyx_v_ngram_starts, a); if (e) return e; + } + if (p->__pyx_v_run_start) { + e = (*v)(((PyObject*)p->__pyx_v_run_start), 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_veb) { + e = (*v)(((PyObject*)p->__pyx_v_veb), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_ngram); + p->__pyx_v_ngram = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_ngram_start); + p->__pyx_v_ngram_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_ngram_starts); + p->__pyx_v_ngram_starts = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_run_start); + p->__pyx_v_run_start = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)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_LCP *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_veb); + p->__pyx_v_veb = ((struct __pyx_obj_4cdec_2sa_3_sa_VEB *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_3_compute_stats, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats, /*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_3_compute_stats, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_14_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_sym = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o; + PyObject_GC_UnTrack(o); + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_sym) { + e = (*v)(p->__pyx_v_sym, 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_2sa_3_sa___pyx_scope_struct_14_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sym); + p->__pyx_v_sym = 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_2sa_3_sa___pyx_scope_struct_14_genexpr[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_14_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct____iter__[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *p; + 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__)))) { + 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__)); + 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_2sa_3_sa___pyx_scope_struct____iter__ *)o); + p->__pyx_v_self = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyObject *o) { + 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__))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct____iter__ *p = (struct __pyx_obj_4cdec_2sa_3_sa___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_2sa_3_sa___pyx_scope_struct____iter__(PyObject *o) { + 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* tmp; + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_4cdec_2sa_3_sa_IntList *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct____iter__[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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____iter__, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct____iter__, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct____iter__, /*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____iter__, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr[8]; +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_8_genexpr *)o); + p->__pyx_outer_scope = 0; + p->__pyx_v_arc = 0; + p->__pyx_v_dist = 0; + p->__pyx_v_node = 0; + p->__pyx_v_sym = 0; + p->__pyx_v_weight = 0; + p->__pyx_t_0 = 0; + p->__pyx_t_3 = 0; + p->__pyx_t_4 = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_outer_scope); + Py_CLEAR(p->__pyx_v_arc); + Py_CLEAR(p->__pyx_v_dist); + Py_CLEAR(p->__pyx_v_node); + Py_CLEAR(p->__pyx_v_sym); + Py_CLEAR(p->__pyx_v_weight); + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)o; + if (p->__pyx_outer_scope) { + e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; + } + if (p->__pyx_v_arc) { + e = (*v)(p->__pyx_v_arc, a); if (e) return e; + } + if (p->__pyx_v_dist) { + e = (*v)(p->__pyx_v_dist, a); if (e) return e; + } + if (p->__pyx_v_node) { + e = (*v)(p->__pyx_v_node, a); if (e) return e; + } + if (p->__pyx_v_sym) { + e = (*v)(p->__pyx_v_sym, 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_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; + } + if (p->__pyx_t_4) { + e = (*v)(p->__pyx_t_4, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr(PyObject *o) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *p = (struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_outer_scope); + p->__pyx_outer_scope = ((struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_arc); + p->__pyx_v_arc = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_dist); + p->__pyx_v_dist = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_node); + p->__pyx_v_node = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_sym); + p->__pyx_v_sym = 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_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); + tmp = ((PyObject*)p->__pyx_t_4); + p->__pyx_t_4 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_8_genexpr, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_4cdec_2sa_3_sa_BitSet(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_2sa_3_sa_6BitSet_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa_BitSet(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pw_4cdec_2sa_3_sa_6BitSet_3__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_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)}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence_BitSet = { + __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + __pyx_pw_4cdec_2sa_3_sa_6BitSet_19__contains__, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BitSet = { + __pyx_pw_4cdec_2sa_3_sa_6BitSet_17__len__, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __pyx_type_4cdec_2sa_3_sa_BitSet = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("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*/ + 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_BitSet, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BitSet, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_4cdec_2sa_3_sa_6BitSet_11__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*/ + __pyx_pw_4cdec_2sa_3_sa_6BitSet_5__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa_BitSet, /*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_BitSet, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *__pyx_freelist_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence[8]; +static int __pyx_freecount_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence = 0; + +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) { + struct __pyx_obj_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence *p; + 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)))) { + 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)); + 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_2sa_3_sa___pyx_scope_struct_9_decode_sentence *)o); + p->__pyx_v_lattice = 0; + return o; +} + +static void __pyx_tp_dealloc_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o) { + 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))) { + __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); + } +} + +static int __pyx_tp_traverse_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o, visitproc v, void *a) { + int e; + 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; + if (p->__pyx_v_lattice) { + e = (*v)(p->__pyx_v_lattice, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence(PyObject *o) { + 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* tmp; + tmp = ((PyObject*)p->__pyx_v_lattice); + p->__pyx_v_lattice = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence[] = { + {0, 0, 0, 0} +}; + +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*/ + 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*/ + 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_9_decode_sentence, /*tp_traverse*/ + __pyx_tp_clear_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence, /*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_9_decode_sentence, /*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 PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + __Pyx_NAMESTR("_sa"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, + {&__pyx_n_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 1}, + {&__pyx_n_s_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 1, 1}, + {&__pyx_kp_s_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 0, 1, 0}, + {&__pyx_kp_s_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 0, 1, 0}, + {&__pyx_n_s_107, __pyx_k_107, sizeof(__pyx_k_107), 0, 0, 1, 1}, + {&__pyx_n_s_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 0, 1, 1}, + {&__pyx_kp_s_110, __pyx_k_110, sizeof(__pyx_k_110), 0, 0, 1, 0}, + {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0}, + {&__pyx_kp_s_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 0, 1, 0}, + {&__pyx_kp_s_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 0, 1, 0}, + {&__pyx_kp_s_115, __pyx_k_115, sizeof(__pyx_k_115), 0, 0, 1, 0}, + {&__pyx_kp_s_116, __pyx_k_116, sizeof(__pyx_k_116), 0, 0, 1, 0}, + {&__pyx_kp_s_117, __pyx_k_117, sizeof(__pyx_k_117), 0, 0, 1, 0}, + {&__pyx_kp_s_118, __pyx_k_118, sizeof(__pyx_k_118), 0, 0, 1, 0}, + {&__pyx_kp_s_119, __pyx_k_119, sizeof(__pyx_k_119), 0, 0, 1, 0}, + {&__pyx_kp_s_120, __pyx_k_120, sizeof(__pyx_k_120), 0, 0, 1, 0}, + {&__pyx_kp_s_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 0, 1, 0}, + {&__pyx_kp_s_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 0, 1, 0}, + {&__pyx_n_s_123, __pyx_k_123, sizeof(__pyx_k_123), 0, 0, 1, 1}, + {&__pyx_kp_s_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 0, 1, 0}, + {&__pyx_n_s_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 0, 1, 1}, + {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0}, + {&__pyx_n_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 1}, + {&__pyx_n_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 1}, + {&__pyx_kp_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 0}, + {&__pyx_kp_s_131, __pyx_k_131, sizeof(__pyx_k_131), 0, 0, 1, 0}, + {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0}, + {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0}, + {&__pyx_kp_s_134, __pyx_k_134, sizeof(__pyx_k_134), 0, 0, 1, 0}, + {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 0}, + {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0}, + {&__pyx_kp_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 0}, + {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0}, + {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0}, + {&__pyx_kp_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0}, + {&__pyx_n_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 1}, + {&__pyx_n_s_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 0, 1, 1}, + {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, + {&__pyx_kp_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 0}, + {&__pyx_kp_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 0}, + {&__pyx_n_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 1}, + {&__pyx_n_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 1}, + {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0}, + {&__pyx_kp_s_158, __pyx_k_158, sizeof(__pyx_k_158), 0, 0, 1, 0}, + {&__pyx_kp_s_161, __pyx_k_161, sizeof(__pyx_k_161), 0, 0, 1, 0}, + {&__pyx_kp_s_165, __pyx_k_165, sizeof(__pyx_k_165), 0, 0, 1, 0}, + {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, + {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, + {&__pyx_n_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 1}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0}, + {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 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_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0}, + {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0}, + {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0}, + {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0}, + {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0}, + {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0}, + {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0}, + {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0}, + {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0}, + {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0}, + {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0}, + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, + {&__pyx_kp_s_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 0, 1, 0}, + {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0}, + {&__pyx_n_s_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 0, 1, 1}, + {&__pyx_n_s_73, __pyx_k_73, sizeof(__pyx_k_73), 0, 0, 1, 1}, + {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0}, + {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0}, + {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 0}, + {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 0}, + {&__pyx_kp_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 0}, + {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0}, + {&__pyx_kp_s_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 0, 1, 0}, + {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_kp_s_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 0, 1, 0}, + {&__pyx_kp_s_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 0, 1, 0}, + {&__pyx_kp_s_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 0, 1, 0}, + {&__pyx_kp_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 0}, + {&__pyx_kp_s_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 0, 1, 0}, + {&__pyx_kp_s_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 0, 1, 0}, + {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0}, + {&__pyx_kp_s__0, __pyx_k__0, sizeof(__pyx_k__0), 0, 0, 1, 0}, + {&__pyx_kp_s__1, __pyx_k__1, sizeof(__pyx_k__1), 0, 0, 1, 0}, + {&__pyx_n_s__Counter, __pyx_k__Counter, sizeof(__pyx_k__Counter), 0, 0, 1, 1}, + {&__pyx_n_s__END_OF_FILE, __pyx_k__END_OF_FILE, sizeof(__pyx_k__END_OF_FILE), 0, 0, 1, 1}, + {&__pyx_n_s__END_OF_LINE, __pyx_k__END_OF_LINE, sizeof(__pyx_k__END_OF_LINE), 0, 0, 1, 1}, + {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1}, + {&__pyx_n_s__FeatureContext, __pyx_k__FeatureContext, sizeof(__pyx_k__FeatureContext), 0, 0, 1, 1}, + {&__pyx_n_s__GzipFile, __pyx_k__GzipFile, sizeof(__pyx_k__GzipFile), 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_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1}, + {&__pyx_n_s__NULL, __pyx_k__NULL, sizeof(__pyx_k__NULL), 0, 0, 1, 1}, + {&__pyx_n_s__RUSAGE_SELF, __pyx_k__RUSAGE_SELF, sizeof(__pyx_k__RUSAGE_SELF), 0, 0, 1, 1}, + {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 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____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____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 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____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___columns, __pyx_k___columns, sizeof(__pyx_k___columns), 0, 0, 1, 1}, + {&__pyx_n_s___doquicksort, __pyx_k___doquicksort, sizeof(__pyx_k___doquicksort), 0, 0, 1, 1}, + {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, + {&__pyx_n_s__advance, __pyx_k__advance, sizeof(__pyx_k__advance), 0, 0, 1, 1}, + {&__pyx_n_s__al, __pyx_k__al, sizeof(__pyx_k__al), 0, 0, 1, 1}, + {&__pyx_n_s__alignment, __pyx_k__alignment, sizeof(__pyx_k__alignment), 0, 0, 1, 1}, + {&__pyx_n_s__alignments, __pyx_k__alignments, sizeof(__pyx_k__alignments), 0, 0, 1, 1}, + {&__pyx_n_s__alphabet_size, __pyx_k__alphabet_size, sizeof(__pyx_k__alphabet_size), 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__arity, __pyx_k__arity, sizeof(__pyx_k__arity), 0, 0, 1, 1}, + {&__pyx_n_s__arr, __pyx_k__arr, sizeof(__pyx_k__arr), 0, 0, 1, 1}, + {&__pyx_n_s__arr_high, __pyx_k__arr_high, sizeof(__pyx_k__arr_high), 0, 0, 1, 1}, + {&__pyx_n_s__arr_low, __pyx_k__arr_low, sizeof(__pyx_k__arr_low), 0, 0, 1, 1}, + {&__pyx_n_s__bilex_e, __pyx_k__bilex_e, sizeof(__pyx_k__bilex_e), 0, 0, 1, 1}, + {&__pyx_n_s__bilex_f, __pyx_k__bilex_f, sizeof(__pyx_k__bilex_f), 0, 0, 1, 1}, + {&__pyx_n_s__bilex_fe, __pyx_k__bilex_fe, sizeof(__pyx_k__bilex_fe), 0, 0, 1, 1}, + {&__pyx_n_s__by_slack_factor, __pyx_k__by_slack_factor, sizeof(__pyx_k__by_slack_factor), 0, 0, 1, 1}, + {&__pyx_n_s__category, __pyx_k__category, sizeof(__pyx_k__category), 0, 0, 1, 1}, + {&__pyx_n_s__chain, __pyx_k__chain, sizeof(__pyx_k__chain), 0, 0, 1, 1}, + {&__pyx_n_s__children, __pyx_k__children, sizeof(__pyx_k__children), 0, 0, 1, 1}, + {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1}, + {&__pyx_n_s__cmp, __pyx_k__cmp, sizeof(__pyx_k__cmp), 0, 0, 1, 1}, + {&__pyx_n_s__col, __pyx_k__col, sizeof(__pyx_k__col), 0, 0, 1, 1}, + {&__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__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_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_sentence, __pyx_k__decode_sentence, sizeof(__pyx_k__decode_sentence), 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__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__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1}, + {&__pyx_n_s__e_i, __pyx_k__e_i, sizeof(__pyx_k__e_i), 0, 0, 1, 1}, + {&__pyx_n_s__e_j, __pyx_k__e_j, sizeof(__pyx_k__e_j), 0, 0, 1, 1}, + {&__pyx_n_s__e_span, __pyx_k__e_span, sizeof(__pyx_k__e_span), 0, 0, 1, 1}, + {&__pyx_n_s__e_text, __pyx_k__e_text, sizeof(__pyx_k__e_text), 0, 0, 1, 1}, + {&__pyx_n_s__e_words, __pyx_k__e_words, sizeof(__pyx_k__e_words), 0, 0, 1, 1}, + {&__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__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, + {&__pyx_n_s__ephrase, __pyx_k__ephrase, sizeof(__pyx_k__ephrase), 0, 0, 1, 1}, + {&__pyx_n_s__eword, __pyx_k__eword, sizeof(__pyx_k__eword), 0, 0, 1, 1}, + {&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1}, + {&__pyx_n_s__extended, __pyx_k__extended, sizeof(__pyx_k__extended), 0, 0, 1, 1}, + {&__pyx_n_s__extract, __pyx_k__extract, sizeof(__pyx_k__extract), 0, 0, 1, 1}, + {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, + {&__pyx_n_s__f_i, __pyx_k__f_i, sizeof(__pyx_k__f_i), 0, 0, 1, 1}, + {&__pyx_n_s__f_j, __pyx_k__f_j, sizeof(__pyx_k__f_j), 0, 0, 1, 1}, + {&__pyx_n_s__f_span, __pyx_k__f_span, sizeof(__pyx_k__f_span), 0, 0, 1, 1}, + {&__pyx_n_s__f_text, __pyx_k__f_text, sizeof(__pyx_k__f_text), 0, 0, 1, 1}, + {&__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__form_rule, __pyx_k__form_rule, sizeof(__pyx_k__form_rule), 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}, + {&__pyx_n_s__from_binary, __pyx_k__from_binary, sizeof(__pyx_k__from_binary), 0, 0, 1, 1}, + {&__pyx_n_s__from_data, __pyx_k__from_data, sizeof(__pyx_k__from_data), 0, 0, 1, 1}, + {&__pyx_n_s__from_iterable, __pyx_k__from_iterable, sizeof(__pyx_k__from_iterable), 0, 0, 1, 1}, + {&__pyx_n_s__from_stats, __pyx_k__from_stats, sizeof(__pyx_k__from_stats), 0, 0, 1, 1}, + {&__pyx_n_s__from_text, __pyx_k__from_text, sizeof(__pyx_k__from_text), 0, 0, 1, 1}, + {&__pyx_n_s__frontier, __pyx_k__frontier, sizeof(__pyx_k__frontier), 0, 0, 1, 1}, + {&__pyx_n_s__fsample_count, __pyx_k__fsample_count, sizeof(__pyx_k__fsample_count), 0, 0, 1, 1}, + {&__pyx_n_s__fsarray, __pyx_k__fsarray, sizeof(__pyx_k__fsarray), 0, 0, 1, 1}, + {&__pyx_n_s__fword, __pyx_k__fword, sizeof(__pyx_k__fword), 0, 0, 1, 1}, + {&__pyx_n_s__fwords, __pyx_k__fwords, sizeof(__pyx_k__fwords), 0, 0, 1, 1}, + {&__pyx_n_s__gc, __pyx_k__gc, sizeof(__pyx_k__gc), 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__getLogger, __pyx_k__getLogger, sizeof(__pyx_k__getLogger), 0, 0, 1, 1}, + {&__pyx_n_s__get_e_id, __pyx_k__get_e_id, sizeof(__pyx_k__get_e_id), 0, 0, 1, 1}, + {&__pyx_n_s__get_f_id, __pyx_k__get_f_id, sizeof(__pyx_k__get_f_id), 0, 0, 1, 1}, + {&__pyx_n_s__get_f_phrases, __pyx_k__get_f_phrases, sizeof(__pyx_k__get_f_phrases), 0, 0, 1, 1}, + {&__pyx_n_s__get_id, __pyx_k__get_id, sizeof(__pyx_k__get_id), 0, 0, 1, 1}, + {&__pyx_n_s__get_next_states, __pyx_k__get_next_states, sizeof(__pyx_k__get_next_states), 0, 0, 1, 1}, + {&__pyx_n_s__get_word, __pyx_k__get_word, sizeof(__pyx_k__get_word), 0, 0, 1, 1}, + {&__pyx_n_s__getchunk, __pyx_k__getchunk, sizeof(__pyx_k__getchunk), 0, 0, 1, 1}, + {&__pyx_n_s__getrusage, __pyx_k__getrusage, sizeof(__pyx_k__getrusage), 0, 0, 1, 1}, + {&__pyx_n_s__gzip, __pyx_k__gzip, sizeof(__pyx_k__gzip), 0, 0, 1, 1}, + {&__pyx_n_s__gzip_or_text, __pyx_k__gzip_or_text, sizeof(__pyx_k__gzip_or_text), 0, 0, 1, 1}, + {&__pyx_n_s__h, __pyx_k__h, sizeof(__pyx_k__h), 0, 0, 1, 1}, + {&__pyx_n_s__high, __pyx_k__high, sizeof(__pyx_k__high), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__ifrom, __pyx_k__ifrom, sizeof(__pyx_k__ifrom), 0, 0, 1, 1}, + {&__pyx_n_s__increment, __pyx_k__increment, sizeof(__pyx_k__increment), 0, 0, 1, 1}, + {&__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_match, __pyx_k__input_match, sizeof(__pyx_k__input_match), 0, 0, 1, 1}, + {&__pyx_n_s__input_span, __pyx_k__input_span, sizeof(__pyx_k__input_span), 0, 0, 1, 1}, + {&__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__iteritems, __pyx_k__iteritems, sizeof(__pyx_k__iteritems), 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}, + {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 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__lattice, __pyx_k__lattice, sizeof(__pyx_k__lattice), 0, 0, 1, 1}, + {&__pyx_n_s__lex_i, __pyx_k__lex_i, sizeof(__pyx_k__lex_i), 0, 0, 1, 1}, + {&__pyx_n_s__lex_j, __pyx_k__lex_j, sizeof(__pyx_k__lex_j), 0, 0, 1, 1}, + {&__pyx_n_s__lhs, __pyx_k__lhs, sizeof(__pyx_k__lhs), 0, 0, 1, 1}, + {&__pyx_n_s__link, __pyx_k__link, sizeof(__pyx_k__link), 0, 0, 1, 1}, + {&__pyx_n_s__link_i, __pyx_k__link_i, sizeof(__pyx_k__link_i), 0, 0, 1, 1}, + {&__pyx_n_s__link_j, __pyx_k__link_j, sizeof(__pyx_k__link_j), 0, 0, 1, 1}, + {&__pyx_n_s__links, __pyx_k__links, sizeof(__pyx_k__links), 0, 0, 1, 1}, + {&__pyx_n_s__logger, __pyx_k__logger, sizeof(__pyx_k__logger), 0, 0, 1, 1}, + {&__pyx_n_s__logging, __pyx_k__logging, sizeof(__pyx_k__logging), 0, 0, 1, 1}, + {&__pyx_n_s__lookup, __pyx_k__lookup, sizeof(__pyx_k__lookup), 0, 0, 1, 1}, + {&__pyx_n_s__low, __pyx_k__low, sizeof(__pyx_k__low), 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__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}, + {&__pyx_n_s__max_chunks, __pyx_k__max_chunks, sizeof(__pyx_k__max_chunks), 0, 0, 1, 1}, + {&__pyx_n_s__max_initial_size, __pyx_k__max_initial_size, sizeof(__pyx_k__max_initial_size), 0, 0, 1, 1}, + {&__pyx_n_s__max_length, __pyx_k__max_length, sizeof(__pyx_k__max_length), 0, 0, 1, 1}, + {&__pyx_n_s__max_nonterminals, __pyx_k__max_nonterminals, sizeof(__pyx_k__max_nonterminals), 0, 0, 1, 1}, + {&__pyx_n_s__max_target_chunks, __pyx_k__max_target_chunks, sizeof(__pyx_k__max_target_chunks), 0, 0, 1, 1}, + {&__pyx_n_s__max_target_length, __pyx_k__max_target_length, sizeof(__pyx_k__max_target_length), 0, 0, 1, 1}, + {&__pyx_n_s__merge, __pyx_k__merge, sizeof(__pyx_k__merge), 0, 0, 1, 1}, + {&__pyx_n_s__meta, __pyx_k__meta, sizeof(__pyx_k__meta), 0, 0, 1, 1}, + {&__pyx_n_s__min_bound, __pyx_k__min_bound, sizeof(__pyx_k__min_bound), 0, 0, 1, 1}, + {&__pyx_n_s__min_dist, __pyx_k__min_dist, sizeof(__pyx_k__min_dist), 0, 0, 1, 1}, + {&__pyx_n_s__min_gap_size, __pyx_k__min_gap_size, sizeof(__pyx_k__min_gap_size), 0, 0, 1, 1}, + {&__pyx_n_s__monitor_cpu, __pyx_k__monitor_cpu, sizeof(__pyx_k__monitor_cpu), 0, 0, 1, 1}, + {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1}, + {&__pyx_n_s__namedtuple, __pyx_k__namedtuple, sizeof(__pyx_k__namedtuple), 0, 0, 1, 1}, + {&__pyx_n_s__new_e_i, __pyx_k__new_e_i, sizeof(__pyx_k__new_e_i), 0, 0, 1, 1}, + {&__pyx_n_s__new_e_j, __pyx_k__new_e_j, sizeof(__pyx_k__new_e_j), 0, 0, 1, 1}, + {&__pyx_n_s__new_lex_i, __pyx_k__new_lex_i, sizeof(__pyx_k__new_lex_i), 0, 0, 1, 1}, + {&__pyx_n_s__new_lex_j, __pyx_k__new_lex_j, sizeof(__pyx_k__new_lex_j), 0, 0, 1, 1}, + {&__pyx_n_s__new_min_bound, __pyx_k__new_min_bound, sizeof(__pyx_k__new_min_bound), 0, 0, 1, 1}, + {&__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_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}, + {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1}, + {&__pyx_n_s__old_last_nt, __pyx_k__old_last_nt, sizeof(__pyx_k__old_last_nt), 0, 0, 1, 1}, + {&__pyx_n_s__online, __pyx_k__online, sizeof(__pyx_k__online), 0, 0, 1, 1}, + {&__pyx_n_s__online_ctx_lookup, __pyx_k__online_ctx_lookup, sizeof(__pyx_k__online_ctx_lookup), 0, 0, 1, 1}, + {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1}, + {&__pyx_n_s__pad, __pyx_k__pad, sizeof(__pyx_k__pad), 0, 0, 1, 1}, + {&__pyx_n_s__paircount, __pyx_k__paircount, sizeof(__pyx_k__paircount), 0, 0, 1, 1}, + {&__pyx_n_s__partition, __pyx_k__partition, sizeof(__pyx_k__partition), 0, 0, 1, 1}, + {&__pyx_n_s__pathlen, __pyx_k__pathlen, sizeof(__pyx_k__pathlen), 0, 0, 1, 1}, + {&__pyx_n_s__pattern2phrase, __pyx_k__pattern2phrase, sizeof(__pyx_k__pattern2phrase), 0, 0, 1, 1}, + {&__pyx_n_s__pattern2phrase_plus, __pyx_k__pattern2phrase_plus, sizeof(__pyx_k__pattern2phrase_plus), 0, 0, 1, 1}, + {&__pyx_n_s__phrase, __pyx_k__phrase, sizeof(__pyx_k__phrase), 0, 0, 1, 1}, + {&__pyx_n_s__phrase_location, __pyx_k__phrase_location, sizeof(__pyx_k__phrase_location), 0, 0, 1, 1}, + {&__pyx_n_s__phrases_al, __pyx_k__phrases_al, sizeof(__pyx_k__phrases_al), 0, 0, 1, 1}, + {&__pyx_n_s__phrases_e, __pyx_k__phrases_e, sizeof(__pyx_k__phrases_e), 0, 0, 1, 1}, + {&__pyx_n_s__phrases_f, __pyx_k__phrases_f, sizeof(__pyx_k__phrases_f), 0, 0, 1, 1}, + {&__pyx_n_s__phrases_fe, __pyx_k__phrases_fe, sizeof(__pyx_k__phrases_fe), 0, 0, 1, 1}, + {&__pyx_n_s__plus_links, __pyx_k__plus_links, sizeof(__pyx_k__plus_links), 0, 0, 1, 1}, + {&__pyx_n_s__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1}, + {&__pyx_n_s__precompute, __pyx_k__precompute, sizeof(__pyx_k__precompute), 0, 0, 1, 1}, + {&__pyx_n_s__precompute_file, __pyx_k__precompute_file, sizeof(__pyx_k__precompute_file), 0, 0, 1, 1}, + {&__pyx_n_s__precompute_rank, __pyx_k__precompute_rank, sizeof(__pyx_k__precompute_rank), 0, 0, 1, 1}, + {&__pyx_n_s__precomputed, __pyx_k__precomputed, sizeof(__pyx_k__precomputed), 0, 0, 1, 1}, + {&__pyx_n_s__q3sort, __pyx_k__q3sort, sizeof(__pyx_k__q3sort), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__reachable, __pyx_k__reachable, sizeof(__pyx_k__reachable), 0, 0, 1, 1}, + {&__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_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__res, __pyx_k__res, sizeof(__pyx_k__res), 0, 0, 1, 1}, + {&__pyx_n_s__reset, __pyx_k__reset, sizeof(__pyx_k__reset), 0, 0, 1, 1}, + {&__pyx_n_s__resource, __pyx_k__resource, sizeof(__pyx_k__resource), 0, 0, 1, 1}, + {&__pyx_n_s__ru_stime, __pyx_k__ru_stime, sizeof(__pyx_k__ru_stime), 0, 0, 1, 1}, + {&__pyx_n_s__ru_utime, __pyx_k__ru_utime, sizeof(__pyx_k__ru_utime), 0, 0, 1, 1}, + {&__pyx_n_s__sa, __pyx_k__sa, sizeof(__pyx_k__sa), 0, 0, 1, 1}, + {&__pyx_n_s__sa_high, __pyx_k__sa_high, sizeof(__pyx_k__sa_high), 0, 0, 1, 1}, + {&__pyx_n_s__sa_low, __pyx_k__sa_low, sizeof(__pyx_k__sa_low), 0, 0, 1, 1}, + {&__pyx_n_s__sample, __pyx_k__sample, sizeof(__pyx_k__sample), 0, 0, 1, 1}, + {&__pyx_n_s__sample_size, __pyx_k__sample_size, sizeof(__pyx_k__sample_size), 0, 0, 1, 1}, + {&__pyx_n_s__sampler, __pyx_k__sampler, sizeof(__pyx_k__sampler), 0, 0, 1, 1}, + {&__pyx_n_s__samples_f, __pyx_k__samples_f, sizeof(__pyx_k__samples_f), 0, 0, 1, 1}, + {&__pyx_n_s__sarray, __pyx_k__sarray, sizeof(__pyx_k__sarray), 0, 0, 1, 1}, + {&__pyx_n_s__scorer, __pyx_k__scorer, sizeof(__pyx_k__scorer), 0, 0, 1, 1}, + {&__pyx_n_s__scores, __pyx_k__scores, sizeof(__pyx_k__scores), 0, 0, 1, 1}, + {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1}, + {&__pyx_n_s__set, __pyx_k__set, sizeof(__pyx_k__set), 0, 0, 1, 1}, + {&__pyx_n_s__shortest, __pyx_k__shortest, sizeof(__pyx_k__shortest), 0, 0, 1, 1}, + {&__pyx_n_s__side, __pyx_k__side, sizeof(__pyx_k__side), 0, 0, 1, 1}, + {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {&__pyx_n_s__skip, __pyx_k__skip, sizeof(__pyx_k__skip), 0, 0, 1, 1}, + {&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1}, + {&__pyx_n_s__source, __pyx_k__source, sizeof(__pyx_k__source), 0, 0, 1, 1}, + {&__pyx_n_s__span_check, __pyx_k__span_check, sizeof(__pyx_k__span_check), 0, 0, 1, 1}, + {&__pyx_n_s__span_dec, __pyx_k__span_dec, sizeof(__pyx_k__span_dec), 0, 0, 1, 1}, + {&__pyx_n_s__span_inc, __pyx_k__span_inc, sizeof(__pyx_k__span_inc), 0, 0, 1, 1}, + {&__pyx_n_s__spanlen, __pyx_k__spanlen, sizeof(__pyx_k__spanlen), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__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__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}, + {&__pyx_n_s__test_sentence, __pyx_k__test_sentence, sizeof(__pyx_k__test_sentence), 0, 0, 1, 1}, + {&__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__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}, + {&__pyx_n_s__use_baeza_yates, __pyx_k__use_baeza_yates, sizeof(__pyx_k__use_baeza_yates), 0, 0, 1, 1}, + {&__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_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}, + {&__pyx_n_s__warn, __pyx_k__warn, sizeof(__pyx_k__warn), 0, 0, 1, 1}, + {&__pyx_n_s__wc, __pyx_k__wc, sizeof(__pyx_k__wc), 0, 0, 1, 1}, + {&__pyx_n_s__word, __pyx_k__word, sizeof(__pyx_k__word), 0, 0, 1, 1}, + {&__pyx_n_s__word_alignments, __pyx_k__word_alignments, sizeof(__pyx_k__word_alignments), 0, 0, 1, 1}, + {&__pyx_n_s__word_ids, __pyx_k__word_ids, sizeof(__pyx_k__word_ids), 0, 0, 1, 1}, + {&__pyx_n_s__words, __pyx_k__words, sizeof(__pyx_k__words), 0, 0, 1, 1}, + {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1}, + {&__pyx_n_s__write_text, __pyx_k__write_text, sizeof(__pyx_k__write_text), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {&__pyx_n_s__zip, __pyx_k__zip, sizeof(__pyx_k__zip), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 23; __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 = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 363; __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_sorted = __Pyx_GetBuiltinName(__pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 976; __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 = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * self.sent_id = IntList(1000,1000) + * self.sent_index = IntList(1000,1000) + */ + __pyx_k_tuple_11 = PyTuple_Pack(2, __pyx_int_1000, __pyx_int_1000); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_11); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * self.sent_index = IntList(1000,1000) + * self.use_sent_id = use_sent_id + */ + __pyx_k_tuple_12 = PyTuple_Pack(2, __pyx_int_1000, __pyx_int_1000); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":22 + * self.data = IntList(1000,1000) + * self.sent_id = IntList(1000,1000) + * self.sent_index = IntList(1000,1000) # <<<<<<<<<<<<<< + * self.use_sent_id = use_sent_id + * if from_binary: + */ + __pyx_k_tuple_13 = PyTuple_Pack(2, __pyx_int_1000, __pyx_int_1000); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_13); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_16); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":61 + * + * def write_text(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * for w_id in self.data: + * if w_id > 1: + */ + __pyx_k_tuple_17 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":69 + * + * def read_text(self, char* filename): + * with gzip_or_text(filename) as fp: # <<<<<<<<<<<<<< + * self.read_text_data(fp) + * + */ + __pyx_k_tuple_18 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_18); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_20); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":73 + * + * 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_k_tuple_21 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + + /* "/home/mdenkows/cdec/python/cdec/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_k_slice_22 = PySlice_New(__pyx_int_2, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_22); + __Pyx_GIVEREF(__pyx_k_slice_22); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":144 + * for i in self.data: + * f.write("%d " %i) + * f.write("\n") # <<<<<<<<<<<<<< + * for i in self.sent_index: + * f.write("%d " %i) + */ + __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_24); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_25); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_26); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":153 + * for word in self.id2word: + * f.write("%s %d " % (word, self.word2id[word])) + * f.write("\n") # <<<<<<<<<<<<<< + * + * def write_enhanced(self, char* filename): + */ + __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_28); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + + /* "/home/mdenkows/cdec/python/cdec/sa/data_array.pxi":156 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * self.write_enhanced_handle(self, f) + */ + __pyx_k_tuple_30 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_30); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":48 + * + * def __cinit__(self, from_binary=None, from_text=None): + * self.links = IntList(1000,1000) # <<<<<<<<<<<<<< + * self.sent_index = IntList(1000,1000) + * if from_binary: + */ + __pyx_k_tuple_31 = PyTuple_Pack(2, __pyx_int_1000, __pyx_int_1000); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_31); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); + + /* "/home/mdenkows/cdec/python/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) # <<<<<<<<<<<<<< + * if from_binary: + * self.read_binary(from_binary) + */ + __pyx_k_tuple_32 = PyTuple_Pack(2, __pyx_int_1000, __pyx_int_1000); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_32); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":61 + * pairs = line.split() + * for pair in pairs: + * (i, j) = map(int, pair.split('-')) # <<<<<<<<<<<<<< + * self.links.append(self.link(i, j)) + * self.sent_index.append(len(self.links)) + */ + __pyx_k_tuple_34 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_33)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_34); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":56 + * + * def read_text(self, char* filename): + * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< + * for line in f: + * self.sent_index.append(len(self.links)) + */ + __pyx_k_tuple_35 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_35); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_36 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_36); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":80 + * sent_num = sent_num + 1 + * f.write("%d-%d " % self.unlink(link)) + * f.write("\n") # <<<<<<<<<<<<<< + * + * def write_binary(self, char* filename): + */ + __pyx_k_tuple_38 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_38); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":73 + * + * def write_text(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * sent_num = 0 + * for i, link in enumerate(self.links): + */ + __pyx_k_tuple_39 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_39); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":93 + * for link in self.links: + * f.write("%d " % link) + * f.write("\n") # <<<<<<<<<<<<<< + * for i in self.sent_index: + * f.write("%d " % i) + */ + __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_40); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":96 + * for i in self.sent_index: + * f.write("%d " % i) + * f.write("\n") # <<<<<<<<<<<<<< + * + * def alignment(self, i): + */ + __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_41); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":90 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * for link in self.links: + * f.write("%d " % link) + */ + __pyx_k_tuple_42 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_42); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":297 + * + * # Re-read file, placing words into buckets + * f.seek(0) # <<<<<<<<<<<<<< + * for line in f: + * (fword, eword, score1, score2) = line.split() + */ + __pyx_k_tuple_45 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_45); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":273 + * + * fcount = IntList() + * with gzip_or_text(filename) as f: # <<<<<<<<<<<<<< + * # first loop merely establishes size of array objects + * for line in f: + */ + __pyx_k_tuple_46 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_46); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":339 + * + * if i > j: + * raise Exception("Sort error in CLex") # <<<<<<<<<<<<<< + * if i == j: #empty interval + * return + */ + __pyx_k_tuple_49 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_48)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_49); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":362 + * 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_k_tuple_51 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_51); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":365 + * 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_k_tuple_53 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_53); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":368 + * 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_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_55); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":371 + * for i, w in enumerate(self.id2eword): + * f.write("%d %s " % (i, w)) + * f.write("\n") # <<<<<<<<<<<<<< + * + * + */ + __pyx_k_tuple_56 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_56); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":359 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * for i in self.f_index: + * f.write("%d " % i) + */ + __pyx_k_tuple_57 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_57); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57)); + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":404 + * cdef i, N, e_id, f_id + * + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * N = len(self.e_index) + * f_id = 0 + */ + __pyx_k_tuple_59 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_59); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":13 + * cdef IntList rank + * + * logger.info("Constructing LCP array") # <<<<<<<<<<<<<< + * self.sa = sa + * n = self.sa.sa.len + */ + __pyx_k_tuple_63 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_63); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63)); + + /* "/home/mdenkows/cdec/python/cdec/sa/lcp.pxi":34 + * if h > 0: + * h = h-1 + * logger.info("LCP array completed") # <<<<<<<<<<<<<< + * + * def compute_stats(self, int max_n): + */ + __pyx_k_tuple_65 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_64)); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_65); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65)); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":297 + * pattern_rank = {} + * + * logger.info("Precomputing frequent intersections") # <<<<<<<<<<<<<< + * cdef float start_time = monitor_cpu() + * + */ + __pyx_k_tuple_75 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_74)); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_75); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":314 + * queue = IntList(increment=1000) + * + * logger.info(" Computing inverted indexes...") # <<<<<<<<<<<<<< + * N = len(data) + * for i from 0 <= i < N: + */ + __pyx_k_tuple_77 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_76)); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_77); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77)); + + /* "/home/mdenkows/cdec/python/cdec/sa/precomputation.pxi":329 + * trie_node_data_append(node, i) + * + * logger.info(" Computing collocations...") # <<<<<<<<<<<<<< + * N = len(queue) + * ptr1 = 0 + */ + __pyx_k_tuple_79 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_78)); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_79); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_81 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_81); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_82 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_82); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_83 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_83); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_84 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[11]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_84); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_95 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_94)); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_95); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_98 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_98); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98)); + + /* "/home/mdenkows/cdec/python/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_k_tuple_99 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_99); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99)); + + /* "/home/mdenkows/cdec/python/cdec/sa/suffix_array.pxi":189 + * + * def write_enhanced(self, char* filename): + * with open(filename, "w") as f: # <<<<<<<<<<<<<< + * self.darray.write_enhanced_handle(f) + * for a_i in self.sa: + */ + __pyx_k_tuple_100 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[12]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_100); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":144 + * logger.info("Sampling strategy: uniform, max sample size = %d", sample_size) + * else: + * logger.info("Sampling strategy: no sampling") # <<<<<<<<<<<<<< + * + * def sample(self, PhraseLocation phrase_location): + */ + __pyx_k_tuple_106 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_105)); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_106); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":357 + * self.rules.root = ExtendedTrieNode(phrase_location=PhraseLocation()) + * if alignment is None: + * raise Exception("Must specify an alignment object") # <<<<<<<<<<<<<< + * self.alignment = alignment + * + */ + __pyx_k_tuple_111 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_110)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_111); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1069 + * else: + * #ERROR: We never get here + * raise Exception("Keyword trie error") # <<<<<<<<<<<<<< + * # checking whether lookup_required + * if lookup_required: + */ + __pyx_k_tuple_127 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_126)); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_127); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_127)); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1988 + * 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_k_slice_141 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_141)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_141); + __Pyx_GIVEREF(__pyx_k_slice_141); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":1925 + * # 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_k_tuple_142 = PyTuple_Pack(19, ((PyObject *)__pyx_n_s__f_i), ((PyObject *)__pyx_n_s__f_j), ((PyObject *)__pyx_n_s__e_i), ((PyObject *)__pyx_n_s__e_j), ((PyObject *)__pyx_n_s__min_bound), ((PyObject *)__pyx_n_s__wc), ((PyObject *)__pyx_n_s__links), ((PyObject *)__pyx_n_s__nt), ((PyObject *)__pyx_n_s__nt_open), ((PyObject *)__pyx_n_s__link_i), ((PyObject *)__pyx_n_s__link_j), ((PyObject *)__pyx_n_s__new_e_i), ((PyObject *)__pyx_n_s__new_e_j), ((PyObject *)__pyx_n_s__new_min_bound), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__nt_collision), ((PyObject *)__pyx_n_s__link), ((PyObject *)__pyx_n_s__plus_links), ((PyObject *)__pyx_n_s__old_last_nt)); if (unlikely(!__pyx_k_tuple_142)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_142); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_142)); + __pyx_k_codeobj_143 = (PyObject*)__Pyx_PyCode_New(9, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__extract, 1925, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_143)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2047 + * # 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_k_slice_146 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_k_slice_146)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_146); + __Pyx_GIVEREF(__pyx_k_slice_146); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2067 + * # 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_k_slice_148 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_148)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_148); + __Pyx_GIVEREF(__pyx_k_slice_148); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2077 + * 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_k_slice_149 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_149)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_149); + __Pyx_GIVEREF(__pyx_k_slice_149); + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2152 + * 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_k_tuple_153 = PyTuple_Pack(10, ((PyObject *)__pyx_n_s__f_i), ((PyObject *)__pyx_n_s__f_j), ((PyObject *)__pyx_n_s__lex_i), ((PyObject *)__pyx_n_s__lex_j), ((PyObject *)__pyx_n_s__wc), ((PyObject *)__pyx_n_s__ntc), ((PyObject *)__pyx_n_s__syms), ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__new_lex_i), ((PyObject *)__pyx_n_s__new_lex_j)); if (unlikely(!__pyx_k_tuple_153)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_153); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_153)); + __pyx_k_codeobj_154 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__extract, 2152, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_154)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cdec/sa/_sa.pyx":5 + * import gzip + * + * def monitor_cpu(): # <<<<<<<<<<<<<< + * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ + * resource.getrusage(resource.RUSAGE_SELF).ru_stime) + */ + __pyx_k_codeobj_157 = (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_158, __pyx_n_s__monitor_cpu, 5, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_157)) {__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) + * + * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< + * if filename.endswith('.gz'): + * return gzip.GzipFile(filename) + */ + __pyx_k_tuple_159 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__filename), ((PyObject *)__pyx_n_s__filename)); if (unlikely(!__pyx_k_tuple_159)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_159); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_159)); + __pyx_k_codeobj_160 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_159, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__gzip_or_text, 9, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_160)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cdec/sa/_sa.pyx":15 + * return open(filename) + * + * logger = logging.getLogger('cdec.sa') # <<<<<<<<<<<<<< + * + * include "float_list.pxi" + */ + __pyx_k_tuple_162 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_161)); if (unlikely(!__pyx_k_tuple_162)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_162); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_162)); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":107 + * return ALPHABET.fromstring(string, terminal) + * + * def isvar(sym): # <<<<<<<<<<<<<< + * return sym_isvar(sym) + * + */ + __pyx_k_tuple_163 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__sym)); if (unlikely(!__pyx_k_tuple_163)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_163); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_163)); + __pyx_k_codeobj_164 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__isvar, 107, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_164)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":110 + * return sym_isvar(sym) + * + * def make_lattice(words): # <<<<<<<<<<<<<< + * word_ids = (sym_fromstring(word, True) for word in words) + * return tuple(((word, None, 1), ) for word in word_ids) + */ + __pyx_k_tuple_166 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__words), ((PyObject *)__pyx_n_s__word_ids), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_166)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_166); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_166)); + __pyx_k_codeobj_167 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__make_lattice, 110, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_167)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":114 + * return tuple(((word, None, 1), ) for word in word_ids) + * + * 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_k_tuple_168 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__lattice), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_168)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_168); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_168)); + __pyx_k_codeobj_169 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_lattice, 114, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_169)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":118 + * for arc in node for node in lattice) + * + * def decode_sentence(lattice): # <<<<<<<<<<<<<< + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) + * + */ + __pyx_k_tuple_170 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__lattice), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_170)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_170); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_170)); + __pyx_k_codeobj_171 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_sentence, 118, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_171)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":121 + * return tuple(sym_tostring(sym) for ((sym, _, _),) in lattice) + * + * def encode_words(words): # <<<<<<<<<<<<<< + * return tuple(sym_fromstring(word, True) for word in words) + * + */ + __pyx_k_tuple_172 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__words), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_172)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_172); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_172)); + __pyx_k_codeobj_173 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__encode_words, 121, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_173)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":124 + * return tuple(sym_fromstring(word, True) for word in words) + * + * def decode_words(syms): # <<<<<<<<<<<<<< + * return tuple(sym_tostring(sym) for sym in syms) + */ + __pyx_k_tuple_174 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__syms), ((PyObject *)__pyx_n_s__genexpr), ((PyObject *)__pyx_n_s__genexpr)); if (unlikely(!__pyx_k_tuple_174)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_174); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_174)); + __pyx_k_codeobj_175 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_165, __pyx_n_s__decode_words, 124, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_175)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2190 + * + * # Spans are _inclusive_ on both ends [i, j] + * def span_check(vec, i, j): # <<<<<<<<<<<<<< + * k = i + * while k <= j: + */ + __pyx_k_tuple_177 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_177)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_177); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_177)); + __pyx_k_codeobj_178 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_177, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_check, 2190, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_178)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2198 + * return True + * + * def span_inc(vec, i, j): # <<<<<<<<<<<<<< + * k = i + * while k <= j: + */ + __pyx_k_tuple_179 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_179)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_179); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_179)); + __pyx_k_codeobj_180 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_179, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_inc, 2198, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_180)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/home/mdenkows/cdec/python/cdec/sa/rulefactory.pxi":2204 + * k += 1 + * + * def span_dec(vec, i, j): # <<<<<<<<<<<<<< + * k = i + * while k <= j: + */ + __pyx_k_tuple_181 = PyTuple_Pack(4, ((PyObject *)__pyx_n_s__vec), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k)); if (unlikely(!__pyx_k_tuple_181)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_181); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_181)); + __pyx_k_codeobj_182 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_181, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_144, __pyx_n_s__span_dec, 2204, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_182)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +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_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_sa(void); /*proto*/ +PyMODINIT_FUNC init_sa(void) +#else +PyMODINIT_FUNC PyInit__sa(void); /*proto*/ +PyMODINIT_FUNC PyInit__sa(void) +#endif +{ + 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_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__sa(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #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); + #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.sa._sa")) { + if (unlikely(PyDict_SetItemString(modules, "cdec.sa._sa", __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;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #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;}; + } + /*--- 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 ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + __pyx_v_4cdec_2sa_3_sa_ALPHABET = ((struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *)Py_None); Py_INCREF(Py_None); + __pyx_v_4cdec_2sa_3_sa_FD = ((struct __pyx_obj_4cdec_2sa_3_sa_StringMap *)Py_None); Py_INCREF(Py_None); + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + if (__Pyx_ExportFunction("sym_tostring", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_tostring, "char *(int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("sym_tocat", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_tocat, "char *(int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("sym_isvar", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_isvar, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("sym_getindex", (void (*)(void))__pyx_f_4cdec_2sa_3_sa_sym_getindex, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Type init code ---*/ + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_FeatureVector = &__pyx_type_4cdec_2sa_3_sa_FeatureVector; + __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; + __pyx_vtable_4cdec_2sa_3_sa_SuffixArray.__pyx___search_low = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_11SuffixArray___search_low; + __pyx_vtable_4cdec_2sa_3_sa_SuffixArray.__pyx___get_range = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, int, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_11SuffixArray___get_range; + __pyx_vtable_4cdec_2sa_3_sa_SuffixArray.__pyx___lookup_helper = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_SuffixArray *, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_11SuffixArray___lookup_helper; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_SuffixArray = &__pyx_type_4cdec_2sa_3_sa_SuffixArray; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_4_make_lattice; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_24_fmt_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_LCP) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_LCP = &__pyx_type_4cdec_2sa_3_sa_LCP; + 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_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_OnlineStats) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_OnlineStats = &__pyx_type_4cdec_2sa_3_sa_OnlineStats; + __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; + __pyx_vtable_4cdec_2sa_3_sa_IntList._append = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, int))__pyx_f_4cdec_2sa_3_sa_7IntList__append; + __pyx_vtable_4cdec_2sa_3_sa_IntList._extend = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, struct __pyx_obj_4cdec_2sa_3_sa_IntList *))__pyx_f_4cdec_2sa_3_sa_7IntList__extend; + __pyx_vtable_4cdec_2sa_3_sa_IntList._extend_arr = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, int *, int))__pyx_f_4cdec_2sa_3_sa_7IntList__extend_arr; + __pyx_vtable_4cdec_2sa_3_sa_IntList._clear = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *))__pyx_f_4cdec_2sa_3_sa_7IntList__clear; + __pyx_vtable_4cdec_2sa_3_sa_IntList.write_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, FILE *))__pyx_f_4cdec_2sa_3_sa_7IntList_write_handle; + __pyx_vtable_4cdec_2sa_3_sa_IntList.read_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_IntList *, FILE *))__pyx_f_4cdec_2sa_3_sa_7IntList_read_handle; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_IntList = &__pyx_type_4cdec_2sa_3_sa_IntList; + __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; + __pyx_vtable_4cdec_2sa_3_sa_Phrase.chunklen = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, int))__pyx_f_4cdec_2sa_3_sa_6Phrase_chunklen; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Phrase = &__pyx_type_4cdec_2sa_3_sa_Phrase; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "TrieNode", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_TrieNode = &__pyx_type_4cdec_2sa_3_sa_TrieNode; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_2_genexpr; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_1_read_bitext; + 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_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_26_get_f_phrases) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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; + __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 = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ExtendedTrieNode", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_ExtendedTrieNode = &__pyx_type_4cdec_2sa_3_sa_ExtendedTrieNode; + __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; + __pyx_vtable_4cdec_2sa_3_sa_Alignment._unlink = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *, int, int *, int *))__pyx_f_4cdec_2sa_3_sa_9Alignment__unlink; + __pyx_vtable_4cdec_2sa_3_sa_Alignment._get_sent_links = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alignment *, int, int *))__pyx_f_4cdec_2sa_3_sa_9Alignment__get_sent_links; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Alignment = &__pyx_type_4cdec_2sa_3_sa_Alignment; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_19_input) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_13_decode_words) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_13_decode_words; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_23_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_Rule) < 0) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Rule = &__pyx_type_4cdec_2sa_3_sa_Rule; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_20_genexpr; + __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; + __pyx_vtable_4cdec_2sa_3_sa_Precomputation.write_map = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Precomputation *, PyObject *, FILE *))__pyx_f_4cdec_2sa_3_sa_14Precomputation_write_map; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Precomputation = &__pyx_type_4cdec_2sa_3_sa_Precomputation; + 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_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_21_add_instance) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 1891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_21_add_instance; + __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; + __pyx_vtable_4cdec_2sa_3_sa_TrieMap._contains = (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__contains; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_TrieMap = &__pyx_type_4cdec_2sa_3_sa_TrieMap; + 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_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_VEBIterator) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_VEBIterator = &__pyx_type_4cdec_2sa_3_sa_VEBIterator; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_5_genexpr; + __pyx_vtabptr_4cdec_2sa_3_sa_FloatList = &__pyx_vtable_4cdec_2sa_3_sa_FloatList; + __pyx_vtable_4cdec_2sa_3_sa_FloatList.set = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, int, float))__pyx_f_4cdec_2sa_3_sa_9FloatList_set; + __pyx_vtable_4cdec_2sa_3_sa_FloatList.write_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *))__pyx_f_4cdec_2sa_3_sa_9FloatList_write_handle; + __pyx_vtable_4cdec_2sa_3_sa_FloatList.read_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_FloatList *, FILE *))__pyx_f_4cdec_2sa_3_sa_9FloatList_read_handle; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_FloatList = &__pyx_type_4cdec_2sa_3_sa_FloatList; + __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; + __pyx_vtable_4cdec_2sa_3_sa_StringMap.index = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_StringMap *, char *))__pyx_f_4cdec_2sa_3_sa_9StringMap_index; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_StringMap = &__pyx_type_4cdec_2sa_3_sa_StringMap; + 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_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_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_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "TrieTable", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_TrieTable) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_TrieTable = &__pyx_type_4cdec_2sa_3_sa_TrieTable; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_11_encode_words; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_25_genexpr) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_12_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_12_genexpr; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_6_genexpr; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_22_form_rule) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_10_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_10_genexpr; + __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; + __pyx_vtable_4cdec_2sa_3_sa_VEB._insert = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_VEB *, int))__pyx_f_4cdec_2sa_3_sa_3VEB__insert; + __pyx_vtable_4cdec_2sa_3_sa_VEB._first = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_VEB *))__pyx_f_4cdec_2sa_3_sa_3VEB__first; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_VEB = &__pyx_type_4cdec_2sa_3_sa_VEB; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_7_decode_lattice; + __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 109; __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_PhraseLocation = &__pyx_type_4cdec_2sa_3_sa_PhraseLocation; + __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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Scorer = &__pyx_type_4cdec_2sa_3_sa_Scorer; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Sampler", (PyObject *)&__pyx_type_4cdec_2sa_3_sa_Sampler) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 131; __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_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; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.isword = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_isword; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.getindex = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_getindex; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.setindex = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_setindex; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.clearindex = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_clearindex; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.match = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_match; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.tocat = (char *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_tocat; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.fromcat = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, char *))__pyx_f_4cdec_2sa_3_sa_8Alphabet_fromcat; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.tostring = (char *(*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_tostring; + __pyx_vtable_4cdec_2sa_3_sa_Alphabet.fromstring = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_Alphabet *, char *, int))__pyx_f_4cdec_2sa_3_sa_8Alphabet_fromstring; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_Alphabet = &__pyx_type_4cdec_2sa_3_sa_Alphabet; + __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; + __pyx_vtable_4cdec_2sa_3_sa_BiLex._add_node = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, struct __pyx_t_4cdec_2sa_3_sa__node *, int *, float, int *))__pyx_f_4cdec_2sa_3_sa_5BiLex__add_node; + __pyx_vtable_4cdec_2sa_3_sa_BiLex.write_wordlist = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, PyObject *, FILE *))__pyx_f_4cdec_2sa_3_sa_5BiLex_write_wordlist; + __pyx_vtable_4cdec_2sa_3_sa_BiLex.read_wordlist = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, PyObject *, PyObject *, FILE *))__pyx_f_4cdec_2sa_3_sa_5BiLex_read_wordlist; + __pyx_vtable_4cdec_2sa_3_sa_BiLex.swap = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, int, int))__pyx_f_4cdec_2sa_3_sa_5BiLex_swap; + __pyx_vtable_4cdec_2sa_3_sa_BiLex.qsort = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_BiLex *, int, int, PyObject *))__pyx_f_4cdec_2sa_3_sa_5BiLex_qsort; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_BiLex = &__pyx_type_4cdec_2sa_3_sa_BiLex; + __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; + __pyx_vtable_4cdec_2sa_3_sa_DataArray.write_handle = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_DataArray *, FILE *))__pyx_f_4cdec_2sa_3_sa_9DataArray_write_handle; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_DataArray = &__pyx_type_4cdec_2sa_3_sa_DataArray; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_BitSetIterator = &__pyx_type_4cdec_2sa_3_sa_BitSetIterator; + __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; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.baeza_yates_helper = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_baeza_yates_helper; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.compare_matchings_set = (long (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings_set; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.compare_matchings = (long (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_compare_matchings; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.merge_helper = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int, int, int, int *, int, int, int, int, int *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_merge_helper; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.sort_phrase_loc = (void (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_IntList *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_sort_phrase_loc; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.intersect_helper = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect_helper; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.loc2str = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_loc2str; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.intersect = (struct __pyx_obj_4cdec_2sa_3_sa_PhraseLocation *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, PyObject *, PyObject *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_intersect; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.find_fixpoint = (int (*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, PyObject *, int *, int *, int *, int *, int, int, int *, int *, int *, int *, int, int, int, int, int, int, int, int, int, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_fixpoint; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.find_projection = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_find_projection; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.int_arr_extend = (int *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int *, int *, int *, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_int_arr_extend; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.extract_phrases = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int, int, int *, int *, int *, int, int, int, int *, int *, int *, int, int, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract_phrases; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.create_alignments = (struct __pyx_obj_4cdec_2sa_3_sa_IntList *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, int *, int, struct __pyx_obj_4cdec_2sa_3_sa_IntList *, struct __pyx_obj_4cdec_2sa_3_sa_IntList *))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_create_alignments; + __pyx_vtable_4cdec_2sa_3_sa_HieroCachingRuleFactory.extract = (PyObject *(*)(struct __pyx_obj_4cdec_2sa_3_sa_HieroCachingRuleFactory *, struct __pyx_obj_4cdec_2sa_3_sa_Phrase *, struct __pyx_t_4cdec_2sa_3_sa_Matching *, int *, int))__pyx_f_4cdec_2sa_3_sa_23HieroCachingRuleFactory_extract; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory) < 0) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 253; __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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa_HieroCachingRuleFactory = &__pyx_type_4cdec_2sa_3_sa_HieroCachingRuleFactory; + 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_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_3_compute_stats) < 0) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_3_compute_stats; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_14_genexpr; + 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_ptype_4cdec_2sa_3_sa___pyx_scope_struct____iter__ = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct____iter__; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_8_genexpr; + 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;} + 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;} + __pyx_ptype_4cdec_2sa_3_sa_BitSet = &__pyx_type_4cdec_2sa_3_sa_BitSet; + if (PyType_Ready(&__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence) < 0) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence = &__pyx_type_4cdec_2sa_3_sa___pyx_scope_struct_9_decode_sentence; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "cdec/sa/_sa.pyx":1 + * import logging # <<<<<<<<<<<<<< + * import resource + * import gzip + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); 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__logging, __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; + + /* "cdec/sa/_sa.pyx":2 + * import logging + * import resource # <<<<<<<<<<<<<< + * import gzip + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__resource), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__resource, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cdec/sa/_sa.pyx":3 + * import logging + * import resource + * import gzip # <<<<<<<<<<<<<< + * + * def monitor_cpu(): + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__gzip), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__gzip, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cdec/sa/_sa.pyx":5 + * import gzip + * + * def monitor_cpu(): # <<<<<<<<<<<<<< + * return (resource.getrusage(resource.RUSAGE_SELF).ru_utime+ + * resource.getrusage(resource.RUSAGE_SELF).ru_stime) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_1monitor_cpu, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__monitor_cpu, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cdec/sa/_sa.pyx":9 + * resource.getrusage(resource.RUSAGE_SELF).ru_stime) + * + * def gzip_or_text(char* filename): # <<<<<<<<<<<<<< + * if filename.endswith('.gz'): + * return gzip.GzipFile(filename) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cdec_2sa_3_sa_3gzip_or_text, NULL, __pyx_n_s_102); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__gzip_or_text, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cdec/sa/_sa.pyx":15 + * return open(filename) + * + * logger = logging.getLogger('cdec.sa') # <<<<<<<<<<<<<< + * + * include "float_list.pxi" + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_162), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + 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; + + /* "/home/mdenkows/cdec/python/cdec/sa/alignment.pxi":8 + * # May need to revisit if things get really tight, though. + * + * cdef int ALIGNMENT_CODE = 1 << 16 # <<<<<<<<<<<<<< + * + * cdef class Alignment: + */ + __pyx_v_4cdec_2sa_3_sa_ALIGNMENT_CODE = 65536; + + /* "/home/mdenkows/cdec/python/cdec/sa/bilex.pxi":54 + * cdef id2eword, id2fword, eword2id, fword2id + * + * def __cinit__(self, from_text=None, from_data=False, from_binary=None, # <<<<<<<<<<<<<< + * earray=None, fsarray=None, alignment=None): + * self.id2eword = [] + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_43 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":17 + * from libc.string cimport memset + * + * cdef int MIN_BOTTOM_SIZE = 32 # <<<<<<<<<<<<<< + * cdef int MIN_BOTTOM_BITS = 5 + * cdef int LOWER_MASK[32] + */ + __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_SIZE = 32; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":18 + * + * cdef int MIN_BOTTOM_SIZE = 32 + * cdef int MIN_BOTTOM_BITS = 5 # <<<<<<<<<<<<<< + * cdef int LOWER_MASK[32] + * + */ + __pyx_v_4cdec_2sa_3_sa_MIN_BOTTOM_BITS = 5; + + /* "/home/mdenkows/cdec/python/cdec/sa/veb.pxi":28 + * LOWER_MASK[i] = mask + * + * _init_lower_mask() # <<<<<<<<<<<<<< + * + * cdef struct _BitSet: + */ + __pyx_f_4cdec_2sa_3_sa__init_lower_mask(); + + /* "/home/mdenkows/cdec/python/cdec/sa/sym.pxi":4 + * from libc.stdlib cimport malloc, realloc, strtol + * + * cdef int INDEX_SHIFT = 3 # <<<<<<<<<<<<<< + * cdef int INDEX_MASK = (1<= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (result) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() 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'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +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) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + 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)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(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->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + 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); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + 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)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + 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; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CPYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return NULL; + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +static CYTHON_INLINE PyObject* __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 */ + } else { + return __Pyx_PyObject_CallMethod1(L, __pyx_n_s__append, x); + } +} + +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 CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { + PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); +} + +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { +#if CYTHON_COMPILING_IN_CPYTHON + PyMappingMethods* mp; +#if PY_MAJOR_VERSION < 3 + PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; + if (likely(ms && ms->sq_slice)) { + if (!has_cstart) { + if (_py_start && (*_py_start != Py_None)) { + cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); + if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstart = 0; + } + if (!has_cstop) { + if (_py_stop && (*_py_stop != Py_None)) { + cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); + if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstop = PY_SSIZE_T_MAX; + } + if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { + Py_ssize_t l = ms->sq_length(obj); + if (likely(l >= 0)) { + if (cstop < 0) { + cstop += l; + if (cstop < 0) cstop = 0; + } + if (cstart < 0) { + cstart += l; + if (cstart < 0) cstart = 0; + } + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + goto bad; + } + } + return ms->sq_slice(obj, cstart, cstop); + } +#endif + mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyInt_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyInt_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_COMPILING_IN_CPYTHON + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + PyErr_Format(PyExc_TypeError, + "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); +bad: + return NULL; +} + +static CYTHON_INLINE int __Pyx_div_int(int a, int b) { + int q = a / b; + int r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +static CYTHON_INLINE int __Pyx_mod_int(int a, int b) { + int r = a % b; + r += ((r != 0) & ((r ^ b) < 0)) * b; + return r; +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", 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", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return -1; + } + } + return m->sq_ass_item(o, i, v); + } + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { +#else + if (is_list || PySequence_Check(o)) { +#endif + return PySequence_SetItem(o, i, v); + } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} + +static double __Pyx__PyObject_AsDouble(PyObject* obj) { + PyObject* float_value; +#if CYTHON_COMPILING_IN_PYPY + float_value = PyNumber_Float(obj); +#else + PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number; + if (likely(nb) && likely(nb->nb_float)) { + float_value = nb->nb_float(obj); + if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) { + PyErr_Format(PyExc_TypeError, + "__float__ returned non-float (type %.200s)", + Py_TYPE(float_value)->tp_name); + Py_DECREF(float_value); + goto bad; + } + } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { +#if PY_MAJOR_VERSION >= 3 + float_value = PyFloat_FromString(obj); +#else + float_value = PyFloat_FromString(obj, 0); +#endif + } else { + PyObject* args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + PyTuple_SET_ITEM(args, 0, obj); + float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0); + PyTuple_SET_ITEM(args, 0, 0); + Py_DECREF(args); + } +#endif + if (likely(float_value)) { + double value = PyFloat_AS_DOUBLE(float_value); + Py_DECREF(float_value); + return value; + } +bad: + return (double)-1; +} + +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(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; + } + else { + if (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); + return 0; +} + +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 PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +{ + if (unlikely(op->func_doc == NULL)) { + if (op->func.m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +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 */ + Py_INCREF(value); + op->func_doc = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, 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 = op->func_name; + Py_INCREF(value); + op->func_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) +{ + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, 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 = op->func_qualname; + Py_INCREF(value); + op->func_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) +{ + PyObject *self; + self = m->func_closure; + if (self == NULL) + self = Py_None; + Py_INCREF(self); + return self; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + tmp = op->func_dict; + Py_INCREF(value); + op->func_dict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + PyObject* dict = PyModule_GetDict(__pyx_m); + Py_XINCREF(dict); + return dict; +} +static PyObject * +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + Py_DECREF(res); + return 0; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyTuple_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_tuple; + op->defaults_tuple = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_kwdict; + op->defaults_kwdict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value || value == Py_None) { + value = NULL; + } else if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + tmp = op->func_annotations; + op->func_annotations = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(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 */ +#define PY_WRITE_RESTRICTED WRITE_RESTRICTED +#endif +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromString(m->func.m_ml->ml_name); +#else + return PyString_FromString(m->func.m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* code) { + __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); + if (op == NULL) + return NULL; + op->flags = flags; + op->func_weakreflist = NULL; + op->func.m_ml = ml; + op->func.m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; + Py_XINCREF(module); + op->func.m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; + op->func_classobj = NULL; + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + PyObject_GC_Track(op); + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(m->func.m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_code); + Py_CLEAR(m->func_classobj); + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyMem_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + if (m->func_weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + PyObject_GC_Del(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(m->func.m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_code); + Py_VISIT(m->func_classobj); + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return PyMethod_New(func, + type, (PyObject *)(Py_TYPE(type))); + } + if (obj == Py_None) + obj = NULL; + return PyMethod_New(func, obj, type); +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +#if CYTHON_COMPILING_IN_PYPY +static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + Py_ssize_t size; + switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) { + case METH_VARARGS: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + size = PyTuple_GET_SIZE(arg); + if (size == 0) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%zd given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL) || PyDict_Size(kw) == 0) { + size = PyTuple_GET_SIZE(arg); + if (size == 1) + return (*meth)(self, PyTuple_GET_ITEM(arg, 0)); + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%zd given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags in " + "__Pyx_CyFunction_Call. METH_OLDARGS is no " + "longer supported!"); + return NULL; + } + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; +} +#else +static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return PyCFunction_Call(func, arg, kw); +} +#endif +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/ + sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ +#if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ +#else + 0, /*reserved*/ +#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*/ +#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) + return -1; + __pyx_CyFunctionType = &__pyx_CyFunctionType_type; + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyMem_Malloc(size); + if (!m->defaults) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000 + if (likely(PyList_CheckExact(L)) + && likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) { + Py_SIZE(L) -= 1; + return PyList_GET_ITEM(L, PyList_GET_SIZE(L)); + } +#if PY_VERSION_HEX >= 0x02050000 + else if (Py_TYPE(L) == (&PySet_Type)) { + return PySet_Pop(L); + } +#endif +#endif + return __Pyx_PyObject_CallMethod0(L, __pyx_n_s__pop); +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +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 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(); + } + } + 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 + } + } + #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); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +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; + } + 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; + } + return (unsigned short)val; + } + 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; + } + 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; + } + return (char)val; + } + 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; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +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; + } + 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; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +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; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed 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; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +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; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#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; + 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; + } + 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]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + 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]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(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; + 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; + } + 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]; + } + } +#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; + } + 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]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(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 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]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); + } + } 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 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; + 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; + } + 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]; + } + } +#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; + } + 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]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(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 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]; + } + } +#endif +#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]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); + } + } 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_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; + 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; + } + 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]; + } + } +#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; + } + 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]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(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; +} + +static PyObject *__Pyx_Generator_Next(PyObject *self); +static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value); +static PyObject *__Pyx_Generator_Close(PyObject *self); +static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args); +static PyTypeObject *__pyx_GeneratorType = 0; +#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) +#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) +#if 1 || PY_VERSION_HEX < 0x030300B0 +static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (unlikely(et != PyExc_StopIteration) && + unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + if (likely(et == PyExc_StopIteration)) { + if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + ev = Py_None; + } + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = ev; + return 0; + } + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if PY_VERSION_HEX >= 0x030300A0 + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); +#else + { + PyObject* args = PyObject_GetAttr(ev, __pyx_n_s__args); + Py_DECREF(ev); + if (likely(args)) { + value = PyObject_GetItem(args, 0); + Py_DECREF(args); + } + if (unlikely(!value)) { + __Pyx_ErrRestore(NULL, NULL, NULL); + Py_INCREF(Py_None); + value = Py_None; + } + } +#endif + *pvalue = value; + return 0; +} +#endif +static CYTHON_INLINE +void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) { + PyObject *exc_type = self->exc_type; + PyObject *exc_value = self->exc_value; + PyObject *exc_traceback = self->exc_traceback; + self->exc_type = NULL; + self->exc_value = NULL; + self->exc_traceback = NULL; + Py_XDECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_traceback); +} +static CYTHON_INLINE +int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) { + if (unlikely(gen->is_running)) { + PyErr_SetString(PyExc_ValueError, + "generator already executing"); + return 1; + } + return 0; +} +static CYTHON_INLINE +PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) { + PyObject *retval; + assert(!self->is_running); + if (unlikely(self->resume_label == 0)) { + if (unlikely(value && value != Py_None)) { + PyErr_SetString(PyExc_TypeError, + "can't send non-None value to a " + "just-started generator"); + return NULL; + } + } + if (unlikely(self->resume_label == -1)) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + if (value) { +#if CYTHON_COMPILING_IN_PYPY +#else + /* Generators always return to their most recent caller, not + * necessarily their creator. */ + if (self->exc_traceback) { + PyThreadState *tstate = PyThreadState_GET(); + PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; + PyFrameObject *f = tb->tb_frame; + Py_XINCREF(tstate->frame); + assert(f->f_back == NULL); + f->f_back = tstate->frame; + } +#endif + __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, + &self->exc_traceback); + } else { + __Pyx_Generator_ExceptionClear(self); + } + self->is_running = 1; + retval = self->body((PyObject *) self, value); + self->is_running = 0; + if (retval) { + __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, + &self->exc_traceback); +#if CYTHON_COMPILING_IN_PYPY +#else + /* Don't keep the reference to f_back any longer than necessary. It + * may keep a chain of frames alive or it could create a reference + * cycle. */ + if (self->exc_traceback) { + PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + } +#endif + } else { + __Pyx_Generator_ExceptionClear(self); + } + return retval; +} +static CYTHON_INLINE +PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) { + PyObject *ret; + PyObject *val = NULL; + __Pyx_Generator_Undelegate(gen); + __Pyx_PyGen_FetchStopIterationValue(&val); + ret = __Pyx_Generator_SendEx(gen, val); + Py_XDECREF(val); + return ret; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + gen->is_running = 1; + ret = Py_TYPE(yf)->tp_iternext(yf); + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Generator_FinishDelegation(gen); + } + return __Pyx_Generator_SendEx(gen, Py_None); +} +static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + gen->is_running = 1; + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Send(yf, value); + } else { + if (value == Py_None) + ret = PyIter_Next(yf); + else + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s__send, value); + } + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Generator_FinishDelegation(gen); + } + return __Pyx_Generator_SendEx(gen, value); +} +static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) { + PyObject *retval = NULL; + int err = 0; + if (__Pyx_Generator_CheckExact(yf)) { + retval = __Pyx_Generator_Close(yf); + if (!retval) + return -1; + } else { + PyObject *meth; + gen->is_running = 1; + meth = PyObject_GetAttr(yf, __pyx_n_s__close); + if (unlikely(!meth)) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_WriteUnraisable(yf); + } + PyErr_Clear(); + } else { + retval = PyObject_CallFunction(meth, NULL); + Py_DECREF(meth); + if (!retval) + err = -1; + } + gen->is_running = 0; + } + Py_XDECREF(retval); + return err; +} +static PyObject *__Pyx_Generator_Close(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject *retval, *raised_exception; + PyObject *yf = gen->yieldfrom; + int err = 0; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Generator_CloseIter(gen, yf); + __Pyx_Generator_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) +#if PY_VERSION_HEX < 0x02050000 + PyErr_SetNone(PyExc_StopIteration); +#else + PyErr_SetNone(PyExc_GeneratorExit); +#endif + retval = __Pyx_Generator_SendEx(gen, NULL); + if (retval) { + Py_DECREF(retval); + PyErr_SetString(PyExc_RuntimeError, + "generator ignored GeneratorExit"); + return NULL; + } + 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 */ + Py_INCREF(Py_None); + return Py_None; + } + return NULL; +} +static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject *typ; + PyObject *tb = NULL; + PyObject *val = NULL; + PyObject *yf = gen->yieldfrom; + if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) + return NULL; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + Py_INCREF(yf); +#if PY_VERSION_HEX >= 0x02050000 + if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { + int err = __Pyx_Generator_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Generator_Undelegate(gen); + if (err < 0) + return __Pyx_Generator_SendEx(gen, NULL); + goto throw_here; + } +#endif + gen->is_running = 1; + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Throw(yf, args); + } else { + PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s__throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + gen->is_running = 0; + return NULL; + } + PyErr_Clear(); + __Pyx_Generator_Undelegate(gen); + gen->is_running = 0; + goto throw_here; + } + ret = PyObject_CallObject(meth, args); + Py_DECREF(meth); + } + gen->is_running = 0; + Py_DECREF(yf); + if (!ret) { + ret = __Pyx_Generator_FinishDelegation(gen); + } + return ret; + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); + return __Pyx_Generator_SendEx(gen, NULL); +} +static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + Py_VISIT(gen->exc_type); + Py_VISIT(gen->exc_value); + Py_VISIT(gen->exc_traceback); + return 0; +} +static int __Pyx_Generator_clear(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + Py_CLEAR(gen->yieldfrom); + Py_CLEAR(gen->exc_type); + Py_CLEAR(gen->exc_value); + Py_CLEAR(gen->exc_traceback); + return 0; +} +static void __Pyx_Generator_dealloc(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject_GC_UnTrack(gen); + if (gen->gi_weakreflist != NULL) + PyObject_ClearWeakRefs(self); + PyObject_GC_Track(self); + if (gen->resume_label > 0) { + Py_TYPE(gen)->tp_del(self); + if (self->ob_refcnt > 0) + return; /* resurrected. :( */ + } + PyObject_GC_UnTrack(self); + __Pyx_Generator_clear(self); + PyObject_GC_Del(gen); +} +static void __Pyx_Generator_del(PyObject *self) { + PyObject *res; + PyObject *error_type, *error_value, *error_traceback; + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + if (gen->resume_label <= 0) + return ; + assert(self->ob_refcnt == 0); + self->ob_refcnt = 1; + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); + res = __Pyx_Generator_Close(self); + if (res == NULL) + PyErr_WriteUnraisable(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. + */ + 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. + */ + { + Py_ssize_t refcnt = self->ob_refcnt; + _Py_NewReference(self); + self->ob_refcnt = refcnt; + } +#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 +} +static PyMemberDef __pyx_Generator_memberlist[] = { + {(char *) "gi_running", +#if PY_VERSION_HEX >= 0x02060000 + T_BOOL, +#else + T_BYTE, +#endif + 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}, + {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*/ +#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_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*/ +#endif +}; +static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, + PyObject *closure) { + __pyx_GeneratorObject *gen = + PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type); + if (gen == NULL) + return NULL; + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->exc_type = NULL; + gen->exc_value = NULL; + gen->exc_traceback = NULL; + gen->gi_weakreflist = NULL; + 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)) { + return -1; + } + __pyx_GeneratorType = &__pyx_GeneratorType_type; + return 0; +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "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; +} + +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); + if (!d) { + PyErr_Clear(); + d = PyDict_New(); + if (!d) + goto bad; + Py_INCREF(d); + if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) + goto bad; + } + tmp.fp = f; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + cobj = PyCapsule_New(tmp.p, sig, 0); +#else + cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); +#endif + if (!cobj) + goto bad; + if (PyDict_SetItemString(d, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(cobj); + Py_XDECREF(d); + 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 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++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 char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* 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; +} + + +#endif /* Py_PYTHON_H */ diff --git a/python/setup.py.in b/python/setup.py.in index cdde696e..a2aa28f6 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -21,7 +21,7 @@ ext_modules = [ extra_compile_args=CPPFLAGS, extra_link_args=LDFLAGS), Extension(name='cdec.sa._sa', - sources=['cdec/sa/_sa.c', 'cdec/sa/strmap.cc'], + sources=['cdec/sa/_sa.cpp', 'cdec/sa/strmap.cc'], extra_compile_args=CPPFLAGS) ] -- cgit v1.2.3 From 672c5cb8566c4484f54e012af46a78dfa7c8c89d Mon Sep 17 00:00:00 2001 From: Waleed Ammar Date: Mon, 11 Nov 2013 11:47:04 -0500 Subject: mira breaks on noninteractive machines when matplotlib is installed, complaining that $DISPLAY environment variable is not set. fix it as described at http://matplotlib.org/faq/howto_faq.html --- training/mira/mira.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/training/mira/mira.py b/training/mira/mira.py index 7b2d06a3..d5a1d9f8 100755 --- a/training/mira/mira.py +++ b/training/mira/mira.py @@ -12,6 +12,8 @@ except ImportError: sys.exit(1) have_mpl = True try: + import matplotlib + matplotlib.use('Agg') import matplotlib.pyplot as plt except ImportError: have_mpl = False -- cgit v1.2.3 From ae282ff1c3b9669496af3308e0f7889658f564cc Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Mon, 11 Nov 2013 16:05:32 -0500 Subject: fix iterator misuse --- utils/atools.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/atools.cc b/utils/atools.cc index 1726c4ac..559eadef 100644 --- a/utils/atools.cc +++ b/utils/atools.cc @@ -203,14 +203,16 @@ struct RefineCommand : public Command { bool keep_going = !p.empty(); while (keep_going) { keep_going = false; - for (set >::iterator pi = p.begin(); - pi != p.end(); ++pi) { + set > added; + for (set >::iterator pi = p.begin(); pi != p.end(); ++pi) { if ((this->*pred)(pi->first, pi->second)) { Align(pi->first, pi->second); - p.erase(pi); + added.insert(make_pair(pi->first, pi->second)); keep_going = true; } } + for (set >::iterator ai = added.begin(); ai != added.end(); ++ai) + p.erase(*ai); } } Array2D res_; // refined alignment -- cgit v1.2.3 From 8a24bb77bc2e9fd17a6f6529a2942cde96a6af49 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Mon, 11 Nov 2013 16:12:39 -0500 Subject: error on new macs --- corpus/tokenize-anything.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/corpus/tokenize-anything.sh b/corpus/tokenize-anything.sh index fb038717..c7adfa61 100755 --- a/corpus/tokenize-anything.sh +++ b/corpus/tokenize-anything.sh @@ -12,8 +12,8 @@ fi $SUPPORT/utf8-normalize.sh $NORMARGS | $SUPPORT/quote-norm.pl | $SUPPORT/tokenizer.pl | - sed -u -e 's/ al - / al-/g' | + sed -e 's/ al - / al-/g' | $SUPPORT/fix-contract.pl | - sed -u -e 's/^ //' | sed -u -e 's/ $//' | + sed -e 's/^ //' | sed -e 's/ $//' | perl -e '$|++; while(<>){s/(\d+)(\.+)$/$1 ./; s/(\d+)(\.+) \|\|\|/$1 . |||/; print;}' -- cgit v1.2.3